@aigens/aigens-sdk-core 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,8 +31,45 @@ import Capacitor
|
|
31
31
|
loadWebViewCustom()
|
32
32
|
initView()
|
33
33
|
|
34
|
+
handleOpenUrl()
|
35
|
+
|
36
|
+
}
|
37
|
+
|
38
|
+
private func handleOpenUrl() {
|
39
|
+
NotificationCenter.default.addObserver(self, selector: #selector(self.handleUniversalLink(notification:)), name: Notification.Name.capacitorOpenUniversalLink, object: nil)
|
40
|
+
|
41
|
+
NotificationCenter.default.addObserver(self, selector: #selector(self.handleUrlOpened(notification:)), name: Notification.Name.capacitorOpenURL, object: nil)
|
34
42
|
}
|
35
43
|
|
44
|
+
@objc func handleUrlOpened(notification: NSNotification) {
|
45
|
+
guard let object = notification.object as? [String: Any?] else {
|
46
|
+
return
|
47
|
+
}
|
48
|
+
|
49
|
+
print("handleUrlOpened url:\(object)")
|
50
|
+
guard let url = object["url"] as? URL else {
|
51
|
+
return
|
52
|
+
}
|
53
|
+
|
54
|
+
let rUrl = URLRequest(url: url)
|
55
|
+
webView?.load(rUrl)
|
56
|
+
}
|
57
|
+
|
58
|
+
@objc func handleUniversalLink(notification: NSNotification) {
|
59
|
+
guard let object = notification.object as? [String: Any?] else {
|
60
|
+
return
|
61
|
+
}
|
62
|
+
|
63
|
+
print("handleUniversalLink url:\(object)")
|
64
|
+
guard let url = object["url"] as? URL else {
|
65
|
+
return
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
let rUrl = URLRequest(url: url)
|
70
|
+
webView?.load(rUrl)
|
71
|
+
|
72
|
+
}
|
36
73
|
private func initView(){
|
37
74
|
|
38
75
|
print("VC initView")
|