solution-plugin 1.4.1 → 1.4.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/android/build.gradle +1 -7
- package/android/src/main/java/com/solutionplugin/SolutionPluginModule.java +109 -0
- package/android/src/main/java/com/solutionplugin/SolutionPluginPackage.java +27 -0
- package/ios/SolutionPlugin.swift +1 -0
- package/lib/module/NativeSolutionPlugin.ts +1 -0
- package/lib/typescript/src/NativeSolutionPlugin.d.ts +1 -0
- package/lib/typescript/src/NativeSolutionPlugin.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeSolutionPlugin.ts +1 -0
- package/android/src/main/java/com/solutionplugin/SolutionPluginModule.kt +0 -83
- package/android/src/main/java/com/solutionplugin/SolutionPluginPackage.kt +0 -33
package/android/build.gradle
CHANGED
|
@@ -10,14 +10,11 @@ buildscript {
|
|
|
10
10
|
|
|
11
11
|
dependencies {
|
|
12
12
|
classpath "com.android.tools.build:gradle:8.7.2"
|
|
13
|
-
// noinspection DifferentKotlinGradleVersion
|
|
14
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
|
|
19
17
|
apply plugin: "com.android.library"
|
|
20
|
-
apply plugin: "kotlin-android"
|
|
21
18
|
|
|
22
19
|
apply plugin: "com.facebook.react"
|
|
23
20
|
|
|
@@ -56,12 +53,9 @@ repositories {
|
|
|
56
53
|
google()
|
|
57
54
|
}
|
|
58
55
|
|
|
59
|
-
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
60
|
-
|
|
61
56
|
dependencies {
|
|
62
57
|
implementation "com.facebook.react:react-android"
|
|
63
|
-
implementation "
|
|
64
|
-
implementation "ai.advance.mobile-sdk.android:solution-lib:1.4.0"
|
|
58
|
+
implementation "ai.advance.mobile-sdk.android:solution-lib:1.4.3"
|
|
65
59
|
}
|
|
66
60
|
|
|
67
61
|
react {
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
package com.solutionplugin;
|
|
2
|
+
|
|
3
|
+
import android.app.Application;
|
|
4
|
+
import android.util.Log;
|
|
5
|
+
import androidx.annotation.NonNull;
|
|
6
|
+
|
|
7
|
+
import com.facebook.react.bridge.Arguments;
|
|
8
|
+
import com.facebook.react.bridge.Promise;
|
|
9
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
11
|
+
import com.facebook.react.bridge.WritableMap;
|
|
12
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
13
|
+
|
|
14
|
+
import java.util.Map;
|
|
15
|
+
|
|
16
|
+
import aai.liveness.sdk.Colors;
|
|
17
|
+
import aai.liveness.sdk.GuardianSolutionSDK;
|
|
18
|
+
import aai.liveness.sdk.ThemeType;
|
|
19
|
+
import aai.telemetry.enums.PluginPlatform;
|
|
20
|
+
|
|
21
|
+
@ReactModule(name = SolutionPluginModule.NAME)
|
|
22
|
+
public class SolutionPluginModule extends NativeSolutionPluginSpec {
|
|
23
|
+
public static final String NAME = "SolutionPlugin";
|
|
24
|
+
|
|
25
|
+
private Application mApplication;
|
|
26
|
+
|
|
27
|
+
public SolutionPluginModule(ReactApplicationContext reactContext) {
|
|
28
|
+
super(reactContext);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private Application getApplication() {
|
|
32
|
+
if (mApplication == null) {
|
|
33
|
+
mApplication = (Application) getReactApplicationContext().getApplicationContext();
|
|
34
|
+
}
|
|
35
|
+
return mApplication;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@Override
|
|
39
|
+
@NonNull
|
|
40
|
+
public String getName() {
|
|
41
|
+
return NAME;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@ReactMethod
|
|
45
|
+
@Override
|
|
46
|
+
public void setThemeARGBColor(String light, String dark, Promise promise) {
|
|
47
|
+
try {
|
|
48
|
+
GuardianSolutionSDK.setThemeColors(
|
|
49
|
+
new Colors.Builder().setPrimaryColor(light).build(),
|
|
50
|
+
new Colors.Builder().setPrimaryColor(dark).build()
|
|
51
|
+
);
|
|
52
|
+
promise.resolve(true);
|
|
53
|
+
} catch (Exception e) {
|
|
54
|
+
promise.reject("SET_THEME_COLOR_ERROR", e.getMessage(), e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@ReactMethod
|
|
59
|
+
@Override
|
|
60
|
+
public void setDarkThemeType(String type, Promise promise) {
|
|
61
|
+
try {
|
|
62
|
+
ThemeType themeType = (type != null) ? ThemeType.valueOf(type) : ThemeType.LIGHT;
|
|
63
|
+
GuardianSolutionSDK.setThemeType(themeType);
|
|
64
|
+
promise.resolve(null);
|
|
65
|
+
} catch (Exception e) {
|
|
66
|
+
promise.reject("SET_DARK_THEME_TYPE_ERROR", e.getMessage(), e);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@ReactMethod
|
|
71
|
+
@Override
|
|
72
|
+
public void getSDKVersion(Promise promise) {
|
|
73
|
+
Log.d("SolutionPluginModule", "getVersion");
|
|
74
|
+
try {
|
|
75
|
+
String version = GuardianSolutionSDK.getSDKVersion();
|
|
76
|
+
promise.resolve(version);
|
|
77
|
+
} catch (Exception e) {
|
|
78
|
+
promise.reject("GET_VERSION_ERROR", e.getMessage(), e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@ReactMethod
|
|
83
|
+
@Override
|
|
84
|
+
public void start(String url, Promise promise) {
|
|
85
|
+
GuardianSolutionSDK.init(getApplication());
|
|
86
|
+
GuardianSolutionSDK.setPluginPlatform(PluginPlatform.ReactNative);
|
|
87
|
+
GuardianSolutionSDK.start(getCurrentActivity(), url, result -> {
|
|
88
|
+
WritableMap map = Arguments.createMap();
|
|
89
|
+
map.putString("code", result.getCode());
|
|
90
|
+
map.putString("signatureId", result.getSignatureId());
|
|
91
|
+
map.putString("finishRedirectUrl", result.getFinishRedirectUrl());
|
|
92
|
+
map.putBoolean("terminated", result.isTerminated());
|
|
93
|
+
Map<String, Object> extraInfo = result.getExtraInfo();
|
|
94
|
+
if (extraInfo != null) {
|
|
95
|
+
WritableMap extraInfoMap = Arguments.createMap();
|
|
96
|
+
for (String key : extraInfo.keySet()) {
|
|
97
|
+
Object value = extraInfo.get(key);
|
|
98
|
+
if (value instanceof String) {
|
|
99
|
+
extraInfoMap.putString(key, (String) value);
|
|
100
|
+
} else {
|
|
101
|
+
extraInfoMap.putString(key, "");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
map.putMap("extraInfo", extraInfoMap);
|
|
105
|
+
}
|
|
106
|
+
promise.resolve(map);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
package com.solutionplugin;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import com.facebook.react.ReactPackage;
|
|
5
|
+
import com.facebook.react.bridge.NativeModule;
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
+
import com.facebook.react.uimanager.ViewManager;
|
|
8
|
+
|
|
9
|
+
import java.util.ArrayList;
|
|
10
|
+
import java.util.Collections;
|
|
11
|
+
import java.util.List;
|
|
12
|
+
|
|
13
|
+
public class SolutionPluginPackage implements ReactPackage {
|
|
14
|
+
@NonNull
|
|
15
|
+
@Override
|
|
16
|
+
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
|
17
|
+
List<NativeModule> modules = new ArrayList<>();
|
|
18
|
+
modules.add(new SolutionPluginModule(reactContext));
|
|
19
|
+
return modules;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@NonNull
|
|
23
|
+
@Override
|
|
24
|
+
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
|
25
|
+
return Collections.emptyList();
|
|
26
|
+
}
|
|
27
|
+
}
|
package/ios/SolutionPlugin.swift
CHANGED
|
@@ -37,6 +37,7 @@ class SolutionPlugin: NSObject {
|
|
|
37
37
|
resultDict["finishRedirectUrl"] = result.finishRedirectUrl
|
|
38
38
|
// Use compactMapValues to remove nil values
|
|
39
39
|
resultDict["extraInfo"] = result.extraInfo
|
|
40
|
+
resultDict["terminated"] = result.terminated
|
|
40
41
|
resolver(resultDict)
|
|
41
42
|
}))
|
|
42
43
|
SolutionCenter.shared.pluginPlatform = "react-native"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeSolutionPlugin.d.ts","sourceRoot":"","sources":["../../../src/NativeSolutionPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,aAAa,kBAAkB;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACvC;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACxC;;AAED,wBAAwE"}
|
|
1
|
+
{"version":3,"file":"NativeSolutionPlugin.d.ts","sourceRoot":"","sources":["../../../src/NativeSolutionPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,aAAa,kBAAkB;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACvC;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACxC;;AAED,wBAAwE"}
|
package/package.json
CHANGED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
package com.solutionplugin
|
|
2
|
-
|
|
3
|
-
import aai.liveness.sdk.Colors
|
|
4
|
-
import aai.liveness.sdk.GuardianSolutionSDK
|
|
5
|
-
import aai.liveness.sdk.ThemeType
|
|
6
|
-
import aai.telemetry.enums.PluginPlatform
|
|
7
|
-
import android.app.Application
|
|
8
|
-
import android.util.Log
|
|
9
|
-
import com.facebook.react.bridge.Arguments
|
|
10
|
-
import com.facebook.react.bridge.Promise
|
|
11
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
12
|
-
import com.facebook.react.bridge.ReactMethod
|
|
13
|
-
import com.facebook.react.module.annotations.ReactModule
|
|
14
|
-
|
|
15
|
-
@ReactModule(name = SolutionPluginModule.NAME)
|
|
16
|
-
class SolutionPluginModule(private val reactContext: ReactApplicationContext) :
|
|
17
|
-
NativeSolutionPluginSpec(reactContext) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
private val application: Application by lazy { reactContext.applicationContext as Application }
|
|
21
|
-
|
|
22
|
-
override fun getName() = NAME
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@ReactMethod
|
|
26
|
-
override fun setThemeARGBColor(light: String, dark: String, promise: Promise) {
|
|
27
|
-
try {
|
|
28
|
-
GuardianSolutionSDK.setThemeColors(
|
|
29
|
-
Colors.Builder().setPrimaryColor(light).build(),
|
|
30
|
-
Colors.Builder().setPrimaryColor(dark).build()
|
|
31
|
-
)
|
|
32
|
-
promise.resolve(true)
|
|
33
|
-
} catch (e: Exception) {
|
|
34
|
-
promise.reject("SET_THEME_COLOR_ERROR", e.message, e)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@ReactMethod
|
|
39
|
-
override fun setDarkThemeType(type: String?, promise: Promise) {
|
|
40
|
-
try {
|
|
41
|
-
val themeType = ThemeType.valueOf(type ?: ThemeType.LIGHT.name)
|
|
42
|
-
GuardianSolutionSDK.setThemeType(themeType)
|
|
43
|
-
} catch (e: Exception) {
|
|
44
|
-
promise.reject("SET_DARK_THEME_TYPE_ERROR", e.message, e)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@ReactMethod
|
|
49
|
-
override fun getSDKVersion(promise: Promise) {
|
|
50
|
-
Log.d("SolutionPluginModule", "getVersion")
|
|
51
|
-
try {
|
|
52
|
-
val version = GuardianSolutionSDK.getSDKVersion()
|
|
53
|
-
promise.resolve(version)
|
|
54
|
-
} catch (e: Exception) {
|
|
55
|
-
promise.reject("GET_VERSION_ERROR", e.message, e)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@ReactMethod
|
|
60
|
-
override fun start(url: String?, promise: Promise) {
|
|
61
|
-
GuardianSolutionSDK.init(application)
|
|
62
|
-
GuardianSolutionSDK.setPluginPlatform(PluginPlatform.ReactNative)
|
|
63
|
-
GuardianSolutionSDK.start(getCurrentActivity(), url) { result ->
|
|
64
|
-
promise.resolve(
|
|
65
|
-
Arguments.createMap().apply {
|
|
66
|
-
putString("code", result.code)
|
|
67
|
-
putString("signatureId", result.signatureId)
|
|
68
|
-
putString("finishRedirectUrl", result.finishRedirectUrl)
|
|
69
|
-
if (result.extraInfo != null) {
|
|
70
|
-
val extraInfoMap = Arguments.createMap()
|
|
71
|
-
for ((key, value) in result.extraInfo) {
|
|
72
|
-
extraInfoMap.putString(key, value as? String ?: "")
|
|
73
|
-
}
|
|
74
|
-
putMap("extraInfo", extraInfoMap)
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
companion object {
|
|
81
|
-
const val NAME = "SolutionPlugin"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
package com.solutionplugin
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.BaseReactPackage
|
|
4
|
-
import com.facebook.react.bridge.NativeModule
|
|
5
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
-
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
-
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
-
import java.util.HashMap
|
|
9
|
-
|
|
10
|
-
class SolutionPluginPackage : BaseReactPackage() {
|
|
11
|
-
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
12
|
-
return if (name == SolutionPluginModule.NAME) {
|
|
13
|
-
SolutionPluginModule(reactContext)
|
|
14
|
-
} else {
|
|
15
|
-
null
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
20
|
-
return ReactModuleInfoProvider {
|
|
21
|
-
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
22
|
-
moduleInfos[SolutionPluginModule.NAME] = ReactModuleInfo(
|
|
23
|
-
SolutionPluginModule.NAME,
|
|
24
|
-
SolutionPluginModule.NAME,
|
|
25
|
-
false, // canOverrideExistingModule
|
|
26
|
-
false, // needsEagerInit
|
|
27
|
-
false, // isCxxModule
|
|
28
|
-
true // isTurboModule
|
|
29
|
-
)
|
|
30
|
-
moduleInfos
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|