File tree Expand file tree Collapse file tree 2 files changed +20
-16
lines changed
plugins/opener/ios/Sources Expand file tree Collapse file tree 2 files changed +20
-16
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " opener " : patch
3+ " opener-js " : patch
4+ ---
5+
6+ Fix usage on iOS.
Original file line number Diff line number Diff line change 33// SPDX-License-Identifier: MIT
44
55import Foundation
6-
76import SwiftRs
87import Tauri
98import UIKit
109import WebKit
1110
1211class OpenerPlugin : Plugin {
13-
14- @objc public func open( _ invoke: Invoke ) throws {
15- do {
16- let urlString = try invoke. parseArgs ( String . self)
17- if let url = URL ( string: urlString) {
18- if #available( iOS 10 , * ) {
19- UIApplication . shared. open ( url, options: [ : ] )
20- } else {
21- UIApplication . shared. openURL ( url)
22- }
23- }
24- invoke. resolve ( )
25- } catch {
26- invoke. reject ( error. localizedDescription)
12+ @objc public func open( _ invoke: Invoke ) throws {
13+ do {
14+ let urlString = try invoke. parseArgs ( String . self)
15+ if let url = URL ( string: urlString) {
16+ if #available( iOS 10 , * ) {
17+ UIApplication . shared. open ( url, options: [ : ] )
18+ } else {
19+ UIApplication . shared. openURL ( url)
2720 }
21+ }
22+ invoke. resolve ( )
23+ } catch {
24+ invoke. reject ( error. localizedDescription)
2825 }
26+ }
2927}
3028
31- @_cdecl ( " init_plugin_shell " )
29+ @_cdecl ( " init_plugin_opener " )
3230func initPlugin( ) -> Plugin {
3331 return OpenerPlugin ( )
3432}
You can’t perform that action at this time.
0 commit comments