@regulaforensics/react-native-document-reader-api 6.8.0 → 6.9.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/RNDocumentReaderApi.podspec +1 -1
- package/android/build.gradle +18 -1
- package/android/src/main/java/com/regula/documentreader/BluetoothUtil.kt +6 -6
- package/android/src/main/java/com/regula/documentreader/Helpers.java +117 -3
- package/android/src/main/java/com/regula/documentreader/JSONConstructor.java +182 -261
- package/android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.java +142 -125
- package/android/src/main/java/com/regula/documentreader/RegulaConfig.java +114 -26
- package/example/.bundle/config +2 -0
- package/example/.eslintrc.js +1 -1
- package/example/.prettierrc.js +2 -2
- package/example/.watchmanconfig +1 -1
- package/example/App.tsx +358 -0
- package/example/Gemfile +6 -0
- package/example/Gemfile.lock +98 -0
- package/example/__tests__/{App-test.js → App.test.tsx} +3 -0
- package/example/android/app/build.gradle +77 -59
- package/example/android/app/src/debug/AndroidManifest.xml +1 -1
- package/example/android/app/src/debug/java/com/regula/dr/fullrfid/ReactNativeFlipper.java +7 -4
- package/example/android/app/src/main/AndroidManifest.xml +4 -9
- package/example/android/app/src/main/java/com/regula/dr/fullrfid/MainActivity.java +17 -0
- package/example/android/app/src/main/java/com/regula/dr/fullrfid/MainApplication.java +17 -36
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
- package/example/android/app/src/main/res/values/styles.xml +2 -2
- package/example/android/app/src/release/java/com/regula/dr/fullrfid/ReactNativeFlipper.java +20 -0
- package/example/android/build.gradle +7 -18
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +2 -1
- package/example/android/gradle.properties +42 -2
- package/example/android/gradlew +164 -105
- package/example/android/gradlew.bat +92 -89
- package/example/android/settings.gradle +2 -1
- package/example/app.json +1 -1
- package/example/ios/.xcode.env +11 -0
- package/example/ios/DocumentReader/AppDelegate.h +2 -4
- package/example/ios/DocumentReader/AppDelegate.mm +26 -0
- package/example/ios/DocumentReader/DocumentReader.entitlements +0 -1
- package/example/ios/DocumentReader/Images.xcassets/AppIcon.appiconset/Contents.json +30 -15
- package/example/ios/DocumentReader/Info.plist +8 -4
- package/example/ios/DocumentReader/main.m +2 -1
- package/example/ios/DocumentReader.xcodeproj/project.pbxproj +134 -96
- package/example/ios/DocumentReaderTests/DocumentReaderTests.m +14 -13
- package/example/ios/Podfile +45 -15
- package/example/jest.config.js +3 -0
- package/example/metro.config.js +18 -15
- package/example/package-lock.json +13091 -0
- package/example/package.json +32 -22
- package/example/tsconfig.json +3 -0
- package/index.d.ts +426 -3015
- package/index.js +253 -2954
- package/ios/RGLWJSONConstructor.h +8 -6
- package/ios/RGLWJSONConstructor.m +109 -92
- package/ios/RGLWRegulaConfig.h +2 -1
- package/ios/RGLWRegulaConfig.m +139 -41
- package/ios/RNRegulaDocumentReader.m +55 -42
- package/package.json +1 -1
- package/example/.buckconfig +0 -6
- package/example/.editorconfig +0 -3
- package/example/.flowconfig +0 -65
- package/example/.gitattributes +0 -3
- package/example/App.js +0 -399
- package/example/android/app/BUCK +0 -55
- package/example/android/app/_BUCK +0 -55
- package/example/android/app/build_defs.bzl +0 -19
- package/example/android/app/src/main/assets/index.android.bundle +0 -636
- package/example/android/app/src/main/res/drawable-mdpi/images_id.png +0 -0
- package/example/android/app/src/main/res/drawable-mdpi/images_portrait.png +0 -0
- package/example/android/app/src/main/res/drawable-mdpi/node_modules_reactnativecheckbox_img_ic_check_box.png +0 -0
- package/example/android/app/src/main/res/drawable-mdpi/node_modules_reactnativecheckbox_img_ic_check_box_outline_blank.png +0 -0
- package/example/android/app/src/main/res/drawable-mdpi/node_modules_reactnativecheckbox_img_ic_indeterminate_check_box.png +0 -0
- package/example/android/app/src/main/res/drawable-xhdpi/node_modules_reactnativecheckbox_img_ic_check_box.png +0 -0
- package/example/android/app/src/main/res/drawable-xhdpi/node_modules_reactnativecheckbox_img_ic_check_box_outline_blank.png +0 -0
- package/example/android/app/src/main/res/drawable-xxhdpi/node_modules_reactnativecheckbox_img_ic_check_box.png +0 -0
- package/example/android/app/src/main/res/drawable-xxhdpi/node_modules_reactnativecheckbox_img_ic_check_box_outline_blank.png +0 -0
- package/example/ios/DocumentReader/AppDelegate.m +0 -62
- package/example/ios/DocumentReader/Base.lproj/LaunchScreen.xib +0 -42
package/android/build.gradle
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext {
|
|
3
|
+
kotlinVersion = '1.8.22'
|
|
4
|
+
gradleVersion = '8.0.2'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
repositories {
|
|
8
|
+
google()
|
|
9
|
+
mavenCentral()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
dependencies {
|
|
13
|
+
classpath "com.android.tools.build:gradle:${project.ext.gradleVersion}"
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${project.ext.kotlinVersion}"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
1
18
|
apply plugin: 'com.android.library'
|
|
2
19
|
apply plugin: 'kotlin-android'
|
|
3
20
|
|
|
@@ -24,7 +41,7 @@ dependencies {
|
|
|
24
41
|
//noinspection GradleDynamicVersion
|
|
25
42
|
implementation 'com.facebook.react:react-native:+'
|
|
26
43
|
//noinspection GradleDependency
|
|
27
|
-
implementation('com.regula.documentreader:api:6.
|
|
44
|
+
implementation('com.regula.documentreader:api:6.9.9346') {
|
|
28
45
|
transitive = true
|
|
29
46
|
}
|
|
30
47
|
}
|
|
@@ -69,8 +69,8 @@ class BluetoothUtil {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
private fun deniedBluetoothPermission(
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
activity: Activity,
|
|
73
|
+
permission: String
|
|
74
74
|
): Array<String> {
|
|
75
75
|
if (checkSelfPermission(activity, permission) != PERMISSION_GRANTED)
|
|
76
76
|
return arrayOf(permission)
|
|
@@ -78,10 +78,10 @@ class BluetoothUtil {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
fun startBluetoothService(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
activity: Activity,
|
|
82
|
+
onConnected: (Boolean) -> Unit,
|
|
83
|
+
onDisconnected: () -> Unit,
|
|
84
|
+
onReady: () -> Unit
|
|
85
85
|
) {
|
|
86
86
|
val bleIntent = Intent(activity, RegulaBleService::class.java)
|
|
87
87
|
activity.startService(bleIntent)
|
|
@@ -19,11 +19,114 @@ import org.json.JSONObject;
|
|
|
19
19
|
|
|
20
20
|
import java.io.ByteArrayOutputStream;
|
|
21
21
|
import java.util.ArrayList;
|
|
22
|
+
import java.util.HashMap;
|
|
23
|
+
import java.util.Iterator;
|
|
22
24
|
import java.util.List;
|
|
25
|
+
import java.util.Map;
|
|
23
26
|
|
|
24
27
|
class Helpers {
|
|
28
|
+
interface JSONObjectGeneratorWithContext<T> {
|
|
29
|
+
JSONObject generateJSONObject(T param, Context context) throws JSONException;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface JSONObjectGenerator<T> {
|
|
33
|
+
JSONObject generateJSONObject(T param) throws JSONException;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static <T> JSONArray generateList(List<T> list) {
|
|
37
|
+
JSONArray result = new JSONArray();
|
|
38
|
+
if (list == null) return result;
|
|
39
|
+
for (T t : list)
|
|
40
|
+
if (t != null)
|
|
41
|
+
result.put(t);
|
|
42
|
+
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static <T> JSONArray generateList(List<T> list, JSONObjectGenerator<T> generator) throws JSONException {
|
|
47
|
+
JSONArray result = new JSONArray();
|
|
48
|
+
if (list == null) return result;
|
|
49
|
+
for (T t : list)
|
|
50
|
+
if (t != null)
|
|
51
|
+
result.put(generator.generateJSONObject(t));
|
|
52
|
+
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static <T> JSONArray generateList(List<T> list, JSONObjectGeneratorWithContext<T> generator, Context context) throws JSONException {
|
|
57
|
+
JSONArray result = new JSONArray();
|
|
58
|
+
if (list == null) return result;
|
|
59
|
+
for (T t : list)
|
|
60
|
+
if (t != null)
|
|
61
|
+
result.put(generator.generateJSONObject(t, context));
|
|
62
|
+
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static <T> JSONArray generateArray(T[] array) throws JSONException {
|
|
67
|
+
JSONArray result = new JSONArray();
|
|
68
|
+
if (array == null) return result;
|
|
69
|
+
for (int i = 0; i < array.length; i++)
|
|
70
|
+
result.put(i, array[i]);
|
|
71
|
+
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static <T> JSONArray generateArray(T[] array, JSONObjectGenerator<T> generator) throws JSONException {
|
|
76
|
+
JSONArray result = new JSONArray();
|
|
77
|
+
if (array == null) return result;
|
|
78
|
+
for (int i = 0; i < array.length; i++)
|
|
79
|
+
result.put(i, generator.generateJSONObject(array[i]));
|
|
80
|
+
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static <T, V> JSONObject generateMap(Map<T, V> map) throws JSONException {
|
|
85
|
+
JSONObject result = new JSONObject();
|
|
86
|
+
if (map == null) return result;
|
|
87
|
+
for (Map.Entry<T, V> entry : map.entrySet())
|
|
88
|
+
if (entry != null)
|
|
89
|
+
result.put(entry.getKey().toString(), entry.getValue());
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static JSONArray generateIntArray(int[] array) throws JSONException {
|
|
94
|
+
JSONArray result = new JSONArray();
|
|
95
|
+
if (array == null) return result;
|
|
96
|
+
for (int i = 0; i < array.length; i++)
|
|
97
|
+
result.put(i, array[i]);
|
|
98
|
+
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static int[] intArrayFromJSON(JSONArray input) throws JSONException {
|
|
103
|
+
int[] result = new int[input.length()];
|
|
104
|
+
for (int i = 0; i < input.length(); i++)
|
|
105
|
+
result[i] = input.getInt(i);
|
|
106
|
+
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
static JSONArray generateByteArray(byte[] array) throws JSONException {
|
|
111
|
+
JSONArray result = new JSONArray();
|
|
112
|
+
if (array == null) return result;
|
|
113
|
+
for (int i = 0; i < array.length; i++)
|
|
114
|
+
result.put(i, array[i]);
|
|
115
|
+
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
static JSONArray generateLongArray(long[] array) throws JSONException {
|
|
120
|
+
JSONArray result = new JSONArray();
|
|
121
|
+
if (array == null) return result;
|
|
122
|
+
for (int i = 0; i < array.length; i++)
|
|
123
|
+
result.put(i, array[i]);
|
|
124
|
+
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
|
|
25
128
|
static Bitmap bitmapFromBase64(String base64) {
|
|
26
|
-
byte[] decodedString = Base64.decode(base64, Base64.
|
|
129
|
+
byte[] decodedString = Base64.decode(base64, Base64.NO_WRAP);
|
|
27
130
|
Bitmap result = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
|
|
28
131
|
int sizeMultiplier = result.getByteCount() / 5000000;
|
|
29
132
|
if (result.getByteCount() > 5000000)
|
|
@@ -63,13 +166,13 @@ class Helpers {
|
|
|
63
166
|
}
|
|
64
167
|
|
|
65
168
|
static String bitmapToBase64String(Bitmap bitmap) {
|
|
66
|
-
if(bitmap == null) return null;
|
|
169
|
+
if (bitmap == null) return null;
|
|
67
170
|
|
|
68
171
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
69
172
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
|
|
70
173
|
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
|
71
174
|
|
|
72
|
-
return Base64.encodeToString(byteArray, Base64.
|
|
175
|
+
return Base64.encodeToString(byteArray, Base64.NO_WRAP);
|
|
73
176
|
}
|
|
74
177
|
|
|
75
178
|
static Matrix matrixFromFloatArray(float[] floats) {
|
|
@@ -142,4 +245,15 @@ class Helpers {
|
|
|
142
245
|
result[i] = jsonArray.optString(i);
|
|
143
246
|
return result;
|
|
144
247
|
}
|
|
248
|
+
|
|
249
|
+
static Map<String, String> stringMapFromJson(JSONObject input) throws JSONException {
|
|
250
|
+
Map<String, String> result = new HashMap<>();
|
|
251
|
+
Iterator<String> keys = input.keys();
|
|
252
|
+
while (keys.hasNext()) {
|
|
253
|
+
String key = keys.next();
|
|
254
|
+
String value = input.getString(key);
|
|
255
|
+
result.put(key, value);
|
|
256
|
+
}
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
145
259
|
}
|