Skip to content

Commit b3b6db2

Browse files
committed
feat: ios working
(some swift plugin api improvements needed)
1 parent 5327809 commit b3b6db2

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

plugins/deep-link/ios/Sources/DeepLinkPlugin.swift

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ struct SetEventHandlerArgs: Decodable {
3131
@objc public func getCurrent(_ invoke: Invoke) throws {
3232
var ret = JSObject()
3333
ret["url"] = self.currentUrl
34+
Logger.info("getCurrent: \(String(describing: ret))")
3435
invoke.resolve(ret)
3536
}
3637

37-
// JS command: set the JS callback handler channel
38+
// This command should not be added to the `build.rs` and exposed as it is only
39+
// used internally from the rust backend.
3840
@objc public func setEventHandler(_ invoke: Invoke) throws {
3941
let args = try invoke.parseArgs(SetEventHandlerArgs.self)
4042
self.channel = args.handler
@@ -64,33 +66,34 @@ struct SetEventHandlerArgs: Decodable {
6466
class AppDelegate: UIResponder, UIApplicationDelegate {
6567
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
6668
DeepLinkPlugin.handleOpenUrl(url)
69+
Logger.info("AppDelegate: Opened URL: \(url)")
6770
return true
6871
}
6972
}
7073

7174

7275

73-
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
76+
// class SceneDelegate: UIResponder, UIWindowSceneDelegate {
7477

75-
var window: UIWindow?
78+
// var window: UIWindow?
7679

77-
// Called when a scene is being created and connected
78-
func scene(_ scene: UIScene,
79-
willConnectTo session: UISceneSession,
80-
options connectionOptions: UIScene.ConnectionOptions) {
80+
// // Called when a scene is being created and connected
81+
// func scene(_ scene: UIScene,
82+
// willConnectTo session: UISceneSession,
83+
// options connectionOptions: UIScene.ConnectionOptions) {
8184

82-
// Handle initial URL if app was launched via a deep link
83-
if let urlContext = connectionOptions.urlContexts.first {
84-
DeepLinkPlugin.handleOpenUrl(urlContext.url)
85-
}
86-
}
85+
// // Handle initial URL if app was launched via a deep link
86+
// if let urlContext = connectionOptions.urlContexts.first {
87+
// DeepLinkPlugin.handleOpenUrl(urlContext.url)
88+
// }
89+
// }
8790

88-
// Called when the app receives a deep link while already running
89-
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
90-
guard let url = URLContexts.first?.url else { return }
91-
DeepLinkPlugin.handleOpenUrl(url)
92-
}
93-
}
91+
// // Called when the app receives a deep link while already running
92+
// func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
93+
// guard let url = URLContexts.first?.url else { return }
94+
// DeepLinkPlugin.handleOpenUrl(url)
95+
// }
96+
// }
9497

9598
@_cdecl("init_plugin_deep_link")
9699
func initPlugin() -> Plugin {

0 commit comments

Comments
 (0)