@aigens/aigens-sdk-core 5.0.2 → 5.0.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.
@@ -141,12 +141,20 @@ public class WebContainerActivity extends BridgeActivity {
141
141
 
142
142
 
143
143
 
144
- private String getRedirectUrl(Intent intent) {
144
+ private String getRedirectUrl(Intent intent, String url_) {
145
145
  try {
146
146
  // Intent intent = getIntent();
147
- Uri uri = intent.getData();
148
- if (uri != null) {
149
- String totalUrl = uri.toString();
147
+
148
+ Uri uri = null;
149
+ if (intent != null) uri = intent.getData();
150
+ if (uri != null || url_ != null) {
151
+
152
+ String totalUrl = null;
153
+ if (uri != null) {
154
+ totalUrl = uri.toString();
155
+ }else if (url_ != null && !url_.isEmpty()) {
156
+ totalUrl = url_;
157
+ }
150
158
  // Log.i("Jason totalUrl", totalUrl);
151
159
  String redirectUrl = null;
152
160
  String universalLink = null;
@@ -224,7 +232,7 @@ public class WebContainerActivity extends BridgeActivity {
224
232
  protected void onNewIntent(Intent intent) {
225
233
  super.onNewIntent(intent);
226
234
  // System.out.println("OPEN URL: onNewIntent" + intent.toString());
227
- String redirectUrl = getRedirectUrl(intent);
235
+ String redirectUrl = getRedirectUrl(intent, null);
228
236
  if (redirectUrl != null) {
229
237
  if (this.bridge != null && this.bridge.getWebView() != null) {
230
238
  initLayout(false, true, false);
@@ -264,7 +272,7 @@ public class WebContainerActivity extends BridgeActivity {
264
272
 
265
273
  Intent intent = getIntent();
266
274
 
267
- String redirectUrl = getRedirectUrl(intent);
275
+ String redirectUrl = getRedirectUrl(intent, null);
268
276
  if (redirectUrl != null && !redirectUrl.equals("") && WebContainerActivity.perviousIntent != null) {
269
277
  WebContainerActivity.perviousIntent.putExtra("url", redirectUrl);
270
278
  intent = WebContainerActivity.perviousIntent;
@@ -384,7 +392,8 @@ public class WebContainerActivity extends BridgeActivity {
384
392
  "com.aigens.sdk.alipay.AlipayPlugin",
385
393
  "com.aigens.sdk.wechat.WechatPlugin",
386
394
  "com.aigens.sdk.utils.AigensUtilsPlugin",
387
- "com.aigens.sdk.preferences.AigensPreferencesPlugin"
395
+ "com.aigens.sdk.preferences.AigensPreferencesPlugin",
396
+ "com.aigens.sdk.adyen.payments.AigensAdyenPaymentsPlugin"
388
397
  }, allPlugins);
389
398
  addExtraPlugins(intent.getStringArrayExtra("extraClasspaths"), allPlugins);
390
399
 
@@ -798,6 +807,15 @@ public class WebContainerActivity extends BridgeActivity {
798
807
  return false;
799
808
  }
800
809
 
810
+ private String decodeURIComponent(String encodedStr) {
811
+ String decodedStr = encodedStr;
812
+ try {
813
+ decodedStr = URLDecoder.decode(encodedStr, "UTF-8");
814
+ } catch (UnsupportedEncodingException e) {
815
+ decodedStr = encodedStr;
816
+ }
817
+ return decodedStr;
818
+ }
801
819
  public boolean shouldOverrideUrl(WebView view, String url) {
802
820
  if (url.startsWith(WebView.SCHEME_TEL)) {
803
821
  try {
@@ -851,6 +869,17 @@ public class WebContainerActivity extends BridgeActivity {
851
869
  }
852
870
  }else if (CorePlugin.coreListener != null && CorePlugin.coreListener.isInterceptedUrl(url, view, activity)) {
853
871
  return true;
872
+ }else {
873
+ String url_ = this.decodeURIComponent(url);
874
+ if (url_.contains("alwayscheck=true") || url_.contains("alwayscheck/true")) {
875
+ String redirectUrl = getRedirectUrl(null, url);
876
+ if (redirectUrl != null) {
877
+ initLayout(false, true, false);
878
+ view.loadUrl(redirectUrl);
879
+ return true;
880
+ }
881
+ }
882
+
854
883
  }
855
884
  return false;
856
885
  }
@@ -185,7 +185,7 @@ import Capacitor
185
185
  return false
186
186
  }
187
187
 
188
- if url.contains("aigens=true") || url.contains("aigens/true") {
188
+ if url.contains("aigens=true") || url.contains("aigens/true") || url.contains("aigensRedirect/") {
189
189
  return true;
190
190
  }
191
191
  if !universalLink.isEmpty && url.contains(universalLink) {
@@ -197,12 +197,25 @@ import Capacitor
197
197
  return false;
198
198
  }
199
199
 
200
- private func fromAppUrl(_ url_: URL) {
200
+ private func isParseUrl2(_ url: String) -> Bool {
201
+
202
+ if isExcludedUniversalLink(url) {
203
+ return false
204
+ }
205
+ let contain = url.contains("alwayscheck=true") || url.contains("alwayscheck/true");
206
+ return contain
207
+ }
208
+
209
+ private func fromAppUrl(_ url_: URL, _ alwayscheck: Bool = false) -> Bool {
201
210
  let url = decodeURIComponent(url_);
202
211
 
203
212
 
204
- if !isParseUrl(url.absoluteString) {
205
- return;
213
+ if !alwayscheck && !isParseUrl(url.absoluteString) {
214
+ return false;
215
+ }
216
+
217
+ if alwayscheck && !isParseUrl2(url.absoluteString) {
218
+ return false;
206
219
  }
207
220
 
208
221
  let rUrl = URLRequest(url: url)
@@ -229,12 +242,13 @@ import Capacitor
229
242
  webContainerView.showError(false)
230
243
  let rUrl = URLRequest(url: redirectUrl)
231
244
  webView?.load(rUrl)
232
- return;
245
+ return true;
233
246
  }
234
247
 
235
248
  webContainerView.showLoading(true)
236
249
  webContainerView.showError(false)
237
250
  webView?.load(rUrl)
251
+ return true;
238
252
  }
239
253
 
240
254
  @objc func handleUrlOpened(notification: NSNotification) {
@@ -492,6 +506,11 @@ extension WebContainerViewController: WKNavigationDelegate {
492
506
  return;
493
507
  }
494
508
 
509
+ if (fromAppUrl(navURL, true)) {
510
+ decisionHandler(.cancel)
511
+ return;
512
+ }
513
+
495
514
  // if isParseUrl(navURL.absoluteString) {
496
515
  //
497
516
  // if navURL.absoluteString.range(of: "redirect=") != nil, var redirect = navURL.absoluteString.components(separatedBy:"redirect=").last{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigens/aigens-sdk-core",
3
- "version": "5.0.2",
3
+ "version": "5.0.3",
4
4
  "description": "Aigens Order.Place Core Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",