@aigens/aigens-sdk-core 0.5.1 → 0.5.3
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.
- package/README.md +35 -0
- package/android/src/main/java/com/aigens/sdk/WebContainerActivity.java +182 -14
- package/android/src/main/java/com/aigens/sdk/plugins/CorePlugin.java +89 -0
- package/android/src/main/res/layout/sdk_layout_main.xml +1 -0
- package/dist/docs.json +86 -0
- package/dist/esm/definitions.d.ts +12 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +2 -1
- package/dist/esm/web.js +4 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +3 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +3 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CorePlugin.m +1 -0
- package/ios/Plugin/CorePlugin.swift +60 -1
- package/ios/Plugin/SecondWebContainerView.swift +157 -0
- package/ios/Plugin/WebContainerViewController.swift +17 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -28,6 +28,7 @@ npx cap sync
|
|
28
28
|
* [`readClipboard()`](#readclipboard)
|
29
29
|
* [`addCalendar(...)`](#addcalendar)
|
30
30
|
* [`makeHKFPSPayment(...)`](#makehkfpspayment)
|
31
|
+
* [`openSecondBrowser(...)`](#opensecondbrowser)
|
31
32
|
* [Interfaces](#interfaces)
|
32
33
|
* [Type Aliases](#type-aliases)
|
33
34
|
|
@@ -251,6 +252,21 @@ makeHKFPSPayment(options: FPSPaymentOptions) => Promise<FPSResultOptions>
|
|
251
252
|
--------------------
|
252
253
|
|
253
254
|
|
255
|
+
### openSecondBrowser(...)
|
256
|
+
|
257
|
+
```typescript
|
258
|
+
openSecondBrowser(options: YuuOptions) => Promise<YuuResultOptions>
|
259
|
+
```
|
260
|
+
|
261
|
+
| Param | Type |
|
262
|
+
| ------------- | ------------------------------------------------- |
|
263
|
+
| **`options`** | <code><a href="#yuuoptions">YuuOptions</a></code> |
|
264
|
+
|
265
|
+
**Returns:** <code>Promise<<a href="#yuuresultoptions">YuuResultOptions</a>></code>
|
266
|
+
|
267
|
+
--------------------
|
268
|
+
|
269
|
+
|
254
270
|
### Interfaces
|
255
271
|
|
256
272
|
|
@@ -330,6 +346,25 @@ makeHKFPSPayment(options: FPSPaymentOptions) => Promise<FPSResultOptions>
|
|
330
346
|
| **`title`** | <code>string</code> |
|
331
347
|
|
332
348
|
|
349
|
+
#### YuuResultOptions
|
350
|
+
|
351
|
+
| Prop | Type |
|
352
|
+
| -------------- | -------------------- |
|
353
|
+
| **`cancel`** | <code>boolean</code> |
|
354
|
+
| **`yuuToken`** | <code>string</code> |
|
355
|
+
| **`cardNo`** | <code>string</code> |
|
356
|
+
| **`warning`** | <code>string</code> |
|
357
|
+
| **`status`** | <code>string</code> |
|
358
|
+
|
359
|
+
|
360
|
+
#### YuuOptions
|
361
|
+
|
362
|
+
| Prop | Type |
|
363
|
+
| ----------------- | ------------------- |
|
364
|
+
| **`url`** | <code>string</code> |
|
365
|
+
| **`serviceName`** | <code>string</code> |
|
366
|
+
|
367
|
+
|
333
368
|
### Type Aliases
|
334
369
|
|
335
370
|
|
@@ -9,17 +9,24 @@ import android.graphics.Color;
|
|
9
9
|
import android.net.Uri;
|
10
10
|
import android.os.Build;
|
11
11
|
import android.os.Bundle;
|
12
|
+
import android.os.Handler;
|
13
|
+
import android.os.Looper;
|
12
14
|
import android.text.TextUtils;
|
13
15
|
import android.util.Log;
|
14
16
|
import android.view.View;
|
17
|
+
import android.view.ViewGroup;
|
18
|
+
import android.webkit.JavascriptInterface;
|
15
19
|
import android.webkit.ServiceWorkerClient;
|
16
20
|
import android.webkit.ServiceWorkerController;
|
17
21
|
import android.webkit.ValueCallback;
|
22
|
+
import android.webkit.WebResourceError;
|
18
23
|
import android.webkit.WebResourceRequest;
|
19
24
|
import android.webkit.WebResourceResponse;
|
20
25
|
import android.webkit.WebSettings;
|
21
26
|
import android.webkit.WebView;
|
27
|
+
import android.webkit.WebViewClient;
|
22
28
|
import android.widget.Button;
|
29
|
+
import android.widget.FrameLayout;
|
23
30
|
|
24
31
|
import com.aigens.sdk.plugins.CorePlugin;
|
25
32
|
import com.getcapacitor.Bridge;
|
@@ -286,18 +293,21 @@ public class WebContainerActivity extends BridgeActivity {
|
|
286
293
|
|
287
294
|
List<Class<? extends Plugin>> auto = loadPlugins();
|
288
295
|
|
289
|
-
|
296
|
+
if (auto != null) {
|
297
|
+
for (Class c : auto) {
|
290
298
|
|
291
|
-
|
299
|
+
String clsName = c.getName();
|
292
300
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
301
|
+
if (clsName.endsWith("SplashScreenPlugin")) {
|
302
|
+
//don't add the splash screen plugin so it doesn't show the splash screen again
|
303
|
+
} else {
|
304
|
+
allPlugins.add(c);
|
305
|
+
}
|
298
306
|
|
307
|
+
}
|
299
308
|
}
|
300
309
|
|
310
|
+
|
301
311
|
// com.getcapacitor.community.firebaseanalytics.FirebaseAnalytics
|
302
312
|
addExtraPlugins(new String[]{
|
303
313
|
"com.aigens.googlepay.GooglePayPlugin",
|
@@ -307,6 +317,10 @@ public class WebContainerActivity extends BridgeActivity {
|
|
307
317
|
"com.aigens.alipay.AliPayPlugin",
|
308
318
|
"com.aigens.alipayhk.AliPayhkPlugin",
|
309
319
|
"com.aigens.payme.PaymePlugin",
|
320
|
+
"com.aigens.sdk.alipay.AlipayPlugin",
|
321
|
+
"com.aigens.sdk.wechat.WechatPlugin",
|
322
|
+
"com.aigens.sdk.utils.AigensUtilsPlugin",
|
323
|
+
"com.aigens.sdk.preferences.AigensPreferencesPlugin"
|
310
324
|
}, allPlugins);
|
311
325
|
addExtraPlugins(intent.getStringArrayExtra("extraClasspaths"), allPlugins);
|
312
326
|
|
@@ -318,6 +332,8 @@ public class WebContainerActivity extends BridgeActivity {
|
|
318
332
|
this.config = cc;
|
319
333
|
this.bridgeBuilder.setInstanceState(currentInstanceState);
|
320
334
|
this.load();
|
335
|
+
this.bridgeBuilder.setPlugins(allPlugins);
|
336
|
+
|
321
337
|
|
322
338
|
//still have time to override webview client to avoid any intercept
|
323
339
|
|
@@ -358,23 +374,49 @@ public class WebContainerActivity extends BridgeActivity {
|
|
358
374
|
// sometime not callback , use Use manual injection js
|
359
375
|
// disableServiceWorker(this.url, this.bridge);
|
360
376
|
|
377
|
+
|
378
|
+
// test
|
379
|
+
// new Handler(getMainLooper()).postDelayed(new Runnable() {
|
380
|
+
// @Override
|
381
|
+
// public void run() {
|
382
|
+
// openSecondBrowser("https://cloud-api.loginradius.com/sso/oidc/v2/loyaltypos/authorize?client_id=1196e953-6981-4dcb-ab65-99102facbc2d&redirect_uri=https%3a%2f%2fuatyuuapi.pizzahut.com.hk%2fapi%2fV3%2fYuu%2fLogin%2fCallBack%2f4b0717d0-9203-402c-8a09-202503111111&scope=openid&response_mode=query&response_type=code&ui_locales=ecomm_zh-hant", null, new SecondBrowserInterface() {
|
383
|
+
// @Override
|
384
|
+
// public void secondBrowserInterfaceYuuLoginCallback(View targetView, String status, String yuuToken, String cardNo, String warning, boolean cancel) {
|
385
|
+
// Log.i("Jason open", status+yuuToken+cardNo+warning+cancel);
|
386
|
+
// ViewGroup parent = (ViewGroup) targetView.getParent();
|
387
|
+
// if (parent != null) {
|
388
|
+
// parent.removeView(targetView);
|
389
|
+
// }
|
390
|
+
// }
|
391
|
+
|
392
|
+
// @Override
|
393
|
+
// public void customHandler(View targetView, String params1, String params2) {
|
394
|
+
|
395
|
+
// }
|
396
|
+
// });
|
397
|
+
// }
|
398
|
+
// }, 20000);
|
399
|
+
|
361
400
|
}
|
362
401
|
|
363
402
|
@Override
|
364
403
|
protected void load() {
|
365
404
|
List<Class<? extends Plugin>> allPlugins = new ArrayList<>();
|
366
405
|
List<Class<? extends Plugin>> auto = loadPlugins();
|
367
|
-
|
406
|
+
if (auto != null) {
|
407
|
+
for (Class c : auto) {
|
368
408
|
|
369
|
-
|
409
|
+
String clsName = c.getName();
|
370
410
|
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
411
|
+
if (clsName.endsWith("SplashScreenPlugin")) {
|
412
|
+
//don't add the splash screen plugin so it doesn't show the splash screen again
|
413
|
+
} else {
|
414
|
+
allPlugins.add(c);
|
415
|
+
}
|
376
416
|
|
417
|
+
}
|
377
418
|
}
|
419
|
+
|
378
420
|
this.bridgeBuilder.setPlugins(allPlugins);
|
379
421
|
super.load();
|
380
422
|
}
|
@@ -641,9 +683,12 @@ public class WebContainerActivity extends BridgeActivity {
|
|
641
683
|
return null;
|
642
684
|
}
|
643
685
|
|
686
|
+
private boolean shouldHandleBackPress = true;
|
644
687
|
@Override
|
645
688
|
public void onBackPressed() {
|
646
689
|
|
690
|
+
if (!shouldHandleBackPress) return;
|
691
|
+
|
647
692
|
super.onBackPressed();
|
648
693
|
|
649
694
|
boolean canBack = this.bridge.getWebView().canGoBack();
|
@@ -844,5 +889,128 @@ public class WebContainerActivity extends BridgeActivity {
|
|
844
889
|
}*/
|
845
890
|
}
|
846
891
|
|
892
|
+
private static final int SECOND_WEBVIEW_ID = 1000001;
|
893
|
+
private String currentUrl = "";
|
894
|
+
public void openSecondBrowser(String url, String serviceName, SecondBrowserInterface callback) {
|
895
|
+
|
896
|
+
try {
|
897
|
+
Handler mainHandler = new Handler(getMainLooper());
|
898
|
+
mainHandler.post(() -> {
|
899
|
+
FrameLayout layout = findViewById(R.id.aigens_sdk_layout_main);
|
900
|
+
|
901
|
+
WebView existingWebView = layout.findViewById(SECOND_WEBVIEW_ID);
|
902
|
+
if (existingWebView != null) {
|
903
|
+
layout.removeView(existingWebView);
|
904
|
+
}
|
905
|
+
|
906
|
+
|
907
|
+
WebView webView = new WebView(this);
|
908
|
+
webView.setId(SECOND_WEBVIEW_ID);
|
909
|
+
|
910
|
+
// webView.setVisibility(showError ? View.VISIBLE : View.INVISIBLE);
|
911
|
+
// webView.setVisibility(View.VISIBLE);
|
912
|
+
|
913
|
+
WebSettings webSettings = webView.getSettings();
|
914
|
+
webSettings.setJavaScriptEnabled(true);
|
915
|
+
webSettings.setDomStorageEnabled(true);
|
916
|
+
|
917
|
+
|
918
|
+
layout.addView(webView, new FrameLayout.LayoutParams(
|
919
|
+
FrameLayout.LayoutParams.MATCH_PARENT,
|
920
|
+
FrameLayout.LayoutParams.MATCH_PARENT
|
921
|
+
));
|
922
|
+
|
923
|
+
webView.setWebViewClient(new WebViewClient() {
|
924
|
+
@Override
|
925
|
+
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
926
|
+
|
927
|
+
Uri url = request.getUrl();
|
928
|
+
// Log.i("jason shouldOverrideUrl", url.toString());
|
929
|
+
|
930
|
+
//return super.shouldOverrideUrlLoading(view, request);
|
931
|
+
currentUrl = url.toString();
|
932
|
+
new Handler(getMainLooper()).postDelayed(new Runnable() {
|
933
|
+
@Override
|
934
|
+
public void run() {
|
935
|
+
if ("about:blank".equals(currentUrl)) {
|
936
|
+
shouldHandleBackPress = true;
|
937
|
+
callback.secondBrowserInterfaceYuuLoginCallback(webView, "", "", "", "", true);;
|
938
|
+
}
|
939
|
+
}
|
940
|
+
}, 1000); // 1s
|
941
|
+
return false;
|
942
|
+
}
|
943
|
+
|
944
|
+
@Override
|
945
|
+
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
946
|
+
|
947
|
+
super.onPageStarted(view, url, favicon);
|
948
|
+
// Log.i("jason onPageStarted", url);
|
949
|
+
|
950
|
+
|
951
|
+
}
|
952
|
+
|
953
|
+
@Override
|
954
|
+
public void onPageFinished(WebView view, String url) {
|
955
|
+
// Log.i("Jason onPageFinished", url);
|
956
|
+
super.onPageFinished(view, url);
|
957
|
+
|
958
|
+
}
|
959
|
+
|
960
|
+
@Override
|
961
|
+
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
|
962
|
+
super.onReceivedError(view, request, error);
|
963
|
+
// Log.i("Jason onReceivedError", error.toString());
|
964
|
+
shouldHandleBackPress = true;
|
965
|
+
ViewGroup parent = (ViewGroup) view.getParent();
|
966
|
+
if (parent != null) {
|
967
|
+
parent.removeView(view);
|
968
|
+
}
|
969
|
+
}
|
970
|
+
});
|
971
|
+
|
972
|
+
webView.addJavascriptInterface(new SecondWebAppInterface(webView, callback), "android");
|
973
|
+
if (serviceName != null) {
|
974
|
+
webView.addJavascriptInterface(new SecondWebAppInterface(webView, callback), serviceName);
|
975
|
+
}
|
976
|
+
|
977
|
+
shouldHandleBackPress = false;
|
978
|
+
webView.loadUrl(url);
|
979
|
+
});
|
980
|
+
}catch (Exception e) {
|
981
|
+
e.printStackTrace();
|
982
|
+
}
|
983
|
+
|
984
|
+
|
985
|
+
|
986
|
+
}
|
987
|
+
|
988
|
+
public class SecondWebAppInterface {
|
989
|
+
private SecondBrowserInterface callback;
|
990
|
+
private View targetView;
|
991
|
+
public SecondWebAppInterface(View targetView, SecondBrowserInterface callback) {
|
992
|
+
this.callback = callback;
|
993
|
+
this.targetView = targetView;
|
994
|
+
}
|
995
|
+
|
996
|
+
@JavascriptInterface
|
997
|
+
public void yuuLoginHandler(String status, String yuuToken, String cardNo, String warning) {
|
998
|
+
shouldHandleBackPress = true;
|
999
|
+
callback.secondBrowserInterfaceYuuLoginCallback(targetView, status, yuuToken, cardNo, warning, false);
|
1000
|
+
}
|
1001
|
+
|
1002
|
+
@JavascriptInterface
|
1003
|
+
public void customHandler(String params1, String params2) {
|
1004
|
+
shouldHandleBackPress = true;
|
1005
|
+
callback.customHandler(targetView, params1, params2);
|
1006
|
+
}
|
1007
|
+
|
1008
|
+
}
|
1009
|
+
|
1010
|
+
public interface SecondBrowserInterface {
|
1011
|
+
void secondBrowserInterfaceYuuLoginCallback(View targetView, String status, String yuuToken, String cardNo, String warning, boolean cancel);
|
1012
|
+
void customHandler(View targetView, String params1, String params2);
|
1013
|
+
|
1014
|
+
}
|
847
1015
|
|
848
1016
|
}
|
@@ -2,15 +2,20 @@ package com.aigens.sdk.plugins;
|
|
2
2
|
|
3
3
|
import android.Manifest;
|
4
4
|
import android.app.Activity;
|
5
|
+
import android.app.ActivityManager;
|
5
6
|
import android.content.ClipData;
|
6
7
|
import android.content.ClipDescription;
|
7
8
|
import android.content.ClipboardManager;
|
9
|
+
import android.content.ComponentName;
|
8
10
|
import android.content.Context;
|
9
11
|
import android.content.Intent;
|
10
12
|
import android.content.pm.PackageInfo;
|
11
13
|
import android.content.pm.PackageManager;
|
12
14
|
import android.net.Uri;
|
15
|
+
import android.os.Build;
|
13
16
|
import android.os.Handler;
|
17
|
+
import android.view.View;
|
18
|
+
import android.view.ViewGroup;
|
14
19
|
import android.webkit.WebSettings;
|
15
20
|
import android.webkit.WebView;
|
16
21
|
|
@@ -538,4 +543,88 @@ public class CorePlugin extends Plugin {
|
|
538
543
|
call.resolve(ret);
|
539
544
|
}
|
540
545
|
|
546
|
+
@PluginMethod
|
547
|
+
public void openSecondBrowser(PluginCall call) {
|
548
|
+
String url = call.getString("url", null);
|
549
|
+
String serviceName = call.getString("serviceName", null);
|
550
|
+
if (url == null) {
|
551
|
+
call.reject("url is missing");
|
552
|
+
return;
|
553
|
+
}
|
554
|
+
|
555
|
+
ActivityManager activityManager = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE);
|
556
|
+
if (activityManager == null) {
|
557
|
+
call.reject("activityManager is missing");
|
558
|
+
return;
|
559
|
+
}
|
560
|
+
Activity currentActivity = null;
|
561
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
562
|
+
List<ActivityManager.AppTask> tasks = activityManager.getAppTasks();
|
563
|
+
if (tasks != null && !tasks.isEmpty()) {
|
564
|
+
ActivityManager.RecentTaskInfo taskInfo = tasks.get(0).getTaskInfo();
|
565
|
+
if (taskInfo.topActivity.getClassName().equals(WebContainerActivity.class.getName())) {
|
566
|
+
try {
|
567
|
+
Class<?> activityClass = Class.forName(taskInfo.topActivity.getClassName());
|
568
|
+
currentActivity = (Activity) activityClass.newInstance();
|
569
|
+
} catch (Exception e) {
|
570
|
+
e.printStackTrace();
|
571
|
+
}
|
572
|
+
|
573
|
+
}
|
574
|
+
}
|
575
|
+
} else {
|
576
|
+
List<ActivityManager.RunningTaskInfo> tasks = activityManager.getRunningTasks(1);
|
577
|
+
if (tasks != null && !tasks.isEmpty()) {
|
578
|
+
ActivityManager.RunningTaskInfo taskInfo = tasks.get(0);
|
579
|
+
if (taskInfo.topActivity.getClassName().equals(WebContainerActivity.class.getName())) {
|
580
|
+
try {
|
581
|
+
Class<?> activityClass = Class.forName(taskInfo.topActivity.getClassName());
|
582
|
+
currentActivity = (Activity) activityClass.newInstance();
|
583
|
+
} catch (Exception e) {
|
584
|
+
e.printStackTrace();
|
585
|
+
}
|
586
|
+
|
587
|
+
|
588
|
+
}
|
589
|
+
}
|
590
|
+
}
|
591
|
+
|
592
|
+
if (currentActivity == null) {
|
593
|
+
call.reject("currentActivity is missing");
|
594
|
+
return;
|
595
|
+
}
|
596
|
+
|
597
|
+
if (currentActivity instanceof WebContainerActivity) {
|
598
|
+
((WebContainerActivity) currentActivity).openSecondBrowser(url, null, new WebContainerActivity.SecondBrowserInterface() {
|
599
|
+
@Override
|
600
|
+
public void secondBrowserInterfaceYuuLoginCallback(View targetView, String status, String yuuToken, String cardNo, String warning, boolean cancel) {
|
601
|
+
JSObject ret = new JSObject();
|
602
|
+
ret.put("cancel", cancel);
|
603
|
+
ret.put("yuuToken", yuuToken);
|
604
|
+
ret.put("cardNo", cardNo);
|
605
|
+
ret.put("warning", warning);
|
606
|
+
ret.put("status", status);
|
607
|
+
call.resolve(ret);
|
608
|
+
ViewGroup parent = (ViewGroup) targetView.getParent();
|
609
|
+
if (parent != null) {
|
610
|
+
parent.removeView(targetView);
|
611
|
+
}
|
612
|
+
}
|
613
|
+
|
614
|
+
@Override
|
615
|
+
public void customHandler(View targetView, String params1, String params2) {
|
616
|
+
JSObject ret = new JSObject();
|
617
|
+
ret.put("params1", params1);
|
618
|
+
ret.put("params2", params2);
|
619
|
+
call.resolve(ret);
|
620
|
+
ViewGroup parent = (ViewGroup) targetView.getParent();
|
621
|
+
if (parent != null) {
|
622
|
+
parent.removeView(targetView);
|
623
|
+
}
|
624
|
+
}
|
625
|
+
});
|
626
|
+
}
|
627
|
+
|
628
|
+
}
|
629
|
+
|
541
630
|
}
|
package/dist/docs.json
CHANGED
@@ -244,6 +244,25 @@
|
|
244
244
|
"FPSPaymentOptions"
|
245
245
|
],
|
246
246
|
"slug": "makehkfpspayment"
|
247
|
+
},
|
248
|
+
{
|
249
|
+
"name": "openSecondBrowser",
|
250
|
+
"signature": "(options: YuuOptions) => Promise<YuuResultOptions>",
|
251
|
+
"parameters": [
|
252
|
+
{
|
253
|
+
"name": "options",
|
254
|
+
"docs": "",
|
255
|
+
"type": "YuuOptions"
|
256
|
+
}
|
257
|
+
],
|
258
|
+
"returns": "Promise<YuuResultOptions>",
|
259
|
+
"tags": [],
|
260
|
+
"docs": "",
|
261
|
+
"complexTypes": [
|
262
|
+
"YuuResultOptions",
|
263
|
+
"YuuOptions"
|
264
|
+
],
|
265
|
+
"slug": "opensecondbrowser"
|
247
266
|
}
|
248
267
|
],
|
249
268
|
"properties": []
|
@@ -555,6 +574,73 @@
|
|
555
574
|
"type": "string | undefined"
|
556
575
|
}
|
557
576
|
]
|
577
|
+
},
|
578
|
+
{
|
579
|
+
"name": "YuuResultOptions",
|
580
|
+
"slug": "yuuresultoptions",
|
581
|
+
"docs": "",
|
582
|
+
"tags": [],
|
583
|
+
"methods": [],
|
584
|
+
"properties": [
|
585
|
+
{
|
586
|
+
"name": "cancel",
|
587
|
+
"tags": [],
|
588
|
+
"docs": "",
|
589
|
+
"complexTypes": [],
|
590
|
+
"type": "boolean"
|
591
|
+
},
|
592
|
+
{
|
593
|
+
"name": "yuuToken",
|
594
|
+
"tags": [],
|
595
|
+
"docs": "",
|
596
|
+
"complexTypes": [],
|
597
|
+
"type": "string | undefined"
|
598
|
+
},
|
599
|
+
{
|
600
|
+
"name": "cardNo",
|
601
|
+
"tags": [],
|
602
|
+
"docs": "",
|
603
|
+
"complexTypes": [],
|
604
|
+
"type": "string | undefined"
|
605
|
+
},
|
606
|
+
{
|
607
|
+
"name": "warning",
|
608
|
+
"tags": [],
|
609
|
+
"docs": "",
|
610
|
+
"complexTypes": [],
|
611
|
+
"type": "string | undefined"
|
612
|
+
},
|
613
|
+
{
|
614
|
+
"name": "status",
|
615
|
+
"tags": [],
|
616
|
+
"docs": "",
|
617
|
+
"complexTypes": [],
|
618
|
+
"type": "string | undefined"
|
619
|
+
}
|
620
|
+
]
|
621
|
+
},
|
622
|
+
{
|
623
|
+
"name": "YuuOptions",
|
624
|
+
"slug": "yuuoptions",
|
625
|
+
"docs": "",
|
626
|
+
"tags": [],
|
627
|
+
"methods": [],
|
628
|
+
"properties": [
|
629
|
+
{
|
630
|
+
"name": "url",
|
631
|
+
"tags": [],
|
632
|
+
"docs": "",
|
633
|
+
"complexTypes": [],
|
634
|
+
"type": "string"
|
635
|
+
},
|
636
|
+
{
|
637
|
+
"name": "serviceName",
|
638
|
+
"tags": [],
|
639
|
+
"docs": "",
|
640
|
+
"complexTypes": [],
|
641
|
+
"type": "string | undefined"
|
642
|
+
}
|
643
|
+
]
|
558
644
|
}
|
559
645
|
],
|
560
646
|
"enums": [],
|
@@ -41,6 +41,18 @@ export interface CorePlugin {
|
|
41
41
|
resultCode?: number;
|
42
42
|
}>;
|
43
43
|
makeHKFPSPayment(options: FPSPaymentOptions): Promise<FPSResultOptions>;
|
44
|
+
openSecondBrowser(options: YuuOptions): Promise<YuuResultOptions>;
|
45
|
+
}
|
46
|
+
export interface YuuOptions {
|
47
|
+
url: string;
|
48
|
+
serviceName?: string;
|
49
|
+
}
|
50
|
+
export interface YuuResultOptions {
|
51
|
+
cancel: boolean;
|
52
|
+
yuuToken?: string;
|
53
|
+
cardNo?: string;
|
54
|
+
warning?: string;
|
55
|
+
status?: string;
|
44
56
|
}
|
45
57
|
export interface FPSPaymentOptions {
|
46
58
|
paymentRequestUrl: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\nexport interface CorePlugin {\n echo(options: any): Promise<any>;\n dismiss(options: any): Promise<any>;\n finish(options: any): Promise<any>;\n getMember(options: any): Promise<{ member: Member }>;\n getDeeplink(options: any): Promise<{ deeplink: Deeplink }>;\n openBrowser(options: BrowserOptions): Promise<any>;\n isInstalledApp(options: { key: string }): Promise<{ install: boolean }>;\n getIsProductionEnvironment(): Promise<{ isPrd: boolean }>;\n openExternalUrl(options: { url: string }): Promise<any>;\n checkNotificationPermissions(): Promise<PermissionStatus>;\n getFinishData(options: any): Promise<{closedData: any}>;\n /**\n *\n * @param value : 0 - 1\n */\n setTextZoom(options: { value: number }): Promise<any>;\n\n /**\n * Promise<any>: { value: string, type: 'text/plain' }\n */\n readClipboard(): Promise<any>;\n\n addCalendar(options: CalendarOptions): Promise<{notPermission?: boolean, resultCode?: number}>;\n\n makeHKFPSPayment(options: FPSPaymentOptions): Promise<FPSResultOptions>;\n}\n\nexport interface FPSPaymentOptions {\n paymentRequestUrl: string,\n callbackUrl?: string,\n typeIdentifier?: string,\n title?: string,\n}\nexport interface FPSResultOptions {\n result: boolean,\n url?: string,\n intent?: string\n}\n\nexport interface BrowserOptions {\n url: string,\n member?: Member,\n deeplink?: Deeplink,\n externalProtocols?: string[],\n addPaddingProtocols?: string[],\n excludedUniversalLinks?: string[],\n}\n\nexport interface CalendarOptions {\n title: string,\n isAllDay?: boolean,\n beginTime?: number,\n endTime?: number,\n location?: string,\n notes?: string\n}\n\nexport interface Member {\n \"memberCode\"?: string;\n \"source\"?: string;\n \"sessionId\"?: string;\n \"pushId\"?: string;\n \"deviceId\": string;\n \"universalLink\"?: string;\n \"appleMerchantId\"?: string;\n \"cachedOrderContext\"?: boolean;\n \"name\"?: string;\n \"email\"?: string;\n \"phone\"?: string;\n}\nexport interface Deeplink {\n \"addItemId\"?: string;\n \"addDiscountCode\"?: string;\n \"addOfferId\"?: string;\n}\n\nexport interface PermissionStatus {\n display: PermissionState;\n}\n\n"]}
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\nexport interface CorePlugin {\n echo(options: any): Promise<any>;\n dismiss(options: any): Promise<any>;\n finish(options: any): Promise<any>;\n getMember(options: any): Promise<{ member: Member }>;\n getDeeplink(options: any): Promise<{ deeplink: Deeplink }>;\n openBrowser(options: BrowserOptions): Promise<any>;\n isInstalledApp(options: { key: string }): Promise<{ install: boolean }>;\n getIsProductionEnvironment(): Promise<{ isPrd: boolean }>;\n openExternalUrl(options: { url: string }): Promise<any>;\n checkNotificationPermissions(): Promise<PermissionStatus>;\n getFinishData(options: any): Promise<{closedData: any}>;\n /**\n *\n * @param value : 0 - 1\n */\n setTextZoom(options: { value: number }): Promise<any>;\n\n /**\n * Promise<any>: { value: string, type: 'text/plain' }\n */\n readClipboard(): Promise<any>;\n\n addCalendar(options: CalendarOptions): Promise<{notPermission?: boolean, resultCode?: number}>;\n\n makeHKFPSPayment(options: FPSPaymentOptions): Promise<FPSResultOptions>;\n openSecondBrowser(options: YuuOptions): Promise<YuuResultOptions>;\n}\n\nexport interface YuuOptions {\n url: string,\n serviceName?: string,\n}\nexport interface YuuResultOptions {\n cancel: boolean,\n yuuToken?: string,\n cardNo?: string,\n warning?: string\n status?: string\n}\n\nexport interface FPSPaymentOptions {\n paymentRequestUrl: string,\n callbackUrl?: string,\n typeIdentifier?: string,\n title?: string,\n}\nexport interface FPSResultOptions {\n result: boolean,\n url?: string,\n intent?: string\n}\n\nexport interface BrowserOptions {\n url: string,\n member?: Member,\n deeplink?: Deeplink,\n externalProtocols?: string[],\n addPaddingProtocols?: string[],\n excludedUniversalLinks?: string[],\n}\n\nexport interface CalendarOptions {\n title: string,\n isAllDay?: boolean,\n beginTime?: number,\n endTime?: number,\n location?: string,\n notes?: string\n}\n\nexport interface Member {\n \"memberCode\"?: string;\n \"source\"?: string;\n \"sessionId\"?: string;\n \"pushId\"?: string;\n \"deviceId\": string;\n \"universalLink\"?: string;\n \"appleMerchantId\"?: string;\n \"cachedOrderContext\"?: boolean;\n \"name\"?: string;\n \"email\"?: string;\n \"phone\"?: string;\n}\nexport interface Deeplink {\n \"addItemId\"?: string;\n \"addDiscountCode\"?: string;\n \"addOfferId\"?: string;\n}\n\nexport interface PermissionStatus {\n display: PermissionState;\n}\n\n"]}
|
package/dist/esm/web.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
2
|
-
import type { BrowserOptions, CalendarOptions, CorePlugin, Deeplink, FPSPaymentOptions, FPSResultOptions, Member, PermissionStatus } from './definitions';
|
2
|
+
import type { BrowserOptions, CalendarOptions, CorePlugin, Deeplink, FPSPaymentOptions, FPSResultOptions, Member, PermissionStatus, YuuOptions, YuuResultOptions } from './definitions';
|
3
3
|
export declare class CoreWeb extends WebPlugin implements CorePlugin {
|
4
4
|
echo(options: any): Promise<any>;
|
5
5
|
getMember(options: any): Promise<{
|
@@ -35,4 +35,5 @@ export declare class CoreWeb extends WebPlugin implements CorePlugin {
|
|
35
35
|
resultCode?: number;
|
36
36
|
}>;
|
37
37
|
makeHKFPSPayment(options: FPSPaymentOptions): Promise<FPSResultOptions>;
|
38
|
+
openSecondBrowser(options: YuuOptions): Promise<YuuResultOptions>;
|
38
39
|
}
|
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,OAAQ,SAAQ,SAAS;IAClC,KAAK,CAAC,IAAI,CAAC,OAAY;QACnB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAA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,OAAO,CAAA;QACP,OAAO,EAAS,CAAC;IACrB,CAAC;CAEJ","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { BrowserOptions, CalendarOptions, CorePlugin, Deeplink, FPSPaymentOptions, FPSResultOptions, Member, PermissionStatus } from './definitions';\n\n\nexport class CoreWeb extends WebPlugin implements CorePlugin {\n async echo(options: any): Promise<any> {\n console.log('ECHO', options);\n return options;\n }\n\n async getMember(options: any): Promise<{ member: Member }> {\n console.log('GET MEMBER', options);\n var result = {} as any;\n var w = window as any;\n result.member = w.aigens?.context?.member;\n return result;\n }\n async getDeeplink(options: any): Promise<{ deeplink: Deeplink }> {\n console.log('GET Deeplink', options);\n var result = {} as any;\n var w = window as any;\n result.deeplink = w.aigens?.context?.deeplink;\n return result;\n }\n\n async dismiss(options: any): Promise<any> {\n console.log('DISMISS', options);\n return options;\n }\n\n async finish(options: any): Promise<any> {\n console.log('FINISH', options);\n return options;\n }\n\n async openBrowser(options: BrowserOptions): Promise<any> {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n\n async isInstalledApp(options: { key: string }): Promise<{ install: boolean }> {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n\n async openExternalUrl(options: { url: string }): Promise<any> {\n window.open(options.url, \"_blank\");\n return {\n open: true\n }\n }\n\n async getIsProductionEnvironment(): Promise<{ isPrd: boolean }> {\n return { isPrd: true };\n }\n\n async checkNotificationPermissions(): Promise<PermissionStatus> {\n throw new Error('checkNotificationPermissions not supported in browser.');\n }\n\n async getFinishData(options: any): Promise<{ closedData: any }> {\n return { closedData: options }\n }\n\n async setTextZoom(options: { value: number }): Promise<any> {\n if (typeof document !== 'undefined') {\n try {\n document.body.style.webkitTextSizeAdjust = `${Math.round(options.value * 100)}%`;\n } catch (error) {\n }\n }\n return options;\n }\n\n async readClipboard(): Promise<any> {\n if (\n typeof navigator === 'undefined' ||\n !navigator.clipboard ||\n !navigator.clipboard.readText\n ) {\n throw this.unavailable(\n 'Reading from clipboard not supported in this browser',\n );\n }\n\n const text = await navigator.clipboard.readText();\n return { value: text, type: 'text/plain' };\n }\n\n async addCalendar(options: CalendarOptions): Promise<{notPermission?: boolean, resultCode?: number}> {\n options\n return {notPermission: true}\n }\n\n async makeHKFPSPayment(options: FPSPaymentOptions): Promise<FPSResultOptions> {\n options\n return {} as any;\n }\n\n}\n"]}
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,OAAQ,SAAQ,SAAS;IAClC,KAAK,CAAC,IAAI,CAAC,OAAY;QACnB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAAY;;QACxB,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACnC,IAAI,MAAM,GAAG,EAAS,CAAC;QACvB,IAAI,CAAC,GAAG,MAAa,CAAC;QACtB,MAAM,CAAC,MAAM,GAAG,MAAA,MAAA,CAAC,CAAC,MAAM,0CAAE,OAAO,0CAAE,MAAM,CAAC;QAC1C,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,OAAY;;QAC1B,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QACrC,IAAI,MAAM,GAAG,EAAS,CAAC;QACvB,IAAI,CAAC,GAAG,MAAa,CAAC;QACtB,MAAM,CAAC,QAAQ,GAAG,MAAA,MAAA,CAAC,CAAC,MAAM,0CAAE,OAAO,0CAAE,QAAQ,CAAC;QAC9C,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAY;QACtB,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO,OAAO,CAAC;IACnB,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AAW;YAChC,CAAC,SAAS,CAAC,SAAS;YACpB,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,EAC/B;YACE,MAAM,IAAI,CAAC,WAAW,CAClB,sDAAsD,CACzD,CAAC;SACL;QAED,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;QAClD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAwB;QACtC,OAAO,CAAA;QACP,OAAO,EAAC,aAAa,EAAE,IAAI,EAAC,CAAA;IAChC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAA0B;QAC7C,OAAO,CAAA;QACP,OAAO,EAAS,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAAmB;QACvC,OAAO,CAAA;QACP,OAAO,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC;IAC1B,CAAC;CAEJ","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { BrowserOptions, CalendarOptions, CorePlugin, Deeplink, FPSPaymentOptions, FPSResultOptions, Member, PermissionStatus, YuuOptions, YuuResultOptions } from './definitions';\n\n\nexport class CoreWeb extends WebPlugin implements CorePlugin {\n async echo(options: any): Promise<any> {\n console.log('ECHO', options);\n return options;\n }\n\n async getMember(options: any): Promise<{ member: Member }> {\n console.log('GET MEMBER', options);\n var result = {} as any;\n var w = window as any;\n result.member = w.aigens?.context?.member;\n return result;\n }\n async getDeeplink(options: any): Promise<{ deeplink: Deeplink }> {\n console.log('GET Deeplink', options);\n var result = {} as any;\n var w = window as any;\n result.deeplink = w.aigens?.context?.deeplink;\n return result;\n }\n\n async dismiss(options: any): Promise<any> {\n console.log('DISMISS', options);\n return options;\n }\n\n async finish(options: any): Promise<any> {\n console.log('FINISH', options);\n return options;\n }\n\n async openBrowser(options: BrowserOptions): Promise<any> {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n\n async isInstalledApp(options: { key: string }): Promise<{ install: boolean }> {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n\n async openExternalUrl(options: { url: string }): Promise<any> {\n window.open(options.url, \"_blank\");\n return {\n open: true\n }\n }\n\n async getIsProductionEnvironment(): Promise<{ isPrd: boolean }> {\n return { isPrd: true };\n }\n\n async checkNotificationPermissions(): Promise<PermissionStatus> {\n throw new Error('checkNotificationPermissions not supported in browser.');\n }\n\n async getFinishData(options: any): Promise<{ closedData: any }> {\n return { closedData: options }\n }\n\n async setTextZoom(options: { value: number }): Promise<any> {\n if (typeof document !== 'undefined') {\n try {\n document.body.style.webkitTextSizeAdjust = `${Math.round(options.value * 100)}%`;\n } catch (error) {\n }\n }\n return options;\n }\n\n async readClipboard(): Promise<any> {\n if (\n typeof navigator === 'undefined' ||\n !navigator.clipboard ||\n !navigator.clipboard.readText\n ) {\n throw this.unavailable(\n 'Reading from clipboard not supported in this browser',\n );\n }\n\n const text = await navigator.clipboard.readText();\n return { value: text, type: 'text/plain' };\n }\n\n async addCalendar(options: CalendarOptions): Promise<{notPermission?: boolean, resultCode?: number}> {\n options\n return {notPermission: true}\n }\n\n async makeHKFPSPayment(options: FPSPaymentOptions): Promise<FPSResultOptions> {\n options\n return {} as any;\n }\n\n async openSecondBrowser(options: YuuOptions): Promise<YuuResultOptions> {\n options\n return {cancel: true};\n }\n\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
package/dist/plugin.cjs.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Core = registerPlugin('Core', {\n web: () => import('./web').then(m => new m.CoreWeb()),\n});\nexport * from './definitions';\nexport { Core };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CoreWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async getMember(options) {\n var _a, _b;\n console.log('GET MEMBER', options);\n var result = {};\n var w = window;\n result.member = (_b = (_a = w.aigens) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.member;\n return result;\n }\n async getDeeplink(options) {\n var _a, _b;\n console.log('GET Deeplink', options);\n var result = {};\n var w = window;\n result.deeplink = (_b = (_a = w.aigens) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.deeplink;\n return result;\n }\n async dismiss(options) {\n console.log('DISMISS', options);\n return options;\n }\n async finish(options) {\n console.log('FINISH', options);\n return options;\n }\n async openBrowser(options) {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n async isInstalledApp(options) {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n async openExternalUrl(options) {\n window.open(options.url, \"_blank\");\n return {\n open: true\n };\n }\n async getIsProductionEnvironment() {\n return { isPrd: true };\n }\n async checkNotificationPermissions() {\n throw new Error('checkNotificationPermissions not supported in browser.');\n }\n async getFinishData(options) {\n return { closedData: options };\n }\n async setTextZoom(options) {\n if (typeof document !== 'undefined') {\n try {\n document.body.style.webkitTextSizeAdjust = `${Math.round(options.value * 100)}%`;\n }\n catch (error) {\n }\n }\n return options;\n }\n async readClipboard() {\n if (typeof navigator === 'undefined' ||\n !navigator.clipboard ||\n !navigator.clipboard.readText) {\n throw this.unavailable('Reading from clipboard not supported in this browser');\n }\n const text = await navigator.clipboard.readText();\n return { value: text, type: 'text/plain' };\n }\n async addCalendar(options) {\n options;\n return { notPermission: true };\n }\n async makeHKFPSPayment(options) {\n options;\n return {};\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,IAAI,GAAGA,mBAAc,CAAC,MAAM,EAAE;AACpC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AACzD,CAAC;;ACFM,MAAM,OAAO,SA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;AAC/B,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;AAC7C,YAAY,IAAI;AAChB,gBAAgB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,oBAAoB,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACjG,aAAa;AACb,YAAY,OAAO,KAAK,EAAE;AAC1B,aAAa;AACb,SAAS;AACT,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,IAAI,OAAO,SAAS,KAAK,WAAW;AAC5C,YAAY,CAAC,SAAS,CAAC,SAAS;AAChC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE;AAC3C,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,sDAAsD,CAAC,CAAC;AAC3F,SAAS;AACT,QAAQ,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;AAC1D,QAAQ,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AACnD,KAAK;AACL,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;AAE/B,QAAQ,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,gBAAgB,CAAC,OAAO,EAAE;AAEpC,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL;;;;;;;;;"}
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Core = registerPlugin('Core', {\n web: () => import('./web').then(m => new m.CoreWeb()),\n});\nexport * from './definitions';\nexport { Core };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CoreWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async getMember(options) {\n var _a, _b;\n console.log('GET MEMBER', options);\n var result = {};\n var w = window;\n result.member = (_b = (_a = w.aigens) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.member;\n return result;\n }\n async getDeeplink(options) {\n var _a, _b;\n console.log('GET Deeplink', options);\n var result = {};\n var w = window;\n result.deeplink = (_b = (_a = w.aigens) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.deeplink;\n return result;\n }\n async dismiss(options) {\n console.log('DISMISS', options);\n return options;\n }\n async finish(options) {\n console.log('FINISH', options);\n return options;\n }\n async openBrowser(options) {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n async isInstalledApp(options) {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n async openExternalUrl(options) {\n window.open(options.url, \"_blank\");\n return {\n open: true\n };\n }\n async getIsProductionEnvironment() {\n return { isPrd: true };\n }\n async checkNotificationPermissions() {\n throw new Error('checkNotificationPermissions not supported in browser.');\n }\n async getFinishData(options) {\n return { closedData: options };\n }\n async setTextZoom(options) {\n if (typeof document !== 'undefined') {\n try {\n document.body.style.webkitTextSizeAdjust = `${Math.round(options.value * 100)}%`;\n }\n catch (error) {\n }\n }\n return options;\n }\n async readClipboard() {\n if (typeof navigator === 'undefined' ||\n !navigator.clipboard ||\n !navigator.clipboard.readText) {\n throw this.unavailable('Reading from clipboard not supported in this browser');\n }\n const text = await navigator.clipboard.readText();\n return { value: text, type: 'text/plain' };\n }\n async addCalendar(options) {\n options;\n return { notPermission: true };\n }\n async makeHKFPSPayment(options) {\n options;\n return {};\n }\n async openSecondBrowser(options) {\n options;\n return { cancel: true };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,IAAI,GAAGA,mBAAc,CAAC,MAAM,EAAE;AACpC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,C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in.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Core = registerPlugin('Core', {\n web: () => import('./web').then(m => new m.CoreWeb()),\n});\nexport * from './definitions';\nexport { Core };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CoreWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async getMember(options) {\n var _a, _b;\n console.log('GET MEMBER', options);\n var result = {};\n var w = window;\n result.member = (_b = (_a = w.aigens) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.member;\n return result;\n }\n async getDeeplink(options) {\n var _a, _b;\n console.log('GET Deeplink', options);\n var result = {};\n var w = window;\n result.deeplink = (_b = (_a = w.aigens) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.deeplink;\n return result;\n }\n async dismiss(options) {\n console.log('DISMISS', options);\n return options;\n }\n async finish(options) {\n console.log('FINISH', options);\n return options;\n }\n async openBrowser(options) {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n async isInstalledApp(options) {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n async openExternalUrl(options) {\n window.open(options.url, \"_blank\");\n return {\n open: true\n };\n }\n async getIsProductionEnvironment() {\n return { isPrd: true };\n }\n async checkNotificationPermissions() {\n throw new Error('checkNotificationPermissions not supported in browser.');\n }\n async getFinishData(options) {\n return { closedData: options };\n }\n async setTextZoom(options) {\n if (typeof document !== 'undefined') {\n try {\n document.body.style.webkitTextSizeAdjust = `${Math.round(options.value * 100)}%`;\n }\n catch (error) {\n }\n }\n return options;\n }\n async readClipboard() {\n if (typeof navigator === 'undefined' ||\n !navigator.clipboard ||\n !navigator.clipboard.readText) {\n throw this.unavailable('Reading from clipboard not supported in this browser');\n }\n const text = await navigator.clipboard.readText();\n return { value: text, type: 'text/plain' };\n }\n async addCalendar(options) {\n options;\n return { notPermission: true };\n }\n async makeHKFPSPayment(options) {\n options;\n return {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
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Core = registerPlugin('Core', {\n web: () => import('./web').then(m => new m.CoreWeb()),\n});\nexport * from './definitions';\nexport { Core };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CoreWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async getMember(options) {\n var _a, _b;\n console.log('GET MEMBER', options);\n var result = {};\n var w = window;\n result.member = (_b = (_a = w.aigens) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.member;\n return result;\n }\n async getDeeplink(options) {\n var _a, _b;\n console.log('GET Deeplink', options);\n var result = {};\n var w = window;\n result.deeplink = (_b = (_a = w.aigens) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.deeplink;\n return result;\n }\n async dismiss(options) {\n console.log('DISMISS', options);\n return options;\n }\n async finish(options) {\n console.log('FINISH', options);\n return options;\n }\n async openBrowser(options) {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n async isInstalledApp(options) {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n async openExternalUrl(options) {\n window.open(options.url, \"_blank\");\n return {\n open: true\n };\n }\n async getIsProductionEnvironment() {\n return { isPrd: true };\n }\n async checkNotificationPermissions() {\n throw new Error('checkNotificationPermissions not supported in browser.');\n }\n async getFinishData(options) {\n return { closedData: options };\n }\n async setTextZoom(options) {\n if (typeof document !== 'undefined') {\n try {\n document.body.style.webkitTextSizeAdjust = `${Math.round(options.value * 100)}%`;\n }\n catch (error) {\n }\n }\n return options;\n }\n async readClipboard() {\n if (typeof navigator === 'undefined' ||\n !navigator.clipboard ||\n !navigator.clipboard.readText) {\n throw this.unavailable('Reading from clipboard not supported in this browser');\n }\n const text = await navigator.clipboard.readText();\n return { value: text, type: 'text/plain' };\n }\n async addCalendar(options) {\n options;\n return { notPermission: true };\n }\n async makeHKFPSPayment(options) {\n options;\n return {};\n }\n async openSecondBrowser(options) {\n options;\n return { cancel: true };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,IAAI,GAAGA,mBAAc,CAAC,MAAM,EAAE;IACpC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IACzD,CAAC;;ICFM,MAAM,OAAO,SAASC,cAAS,CAAC;IACvC,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,OAAO,OAAO,CAAC;IACvB,KAAK;IACL,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;IAC7B,QAAQ,IAAI,EAAE,EAAE,EAAE,CAAC;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC3C,QAAQ,IAAI,MAAM,GAAG,EAAE,CAAC;IACxB,QAAQ,IAAI,CAAC,GAAG,MAAM,CAAC;IACvB,QAAQ,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,MAAM,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAC9I,QAAQ,OAAO,MAAM,CAAC;IACtB,KAAK;IACL,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;IAC/B,QAAQ,IAAI,EAAE,EAAE,EAAE,CAAC;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7C,QAAQ,IAAI,MAAM,GAAG,EAAE,CAAC;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QAAQ,OAAO,EAAE,CAAC;IAClB,KAAK;IACL,IAAI,MAAM,iBAAiB,CAAC,OAAO,EAAE;IAErC,QAAQ,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAChC,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
package/ios/Plugin/CorePlugin.m
CHANGED
@@ -8,6 +8,7 @@ CAP_PLUGIN(CorePlugin, "Core",
|
|
8
8
|
CAP_PLUGIN_METHOD(dismiss, CAPPluginReturnPromise);
|
9
9
|
CAP_PLUGIN_METHOD(finish, CAPPluginReturnPromise);
|
10
10
|
CAP_PLUGIN_METHOD(openBrowser, CAPPluginReturnPromise);
|
11
|
+
CAP_PLUGIN_METHOD(openSecondBrowser, CAPPluginReturnPromise);
|
11
12
|
CAP_PLUGIN_METHOD(getDeeplink, CAPPluginReturnPromise);
|
12
13
|
CAP_PLUGIN_METHOD(getMember, CAPPluginReturnPromise);
|
13
14
|
CAP_PLUGIN_METHOD(isInstalledApp, CAPPluginReturnPromise);
|
@@ -27,11 +27,20 @@ public class CorePlugin: CAPPlugin {
|
|
27
27
|
public static var member: Dictionary<String, Any>?
|
28
28
|
public static var deeplink: Dictionary<String, Any>?
|
29
29
|
|
30
|
-
|
30
|
+
static var StaticBridge: CAPBridgeProtocol?
|
31
31
|
public override func load() {
|
32
32
|
handleOpenUrl()
|
33
|
+
CorePlugin.StaticBridge = self.bridge;
|
34
|
+
}
|
35
|
+
|
36
|
+
public static func getCoreInstance() -> CorePlugin? {
|
37
|
+
if let instance = StaticBridge?.plugin(withName: "Core") as? CorePlugin {
|
38
|
+
return instance
|
39
|
+
}
|
40
|
+
return nil
|
33
41
|
}
|
34
42
|
|
43
|
+
|
35
44
|
private func handleOpenUrl() {
|
36
45
|
NotificationCenter.default.addObserver(self, selector: #selector(self.handleUniversalLink(notification:)), name: Notification.Name.capacitorOpenUniversalLink, object: nil)
|
37
46
|
|
@@ -100,13 +109,18 @@ public class CorePlugin: CAPPlugin {
|
|
100
109
|
let typeIdentifier = call.getString("typeIdentifier", "hk.com.hkicl");
|
101
110
|
|
102
111
|
let paymentData: [String: Any] = ["URL": paymentRequestUrl, "callback": callbackUrl]
|
112
|
+
// let jsonData = try! JSONSerialization.data(withJSONObject: paymentData, options: [])
|
113
|
+
// let itemProvider = NSItemProvider(item: jsonData as NSSecureCoding, typeIdentifier: typeIdentifier)
|
103
114
|
let itemProvider = NSItemProvider(item: paymentData as NSSecureCoding, typeIdentifier: typeIdentifier)
|
104
115
|
let extensionItem = NSExtensionItem()
|
105
116
|
extensionItem.attachments = [itemProvider]
|
106
117
|
|
118
|
+
// Invoke UIActivityViewController to choose Payment App
|
107
119
|
let activityViewController = UIActivityViewController(activityItems: [extensionItem], applicationActivities: nil)
|
108
120
|
|
109
121
|
activityViewController.completionWithItemsHandler = { (activityType, completed, returnedItems, activityError) in
|
122
|
+
// Start the activity chosen to complete the payment
|
123
|
+
// print("Start the activity chosen to complete the payment : \(completed)")
|
110
124
|
if !completed {
|
111
125
|
CorePlugin.HKFPSCall?.keepAlive = false;
|
112
126
|
CorePlugin.HKFPSCall = nil;
|
@@ -114,6 +128,7 @@ public class CorePlugin: CAPPlugin {
|
|
114
128
|
}
|
115
129
|
DispatchQueue.main.async {
|
116
130
|
self.bridge?.viewController?.present(activityViewController, animated: true, completion: nil)
|
131
|
+
|
117
132
|
call.keepAlive = true;
|
118
133
|
CorePlugin.HKFPSCall = call;
|
119
134
|
}
|
@@ -253,6 +268,41 @@ public class CorePlugin: CAPPlugin {
|
|
253
268
|
CorePlugin.dismissCall = call
|
254
269
|
}
|
255
270
|
|
271
|
+
var openEmbedBrowserCallback: CAPPluginCall?
|
272
|
+
@objc func openSecondBrowser(_ call: CAPPluginCall) {
|
273
|
+
aigensprint("CorePlugin openEmbedBrowser")
|
274
|
+
guard let url = call.getString("url") else {
|
275
|
+
call.reject("url is missing")
|
276
|
+
return;
|
277
|
+
}
|
278
|
+
let serviceName = call.getString("serviceName")
|
279
|
+
|
280
|
+
DispatchQueue.main.async {
|
281
|
+
guard let currentVc = self.bridge?.viewController?.view else {
|
282
|
+
call.reject("currentVc is missing")
|
283
|
+
return;
|
284
|
+
}
|
285
|
+
|
286
|
+
let secondView = SecondWebContainerView()
|
287
|
+
self.insertView(secondView, currentVc)
|
288
|
+
secondView.delegate = self
|
289
|
+
secondView.serviceName = serviceName
|
290
|
+
secondView.loadUrl(urlString: url)
|
291
|
+
call.keepAlive = true
|
292
|
+
self.openEmbedBrowserCallback = call
|
293
|
+
}
|
294
|
+
|
295
|
+
}
|
296
|
+
|
297
|
+
public func insertView(_ newView: SecondWebContainerView, _ parentView: UIView) {
|
298
|
+
parentView.subviews
|
299
|
+
.filter { $0 is SecondWebContainerView }
|
300
|
+
.forEach { $0.removeFromSuperview() }
|
301
|
+
|
302
|
+
parentView.addSubview(newView)
|
303
|
+
newView.setCustomFrame(CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height:UIScreen.main.bounds.size.height))
|
304
|
+
}
|
305
|
+
|
256
306
|
|
257
307
|
@objc func openBrowser(_ call: CAPPluginCall) {
|
258
308
|
|
@@ -489,6 +539,15 @@ public class CorePlugin: CAPPlugin {
|
|
489
539
|
|
490
540
|
|
491
541
|
|
542
|
+
}
|
543
|
+
|
544
|
+
extension CorePlugin: SecondWebContainerDelegate {
|
545
|
+
|
546
|
+
public func secondWebContainerViewYuuLoginCallback(view: UIView, data: [String: Any]) {
|
547
|
+
guard let callback = openEmbedBrowserCallback else {return}
|
548
|
+
callback.resolve(data)
|
549
|
+
view.removeFromSuperview()
|
550
|
+
}
|
492
551
|
}
|
493
552
|
|
494
553
|
|
@@ -0,0 +1,157 @@
|
|
1
|
+
//
|
2
|
+
// SecondWebContainerView.swift
|
3
|
+
// AigensSdkCore
|
4
|
+
//
|
5
|
+
// Created by 陈培爵 on 2025/3/10.
|
6
|
+
//
|
7
|
+
|
8
|
+
import WebKit
|
9
|
+
|
10
|
+
@objc public protocol SecondWebContainerDelegate: AnyObject {
|
11
|
+
func secondWebContainerViewYuuLoginCallback(view: UIView, data: [String: Any])
|
12
|
+
}
|
13
|
+
|
14
|
+
@objc open class SecondWebContainerView: UIView {
|
15
|
+
|
16
|
+
public let webView: WKWebView
|
17
|
+
|
18
|
+
private let messageHandlerName = "YuuLoginHandler"
|
19
|
+
private let messageHandlerName2 = "yuuLoginHandler"
|
20
|
+
private var messageHandler: SecondWebViewMessageHandler?
|
21
|
+
|
22
|
+
public weak var delegate: SecondWebContainerDelegate?
|
23
|
+
|
24
|
+
private var currentUrl: String?
|
25
|
+
public var serviceName: String?
|
26
|
+
override init(frame: CGRect) {
|
27
|
+
// 创建 WebView 配置
|
28
|
+
let webConfiguration = WKWebViewConfiguration()
|
29
|
+
webView = WKWebView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height:UIScreen.main.bounds.size.height), configuration: webConfiguration)
|
30
|
+
|
31
|
+
super.init(frame: frame)
|
32
|
+
setupView()
|
33
|
+
}
|
34
|
+
|
35
|
+
required public init?(coder: NSCoder) {
|
36
|
+
fatalError("init(coder:) has not been implemented")
|
37
|
+
}
|
38
|
+
|
39
|
+
private func setupView() {
|
40
|
+
|
41
|
+
addSubview(webView)
|
42
|
+
webView.translatesAutoresizingMaskIntoConstraints = false
|
43
|
+
NSLayoutConstraint.activate([
|
44
|
+
webView.topAnchor.constraint(equalTo: topAnchor),
|
45
|
+
webView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
46
|
+
webView.trailingAnchor.constraint(equalTo: trailingAnchor),
|
47
|
+
webView.bottomAnchor.constraint(equalTo: bottomAnchor)
|
48
|
+
])
|
49
|
+
|
50
|
+
|
51
|
+
webView.navigationDelegate = self
|
52
|
+
webView.allowsBackForwardNavigationGestures = false
|
53
|
+
webView.scrollView.minimumZoomScale = 1.0
|
54
|
+
webView.scrollView.maximumZoomScale = 1.0
|
55
|
+
|
56
|
+
// 禁用双击缩放
|
57
|
+
let disableDoubleTapScript = """
|
58
|
+
var script = document.createElement('script');
|
59
|
+
script.textContent = 'document.documentElement.style.webkitTouchCallout = "none";';
|
60
|
+
document.documentElement.appendChild(script);
|
61
|
+
"""
|
62
|
+
let userScript = WKUserScript(source: disableDoubleTapScript,
|
63
|
+
injectionTime: .atDocumentEnd,
|
64
|
+
forMainFrameOnly: true)
|
65
|
+
webView.configuration.userContentController.addUserScript(userScript)
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
deinit {
|
70
|
+
|
71
|
+
print("SecondWebContainerView deinit")
|
72
|
+
webView.configuration.userContentController.removeScriptMessageHandler(forName: messageHandlerName)
|
73
|
+
}
|
74
|
+
|
75
|
+
public func loadUrl(urlString: String) {
|
76
|
+
guard let url = URL(string: urlString) else {
|
77
|
+
aigensprint("secondview Invalid URL: \(urlString)")
|
78
|
+
return
|
79
|
+
}
|
80
|
+
|
81
|
+
messageHandler = SecondWebViewMessageHandler(serviceName: self.serviceName, callback: { [weak self] message in
|
82
|
+
guard let s = self else { return }
|
83
|
+
self?.delegate?.secondWebContainerViewYuuLoginCallback(view: s, data: message)
|
84
|
+
})
|
85
|
+
|
86
|
+
webView.configuration.userContentController.add(messageHandler!, name: messageHandlerName)
|
87
|
+
webView.configuration.userContentController.add(messageHandler!, name: messageHandlerName2)
|
88
|
+
if let name = serviceName {
|
89
|
+
webView.configuration.userContentController.add(messageHandler!, name: name)
|
90
|
+
}
|
91
|
+
|
92
|
+
let request = URLRequest(url: url)
|
93
|
+
webView.load(request)
|
94
|
+
webView.navigationDelegate = self
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
public func setCustomFrame(_ frame: CGRect) {
|
99
|
+
self.frame = frame
|
100
|
+
layoutIfNeeded()
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
private class SecondWebViewMessageHandler: NSObject, WKScriptMessageHandler {
|
105
|
+
private let callback: ([String: Any]) -> Void
|
106
|
+
|
107
|
+
private let messageHandlerName = "YuuLoginHandler"
|
108
|
+
private let messageHandlerName2 = "yuuLoginHandler"
|
109
|
+
private var serviceName: String?
|
110
|
+
init(serviceName: String?, callback: @escaping ([String: Any]) -> Void) {
|
111
|
+
self.callback = callback
|
112
|
+
self.serviceName = serviceName
|
113
|
+
}
|
114
|
+
|
115
|
+
func userContentController(_ userContentController: WKUserContentController,
|
116
|
+
didReceive message: WKScriptMessage) {
|
117
|
+
// print("jason message:\(message.name)")
|
118
|
+
|
119
|
+
guard (message.name == messageHandlerName || message.name == messageHandlerName2 || message.name == serviceName ?? ""),
|
120
|
+
let messageBody = message.body as? [String: Any] else {
|
121
|
+
return
|
122
|
+
}
|
123
|
+
|
124
|
+
aigensprint("Received credit card token: \(messageBody)")
|
125
|
+
callback(messageBody)
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
// MARK: - WKNavigationDelegate 实现
|
130
|
+
extension SecondWebContainerView: WKNavigationDelegate {
|
131
|
+
public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
132
|
+
if let navURL = navigationAction.request.url {
|
133
|
+
currentUrl = navURL.absoluteString
|
134
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
135
|
+
if let url = self.currentUrl, url == "about:blank" {
|
136
|
+
self.delegate?.secondWebContainerViewYuuLoginCallback(view: self, data: ["cancel": true])
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
}
|
141
|
+
|
142
|
+
|
143
|
+
decisionHandler(.allow)
|
144
|
+
}
|
145
|
+
|
146
|
+
public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
|
147
|
+
print("jason secondnavURL didFinish")
|
148
|
+
}
|
149
|
+
|
150
|
+
public func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
|
151
|
+
|
152
|
+
print("jason secondnavURL didFail")
|
153
|
+
self.removeFromSuperview()
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
|
@@ -301,6 +301,23 @@ import Capacitor
|
|
301
301
|
return str.removingPercentEncoding ?? str
|
302
302
|
}
|
303
303
|
|
304
|
+
public func insertView(_ newView: SecondWebContainerView) {
|
305
|
+
|
306
|
+
if let parentView = self.view {
|
307
|
+
parentView.subviews
|
308
|
+
.filter { $0 is SecondWebContainerView }
|
309
|
+
.forEach { $0.removeFromSuperview() }
|
310
|
+
|
311
|
+
}
|
312
|
+
|
313
|
+
if webContainerView.superview != nil {
|
314
|
+
self.view.insertSubview(newView, belowSubview: webContainerView)
|
315
|
+
} else {
|
316
|
+
self.view.addSubview(newView)
|
317
|
+
}
|
318
|
+
newView.setCustomFrame(CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height:UIScreen.main.bounds.size.height))
|
319
|
+
}
|
320
|
+
|
304
321
|
public final func loadWebViewCustom() {
|
305
322
|
|
306
323
|
//let bridge = self.bridge
|