@aigens/aigens-sdk-core 0.0.20 → 0.0.22
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.
@@ -215,6 +215,7 @@ public class WebContainerActivity extends BridgeActivity {
|
|
215
215
|
"com.aigens.googlepay.GooglePayPlugin",
|
216
216
|
"com.aigens.octopus.OctopusPlugin",
|
217
217
|
"com.aigens.wechatpay.WechatPayPlugin",
|
218
|
+
"com.aigens.sdk.wechathk.WechatHKPlugin",
|
218
219
|
"com.aigens.alipay.AliPayPlugin",
|
219
220
|
"com.aigens.alipayhk.AliPayhkPlugin",
|
220
221
|
"com.aigens.payme.PaymePlugin",
|
@@ -233,6 +234,8 @@ public class WebContainerActivity extends BridgeActivity {
|
|
233
234
|
this.bridge.getWebView().setWebViewClient(wvc);
|
234
235
|
this.bridge.getWebView().setWebContentsDebuggingEnabled(true);
|
235
236
|
|
237
|
+
this.bridge.getWebView().getSettings().setUseWideViewPort(true);
|
238
|
+
this.bridge.getWebView().getSettings().setLoadWithOverviewMode(true);
|
236
239
|
|
237
240
|
// this.bridge.getWebView().getSettings().setAppCacheEnabled(false);
|
238
241
|
// this.bridge.getWebView().clearCache(true);
|
@@ -9,10 +9,32 @@ import UIKit
|
|
9
9
|
@objc(CorePlugin)
|
10
10
|
public class CorePlugin: CAPPlugin {
|
11
11
|
|
12
|
+
public static let shared = CorePlugin()
|
12
13
|
private let implementation = Core()
|
13
14
|
public static var member: Dictionary<String, Any>?
|
14
15
|
public static var deeplink: Dictionary<String, Any>?
|
15
16
|
|
17
|
+
@objc public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
|
18
|
+
NotificationCenter.default.post(name: .capacitorOpenURL, object: [
|
19
|
+
"url": url,
|
20
|
+
"options": options
|
21
|
+
])
|
22
|
+
NotificationCenter.default.post(name: NSNotification.Name.CDVPluginHandleOpenURL, object: url)
|
23
|
+
return true
|
24
|
+
}
|
25
|
+
|
26
|
+
@objc public func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
|
27
|
+
// TODO: Support other types, emit to rest of plugins
|
28
|
+
if userActivity.activityType != NSUserActivityTypeBrowsingWeb || userActivity.webpageURL == nil {
|
29
|
+
return false
|
30
|
+
}
|
31
|
+
let url = userActivity.webpageURL
|
32
|
+
NotificationCenter.default.post(name: .capacitorOpenUniversalLink, object: [
|
33
|
+
"url": url
|
34
|
+
])
|
35
|
+
return true
|
36
|
+
}
|
37
|
+
|
16
38
|
@objc func echo(_ call: CAPPluginCall) {
|
17
39
|
|
18
40
|
print("CorePlugin echo")
|
@@ -275,15 +275,15 @@ extension WebContainerViewController: WKNavigationDelegate {
|
|
275
275
|
}
|
276
276
|
|
277
277
|
// otherwise, is this a new window or a main frame navigation but to an outside source
|
278
|
-
let toplevelNavigation = (navigationAction.targetFrame == nil || navigationAction.targetFrame?.isMainFrame == true)
|
279
|
-
if navURL.absoluteString.contains(bridge.config.serverURL.absoluteString) == false, toplevelNavigation {
|
280
|
-
// disallow and let the system handle it
|
281
|
-
if UIApplication.shared.applicationState == .active {
|
282
|
-
UIApplication.shared.open(navURL, options: [:], completionHandler: nil)
|
283
|
-
}
|
284
|
-
decisionHandler(.cancel)
|
285
|
-
return
|
286
|
-
}
|
278
|
+
// let toplevelNavigation = (navigationAction.targetFrame == nil || navigationAction.targetFrame?.isMainFrame == true)
|
279
|
+
// if navURL.absoluteString.contains(bridge.config.serverURL.absoluteString) == false, toplevelNavigation {
|
280
|
+
// // disallow and let the system handle it
|
281
|
+
// if UIApplication.shared.applicationState == .active {
|
282
|
+
// UIApplication.shared.open(navURL, options: [:], completionHandler: nil)
|
283
|
+
// }
|
284
|
+
// decisionHandler(.cancel)
|
285
|
+
// return
|
286
|
+
// }
|
287
287
|
|
288
288
|
// fallthrough to allowing it
|
289
289
|
decisionHandler(.allow)
|
@@ -316,31 +316,31 @@ extension WebContainerViewController: WKNavigationDelegate {
|
|
316
316
|
CAPLog.print("⚡️ Error: " + error.localizedDescription)
|
317
317
|
}
|
318
318
|
|
319
|
-
// The force unwrap is part of the protocol declaration, so we should keep it.
|
320
|
-
// swiftlint:disable:next implicitly_unwrapped_optional
|
321
|
-
public func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
|
322
|
-
webContainerView.showLoading(false)
|
323
|
-
// cancel
|
324
|
-
let e = error as NSError
|
325
|
-
if (e.code == NSURLErrorCancelled || e.code == -999) {
|
326
|
-
webContainerView.showError(false)
|
327
|
-
}
|
328
|
-
CAPLog.print("⚡️ WebView failed provisional navigation")
|
329
|
-
CAPLog.print("⚡️ Error: " + error.localizedDescription)
|
330
|
-
|
331
|
-
if let errorUrl = webView.url?.absoluteString {
|
332
|
-
print("navURL-- errorUrl: \(errorUrl)")
|
333
|
-
if (!self.redirectLink.isEmpty && errorUrl.starts(with: self.redirectLink)) {
|
334
|
-
webContainerView.showError(false)
|
335
|
-
webContainerView.showLoading(true)
|
336
|
-
}else {
|
337
|
-
webContainerView.showError(true, error.localizedDescription)
|
338
|
-
}
|
339
|
-
}else {
|
340
|
-
webContainerView.showError(true, error.localizedDescription)
|
341
|
-
}
|
342
|
-
|
343
|
-
}
|
319
|
+
// // The force unwrap is part of the protocol declaration, so we should keep it.
|
320
|
+
// // swiftlint:disable:next implicitly_unwrapped_optional
|
321
|
+
// public func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
|
322
|
+
// webContainerView.showLoading(false)
|
323
|
+
// // cancel
|
324
|
+
// let e = error as NSError
|
325
|
+
// if (e.code == NSURLErrorCancelled || e.code == -999) {
|
326
|
+
// webContainerView.showError(false)
|
327
|
+
// }
|
328
|
+
// CAPLog.print("⚡️ WebView failed provisional navigation")
|
329
|
+
// CAPLog.print("⚡️ Error: " + error.localizedDescription)
|
330
|
+
//
|
331
|
+
// if let errorUrl = webView.url?.absoluteString {
|
332
|
+
// print("navURL-- errorUrl: \(errorUrl)")
|
333
|
+
// if (!self.redirectLink.isEmpty && errorUrl.starts(with: self.redirectLink)) {
|
334
|
+
// webContainerView.showError(false)
|
335
|
+
// webContainerView.showLoading(true)
|
336
|
+
// }else {
|
337
|
+
// webContainerView.showError(true, error.localizedDescription)
|
338
|
+
// }
|
339
|
+
// }else {
|
340
|
+
// webContainerView.showError(true, error.localizedDescription)
|
341
|
+
// }
|
342
|
+
//
|
343
|
+
// }
|
344
344
|
|
345
345
|
public func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
|
346
346
|
webView.reload()
|