@aigens/aigens-sdk-core 0.0.24 → 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
 
@@ -31,9 +31,12 @@
31
31
  <constraint firstAttribute="height" constant="100" id="SFb-3i-Gvl"/>
32
32
  </constraints>
33
33
  </view>
34
- <button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Rie-2B-ejA" userLabel="reload">
35
- <rect key="frame" x="237.5" y="579" width="70" height="31"/>
34
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Rie-2B-ejA" userLabel="reload">
35
+ <rect key="frame" x="237.5" y="579" width="100" height="31"/>
36
36
  <color key="backgroundColor" systemColor="linkColor"/>
37
+ <constraints>
38
+ <constraint firstAttribute="width" constant="100" id="eZU-e3-pAz"/>
39
+ </constraints>
37
40
  <state key="normal" title="Button"/>
38
41
  <buttonConfiguration key="configuration" style="filled" title="Reload">
39
42
  <color key="baseForegroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -49,9 +52,12 @@
49
52
  <fontDescription key="fontDescription" type="system" pointSize="17"/>
50
53
  <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
51
54
  </textView>
52
- <button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3jG-Lv-8dD" userLabel="back">
53
- <rect key="frame" x="120.5" y="579" width="70" height="31"/>
55
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3jG-Lv-8dD" userLabel="back">
56
+ <rect key="frame" x="76.5" y="579" width="100" height="31"/>
54
57
  <color key="backgroundColor" systemColor="linkColor"/>
58
+ <constraints>
59
+ <constraint firstAttribute="width" constant="100" id="DQH-u1-8bh"/>
60
+ </constraints>
55
61
  <state key="normal" title="Button"/>
56
62
  <buttonConfiguration key="configuration" style="filled" title="Back">
57
63
  <color key="baseForegroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -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] = [
@@ -186,6 +186,7 @@ import Capacitor
186
186
 
187
187
  deinit {
188
188
  print("WebContainerViewController deinit")
189
+ NotificationCenter.default.removeObserver(self)
189
190
  }
190
191
 
191
192
 
@@ -197,6 +198,8 @@ extension WebContainerViewController: WKNavigationDelegate {
197
198
  public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
198
199
  // Reset the bridge on each navigation
199
200
  // self.bridge?.reset()
201
+ webContainerView.showError(false)
202
+ webContainerView.showLoading(true)
200
203
  }
201
204
 
202
205
  public func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
@@ -306,37 +309,44 @@ extension WebContainerViewController: WKNavigationDelegate {
306
309
  // The force unwrap is part of the protocol declaration, so we should keep it.
307
310
  // swiftlint:disable:next implicitly_unwrapped_optional
308
311
  public func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
309
- // if case .initialLoad(let isOpaque) = webViewLoadingState {
310
- // webView.isOpaque = isOpaque
311
- // webViewLoadingState = .subsequentLoad
312
- // }
313
- webContainerView.showLoading(false)
314
-
315
- webContainerView.showError(true, error.localizedDescription)
316
312
  CAPLog.print("⚡️ WebView failed to load")
317
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
+
318
330
  }
319
331
 
320
332
  // // The force unwrap is part of the protocol declaration, so we should keep it.
321
333
  // // swiftlint:disable:next implicitly_unwrapped_optional
322
334
  // 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
335
  // CAPLog.print("⚡️ WebView failed provisional navigation")
330
336
  // CAPLog.print("⚡️ Error: " + error.localizedDescription)
331
337
  //
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
- // }
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) {
340
350
  // }else {
341
351
  // webContainerView.showError(true, error.localizedDescription)
342
352
  // }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigens/aigens-sdk-core",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "description": "Aigens Order.Place Core Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",