@aigens/aigens-sdk-core 0.1.2 → 0.4.0
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/android/build.gradle +8 -7
- package/android/src/main/java/com/aigens/sdk/WebContainerActivity.java +2 -0
- package/android/src/main/java/com/aigens/sdk/plugins/CorePlugin.java +6 -0
- package/ios/Plugin/CorePlugin.swift +5 -0
- package/ios/Plugin/WebContainerViewController.swift +7 -0
- package/package.json +1 -1
package/android/build.gradle
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
ext {
|
2
|
-
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
|
6
|
+
|
6
7
|
}
|
7
8
|
|
8
9
|
buildscript {
|
@@ -11,7 +12,7 @@ buildscript {
|
|
11
12
|
jcenter()
|
12
13
|
}
|
13
14
|
dependencies {
|
14
|
-
classpath 'com.android.tools.build:gradle:
|
15
|
+
classpath 'com.android.tools.build:gradle:7.2.1'
|
15
16
|
}
|
16
17
|
}
|
17
18
|
|
@@ -36,8 +37,8 @@ android {
|
|
36
37
|
abortOnError false
|
37
38
|
}
|
38
39
|
compileOptions {
|
39
|
-
sourceCompatibility JavaVersion.
|
40
|
-
targetCompatibility JavaVersion.
|
40
|
+
sourceCompatibility JavaVersion.VERSION_11
|
41
|
+
targetCompatibility JavaVersion.VERSION_11
|
41
42
|
}
|
42
43
|
}
|
43
44
|
|
@@ -698,6 +698,8 @@ public class WebContainerActivity extends BridgeActivity {
|
|
698
698
|
} catch (android.content.ActivityNotFoundException e) {
|
699
699
|
Log.e(TAG, "Error sending sms " + url + ":" + e.toString());
|
700
700
|
}
|
701
|
+
}else if (CorePlugin.coreListener != null && CorePlugin.coreListener.isInterceptedUrl(url, view, activity)) {
|
702
|
+
return true;
|
701
703
|
}
|
702
704
|
return false;
|
703
705
|
}
|
@@ -11,6 +11,8 @@ import android.content.pm.PackageManager;
|
|
11
11
|
import android.net.Uri;
|
12
12
|
import android.os.Handler;
|
13
13
|
import android.webkit.WebSettings;
|
14
|
+
import android.webkit.WebView;
|
15
|
+
|
14
16
|
import androidx.core.app.NotificationManagerCompat;
|
15
17
|
|
16
18
|
import com.aigens.sdk.WebContainerActivity;
|
@@ -33,6 +35,10 @@ import java.util.Map;
|
|
33
35
|
@CapacitorPlugin(name = "Core")
|
34
36
|
public class CorePlugin extends Plugin {
|
35
37
|
|
38
|
+
public interface CoreListener {
|
39
|
+
public boolean isInterceptedUrl(String url, WebView view, Activity activity);
|
40
|
+
}
|
41
|
+
static public CoreListener coreListener;
|
36
42
|
public static final int REQUEST_CODE_OPEN_URL = 100001;
|
37
43
|
|
38
44
|
public static boolean DEBUG = false;
|
@@ -2,6 +2,9 @@ import Foundation
|
|
2
2
|
import Capacitor
|
3
3
|
import UIKit
|
4
4
|
|
5
|
+
@objc public protocol CoreDelegate: AnyObject {
|
6
|
+
func isInterceptedUrl(url: URL, webview: WKWebView) -> Bool
|
7
|
+
}
|
5
8
|
|
6
9
|
var aigensDebug = false;
|
7
10
|
/**
|
@@ -11,6 +14,8 @@ var aigensDebug = false;
|
|
11
14
|
@objc(CorePlugin)
|
12
15
|
public class CorePlugin: CAPPlugin {
|
13
16
|
|
17
|
+
static public var coreDelegate: CoreDelegate?
|
18
|
+
|
14
19
|
public static let shared = CorePlugin()
|
15
20
|
private let implementation = Core()
|
16
21
|
public static var member: Dictionary<String, Any>?
|
@@ -371,6 +371,13 @@ extension WebContainerViewController: WKNavigationDelegate {
|
|
371
371
|
decisionHandler(.allow)
|
372
372
|
return
|
373
373
|
}
|
374
|
+
|
375
|
+
if let del = CorePlugin.coreDelegate {
|
376
|
+
if del.isInterceptedUrl(url: navURL, webview: webView) {
|
377
|
+
decisionHandler(.cancel)
|
378
|
+
return
|
379
|
+
}
|
380
|
+
}
|
374
381
|
|
375
382
|
aigensprint("navURL--:\(navURL)")
|
376
383
|
if !universalLink.isEmpty && (navURL.absoluteString.starts(with: universalLink) || universalLink.contains("aigens=true") || universalLink.contains("aigens/true")) {
|