solution-plugin 1.4.0 → 1.4.3-alpha01
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 +45 -47
- 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.m +2 -2
- package/ios/SolutionPlugin.swift +4 -3
- package/lib/module/NativeSolutionPlugin.ts +1 -0
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeSolutionPlugin.d.ts +1 -0
- package/lib/typescript/src/NativeSolutionPlugin.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/NativeSolutionPlugin.ts +1 -0
- package/src/index.tsx +2 -2
- 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
|
@@ -1,67 +1,65 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['SolutionPlugin_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
13
|
+
}
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
apply plugin: 'com.android.library'
|
|
16
|
-
apply plugin: 'kotlin-android'
|
|
17
|
-
apply plugin: 'com.facebook.react'
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
apply plugin: "com.android.library"
|
|
18
|
+
|
|
19
|
+
apply plugin: "com.facebook.react"
|
|
20
|
+
|
|
21
|
+
def getExtOrIntegerDefault(name) {
|
|
22
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["SolutionPlugin_" + name]).toInteger()
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
android {
|
|
24
|
-
|
|
25
|
-
namespace "com.solutionplugin"
|
|
26
|
+
namespace "com.solutionplugin"
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
minSdkVersion 21
|
|
29
|
-
targetSdkVersion safeExtGet('targetSdkVersion', 33)
|
|
30
|
-
}
|
|
28
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
30
|
+
defaultConfig {
|
|
31
|
+
minSdkVersion 21
|
|
32
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
33
|
+
}
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
buildTypes {
|
|
36
|
+
release {
|
|
37
|
+
minifyEnabled false
|
|
40
38
|
}
|
|
39
|
+
}
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
41
|
+
lintOptions {
|
|
42
|
+
disable "GradleCompatible"
|
|
43
|
+
}
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
react {
|
|
53
|
-
jsRootDir = file("../src/")
|
|
54
|
-
libraryName = "SolutionPlugin"
|
|
55
|
-
codegenJavaPackageName = "com.solutionplugin"
|
|
45
|
+
compileOptions {
|
|
46
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
47
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
48
|
+
}
|
|
56
49
|
}
|
|
57
50
|
|
|
58
51
|
repositories {
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
mavenCentral()
|
|
53
|
+
google()
|
|
61
54
|
}
|
|
62
55
|
|
|
63
56
|
dependencies {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
implementation "com.facebook.react:react-android"
|
|
58
|
+
implementation "ai.advance.mobile-sdk.android:solution-lib:1.4.3"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
react {
|
|
62
|
+
jsRootDir = file("../src/")
|
|
63
|
+
libraryName = "SolutionPlugin"
|
|
64
|
+
codegenJavaPackageName = "com.solutionplugin"
|
|
67
65
|
}
|
|
@@ -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.m
CHANGED
|
@@ -15,7 +15,7 @@ RCT_EXTERN_METHOD(start:(nonnull NSString *)url
|
|
|
15
15
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
16
16
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
17
17
|
|
|
18
|
-
RCT_EXTERN_METHOD(
|
|
18
|
+
RCT_EXTERN_METHOD(getSDKVersion:(RCTPromiseResolveBlock)resolve
|
|
19
19
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
20
20
|
|
|
21
|
-
@end
|
|
21
|
+
@end
|
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"
|
|
@@ -44,14 +45,14 @@ class SolutionPlugin: NSObject {
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
// MARK: -
|
|
48
|
+
// MARK: - Version Methods
|
|
48
49
|
|
|
49
50
|
@objc
|
|
50
|
-
func
|
|
51
|
-
|
|
51
|
+
func getSDKVersion(_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
|
|
52
52
|
resolver(SolutionCenter.shared.sdkVersion)
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
|
|
55
56
|
// MARK: - Static Methods
|
|
56
57
|
|
|
57
58
|
@objc
|
package/lib/module/index.js
CHANGED
|
@@ -11,12 +11,12 @@ export function setThemeARGBColor(light, dark) {
|
|
|
11
11
|
export function setDarkThemeType(type) {
|
|
12
12
|
return NativeSolutionPlugin?.setDarkThemeType(type) ?? Promise.reject(new Error('SolutionPlugin not available'));
|
|
13
13
|
}
|
|
14
|
-
export function
|
|
14
|
+
export function getSDKVersion() {
|
|
15
15
|
return NativeSolutionPlugin?.getSDKVersion() ?? Promise.reject(new Error('SolutionPlugin not available'));
|
|
16
16
|
}
|
|
17
17
|
export function getPluginVersion() {
|
|
18
18
|
// This is a hardcoded value. Remember to update it manually on release.
|
|
19
|
-
return Promise.resolve("1.4.0.
|
|
19
|
+
return Promise.resolve("1.4.0.local");
|
|
20
20
|
}
|
|
21
21
|
export function start(url) {
|
|
22
22
|
return NativeSolutionPlugin?.start(url) ?? Promise.reject(new Error('SolutionPlugin not available'));
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeSolutionPlugin","setThemeARGBColor","light","dark","Promise","reject","Error","setDarkThemeType","type","
|
|
1
|
+
{"version":3,"names":["NativeSolutionPlugin","setThemeARGBColor","light","dark","Promise","reject","Error","setDarkThemeType","type","getSDKVersion","getPluginVersion","resolve","start","url"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA,cAAc,wBAAwB;AACtC;;AAGA,OAAOA,oBAAoB,MAAM,wBAAwB;AAEzD,OAAO,SAASC,iBAAiBA,CAACC,KAAa,EAAEC,IAAY,EAAiB;EAC5E,OAAOH,oBAAoB,EAAEC,iBAAiB,CAACC,KAAK,EAAEC,IAAI,CAAC,IAAIC,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAC1H;AAEA,OAAO,SAASC,gBAAgBA,CAACC,IAAe,EAAiB;EAC/D,OAAOR,oBAAoB,EAAEO,gBAAgB,CAACC,IAAI,CAAC,IAAIJ,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAClH;AAEA,OAAO,SAASG,aAAaA,CAAA,EAAoB;EAC/C,OAAOT,oBAAoB,EAAES,aAAa,CAAC,CAAC,IAAIL,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAC3G;AAEA,OAAO,SAASI,gBAAgBA,CAAA,EAAoB;EAClD;EACA,OAAON,OAAO,CAACO,OAAO,CAAC,aAAa,CAAC;AACvC;AAEA,OAAO,SAASC,KAAKA,CAACC,GAAW,EAAsB;EACrD,OAAOb,oBAAoB,EAAEY,KAAK,CAACC,GAAG,CAAC,IAAIT,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,8BAA8B,CAAC,CAAC;AACtG","ignoreList":[]}
|
|
@@ -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"}
|
|
@@ -3,7 +3,7 @@ import type { EndResult } from './NativeSolutionPlugin';
|
|
|
3
3
|
import { ThemeType } from './NativeSolutionPlugin';
|
|
4
4
|
export declare function setThemeARGBColor(light: string, dark: string): Promise<void>;
|
|
5
5
|
export declare function setDarkThemeType(type: ThemeType): Promise<void>;
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function getSDKVersion(): Promise<string>;
|
|
7
7
|
export declare function getPluginVersion(): Promise<string>;
|
|
8
8
|
export declare function start(url: string): Promise<EndResult>;
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;AAED,wBAAgB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAE/C;AAED,wBAAgB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAGlD;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAErD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solution-plugin",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3-alpha01",
|
|
4
4
|
"description": "A plugin to add two numbers using native code.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"source": "src/index.tsx",
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"@eslint/eslintrc": "^3.3.0",
|
|
64
64
|
"@eslint/js": "^9.22.0",
|
|
65
65
|
"@evilmartians/lefthook": "^1.5.0",
|
|
66
|
-
"@react-native-community/cli": "15.0.0-alpha.2",
|
|
67
66
|
"@react-native/babel-preset": "0.79.2",
|
|
68
67
|
"@react-native/eslint-config": "^0.78.0",
|
|
69
68
|
"@release-it/conventional-changelog": "^9.0.2",
|
|
@@ -90,7 +89,7 @@
|
|
|
90
89
|
"workspaces": [
|
|
91
90
|
"example"
|
|
92
91
|
],
|
|
93
|
-
"packageManager": "yarn@
|
|
92
|
+
"packageManager": "yarn@1.22.22",
|
|
94
93
|
"jest": {
|
|
95
94
|
"preset": "react-native",
|
|
96
95
|
"modulePathIgnorePatterns": [
|
package/src/index.tsx
CHANGED
|
@@ -13,13 +13,13 @@ export function setDarkThemeType(type: ThemeType): Promise<void> {
|
|
|
13
13
|
return NativeSolutionPlugin?.setDarkThemeType(type) ?? Promise.reject(new Error('SolutionPlugin not available'));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export function
|
|
16
|
+
export function getSDKVersion(): Promise<string> {
|
|
17
17
|
return NativeSolutionPlugin?.getSDKVersion() ?? Promise.reject(new Error('SolutionPlugin not available'));
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export function getPluginVersion(): Promise<string> {
|
|
21
21
|
// This is a hardcoded value. Remember to update it manually on release.
|
|
22
|
-
return Promise.resolve("1.4.0.
|
|
22
|
+
return Promise.resolve("1.4.0.local");
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export function start(url: string): Promise<EndResult> {
|
|
@@ -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
|
-
}
|