@aigens/aigens-sdk-core 0.0.35 → 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
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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://");
|
@@ -146,6 +146,9 @@ public class WebContainerActivity extends BridgeActivity {
|
|
146
146
|
|
147
147
|
this.url = intent.getStringExtra("url");
|
148
148
|
|
149
|
+
// TEST
|
150
|
+
// this.url = "http://192.168.100.66:4200/crm/brand/220000/directory";
|
151
|
+
|
149
152
|
//if navbar = true, show nav bar with "Done" button
|
150
153
|
this.navbar = intent.getBooleanExtra("navbar", false);
|
151
154
|
|
@@ -220,20 +223,26 @@ public class WebContainerActivity extends BridgeActivity {
|
|
220
223
|
|
221
224
|
}
|
222
225
|
|
226
|
+
// com.getcapacitor.community.firebaseanalytics.FirebaseAnalytics
|
223
227
|
addExtraPlugins(new String[]{
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
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",
|
231
235
|
}, allPlugins);
|
232
236
|
addExtraPlugins(intent.getStringArrayExtra("extraClasspaths"), allPlugins);
|
233
237
|
|
234
238
|
debug("App plugins:" + allPlugins);
|
235
239
|
|
236
|
-
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();
|
237
246
|
|
238
247
|
//still have time to override webview client to avoid any intercept
|
239
248
|
|
@@ -276,6 +285,25 @@ public class WebContainerActivity extends BridgeActivity {
|
|
276
285
|
|
277
286
|
}
|
278
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
|
+
|
279
307
|
private void addExtraPlugins(String[] extraClasspaths, List<Class<? extends Plugin>> plugins) {
|
280
308
|
if (extraClasspaths == null) return;
|
281
309
|
for (int i = 0; i < extraClasspaths.length; i++) {
|
@@ -416,10 +444,10 @@ public class WebContainerActivity extends BridgeActivity {
|
|
416
444
|
}
|
417
445
|
} catch (Exception ex) {
|
418
446
|
Logger.error(
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
447
|
+
"NativePlugin " +
|
448
|
+
pluginClass.getName() +
|
449
|
+
" is invalid. Ensure the @CapacitorPlugin annotation exists on the plugin class and" +
|
450
|
+
" the class extends Plugin"
|
423
451
|
);
|
424
452
|
}
|
425
453
|
}
|
@@ -438,19 +466,19 @@ public class WebContainerActivity extends BridgeActivity {
|
|
438
466
|
String cordovaPluginsFileJS = JSExport.getCordovaPluginsFileJS(this);
|
439
467
|
String localUrlJS = "window.WEBVIEW_SERVER_URL = '" + this.url + "';";
|
440
468
|
return (
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
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
|
454
482
|
);
|
455
483
|
} catch (Exception ex) {
|
456
484
|
Logger.error("Unable to export Capacitor JS. App will not function!", ex);
|
@@ -506,6 +534,16 @@ public class WebContainerActivity extends BridgeActivity {
|
|
506
534
|
|
507
535
|
JSONObject jo = new JSONObject(joStr);
|
508
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
|
+
|
509
547
|
return jo;
|
510
548
|
} catch (Exception e) {
|
511
549
|
e.printStackTrace();
|
@@ -560,7 +598,7 @@ public class WebContainerActivity extends BridgeActivity {
|
|
560
598
|
Log.e(TAG, "Error dialing " + url + ": " + e.toString());
|
561
599
|
}
|
562
600
|
} else if (url.startsWith("geo:") || url.startsWith(WebView.SCHEME_MAILTO) || url.startsWith("market:")
|
563
|
-
|
601
|
+
|| loopExternalProtocols(url)) {
|
564
602
|
try {
|
565
603
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
566
604
|
intent.setData(Uri.parse(url));
|
@@ -654,15 +692,15 @@ public class WebContainerActivity extends BridgeActivity {
|
|
654
692
|
|
655
693
|
private void injectJs(String content) {
|
656
694
|
String str = "javascript:(function() { "
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
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
|
+
+ "})()";
|
666
704
|
// Log.wtf("injector", content);
|
667
705
|
bridge.getWebView().evaluateJavascript(content, new ValueCallback<String>() {
|
668
706
|
@Override
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@aigens/aigens-sdk-core",
|
3
|
-
"version": "0.0.
|
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.
|
60
|
+
"typescript": "~4.1.5"
|
61
61
|
},
|
62
62
|
"peerDependencies": {
|
63
63
|
"@capacitor/core": "^3.0.0"
|