@identomat-inc/react-native-identomat 1.1.4 → 1.1.6
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/package.json
CHANGED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
package com.reactlibrary;
|
|
2
|
-
|
|
3
|
-
import android.app.Activity;
|
|
4
|
-
import android.content.Intent;
|
|
5
|
-
import android.content.IntentFilter;
|
|
6
|
-
import android.widget.Toast;
|
|
7
|
-
import android.util.Log;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// https://facebook.github.io/react-native/
|
|
11
|
-
import org.json.JSONException;
|
|
12
|
-
import org.json.JSONObject;
|
|
13
|
-
|
|
14
|
-
import com.facebook.react.ReactInstanceManager;
|
|
15
|
-
import com.facebook.react.ReactNativeHost;
|
|
16
|
-
import com.facebook.react.bridge.CatalystInstance;
|
|
17
|
-
import com.facebook.react.bridge.NativeModule;
|
|
18
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
19
|
-
import com.facebook.react.bridge.ReactContext;
|
|
20
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
21
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
22
|
-
import com.facebook.react.bridge.WritableNativeArray;
|
|
23
|
-
import com.identomat.IdentomatKotlinObjectBridge;
|
|
24
|
-
import com.identomat.IdentomatBridgeCallback;
|
|
25
|
-
|
|
26
|
-
import org.json.JSONObject;
|
|
27
|
-
|
|
28
|
-
import java.util.HashMap;
|
|
29
|
-
import java.util.Map;
|
|
30
|
-
import java.util.Iterator;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
public class BridgeModule extends ReactContextBaseJavaModule {
|
|
35
|
-
private static ReactApplicationContext reactContext;
|
|
36
|
-
static IdentomatKotlinObjectBridge identomatSDK = new IdentomatKotlinObjectBridge();
|
|
37
|
-
String mLanguage=null;
|
|
38
|
-
BridgeModule(ReactApplicationContext context){
|
|
39
|
-
super(context);
|
|
40
|
-
BridgeModule.reactContext = context;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@Override
|
|
44
|
-
public String getName(){
|
|
45
|
-
return "BridgeModule";
|
|
46
|
-
}
|
|
47
|
-
public void callback(){
|
|
48
|
-
|
|
49
|
-
if (reactContext != null) {
|
|
50
|
-
CatalystInstance catalystInstance = reactContext.getCatalystInstance();
|
|
51
|
-
// WritableNativeArray params = new WritableNativeArray();
|
|
52
|
-
// params.pushString("session");
|
|
53
|
-
identomatSDK.setCallback(new IdentomatBridgeCallback(){
|
|
54
|
-
@Override
|
|
55
|
-
public void invoke(){
|
|
56
|
-
catalystInstance.callFunction("JavaScriptVisibleToJava", "callback",new WritableNativeArray());
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
@ReactMethod
|
|
64
|
-
public void setColors(String colorsString){
|
|
65
|
-
try {
|
|
66
|
-
JSONObject colorsObj=new JSONObject(colorsString);
|
|
67
|
-
Iterator<String> keys = colorsObj.keys();
|
|
68
|
-
HashMap<String, String> colors = new HashMap<String, String>();
|
|
69
|
-
while(keys.hasNext()) {
|
|
70
|
-
String key = keys.next();
|
|
71
|
-
colors.put(key, colorsObj.getString(key));
|
|
72
|
-
}
|
|
73
|
-
identomatSDK.setColors(colors);
|
|
74
|
-
} catch (JSONException e) {
|
|
75
|
-
e.printStackTrace();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
@ReactMethod
|
|
80
|
-
public void setVariables(String variablesString){
|
|
81
|
-
try {
|
|
82
|
-
JSONObject variablesObj=new JSONObject(variablesString);
|
|
83
|
-
Iterator<String> keys = variablesObj.keys();
|
|
84
|
-
HashMap<String, Object> variables = new HashMap<String, Object>();
|
|
85
|
-
while(keys.hasNext()) {
|
|
86
|
-
String key = keys.next();
|
|
87
|
-
variables.put(key, variablesObj.getInt(key));
|
|
88
|
-
}
|
|
89
|
-
identomatSDK.setVariables(variables);
|
|
90
|
-
} catch (JSONException e) {
|
|
91
|
-
e.printStackTrace();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
@ReactMethod
|
|
95
|
-
public void setStrings(String strings){
|
|
96
|
-
try {
|
|
97
|
-
JSONObject allStringsObj=new JSONObject(strings);
|
|
98
|
-
Iterator<String> languageKeys = allStringsObj.keys();
|
|
99
|
-
HashMap<String, HashMap> fullStringsMap = new HashMap<String, HashMap>();
|
|
100
|
-
while(languageKeys.hasNext()) {
|
|
101
|
-
String languageKey = languageKeys.next();
|
|
102
|
-
JSONObject stringsObj=allStringsObj.getJSONObject(languageKey);
|
|
103
|
-
Iterator<String> keys = stringsObj.keys();
|
|
104
|
-
HashMap<String, String> stringsMap = new HashMap<String, String>();
|
|
105
|
-
while(keys.hasNext()) {
|
|
106
|
-
String key = keys.next();
|
|
107
|
-
stringsMap.put(key, stringsObj.getString(key));
|
|
108
|
-
}
|
|
109
|
-
fullStringsMap.put(languageKey, stringsMap);
|
|
110
|
-
}
|
|
111
|
-
identomatSDK.strings(fullStringsMap);
|
|
112
|
-
} catch (JSONException e) {
|
|
113
|
-
e.printStackTrace();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@ReactMethod
|
|
119
|
-
public void setBaseUrl(String baseUrl){
|
|
120
|
-
identomatSDK.setBaseUrl(baseUrl);
|
|
121
|
-
}
|
|
122
|
-
@ReactMethod
|
|
123
|
-
public void start(String mSessionKey){
|
|
124
|
-
callback();
|
|
125
|
-
identomatSDK.setUp(mSessionKey);
|
|
126
|
-
reactContext.startActivity(identomatSDK.getIdentomatActivity(reactContext));
|
|
127
|
-
}
|
|
128
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
package com.reactlibrary;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import com.facebook.react.ReactPackage;
|
|
5
|
-
import com.facebook.react.bridge.JavaScriptModule;
|
|
6
|
-
import com.facebook.react.bridge.NativeModule;
|
|
7
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
|
-
import com.facebook.react.uimanager.ViewManager;
|
|
9
|
-
|
|
10
|
-
import java.util.ArrayList;
|
|
11
|
-
import java.util.Collections;
|
|
12
|
-
import java.util.List;
|
|
13
|
-
|
|
14
|
-
import com.reactlibrary.BridgeModule;
|
|
15
|
-
|
|
16
|
-
public class BridgePackage implements ReactPackage{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@Override
|
|
21
|
-
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext){
|
|
22
|
-
List<NativeModule> modules = new ArrayList<>();
|
|
23
|
-
modules.add(new BridgeModule(reactContext));
|
|
24
|
-
return modules;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public List<Class<? extends JavaScriptModule>> createJSModules() {
|
|
28
|
-
return Collections.emptyList();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@Override
|
|
32
|
-
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext){
|
|
33
|
-
return Collections.emptyList();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|