@aigens/aigens-sdk-core 0.4.2 → 0.4.4

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.
@@ -102,6 +102,7 @@ public class WebContainerActivity extends BridgeActivity {
102
102
  Uri uri = intent.getData();
103
103
  if (uri != null) {
104
104
  String totalUrl = uri.toString();
105
+ // Log.i("Jason totalUrl", totalUrl);
105
106
  String redirectUrl = null;
106
107
  String universalLink = null;
107
108
  if (perviousIntent != null) {
@@ -113,19 +114,22 @@ public class WebContainerActivity extends BridgeActivity {
113
114
  universalLink = null;
114
115
  }
115
116
  }
116
- if (universalLink != null && (totalUrl.startsWith(universalLink) || universalLink.contains("aigens=true") || universalLink.contains("aigens/true")) && totalUrl.indexOf("redirect=") >= 0) {
117
+ // Log.i("Jason totalUrl", totalUrl+universalLink);
118
+ if (totalUrl != null && totalUrl.indexOf("redirect=") >= 0) {
117
119
  redirectUrl = totalUrl.split("redirect=")[1];
118
120
  }
119
- if (universalLink != null && (totalUrl.startsWith(universalLink) || universalLink.contains("aigens=true") || universalLink.contains("aigens/true")) && totalUrl.indexOf("aigensRedirect/") >= 0) {
121
+ if (totalUrl != null && totalUrl.indexOf("aigensRedirect/") >= 0) {
120
122
  redirectUrl = totalUrl.split("aigensRedirect/")[1];
121
123
  }
122
124
  // Log.i("getRedirectUrl", totalUrl);
123
125
  if (redirectUrl != null) {
124
126
  redirectUrl = this.decodeURIComponent(redirectUrl);
127
+ Log.i("Jason redirectUrl", redirectUrl);
125
128
  }
126
- if (!redirectUrl.startsWith("http://") && !redirectUrl.startsWith("https://")) {
129
+ if (redirectUrl != null && !redirectUrl.startsWith("http://") && !redirectUrl.startsWith("https://")) {
127
130
  redirectUrl = "https://" + redirectUrl;
128
131
  }
132
+
129
133
  return redirectUrl;
130
134
  } else {
131
135
  // Log.i("getRedirectUrl", "null");
@@ -17,6 +17,7 @@ import Capacitor
17
17
  private var isFirstError = true
18
18
  private var redirectLink = ""
19
19
  private var universalLink = ""
20
+ private var appScheme = ""
20
21
  var externalProtocols: [String] = [
21
22
  "octopus://", "alipay://", "alipays://", "alipayhk://", "https://play.google.com", "https://itunes.apple.com", "tel:", "mailto:", "itms-apps://itunes.apple.com", "https://apps.apple.com", "payme://", "weixin://", "hsbcpaymepay://", "mpay://"
22
23
  ]
@@ -131,6 +132,20 @@ import Capacitor
131
132
  NotificationCenter.default.addObserver(self, selector: #selector(self.handleUrlOpened(notification:)), name: Notification.Name.capacitorOpenURL, object: nil)
132
133
  }
133
134
 
135
+ private func isParseUrl(_ url: String) -> Bool {
136
+
137
+ if url.contains("aigens=true") || url.contains("aigens/true") {
138
+ return true;
139
+ }
140
+ if !universalLink.isEmpty && url.contains(universalLink) {
141
+ return true
142
+ }
143
+ if !appScheme.isEmpty && url.contains(appScheme) {
144
+ return true
145
+ }
146
+ return false;
147
+ }
148
+
134
149
  @objc func handleUrlOpened(notification: NSNotification) {
135
150
  guard let object = notification.object as? [String: Any?] else {
136
151
  return
@@ -143,7 +158,8 @@ import Capacitor
143
158
 
144
159
  url = decodeURIComponent(url);
145
160
 
146
- if universalLink.isEmpty || (!url.absoluteString.starts(with: universalLink) && !universalLink.contains("aigens=true") && !universalLink.contains("aigens/true")) {
161
+
162
+ if !isParseUrl(url.absoluteString) {
147
163
  return;
148
164
  }
149
165
 
@@ -175,8 +191,7 @@ import Capacitor
175
191
 
176
192
  url = decodeURIComponent(url);
177
193
 
178
-
179
- if universalLink.isEmpty || (!url.absoluteString.starts(with: universalLink) && !universalLink.contains("aigens=true") && !universalLink.contains("aigens/true")) {
194
+ if !isParseUrl(url.absoluteString) {
180
195
  return;
181
196
  }
182
197
 
@@ -286,6 +301,8 @@ import Capacitor
286
301
 
287
302
  let member = self.options?["member"] as? Dictionary<String, Any>
288
303
  self.universalLink = member?["universalLink"] as? String ?? ""
304
+ self.appScheme = member?["appScheme"] as? String ?? ""
305
+
289
306
 
290
307
  CorePlugin.member = member
291
308
  let deeplink = self.options?["deeplink"] as? Dictionary<String, Any>
@@ -380,7 +397,7 @@ extension WebContainerViewController: WKNavigationDelegate {
380
397
  }
381
398
 
382
399
  aigensprint("navURL--:\(navURL)")
383
- if !universalLink.isEmpty && (navURL.absoluteString.starts(with: universalLink) || universalLink.contains("aigens=true") || universalLink.contains("aigens/true")) {
400
+ if isParseUrl(navURL.absoluteString) {
384
401
 
385
402
  if navURL.absoluteString.range(of: "redirect=") != nil, var redirect = navURL.absoluteString.components(separatedBy:"redirect=").last{
386
403
  if !redirect.starts(with: "http://") && !redirect.starts(with: "https://") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigens/aigens-sdk-core",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Aigens Order.Place Core Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",