@aigens/aigens-sdk-core 0.0.21 → 0.0.23
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.
@@ -179,6 +179,7 @@ import Capacitor
|
|
179
179
|
|
180
180
|
let descriptor = InstanceDescriptor.init(at: wwwLoc!, configuration: configLoc, cordovaConfiguration: nil)
|
181
181
|
|
182
|
+
descriptor.appendedUserAgentString = "AigensSDK"
|
182
183
|
|
183
184
|
return descriptor
|
184
185
|
}
|
@@ -275,15 +276,15 @@ extension WebContainerViewController: WKNavigationDelegate {
|
|
275
276
|
}
|
276
277
|
|
277
278
|
// 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
|
-
}
|
279
|
+
// let toplevelNavigation = (navigationAction.targetFrame == nil || navigationAction.targetFrame?.isMainFrame == true)
|
280
|
+
// if navURL.absoluteString.contains(bridge.config.serverURL.absoluteString) == false, toplevelNavigation {
|
281
|
+
// // disallow and let the system handle it
|
282
|
+
// if UIApplication.shared.applicationState == .active {
|
283
|
+
// UIApplication.shared.open(navURL, options: [:], completionHandler: nil)
|
284
|
+
// }
|
285
|
+
// decisionHandler(.cancel)
|
286
|
+
// return
|
287
|
+
// }
|
287
288
|
|
288
289
|
// fallthrough to allowing it
|
289
290
|
decisionHandler(.allow)
|
@@ -316,31 +317,31 @@ extension WebContainerViewController: WKNavigationDelegate {
|
|
316
317
|
CAPLog.print("⚡️ Error: " + error.localizedDescription)
|
317
318
|
}
|
318
319
|
|
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
|
-
}
|
320
|
+
// // The force unwrap is part of the protocol declaration, so we should keep it.
|
321
|
+
// // swiftlint:disable:next implicitly_unwrapped_optional
|
322
|
+
// public func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
|
323
|
+
// webContainerView.showLoading(false)
|
324
|
+
// // cancel
|
325
|
+
// let e = error as NSError
|
326
|
+
// if (e.code == NSURLErrorCancelled || e.code == -999) {
|
327
|
+
// webContainerView.showError(false)
|
328
|
+
// }
|
329
|
+
// CAPLog.print("⚡️ WebView failed provisional navigation")
|
330
|
+
// CAPLog.print("⚡️ Error: " + error.localizedDescription)
|
331
|
+
//
|
332
|
+
// if let errorUrl = webView.url?.absoluteString {
|
333
|
+
// print("navURL-- errorUrl: \(errorUrl)")
|
334
|
+
// if (!self.redirectLink.isEmpty && errorUrl.starts(with: self.redirectLink)) {
|
335
|
+
// webContainerView.showError(false)
|
336
|
+
// webContainerView.showLoading(true)
|
337
|
+
// }else {
|
338
|
+
// webContainerView.showError(true, error.localizedDescription)
|
339
|
+
// }
|
340
|
+
// }else {
|
341
|
+
// webContainerView.showError(true, error.localizedDescription)
|
342
|
+
// }
|
343
|
+
//
|
344
|
+
// }
|
344
345
|
|
345
346
|
public func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
|
346
347
|
webView.reload()
|