@aigens/aigens-sdk-core 0.0.25 → 0.0.26
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.
@@ -17,6 +17,7 @@ import android.webkit.ServiceWorkerController;
|
|
17
17
|
import android.webkit.ValueCallback;
|
18
18
|
import android.webkit.WebResourceRequest;
|
19
19
|
import android.webkit.WebResourceResponse;
|
20
|
+
import android.webkit.WebSettings;
|
20
21
|
import android.webkit.WebView;
|
21
22
|
import android.widget.Button;
|
22
23
|
|
@@ -49,6 +50,7 @@ import java.util.Map;
|
|
49
50
|
|
50
51
|
public class WebContainerActivity extends BridgeActivity {
|
51
52
|
|
53
|
+
private boolean isFirstError = true;
|
52
54
|
static Bundle perviousInstanceState;
|
53
55
|
static Intent perviousIntent;
|
54
56
|
private boolean DEBUG = CorePlugin.DEBUG;
|
@@ -235,9 +237,13 @@ public class WebContainerActivity extends BridgeActivity {
|
|
235
237
|
this.bridge.getWebView().setWebViewClient(wvc);
|
236
238
|
this.bridge.getWebView().setWebContentsDebuggingEnabled(true);
|
237
239
|
|
240
|
+
// disable zoom
|
238
241
|
this.bridge.getWebView().getSettings().setUseWideViewPort(true);
|
239
242
|
this.bridge.getWebView().getSettings().setLoadWithOverviewMode(true);
|
240
243
|
|
244
|
+
// set http & https mixed
|
245
|
+
this.bridge.getWebView().getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
246
|
+
|
241
247
|
if (clearCache) {
|
242
248
|
this.bridge.getWebView().clearCache(true);
|
243
249
|
}
|
@@ -675,7 +681,12 @@ public class WebContainerActivity extends BridgeActivity {
|
|
675
681
|
@Override
|
676
682
|
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
|
677
683
|
debug("onReceivedErrorOld", errorCode, description, failingUrl);
|
678
|
-
|
684
|
+
System.out.println("onReceivedErrorOld:"+description+failingUrl);
|
685
|
+
if (isFirstError) { // reload
|
686
|
+
isFirstError = false;
|
687
|
+
reload();
|
688
|
+
return;
|
689
|
+
}
|
679
690
|
initLayout(false, true, true);
|
680
691
|
}
|
681
692
|
|
@@ -13,7 +13,7 @@ import Capacitor
|
|
13
13
|
|
14
14
|
// {themeColor: "#xxxxxx"}
|
15
15
|
public var options: Dictionary<String, Any>?
|
16
|
-
|
16
|
+
private var isFirstError = true
|
17
17
|
private var redirectLink = ""
|
18
18
|
private var universalLink = ""
|
19
19
|
var externalProtocols: [String] = [
|
@@ -309,37 +309,44 @@ extension WebContainerViewController: WKNavigationDelegate {
|
|
309
309
|
// The force unwrap is part of the protocol declaration, so we should keep it.
|
310
310
|
// swiftlint:disable:next implicitly_unwrapped_optional
|
311
311
|
public func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
|
312
|
-
// if case .initialLoad(let isOpaque) = webViewLoadingState {
|
313
|
-
// webView.isOpaque = isOpaque
|
314
|
-
// webViewLoadingState = .subsequentLoad
|
315
|
-
// }
|
316
|
-
webContainerView.showLoading(false)
|
317
|
-
|
318
|
-
webContainerView.showError(true, error.localizedDescription)
|
319
312
|
CAPLog.print("⚡️ WebView failed to load")
|
320
313
|
CAPLog.print("⚡️ Error: " + error.localizedDescription)
|
314
|
+
webContainerView.showLoading(false)
|
315
|
+
|
316
|
+
if isFirstError {
|
317
|
+
CAPLog.print("⚡️ WebView failed didFail reload")
|
318
|
+
isFirstError = false
|
319
|
+
// reload
|
320
|
+
webView.reload()
|
321
|
+
return;
|
322
|
+
}
|
323
|
+
|
324
|
+
let e = error as NSError
|
325
|
+
if (e.code == NSURLErrorCancelled || e.code == -999) {
|
326
|
+
}else {
|
327
|
+
webContainerView.showError(true, error.localizedDescription)
|
328
|
+
}
|
329
|
+
|
321
330
|
}
|
322
331
|
|
323
332
|
// // The force unwrap is part of the protocol declaration, so we should keep it.
|
324
333
|
// // swiftlint:disable:next implicitly_unwrapped_optional
|
325
334
|
// public func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
|
326
|
-
// webContainerView.showLoading(false)
|
327
|
-
// // cancel
|
328
|
-
// let e = error as NSError
|
329
|
-
// if (e.code == NSURLErrorCancelled || e.code == -999) {
|
330
|
-
// webContainerView.showError(false)
|
331
|
-
// }
|
332
335
|
// CAPLog.print("⚡️ WebView failed provisional navigation")
|
333
336
|
// CAPLog.print("⚡️ Error: " + error.localizedDescription)
|
334
337
|
//
|
335
|
-
//
|
336
|
-
//
|
337
|
-
//
|
338
|
-
//
|
339
|
-
//
|
340
|
-
//
|
341
|
-
//
|
342
|
-
//
|
338
|
+
// webContainerView.showLoading(false)
|
339
|
+
//
|
340
|
+
// if isFirstError {
|
341
|
+
// CAPLog.print("⚡️ WebView failed provisional reload")
|
342
|
+
// isFirstError = false
|
343
|
+
// // reload
|
344
|
+
// webView.reload()
|
345
|
+
// return;
|
346
|
+
// }
|
347
|
+
//
|
348
|
+
// let e = error as NSError
|
349
|
+
// if (e.code == NSURLErrorCancelled || e.code == -999) {
|
343
350
|
// }else {
|
344
351
|
// webContainerView.showError(true, error.localizedDescription)
|
345
352
|
// }
|