From 354f537d7a4233b60764012266a0d68b8f210b57 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 10 Dec 2024 14:14:06 -0300 Subject: [PATCH 1/2] fix(opener): iOS build --- .changes/fix-opener-ios-fn-name.md | 5 ++++ plugins/opener/ios/Sources/OpenerPlugin.swift | 30 +++++++++---------- 2 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 .changes/fix-opener-ios-fn-name.md diff --git a/.changes/fix-opener-ios-fn-name.md b/.changes/fix-opener-ios-fn-name.md new file mode 100644 index 000000000..2a0ee45a8 --- /dev/null +++ b/.changes/fix-opener-ios-fn-name.md @@ -0,0 +1,5 @@ +--- +"opener": patch +--- + +Fix usage on iOS. diff --git a/plugins/opener/ios/Sources/OpenerPlugin.swift b/plugins/opener/ios/Sources/OpenerPlugin.swift index 39bc5725c..81ff76b42 100644 --- a/plugins/opener/ios/Sources/OpenerPlugin.swift +++ b/plugins/opener/ios/Sources/OpenerPlugin.swift @@ -3,32 +3,30 @@ // SPDX-License-Identifier: MIT import Foundation - import SwiftRs import Tauri import UIKit import WebKit class OpenerPlugin: Plugin { - - @objc public func open(_ invoke: Invoke) throws { - do { - let urlString = try invoke.parseArgs(String.self) - if let url = URL(string: urlString) { - if #available(iOS 10, *) { - UIApplication.shared.open(url, options: [:]) - } else { - UIApplication.shared.openURL(url) - } - } - invoke.resolve() - } catch { - invoke.reject(error.localizedDescription) + @objc public func open(_ invoke: Invoke) throws { + do { + let urlString = try invoke.parseArgs(String.self) + if let url = URL(string: urlString) { + if #available(iOS 10, *) { + UIApplication.shared.open(url, options: [:]) + } else { + UIApplication.shared.openURL(url) } + } + invoke.resolve() + } catch { + invoke.reject(error.localizedDescription) } + } } -@_cdecl("init_plugin_shell") +@_cdecl("init_plugin_opener") func initPlugin() -> Plugin { return OpenerPlugin() } From 7713f00351abdb7b6721b9889585d239bd639208 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 10 Dec 2024 14:16:48 -0300 Subject: [PATCH 2/2] fix covector --- .changes/fix-opener-ios-fn-name.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.changes/fix-opener-ios-fn-name.md b/.changes/fix-opener-ios-fn-name.md index 2a0ee45a8..f584662c1 100644 --- a/.changes/fix-opener-ios-fn-name.md +++ b/.changes/fix-opener-ios-fn-name.md @@ -1,5 +1,6 @@ --- "opener": patch +"opener-js": patch --- Fix usage on iOS.