@aigens/aigens-sdk-core 0.0.6 → 0.0.9

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.
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.homepage = package['repository']['url']
11
11
  s.author = package['author']
12
12
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
- s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
13
+ s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp,xib}'
14
14
  s.ios.deployment_target = '12.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
package/README.md CHANGED
@@ -18,6 +18,9 @@ npx cap sync
18
18
  * [`finish(...)`](#finish)
19
19
  * [`getMember(...)`](#getmember)
20
20
  * [`openBrowser(...)`](#openbrowser)
21
+ * [`isInstalledApp(...)`](#isinstalledapp)
22
+ * [`getIsProductionEnvironment()`](#getisproductionenvironment)
23
+ * [`openExternalUrl(...)`](#openexternalurl)
21
24
 
22
25
  </docgen-index>
23
26
 
@@ -98,4 +101,45 @@ openBrowser(options: any) => Promise<any>
98
101
 
99
102
  --------------------
100
103
 
104
+
105
+ ### isInstalledApp(...)
106
+
107
+ ```typescript
108
+ isInstalledApp(options: { key: string; }) => Promise<{ install: boolean; }>
109
+ ```
110
+
111
+ | Param | Type |
112
+ | ------------- | ----------------------------- |
113
+ | **`options`** | <code>{ key: string; }</code> |
114
+
115
+ **Returns:** <code>Promise&lt;{ install: boolean; }&gt;</code>
116
+
117
+ --------------------
118
+
119
+
120
+ ### getIsProductionEnvironment()
121
+
122
+ ```typescript
123
+ getIsProductionEnvironment() => Promise<{ isPrd: boolean; }>
124
+ ```
125
+
126
+ **Returns:** <code>Promise&lt;{ isPrd: boolean; }&gt;</code>
127
+
128
+ --------------------
129
+
130
+
131
+ ### openExternalUrl(...)
132
+
133
+ ```typescript
134
+ openExternalUrl(options: { url: string; }) => Promise<any>
135
+ ```
136
+
137
+ | Param | Type |
138
+ | ------------- | ----------------------------- |
139
+ | **`options`** | <code>{ url: string; }</code> |
140
+
141
+ **Returns:** <code>Promise&lt;any&gt;</code>
142
+
143
+ --------------------
144
+
101
145
  </docgen-api>
@@ -1,3 +1,12 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
1
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
3
  package="com.aigens.sdk">
4
+ <uses-permission android:name="android.permission.INTERNET" />
5
+ <application android:hardwareAccelerated="true">
6
+ <activity android:name=".WebContainerActivity"
7
+ android:screenOrientation="portrait"
8
+ >
9
+
10
+ </activity>
11
+ </application>
3
12
  </manifest>
@@ -1,11 +1,18 @@
1
1
  package com.aigens.sdk;
2
2
 
3
+ import android.app.Activity;
3
4
  import android.content.Intent;
4
5
  import android.content.res.AssetManager;
5
6
  import android.graphics.Bitmap;
7
+ import android.graphics.Color;
6
8
  import android.net.Uri;
9
+ import android.os.Build;
7
10
  import android.os.Bundle;
11
+ import android.text.TextUtils;
12
+ import android.util.Log;
8
13
  import android.view.View;
14
+ import android.webkit.ServiceWorkerClient;
15
+ import android.webkit.ServiceWorkerController;
9
16
  import android.webkit.WebResourceError;
10
17
  import android.webkit.WebResourceRequest;
11
18
  import android.webkit.WebResourceResponse;
@@ -21,7 +28,6 @@ import com.getcapacitor.CapConfig;
21
28
  import com.getcapacitor.Plugin;
22
29
  import com.getcapacitor.PluginLoadException;
23
30
  import com.getcapacitor.PluginManager;
24
- import com.aigens.sdk.R;
25
31
 
26
32
  import org.json.JSONException;
27
33
  import org.json.JSONObject;
@@ -40,6 +46,17 @@ public class WebContainerActivity extends BridgeActivity {
40
46
  private String url;
41
47
  private boolean navbar = false;
42
48
  private Map member;
49
+ private boolean ENVIRONMENT_PRODUCTION = true;
50
+ private List<String> externalProtocols = new ArrayList<String>(){{
51
+ add("octopus://");
52
+ add("alipay://");
53
+ add("alipays://");
54
+ add("alipayhk://");
55
+ add("tel:");
56
+ add("mailto:");
57
+ add("payme://");
58
+ add("https://play.google.com");
59
+ }};
43
60
 
44
61
  private void debug(Object... msgs){
45
62
 
@@ -59,7 +76,9 @@ public class WebContainerActivity extends BridgeActivity {
59
76
 
60
77
  super.onCreate(savedInstanceState);
61
78
 
62
- setContentView(R.layout.sdk_layout_main);
79
+ setContentView(com.aigens.sdk.R.layout.sdk_layout_main);
80
+
81
+ disableServiceWorker();
63
82
 
64
83
  Intent intent = getIntent();
65
84
  this.url = intent.getStringExtra("url");
@@ -68,6 +87,15 @@ public class WebContainerActivity extends BridgeActivity {
68
87
  this.navbar = intent.getBooleanExtra("navbar", false);
69
88
 
70
89
  this.member = (Map) intent.getSerializableExtra("member");
90
+ boolean ENVIRONMENT_PRODUCTION = intent.getBooleanExtra("ENVIRONMENT_PRODUCTION", true);
91
+ CorePlugin.setENVIRONMENT_PRODUCTION(ENVIRONMENT_PRODUCTION);
92
+
93
+ List<String> externalProtocols_ = (List<String>) intent.getSerializableExtra("externalProtocols");
94
+ if (externalProtocols_ != null) {
95
+ for (String s : externalProtocols_) {
96
+ this.externalProtocols.add(s);
97
+ }
98
+ }
71
99
 
72
100
  if(this.member != null) {
73
101
  CorePlugin.setMember(this.member);
@@ -119,6 +147,16 @@ public class WebContainerActivity extends BridgeActivity {
119
147
 
120
148
  }
121
149
 
150
+ addExtraPlugins(new String[] {
151
+ "com.aigens.googlepay.GooglePayPlugin",
152
+ "com.aigens.octopus.OctopusPlugin",
153
+ "com.aigens.wechatpay.WechatPayPlugin",
154
+ "com.aigens.alipay.AliPayPlugin",
155
+ "com.aigens.alipayhk.AliPayhkPlugin",
156
+ "com.aigens.payme.PaymePlugin",
157
+ }, plugins);
158
+ addExtraPlugins(intent.getStringArrayExtra("extraClasspaths"), plugins);
159
+
122
160
  debug("App plugins:" + plugins);
123
161
 
124
162
  super.init(savedInstanceState, plugins, cc);
@@ -126,12 +164,38 @@ public class WebContainerActivity extends BridgeActivity {
126
164
  //still have time to override webview client to avoid any intercept
127
165
 
128
166
  BypassWebViewClient wvc = new BypassWebViewClient(this.bridge);
167
+ wvc.activity = this;
168
+ wvc.externalProtocols = this.externalProtocols;
129
169
  this.bridge.getWebView().setWebViewClient(wvc);
130
170
 
131
171
  initView();
132
172
  initLayout(false, true, false);
133
173
  }
134
174
 
175
+ private void addExtraPlugins(String[] extraClasspaths, List<Class<? extends Plugin>> plugins) {
176
+ if (extraClasspaths == null) return;
177
+ for (int i = 0; i < extraClasspaths.length; i++) {
178
+ String classPath = extraClasspaths[i];
179
+ try {
180
+ Class<?> c = Class.forName(classPath);
181
+ Class<? extends Plugin> sub = c.asSubclass(Plugin.class);
182
+ String clsName = sub.getName();
183
+ Boolean add = false;
184
+ for (Class<? extends Plugin> plugin : plugins) {
185
+ if (plugin.getName() == clsName) {
186
+ add = true;
187
+ break;
188
+ }
189
+ }
190
+ if (!add) {
191
+ plugins.add(sub);
192
+ }
193
+ } catch (ClassNotFoundException e) {
194
+ e.printStackTrace();
195
+ }
196
+ }
197
+ }
198
+
135
199
  private void initView(){
136
200
 
137
201
  Button backButton = (Button) findViewById(R.id.back);
@@ -154,6 +218,8 @@ public class WebContainerActivity extends BridgeActivity {
154
218
  }
155
219
  });
156
220
 
221
+ setTheme();
222
+
157
223
  }
158
224
 
159
225
  private void reload(){
@@ -170,6 +236,18 @@ public class WebContainerActivity extends BridgeActivity {
170
236
 
171
237
  }
172
238
 
239
+ private void setTheme() {
240
+ Intent intent = getIntent();
241
+ String themeColor = intent.getStringExtra("themeColor");
242
+ if (!TextUtils.isEmpty(themeColor)) {
243
+ View info = findViewById(R.id.info);
244
+ View error = findViewById(R.id.error);
245
+ info.setBackgroundColor(Color.parseColor(themeColor));
246
+ error.setBackgroundColor(Color.parseColor(themeColor));
247
+ bridge.getWebView().setBackgroundColor(Color.parseColor(themeColor));
248
+ getWindow().setStatusBarColor(Color.parseColor(themeColor));//set statussbar color
249
+ }
250
+ }
173
251
  private void initLayout(boolean showWeb, boolean showInfo, boolean showError){
174
252
 
175
253
  if(showError){
@@ -203,6 +281,25 @@ public class WebContainerActivity extends BridgeActivity {
203
281
  return plugins;
204
282
  }
205
283
 
284
+ private static boolean SW_DISABLED = false;
285
+
286
+ private static void disableServiceWorker(){
287
+
288
+ if(SW_DISABLED) return;
289
+
290
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
291
+ ServiceWorkerController.getInstance().setServiceWorkerClient(new ServiceWorkerClient() {
292
+ @Override
293
+ public WebResourceResponse shouldInterceptRequest(WebResourceRequest request) {
294
+
295
+ return null;
296
+ }
297
+ });
298
+ }
299
+
300
+ SW_DISABLED = true;
301
+
302
+ }
206
303
 
207
304
 
208
305
  private static String readString(InputStream is) throws IOException {
@@ -254,10 +351,78 @@ public class WebContainerActivity extends BridgeActivity {
254
351
  //BridgeWebViewClient
255
352
  class BypassWebViewClient extends BridgeWebViewClient {
256
353
 
354
+ public Activity activity;
355
+ private String TAG = "BypassWebViewClient";
356
+ List<String> externalProtocols;
257
357
  public BypassWebViewClient(Bridge bridge) {
258
358
  super(bridge);
259
359
  }
260
360
 
361
+ public boolean loopExternalProtocols(String url) {
362
+ if (externalProtocols != null) {
363
+ for (String p : externalProtocols) {
364
+ if (url != null && url != "" && url.startsWith(p)) {
365
+ return true;
366
+ }
367
+ }
368
+ }
369
+ return false;
370
+ }
371
+ public boolean shouldOverrideUrl(WebView view, String url) {
372
+ if (url.startsWith(WebView.SCHEME_TEL)) {
373
+ try {
374
+ Intent intent = new Intent(Intent.ACTION_DIAL);
375
+ intent.setData(Uri.parse(url));
376
+ activity.startActivity(intent);
377
+ return true;
378
+ } catch (android.content.ActivityNotFoundException e) {
379
+ Log.e(TAG, "Error dialing " + url + ": " + e.toString());
380
+ }
381
+ } else if (url.startsWith("geo:") || url.startsWith(WebView.SCHEME_MAILTO) || url.startsWith("market:")
382
+ || loopExternalProtocols(url)) {
383
+ try {
384
+ Intent intent = new Intent(Intent.ACTION_VIEW);
385
+ intent.setData(Uri.parse(url));
386
+ activity.startActivity(intent);
387
+ return true;
388
+ } catch (android.content.ActivityNotFoundException e) {
389
+ Log.e(TAG, "Error with " + url + ": " + e.toString());
390
+ }
391
+ }
392
+ // If sms:5551212?body=This is the message
393
+ else if (url.startsWith("sms:")) {
394
+ try {
395
+ Intent intent = new Intent(Intent.ACTION_VIEW);
396
+
397
+ // Get address
398
+ String address = null;
399
+ int parmIndex = url.indexOf('?');
400
+ if (parmIndex == -1) {
401
+ address = url.substring(4);
402
+ } else {
403
+ address = url.substring(4, parmIndex);
404
+
405
+ // If body, then set sms body
406
+ Uri uri = Uri.parse(url);
407
+ String query = uri.getQuery();
408
+ if (query != null) {
409
+ if (query.startsWith("body=")) {
410
+ intent.putExtra("sms_body", query.substring(5));
411
+ }
412
+ }
413
+ }
414
+ intent.setData(Uri.parse("sms:" + address));
415
+ intent.putExtra("address", address);
416
+ intent.setType("vnd.android-dir/mms-sms");
417
+ activity.startActivity(intent);
418
+ return true;
419
+ } catch (android.content.ActivityNotFoundException e) {
420
+ Log.e(TAG, "Error sending sms " + url + ":" + e.toString());
421
+ }
422
+ }
423
+ return false;
424
+ }
425
+
261
426
  //somehow this must call parent, otherwise plugins won't work
262
427
  @Override
263
428
  public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
@@ -267,7 +432,9 @@ public class WebContainerActivity extends BridgeActivity {
267
432
  //debug("shouldInterceptRequest", url);
268
433
 
269
434
 
270
- if(url.indexOf("//scan") > 0){
435
+
436
+ //support redirect from /scan
437
+ if(url.indexOf("/scan?") > 0 || url.indexOf("/qr?") > 0 || url.indexOf("//scan") > 0){
271
438
  return null;
272
439
  }
273
440
 
@@ -281,11 +448,10 @@ public class WebContainerActivity extends BridgeActivity {
281
448
  @Override
282
449
  public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
283
450
  debug("shouldOverrideUrlLoading", request.getUrl());
284
- //Uri url = request.getUrl();
451
+ Uri url = request.getUrl();
285
452
 
286
453
  //return super.shouldOverrideUrlLoading(view, request);
287
-
288
- return false;
454
+ return shouldOverrideUrl(view, url.toString());
289
455
  }
290
456
 
291
457
  @Override
@@ -295,7 +461,7 @@ public class WebContainerActivity extends BridgeActivity {
295
461
 
296
462
  //return super.shouldOverrideUrlLoading(view, url);
297
463
 
298
- return false;
464
+ return shouldOverrideUrl(view, url);
299
465
  }
300
466
 
301
467
  @Override
@@ -2,11 +2,16 @@ package com.aigens.sdk.plugins;
2
2
 
3
3
  import android.app.Activity;
4
4
  import android.content.Intent;
5
+ import android.content.pm.PackageInfo;
6
+ import android.content.pm.PackageManager;
7
+ import android.net.Uri;
8
+ import android.os.Parcelable;
5
9
 
6
10
  import androidx.activity.result.ActivityResultLauncher;
7
11
  import androidx.appcompat.app.AppCompatActivity;
8
12
 
9
13
  import com.aigens.sdk.WebContainerActivity;
14
+ import com.getcapacitor.JSArray;
10
15
  import com.getcapacitor.JSObject;
11
16
  import com.getcapacitor.Plugin;
12
17
  import com.getcapacitor.PluginCall;
@@ -18,29 +23,35 @@ import org.json.JSONException;
18
23
  import java.io.Serializable;
19
24
  import java.util.HashMap;
20
25
  import java.util.Iterator;
26
+ import java.util.List;
27
+ import java.util.Locale;
21
28
  import java.util.Map;
22
29
 
23
30
  @CapacitorPlugin(name = "Core")
24
31
  public class CorePlugin extends Plugin {
25
32
 
26
- public static boolean DEBUG = true;
33
+ public static boolean DEBUG = false;
27
34
 
28
35
  private static Map member;
36
+ private static boolean ENVIRONMENT_PRODUCTION = true;
37
+ private void debug(Object msg) {
29
38
 
30
- private void debug(Object msg){
31
-
32
- if(DEBUG){
39
+ if (DEBUG) {
33
40
  System.out.println(msg);
34
41
  }
35
42
 
36
43
  }
37
44
 
38
- public static void setMember(Map member){
45
+ public static void setMember(Map member) {
39
46
  CorePlugin.member = member;
40
47
  }
41
48
 
49
+ public static void setENVIRONMENT_PRODUCTION(boolean ENVIRONMENT_PRODUCTION) {
50
+ CorePlugin.ENVIRONMENT_PRODUCTION = ENVIRONMENT_PRODUCTION;
51
+ }
52
+
42
53
  @Override
43
- protected void handleOnStart(){
54
+ protected void handleOnStart() {
44
55
 
45
56
  }
46
57
 
@@ -65,6 +76,15 @@ public class CorePlugin extends Plugin {
65
76
  call.resolve(ret);
66
77
  }
67
78
 
79
+ @PluginMethod()
80
+ public void getIsProductionEnvironment(PluginCall call) {
81
+
82
+ debug("CorePlugin getIsProductionEnvironment:" + ENVIRONMENT_PRODUCTION);
83
+ JSObject ret = new JSObject();
84
+ ret.put("isPrd", ENVIRONMENT_PRODUCTION);
85
+ call.resolve(ret);
86
+ }
87
+
68
88
 
69
89
  // Launch
70
90
  //public void onButtonClick(View view) {
@@ -90,16 +110,18 @@ public class CorePlugin extends Plugin {
90
110
 
91
111
  String url = call.getString("url");
92
112
 
93
- if(url == null) return;
113
+ if (url == null) return;
94
114
 
95
115
  JSObject options = call.getObject("options", null);
96
116
  JSObject member = call.getObject("member", null);
117
+ boolean ENVIRONMENT_PRODUCTION = call.getBoolean("ENVIRONMENT_PRODUCTION", true);
118
+ CorePlugin.setENVIRONMENT_PRODUCTION(ENVIRONMENT_PRODUCTION);
97
119
 
98
120
  Map memMap = new HashMap();
99
121
 
100
- if(member != null){
122
+ if (member != null) {
101
123
  Iterator<String> iter = member.keys();
102
- while(iter.hasNext()){
124
+ while (iter.hasNext()) {
103
125
  String k = iter.next();
104
126
  try {
105
127
  Object v = member.get(k);
@@ -115,8 +137,20 @@ public class CorePlugin extends Plugin {
115
137
 
116
138
  Intent intent = new Intent(act, WebContainerActivity.class);
117
139
 
140
+ JSArray externalProtocols = call.getArray("externalProtocols");
141
+ try {
142
+ if (externalProtocols != null) {
143
+ List<String> es = externalProtocols.toList();
144
+ intent.putExtra("externalProtocols", (Serializable) es);
145
+ }
146
+ } catch (JSONException e) {
147
+ e.printStackTrace();
148
+ }
149
+
118
150
  intent.putExtra("url", url);
119
151
  intent.putExtra("member", (Serializable) memMap);
152
+ intent.putExtra("ENVIRONMENT_PRODUCTION", ENVIRONMENT_PRODUCTION);
153
+
120
154
 
121
155
  act.startActivity(intent);
122
156
 
@@ -125,4 +159,52 @@ public class CorePlugin extends Plugin {
125
159
  call.resolve(ret);
126
160
  }
127
161
 
162
+ @PluginMethod
163
+ public void openExternalUrl(PluginCall call) {
164
+ String url = call.getString("url");
165
+ if (url == null) {
166
+ call.reject("missing the url");
167
+ return;
168
+ }
169
+
170
+ final Intent intentExternal = new Intent();
171
+ intentExternal.setAction(Intent.ACTION_VIEW);
172
+ intentExternal.setData(Uri.parse(url));
173
+ Activity act = getActivity();
174
+ act.startActivity(intentExternal);
175
+ JSObject ret = new JSObject();
176
+ ret.put("open", true);
177
+ call.resolve(ret);
178
+ }
179
+
180
+ @PluginMethod
181
+ public void isInstalledApp(PluginCall call) {
182
+ String packname = call.getString("key");
183
+ Activity act = getActivity();
184
+ if (packname == null) {
185
+ call.reject("key is missing or is invaild key");
186
+ return;
187
+ }
188
+
189
+ try {
190
+ JSObject object = new JSObject();
191
+ final PackageManager packageManager = act.getPackageManager();// 获取packagemanager
192
+ List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);// 获取所有已安装程序的包信息
193
+ object.put("install", false);
194
+ if (pinfo != null && packname != null) {
195
+ packname = packname.toLowerCase(Locale.ENGLISH);
196
+ for (int i = 0; i < pinfo.size(); i++) {
197
+ String pn = pinfo.get(i).packageName.toLowerCase(Locale.ENGLISH);
198
+ if (pn.equals(packname)) {
199
+ object.put("install", true);
200
+ }
201
+ }
202
+ }
203
+ call.resolve(object);
204
+ } catch (Exception e) {
205
+ e.printStackTrace();
206
+ call.reject("key is missing or is invaild key");
207
+ }
208
+ }
209
+
128
210
  }
package/dist/docs.json CHANGED
@@ -84,6 +84,48 @@
84
84
  "docs": "",
85
85
  "complexTypes": [],
86
86
  "slug": "openbrowser"
87
+ },
88
+ {
89
+ "name": "isInstalledApp",
90
+ "signature": "(options: { key: string; }) => Promise<{ install: boolean; }>",
91
+ "parameters": [
92
+ {
93
+ "name": "options",
94
+ "docs": "",
95
+ "type": "{ key: string; }"
96
+ }
97
+ ],
98
+ "returns": "Promise<{ install: boolean; }>",
99
+ "tags": [],
100
+ "docs": "",
101
+ "complexTypes": [],
102
+ "slug": "isinstalledapp"
103
+ },
104
+ {
105
+ "name": "getIsProductionEnvironment",
106
+ "signature": "() => Promise<{ isPrd: boolean; }>",
107
+ "parameters": [],
108
+ "returns": "Promise<{ isPrd: boolean; }>",
109
+ "tags": [],
110
+ "docs": "",
111
+ "complexTypes": [],
112
+ "slug": "getisproductionenvironment"
113
+ },
114
+ {
115
+ "name": "openExternalUrl",
116
+ "signature": "(options: { url: string; }) => Promise<any>",
117
+ "parameters": [
118
+ {
119
+ "name": "options",
120
+ "docs": "",
121
+ "type": "{ url: string; }"
122
+ }
123
+ ],
124
+ "returns": "Promise<any>",
125
+ "tags": [],
126
+ "docs": "",
127
+ "complexTypes": [],
128
+ "slug": "openexternalurl"
87
129
  }
88
130
  ],
89
131
  "properties": []
@@ -4,4 +4,15 @@ export interface CorePlugin {
4
4
  finish(options: any): Promise<any>;
5
5
  getMember(options: any): Promise<any>;
6
6
  openBrowser(options: any): Promise<any>;
7
+ isInstalledApp(options: {
8
+ key: string;
9
+ }): Promise<{
10
+ install: boolean;
11
+ }>;
12
+ getIsProductionEnvironment(): Promise<{
13
+ isPrd: boolean;
14
+ }>;
15
+ openExternalUrl(options: {
16
+ url: string;
17
+ }): Promise<any>;
7
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export 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<any>;\n openBrowser(options: any): Promise<any>;\n\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export 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<any>;\n openBrowser(options: any): Promise<any>;\n isInstalledApp(options: { key: string }): Promise<{ install: boolean }>;\n getIsProductionEnvironment(): Promise<{ isPrd: boolean }>;\n openExternalUrl(options: { url: string }): Promise<any>;\n\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -6,4 +6,15 @@ export declare class CoreWeb extends WebPlugin implements CorePlugin {
6
6
  dismiss(options: any): Promise<any>;
7
7
  finish(options: any): Promise<any>;
8
8
  openBrowser(options: any): Promise<any>;
9
+ isInstalledApp(options: {
10
+ key: string;
11
+ }): Promise<{
12
+ install: boolean;
13
+ }>;
14
+ openExternalUrl(options: {
15
+ url: string;
16
+ }): Promise<any>;
17
+ getIsProductionEnvironment(): Promise<{
18
+ isPrd: boolean;
19
+ }>;
9
20
  }
package/dist/esm/web.js CHANGED
@@ -24,5 +24,18 @@ export class CoreWeb extends WebPlugin {
24
24
  console.log(options);
25
25
  throw new Error('Method not implemented.');
26
26
  }
27
+ async isInstalledApp(options) {
28
+ console.log(options);
29
+ throw new Error('Method not implemented.');
30
+ }
31
+ async openExternalUrl(options) {
32
+ window.open(options.url, "_blank");
33
+ return {
34
+ open: true
35
+ };
36
+ }
37
+ async getIsProductionEnvironment() {
38
+ return { isPrd: true };
39
+ }
27
40
  }
28
41
  //# sourceMappingURL=web.js.map
@@ -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,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,eAAG,CAAC,CAAC,MAAM,0CAAE,OAAO,0CAAE,MAAM,CAAC;QAC1C,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,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAY;QACrB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAY;QAC1B,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;CAGJ","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { CorePlugin } 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<any> {\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\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: any): Promise<any> {\n console.log(options);\n throw new Error('Method not implemented.');\n }\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,eAAG,CAAC,CAAC,MAAM,0CAAE,OAAO,0CAAE,MAAM,CAAC;QAC1C,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,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAY;QACrB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAY;QAC1B,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAwB;QACzC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAAwB;QAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACnC,OAAO;YACH,IAAI,EAAE,IAAI;SACb,CAAA;IACL,CAAC;IAED,KAAK,CAAC,0BAA0B;QAC5B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CAGJ","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { CorePlugin } 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<any> {\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\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: any): 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\n}\n"]}
@@ -33,6 +33,19 @@ class CoreWeb extends core.WebPlugin {
33
33
  console.log(options);
34
34
  throw new Error('Method not implemented.');
35
35
  }
36
+ async isInstalledApp(options) {
37
+ console.log(options);
38
+ throw new Error('Method not implemented.');
39
+ }
40
+ async openExternalUrl(options) {
41
+ window.open(options.url, "_blank");
42
+ return {
43
+ open: true
44
+ };
45
+ }
46
+ async getIsProductionEnvironment() {
47
+ return { isPrd: true };
48
+ }
36
49
  }
37
50
 
38
51
  var web = /*#__PURE__*/Object.freeze({