@aigens/aigens-sdk-core 0.0.34 → 0.0.36

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.
@@ -62,12 +62,12 @@ public class WebContainerActivity extends BridgeActivity {
62
62
  private boolean ENVIRONMENT_PRODUCTION = true;
63
63
  private List<Class<? extends Plugin>> allPlugins;
64
64
  private String[] shouldRedirectList = new String[]{
65
- "/scan?",
66
- "/qr?",
67
- "//scan",
68
- "/api/v1/pay",
69
- "/api/v1/wechat",
70
- "/api/v1/qfpaywechat"
65
+ "/scan?",
66
+ "/qr?",
67
+ "//scan",
68
+ "/api/v1/pay",
69
+ "/api/v1/wechat",
70
+ "/api/v1/qfpaywechat"
71
71
  };
72
72
  private List<String> externalProtocols = new ArrayList<String>() {{
73
73
  add("octopus://");
@@ -104,6 +104,7 @@ public class WebContainerActivity extends BridgeActivity {
104
104
  if (perviousIntent != null) {
105
105
  Map member = (Map) perviousIntent.getSerializableExtra("member");
106
106
  universalLink = (String) member.get("universalLink");
107
+ universalLink = universalLink.trim();
107
108
  }
108
109
  if (universalLink != null && totalUrl.startsWith(universalLink) && totalUrl.indexOf("redirect=") >= 0) {
109
110
  redirectUrl = totalUrl.split("redirect=")[1];
@@ -135,19 +136,19 @@ public class WebContainerActivity extends BridgeActivity {
135
136
  Intent intent = getIntent();
136
137
 
137
138
  if (redirectUrl != null && !redirectUrl.equals("") && WebContainerActivity.perviousIntent != null) {
138
- perviousIntent.putExtra("url", redirectUrl);
139
- intent = perviousIntent;
139
+ WebContainerActivity.perviousIntent.putExtra("url", redirectUrl);
140
+ intent = WebContainerActivity.perviousIntent;
140
141
  currentInstanceState = WebContainerActivity.perviousInstanceState;
141
- WebContainerActivity.perviousIntent = null;
142
- WebContainerActivity.perviousInstanceState = null;
143
- } else {
144
- WebContainerActivity.perviousIntent = intent;
145
- WebContainerActivity.perviousInstanceState = currentInstanceState;
146
142
  }
143
+ WebContainerActivity.perviousIntent = intent;
144
+ WebContainerActivity.perviousInstanceState = currentInstanceState;
147
145
 
148
146
 
149
147
  this.url = intent.getStringExtra("url");
150
148
 
149
+ // TEST
150
+ // this.url = "http://192.168.100.66:4200/crm/brand/220000/directory";
151
+
151
152
  //if navbar = true, show nav bar with "Done" button
152
153
  this.navbar = intent.getBooleanExtra("navbar", false);
153
154
 
@@ -222,20 +223,26 @@ public class WebContainerActivity extends BridgeActivity {
222
223
 
223
224
  }
224
225
 
226
+ // com.getcapacitor.community.firebaseanalytics.FirebaseAnalytics
225
227
  addExtraPlugins(new String[]{
226
- "com.aigens.googlepay.GooglePayPlugin",
227
- "com.aigens.octopus.OctopusPlugin",
228
- "com.aigens.wechatpay.WechatPayPlugin",
229
- "com.aigens.sdk.wechathk.WechatHKPlugin",
230
- "com.aigens.alipay.AliPayPlugin",
231
- "com.aigens.alipayhk.AliPayhkPlugin",
232
- "com.aigens.payme.PaymePlugin",
228
+ "com.aigens.googlepay.GooglePayPlugin",
229
+ "com.aigens.octopus.OctopusPlugin",
230
+ "com.aigens.wechatpay.WechatPayPlugin",
231
+ "com.aigens.sdk.wechathk.WechatHKPlugin",
232
+ "com.aigens.alipay.AliPayPlugin",
233
+ "com.aigens.alipayhk.AliPayhkPlugin",
234
+ "com.aigens.payme.PaymePlugin",
233
235
  }, allPlugins);
234
236
  addExtraPlugins(intent.getStringArrayExtra("extraClasspaths"), allPlugins);
235
237
 
236
238
  debug("App plugins:" + allPlugins);
237
239
 
238
- super.init(currentInstanceState, allPlugins, cc);
240
+ // super.init(currentInstanceState, allPlugins, cc);
241
+ this.bridgeBuilder.setPlugins(new ArrayList<>());
242
+ this.initialPlugins = allPlugins;
243
+ this.config = cc;
244
+ this.bridgeBuilder.setInstanceState(currentInstanceState);
245
+ this.load();
239
246
 
240
247
  //still have time to override webview client to avoid any intercept
241
248
 
@@ -278,6 +285,25 @@ public class WebContainerActivity extends BridgeActivity {
278
285
 
279
286
  }
280
287
 
288
+ @Override
289
+ protected void load() {
290
+ List<Class<? extends Plugin>> allPlugins = new ArrayList<>();
291
+ List<Class<? extends Plugin>> auto = loadPlugins();
292
+ for (Class c : auto) {
293
+
294
+ String clsName = c.getName();
295
+
296
+ if (clsName.endsWith("SplashScreenPlugin")) {
297
+ //don't add the splash screen plugin so it doesn't show the splash screen again
298
+ } else {
299
+ allPlugins.add(c);
300
+ }
301
+
302
+ }
303
+ this.bridgeBuilder.setPlugins(allPlugins);
304
+ super.load();
305
+ }
306
+
281
307
  private void addExtraPlugins(String[] extraClasspaths, List<Class<? extends Plugin>> plugins) {
282
308
  if (extraClasspaths == null) return;
283
309
  for (int i = 0; i < extraClasspaths.length; i++) {
@@ -418,10 +444,10 @@ public class WebContainerActivity extends BridgeActivity {
418
444
  }
419
445
  } catch (Exception ex) {
420
446
  Logger.error(
421
- "NativePlugin " +
422
- pluginClass.getName() +
423
- " is invalid. Ensure the @CapacitorPlugin annotation exists on the plugin class and" +
424
- " the class extends Plugin"
447
+ "NativePlugin " +
448
+ pluginClass.getName() +
449
+ " is invalid. Ensure the @CapacitorPlugin annotation exists on the plugin class and" +
450
+ " the class extends Plugin"
425
451
  );
426
452
  }
427
453
  }
@@ -440,19 +466,19 @@ public class WebContainerActivity extends BridgeActivity {
440
466
  String cordovaPluginsFileJS = JSExport.getCordovaPluginsFileJS(this);
441
467
  String localUrlJS = "window.WEBVIEW_SERVER_URL = '" + this.url + "';";
442
468
  return (
443
- globalJS +
444
- "\n\n" +
445
- localUrlJS +
446
- "\n\n" +
447
- bridgeJS +
448
- "\n\n" +
449
- pluginJS +
450
- "\n\n" +
451
- cordovaJS +
452
- "\n\n" +
453
- cordovaPluginsFileJS +
454
- "\n\n" +
455
- cordovaPluginsJS
469
+ globalJS +
470
+ "\n\n" +
471
+ localUrlJS +
472
+ "\n\n" +
473
+ bridgeJS +
474
+ "\n\n" +
475
+ pluginJS +
476
+ "\n\n" +
477
+ cordovaJS +
478
+ "\n\n" +
479
+ cordovaPluginsFileJS +
480
+ "\n\n" +
481
+ cordovaPluginsJS
456
482
  );
457
483
  } catch (Exception ex) {
458
484
  Logger.error("Unable to export Capacitor JS. App will not function!", ex);
@@ -508,6 +534,16 @@ public class WebContainerActivity extends BridgeActivity {
508
534
 
509
535
  JSONObject jo = new JSONObject(joStr);
510
536
 
537
+ try {
538
+ JSONObject plugins = jo.optJSONObject("plugins");
539
+ JSONObject splashScreen = plugins.optJSONObject("SplashScreen");
540
+ splashScreen.putOpt("launchShowDuration", 0);
541
+ splashScreen.putOpt("launchAutoHide", true);
542
+ } catch (JSONException e) {
543
+ e.printStackTrace();
544
+ }
545
+
546
+
511
547
  return jo;
512
548
  } catch (Exception e) {
513
549
  e.printStackTrace();
@@ -562,7 +598,7 @@ public class WebContainerActivity extends BridgeActivity {
562
598
  Log.e(TAG, "Error dialing " + url + ": " + e.toString());
563
599
  }
564
600
  } else if (url.startsWith("geo:") || url.startsWith(WebView.SCHEME_MAILTO) || url.startsWith("market:")
565
- || loopExternalProtocols(url)) {
601
+ || loopExternalProtocols(url)) {
566
602
  try {
567
603
  Intent intent = new Intent(Intent.ACTION_VIEW);
568
604
  intent.setData(Uri.parse(url));
@@ -656,15 +692,15 @@ public class WebContainerActivity extends BridgeActivity {
656
692
 
657
693
  private void injectJs(String content) {
658
694
  String str = "javascript:(function() { "
659
- + " " //turns to red the background color
660
- + " var script=document.createElement('script'); "
661
- + " script.setAttribute('type','text/javascript'); "
662
- + " script.setAttribute('id', 'test'); "
663
- + " script.innerText='"
664
- + content +
665
- "'; "
666
- + " document.getElementsByTagName('head')[0].appendChild(script); "
667
- + "})()";
695
+ + " " //turns to red the background color
696
+ + " var script=document.createElement('script'); "
697
+ + " script.setAttribute('type','text/javascript'); "
698
+ + " script.setAttribute('id', 'test'); "
699
+ + " script.innerText='"
700
+ + content +
701
+ "'; "
702
+ + " document.getElementsByTagName('head')[0].appendChild(script); "
703
+ + "})()";
668
704
  // Log.wtf("injector", content);
669
705
  bridge.getWebView().evaluateJavascript(content, new ValueCallback<String>() {
670
706
  @Override
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigens/aigens-sdk-core",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "description": "Aigens Order.Place Core Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -57,7 +57,7 @@
57
57
  "rimraf": "^3.0.2",
58
58
  "rollup": "^2.32.0",
59
59
  "swiftlint": "^1.0.1",
60
- "typescript": "~4.0.3"
60
+ "typescript": "~4.1.5"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@capacitor/core": "^3.0.0"