@regulaforensics/react-native-document-reader-api 6.3.0 → 6.5.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/.github/ISSUE_TEMPLATE/bug-report.md +39 -0
- package/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/.github/ISSUE_TEMPLATE/feature-request.md +20 -0
- package/README.md +0 -3
- package/RNDocumentReaderApi.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/regula/documentreader/Helpers.java +1 -1
- package/android/src/main/java/com/regula/documentreader/JSONConstructor.java +78 -47
- package/android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.java +31 -28
- package/android/src/main/java/com/regula/documentreader/RegulaConfig.java +52 -6
- package/core/.gitkeep +0 -0
- package/example/App.js +168 -168
- package/example/metro.config.js +7 -8
- package/example/package.json +2 -2
- package/index.d.ts +3396 -3219
- package/index.js +3309 -3184
- package/ios/RGLWJSONConstructor.h +2 -0
- package/ios/RGLWJSONConstructor.m +68 -6
- package/ios/RNRegulaDocumentReader.m +25 -18
- package/ios/RegulaConfig.m +40 -6
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: "[BR] "
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Before Submitting, be sure to**
|
|
11
|
+
- [ ] Update to the latest stable version.
|
|
12
|
+
- [ ] Read and follow the guides described in the [documentation](https://docs.regulaforensics.com?utm_source=github).
|
|
13
|
+
- [ ] Try to reproduce in our demo project.
|
|
14
|
+
- [ ] Search for your issue in the existing GitHub issues.
|
|
15
|
+
|
|
16
|
+
**Bug Description**
|
|
17
|
+
<!--A clear and concise description of what the bug is.-->
|
|
18
|
+
|
|
19
|
+
**Steps To Reproduce**
|
|
20
|
+
<!--
|
|
21
|
+
1. Go to '...'
|
|
22
|
+
2. Click on '....'
|
|
23
|
+
3. Scroll down to '....'
|
|
24
|
+
4. See error
|
|
25
|
+
-->
|
|
26
|
+
|
|
27
|
+
**Expected behavior**
|
|
28
|
+
<!--A clear and concise description of what you expected to happen.-->
|
|
29
|
+
|
|
30
|
+
**Screenshots**
|
|
31
|
+
<!--If applicable, add screenshots to help explain your issue.-->
|
|
32
|
+
|
|
33
|
+
**Environment:**
|
|
34
|
+
- Device: <!--[e.g. iPhone 12]-->
|
|
35
|
+
- OS: <!--[e.g. iOS]-->
|
|
36
|
+
- OS version: <!--[e.g. 10.0]-->
|
|
37
|
+
|
|
38
|
+
**Additional context**
|
|
39
|
+
<!--Add any other context about the problem here.-->
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest an idea for this product
|
|
4
|
+
title: "[FR] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
<!--A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]-->
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
<!--A clear and concise description of what you want to happen.-->
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
<!--A clear and concise description of any alternative solutions or features you've considered.-->
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
<!--Add any other context or screenshots about the feature request here.-->
|
package/README.md
CHANGED
|
@@ -26,20 +26,17 @@ $ pod install
|
|
|
26
26
|
|
|
27
27
|
4. Android:
|
|
28
28
|
* Copy the `regula.license` file to the `example/android/app/src/main/assets` folder.
|
|
29
|
-
* Change the application ID to the one you have specified during the registration at [client.regulaforensics.com](https://client.regulaforensics.com).
|
|
30
29
|
* Run `npx react-native run-android` inside `example` folder - this is just one way to run the app. You can also run it directly from within Android Studio. **Note**: `npx react-native log-android` is used to view logs.
|
|
31
30
|
|
|
32
31
|
**Note**: if the running failed with the following error `Error: spawn ./gradlew EACCES`, try to run the following command `chmod +x gradlew` within the `example/android` directory.
|
|
33
32
|
|
|
34
33
|
5. iOS:
|
|
35
34
|
* Copy the `regula.license` file to the `example/ios/DocumentReader` folder.
|
|
36
|
-
* Change the Bundle Identifier to the one you have specified during the registration at [client.regulaforensics.com](https://client.regulaforensics.com).
|
|
37
35
|
* Run `npx react-native run-ios` inside `example` folder - this is just one way to run the app. You can also run it directly from within Xcode.
|
|
38
36
|
|
|
39
37
|
### Troubleshooting license issues
|
|
40
38
|
If you have issues with license verification when running the application, please verify that next is true:
|
|
41
39
|
1. The OS, which you use, is specified in the license (e.g., Android and/or iOS).
|
|
42
|
-
2. The application (Bundle) ID, which you use, is specified in the license.
|
|
43
40
|
3. The license is valid (not expired).
|
|
44
41
|
4. The date and time on the device, where you run the application, are valid.
|
|
45
42
|
5. You use the latest release version of the Document Reader SDK.
|
package/android/build.gradle
CHANGED
|
@@ -49,7 +49,7 @@ dependencies {
|
|
|
49
49
|
//noinspection GradleDynamicVersion
|
|
50
50
|
implementation 'com.facebook.react:react-native:+'
|
|
51
51
|
//noinspection GradleDependency
|
|
52
|
-
implementation('com.regula.documentreader:api:6.
|
|
52
|
+
implementation('com.regula.documentreader:api:6.5.7488') {
|
|
53
53
|
transitive = true
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -10,7 +10,7 @@ import android.graphics.drawable.Drawable;
|
|
|
10
10
|
import android.util.Base64;
|
|
11
11
|
|
|
12
12
|
import com.regula.documentreader.api.enums.BarcodeType;
|
|
13
|
-
import com.regula.documentreader.api.params.FaceMetaData;
|
|
13
|
+
import com.regula.documentreader.api.internal.params.FaceMetaData;
|
|
14
14
|
import com.regula.documentreader.api.results.Bounds;
|
|
15
15
|
|
|
16
16
|
import org.json.JSONArray;
|
|
@@ -15,7 +15,9 @@ import com.regula.documentreader.api.enums.eGraphicFieldType;
|
|
|
15
15
|
import com.regula.documentreader.api.enums.eRPRM_Lights;
|
|
16
16
|
import com.regula.documentreader.api.errors.DocumentReaderException;
|
|
17
17
|
import com.regula.documentreader.api.internal.core.CoreDetailedScenario;
|
|
18
|
-
import com.regula.documentreader.api.params.
|
|
18
|
+
import com.regula.documentreader.api.params.DocReaderConfig;
|
|
19
|
+
import com.regula.documentreader.api.internal.params.FaceMetaData;
|
|
20
|
+
import com.regula.documentreader.api.params.ImageInputData;
|
|
19
21
|
import com.regula.documentreader.api.params.rfid.TccParams;
|
|
20
22
|
import com.regula.documentreader.api.params.rfid.authorization.PAAttribute;
|
|
21
23
|
import com.regula.documentreader.api.params.rfid.authorization.PAResourcesIssuer;
|
|
@@ -55,7 +57,6 @@ import com.regula.documentreader.api.results.rfid.Extension;
|
|
|
55
57
|
import com.regula.documentreader.api.results.rfid.File;
|
|
56
58
|
import com.regula.documentreader.api.results.rfid.FileData;
|
|
57
59
|
import com.regula.documentreader.api.results.rfid.RFIDSessionData;
|
|
58
|
-
import com.regula.documentreader.api.results.rfid.RFIDSessionDataStatus;
|
|
59
60
|
import com.regula.documentreader.api.results.rfid.SecurityObject;
|
|
60
61
|
import com.regula.documentreader.api.results.rfid.SecurityObjectCertificates;
|
|
61
62
|
import com.regula.documentreader.api.results.rfid.SignerInfo;
|
|
@@ -360,6 +361,64 @@ class JSONConstructor {
|
|
|
360
361
|
return result;
|
|
361
362
|
}
|
|
362
363
|
|
|
364
|
+
static DocReaderConfig DocReaderConfigFromJSON(JSONObject input) {
|
|
365
|
+
DocReaderConfig result = new DocReaderConfig(null);
|
|
366
|
+
byte[] license;
|
|
367
|
+
try {
|
|
368
|
+
if (input.has("license")) {
|
|
369
|
+
license = Base64.decode(input.getString("license"), Base64.DEFAULT);
|
|
370
|
+
result = new DocReaderConfig(license);
|
|
371
|
+
} else return result;
|
|
372
|
+
if (input.has("customDb"))
|
|
373
|
+
result = new DocReaderConfig(license, Base64.decode(input.getString("customDb"), Base64.DEFAULT));
|
|
374
|
+
if (input.has("licenseUpdate"))
|
|
375
|
+
result.setLicenseUpdate(input.getBoolean("licenseUpdate"));
|
|
376
|
+
if (input.has("delayedNNLoad"))
|
|
377
|
+
result.setDelayedNNLoad(input.getBoolean("delayedNNLoad"));
|
|
378
|
+
if (input.has("blackList"))
|
|
379
|
+
result.setBlackList(input.getJSONObject("blackList"));
|
|
380
|
+
} catch (JSONException e) {
|
|
381
|
+
e.printStackTrace();
|
|
382
|
+
}
|
|
383
|
+
return result;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
static ImageInputData ImageInputDataFromJSON(JSONObject input) {
|
|
387
|
+
ImageInputData result = new ImageInputData(null);
|
|
388
|
+
int pageIndex = 0;
|
|
389
|
+
int light = 6;
|
|
390
|
+
int type = 254;
|
|
391
|
+
int width = 0;
|
|
392
|
+
int height = 0;
|
|
393
|
+
Bitmap bitmap;
|
|
394
|
+
byte[] imgBytes;
|
|
395
|
+
|
|
396
|
+
try {
|
|
397
|
+
if(input.has("pageIndex"))
|
|
398
|
+
pageIndex = input.optInt("pageIndex");
|
|
399
|
+
if(input.has("light"))
|
|
400
|
+
pageIndex = input.optInt("light");
|
|
401
|
+
if(input.has("type"))
|
|
402
|
+
pageIndex = input.optInt("type");
|
|
403
|
+
if (input.has("bitmap")) {
|
|
404
|
+
bitmap = Helpers.bitmapFromBase64(input.getString("bitmap"));
|
|
405
|
+
result = new ImageInputData(bitmap, light, pageIndex);
|
|
406
|
+
}
|
|
407
|
+
if (input.has("imgBytes")) {
|
|
408
|
+
JSONArray jsonArray_data = input.getJSONArray("data");
|
|
409
|
+
byte[] data = new byte[jsonArray_data.length()];
|
|
410
|
+
for (int i = 0; i < jsonArray_data.length(); i++)
|
|
411
|
+
data[i] = (byte) jsonArray_data.get(i);
|
|
412
|
+
imgBytes = data;
|
|
413
|
+
result = new ImageInputData(imgBytes, width, height, light, pageIndex);
|
|
414
|
+
}
|
|
415
|
+
} catch (JSONException e) {
|
|
416
|
+
e.printStackTrace();
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
return result;
|
|
420
|
+
}
|
|
421
|
+
|
|
363
422
|
static Throwable ThrowableFromJSON(JSONObject jsonObject) {
|
|
364
423
|
return new Throwable();
|
|
365
424
|
}
|
|
@@ -883,7 +942,6 @@ class JSONConstructor {
|
|
|
883
942
|
result.put("extLeSupport", input.extLeSupport);
|
|
884
943
|
result.put("processTime", input.processTime);
|
|
885
944
|
result.put("cardProperties", generateCardProperties(input.cardProperties));
|
|
886
|
-
result.put("sessionDataStatus", generateRFIDSessionDataStatus(input.sessionDataStatus));
|
|
887
945
|
result.put("accessControls", generateList(input.accessControls, JSONConstructor::generateAccessControlProcedureType));
|
|
888
946
|
result.put("applications", generateList(input.applications, JSONConstructor::generateApplication));
|
|
889
947
|
result.put("securityObjects", generateList(input.securityObjects, JSONConstructor::generateSecurityObject));
|
|
@@ -921,23 +979,6 @@ class JSONConstructor {
|
|
|
921
979
|
return result;
|
|
922
980
|
}
|
|
923
981
|
|
|
924
|
-
static JSONObject generateRFIDSessionDataStatus(RFIDSessionDataStatus input) {
|
|
925
|
-
JSONObject result = new JSONObject();
|
|
926
|
-
if (input == null) return result;
|
|
927
|
-
try {
|
|
928
|
-
result.put("AA", input.AA);
|
|
929
|
-
result.put("BAC", input.BAC);
|
|
930
|
-
result.put("CA", input.CA);
|
|
931
|
-
result.put("PA", input.PA);
|
|
932
|
-
result.put("PACE", input.PACE);
|
|
933
|
-
result.put("TA", input.TA);
|
|
934
|
-
result.put("overallStatus", input.overallStatus);
|
|
935
|
-
} catch (JSONException e) {
|
|
936
|
-
e.printStackTrace();
|
|
937
|
-
}
|
|
938
|
-
return result;
|
|
939
|
-
}
|
|
940
|
-
|
|
941
982
|
static JSONObject generateDocumentReaderBarcodeResult(DocumentReaderBarcodeResult input) {
|
|
942
983
|
JSONObject result = new JSONObject();
|
|
943
984
|
if (input == null) return result;
|
|
@@ -1184,12 +1225,28 @@ class JSONConstructor {
|
|
|
1184
1225
|
return result;
|
|
1185
1226
|
}
|
|
1186
1227
|
|
|
1228
|
+
static JSONObject generateImageInputData(ImageInputData input) {
|
|
1229
|
+
JSONObject result = new JSONObject();
|
|
1230
|
+
if (input == null) return result;
|
|
1231
|
+
try {
|
|
1232
|
+
result.put("pageIndex", input.getPageIndex());
|
|
1233
|
+
result.put("light", input.getLight());
|
|
1234
|
+
result.put("type", input.getType());
|
|
1235
|
+
result.put("width", input.getWidth());
|
|
1236
|
+
result.put("height", input.getHeight());
|
|
1237
|
+
result.put("bitmap", generateBitmap(input.getBitmap()));
|
|
1238
|
+
result.put("imgBytes", generateByteArray(input.getImgBytes()));
|
|
1239
|
+
} catch (JSONException e) {
|
|
1240
|
+
e.printStackTrace();
|
|
1241
|
+
}
|
|
1242
|
+
return result;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1187
1245
|
static JSONObject generateDocumentReaderResults(DocumentReaderResults input, Context context) {
|
|
1188
1246
|
JSONObject result = new JSONObject();
|
|
1189
1247
|
if (input == null) return result;
|
|
1190
1248
|
try {
|
|
1191
1249
|
result.put("chipPage", input.chipPage);
|
|
1192
|
-
result.put("overallResult", input.getOverallResult());
|
|
1193
1250
|
result.put("processingFinishedStatus", input.processingFinishedStatus);
|
|
1194
1251
|
result.put("elapsedTime", input.elapsedTime);
|
|
1195
1252
|
result.put("elapsedTimeRFID", input.elapsedTimeRFID);
|
|
@@ -1984,8 +2041,6 @@ class JSONConstructor {
|
|
|
1984
2041
|
result.processTime = input.getInt("processTime");
|
|
1985
2042
|
if (input.has("cardProperties"))
|
|
1986
2043
|
result.cardProperties = CardPropertiesFromJSON(input.getJSONObject("cardProperties"));
|
|
1987
|
-
if (input.has("sessionDataStatus"))
|
|
1988
|
-
result.sessionDataStatus = RFIDSessionDataStatusFromJSON(input.getJSONObject("sessionDataStatus"));
|
|
1989
2044
|
if (input.has("accessControls")){
|
|
1990
2045
|
JSONArray jsonArray_accessControls = input.getJSONArray("accessControls");
|
|
1991
2046
|
List<AccessControlProcedureType> accessControls = new ArrayList<>();
|
|
@@ -2051,30 +2106,6 @@ class JSONConstructor {
|
|
|
2051
2106
|
return null;
|
|
2052
2107
|
}
|
|
2053
2108
|
|
|
2054
|
-
static RFIDSessionDataStatus RFIDSessionDataStatusFromJSON(JSONObject input) {
|
|
2055
|
-
try {
|
|
2056
|
-
RFIDSessionDataStatus result = new RFIDSessionDataStatus();
|
|
2057
|
-
if (input.has("AA"))
|
|
2058
|
-
result.AA = input.getInt("AA");
|
|
2059
|
-
if (input.has("BAC"))
|
|
2060
|
-
result.BAC = input.getInt("BAC");
|
|
2061
|
-
if (input.has("CA"))
|
|
2062
|
-
result.CA = input.getInt("CA");
|
|
2063
|
-
if (input.has("PA"))
|
|
2064
|
-
result.PA = input.getInt("PA");
|
|
2065
|
-
if (input.has("PACE"))
|
|
2066
|
-
result.PACE = input.getInt("PACE");
|
|
2067
|
-
if (input.has("TA"))
|
|
2068
|
-
result.TA = input.getInt("TA");
|
|
2069
|
-
if (input.has("overallStatus"))
|
|
2070
|
-
result.overallStatus = input.getInt("overallStatus");
|
|
2071
|
-
return result;
|
|
2072
|
-
} catch (JSONException e) {
|
|
2073
|
-
e.printStackTrace();
|
|
2074
|
-
}
|
|
2075
|
-
return null;
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
2109
|
static DocumentReaderBarcodeResult DocumentReaderBarcodeResultFromJSON(JSONObject input) {
|
|
2079
2110
|
try {
|
|
2080
2111
|
DocumentReaderBarcodeResult result = new DocumentReaderBarcodeResult();
|
|
@@ -33,12 +33,13 @@ import com.regula.documentreader.api.enums.DocReaderAction;
|
|
|
33
33
|
import com.regula.documentreader.api.errors.DocumentReaderException;
|
|
34
34
|
import com.regula.documentreader.api.internal.core.CoreScenarioUtil;
|
|
35
35
|
import com.regula.documentreader.api.params.DocReaderConfig;
|
|
36
|
-
import com.regula.documentreader.api.params.
|
|
36
|
+
import com.regula.documentreader.api.params.ImageInputData;
|
|
37
|
+
import com.regula.documentreader.api.internal.params.ImageInputParam;
|
|
37
38
|
import com.regula.documentreader.api.params.rfid.PKDCertificate;
|
|
38
39
|
import com.regula.documentreader.api.params.rfid.authorization.PAResourcesIssuer;
|
|
39
40
|
import com.regula.documentreader.api.params.rfid.authorization.TAChallenge;
|
|
40
41
|
import com.regula.documentreader.api.results.DocumentReaderResults;
|
|
41
|
-
import com.regula.documentreader.api.parser.DocReaderResultsJsonParser;
|
|
42
|
+
import com.regula.documentreader.api.internal.parser.DocReaderResultsJsonParser;
|
|
42
43
|
|
|
43
44
|
import org.json.JSONArray;
|
|
44
45
|
import org.json.JSONException;
|
|
@@ -253,6 +254,9 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
253
254
|
case "stopRFIDReader":
|
|
254
255
|
stopRFIDReader(callback);
|
|
255
256
|
break;
|
|
257
|
+
case "stopRFIDReaderWithErrorMessage":
|
|
258
|
+
stopRFIDReaderWithErrorMessage(callback, args(0));
|
|
259
|
+
break;
|
|
256
260
|
case "stopScanner":
|
|
257
261
|
stopScanner(callback);
|
|
258
262
|
break;
|
|
@@ -337,6 +341,9 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
337
341
|
case "recognizeImage":
|
|
338
342
|
recognizeImage(callback, args(0));
|
|
339
343
|
break;
|
|
344
|
+
case "recognizeData":
|
|
345
|
+
recognizeData(callback, args(0));
|
|
346
|
+
break;
|
|
340
347
|
case "setRfidSessionStatus":
|
|
341
348
|
setRfidSessionStatus(callback, args(0));
|
|
342
349
|
break;
|
|
@@ -355,12 +362,6 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
355
362
|
case "setTCCParams":
|
|
356
363
|
setTCCParams(callback, args(0));
|
|
357
364
|
break;
|
|
358
|
-
case "initializeReaderWithDatabase":
|
|
359
|
-
initializeReaderWithDatabase(callback, args(0), args(1));
|
|
360
|
-
break;
|
|
361
|
-
case "recognizeImageFrame":
|
|
362
|
-
recognizeImageFrame(callback, args(0), args(1));
|
|
363
|
-
break;
|
|
364
365
|
case "recognizeImageWithOpts":
|
|
365
366
|
recognizeImageWithOpts(callback, args(0), args(1));
|
|
366
367
|
break;
|
|
@@ -370,12 +371,12 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
370
371
|
case "showScannerWithCameraIDAndOpts":
|
|
371
372
|
showScannerWithCameraIDAndOpts(callback, args(0), args(1));
|
|
372
373
|
break;
|
|
373
|
-
case "recognizeImageWithImageInputParams":
|
|
374
|
-
recognizeImageWithImageInputParams(callback, args(0), args(1));
|
|
375
|
-
break;
|
|
376
374
|
case "recognizeImageWithCameraMode":
|
|
377
375
|
recognizeImageWithCameraMode(callback, args(0), args(1));
|
|
378
376
|
break;
|
|
377
|
+
case "recognizeImagesWithImageInputs":
|
|
378
|
+
recognizeImagesWithImageInputs(callback, args(0));
|
|
379
|
+
break;
|
|
379
380
|
}
|
|
380
381
|
} catch (Exception ignored) {
|
|
381
382
|
}
|
|
@@ -524,16 +525,9 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
524
525
|
callback.success(Instance().isRFIDAvailableForUse());
|
|
525
526
|
}
|
|
526
527
|
|
|
527
|
-
private void initializeReader(Callback callback,
|
|
528
|
+
private void initializeReader(Callback callback, JSONObject config) {
|
|
528
529
|
if (!Instance().isReady())
|
|
529
|
-
Instance().initializeReader(getContext(),
|
|
530
|
-
else
|
|
531
|
-
callback.success("already initialized");
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
private void initializeReaderWithDatabase(Callback callback, Object license, Object db) {
|
|
535
|
-
if (!Instance().isReady())
|
|
536
|
-
Instance().initializeReader(getContext(), new DocReaderConfig(Base64.decode(license.toString(), Base64.DEFAULT), Base64.decode(db.toString(), Base64.DEFAULT)), getInitCompletion(callback));
|
|
530
|
+
Instance().initializeReader(getContext(), JSONConstructor.DocReaderConfigFromJSON(config), getInitCompletion(callback));
|
|
537
531
|
else
|
|
538
532
|
callback.success("already initialized");
|
|
539
533
|
}
|
|
@@ -548,10 +542,6 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
548
542
|
callback.success();
|
|
549
543
|
}
|
|
550
544
|
|
|
551
|
-
private void recognizeImageWithImageInputParams(@SuppressWarnings("unused") Callback callback, String base64Image, final JSONObject params) throws JSONException {
|
|
552
|
-
Instance().recognizeImage(Helpers.bitmapFromBase64(base64Image), new ImageInputParam(params.getInt("width"), params.getInt("height"), params.getInt("type")), getCompletion());
|
|
553
|
-
}
|
|
554
|
-
|
|
555
545
|
private void recognizeImageWithOpts(Callback callback, String base64Image, final JSONObject opts) throws JSONException {
|
|
556
546
|
RegulaConfig.setConfig(Instance(), opts, getContext());
|
|
557
547
|
recognizeImage(callback, base64Image);
|
|
@@ -562,6 +552,11 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
562
552
|
Instance().recognizeImage(Helpers.bitmapFromBase64(base64Image), getCompletion());
|
|
563
553
|
}
|
|
564
554
|
|
|
555
|
+
private void recognizeData(@SuppressWarnings("unused") Callback callback, Object data) {
|
|
556
|
+
stopBackgroundRFID();
|
|
557
|
+
Instance().recognizeImage(Base64.decode(data.toString(), Base64.DEFAULT), getCompletion());
|
|
558
|
+
}
|
|
559
|
+
|
|
565
560
|
private void recognizeImages(@SuppressWarnings("unused") Callback callback, JSONArray base64Images) throws JSONException {
|
|
566
561
|
stopBackgroundRFID();
|
|
567
562
|
Bitmap[] images = new Bitmap[base64Images.length()];
|
|
@@ -570,6 +565,14 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
570
565
|
Instance().recognizeImages(images, getCompletion());
|
|
571
566
|
}
|
|
572
567
|
|
|
568
|
+
private void recognizeImagesWithImageInputs(@SuppressWarnings("unused") Callback callback, JSONArray base64Images) throws JSONException {
|
|
569
|
+
stopBackgroundRFID();
|
|
570
|
+
ImageInputData[] images = new ImageInputData[base64Images.length()];
|
|
571
|
+
for (int i = 0; i < images.length; i++)
|
|
572
|
+
images[i] = JSONConstructor.ImageInputDataFromJSON(base64Images.getJSONObject(i));
|
|
573
|
+
Instance().recognizeImages(images, getCompletion());
|
|
574
|
+
}
|
|
575
|
+
|
|
573
576
|
private void removeDatabase(Callback callback) {
|
|
574
577
|
callback.success(Instance().removeDatabase(getContext()));
|
|
575
578
|
}
|
|
@@ -603,10 +606,6 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
603
606
|
callback.success();
|
|
604
607
|
}
|
|
605
608
|
|
|
606
|
-
private void recognizeImageFrame(@SuppressWarnings("unused") Callback callback, String base64Image, final JSONObject opts) throws JSONException {
|
|
607
|
-
Instance().recognizeImageFrame(Helpers.bitmapFromBase64(base64Image), new ImageInputParam(opts.getInt("width"), opts.getInt("height"), opts.getInt("type")), getCompletion());
|
|
608
|
-
}
|
|
609
|
-
|
|
610
609
|
private void recognizeVideoFrame(@SuppressWarnings("unused") Callback callback, String byteString, final JSONObject opts) throws JSONException {
|
|
611
610
|
stopBackgroundRFID();
|
|
612
611
|
Instance().recognizeVideoFrame(byteString.getBytes(), new ImageInputParam(opts.getInt("width"), opts.getInt("height"), opts.getInt("type")), getCompletion());
|
|
@@ -725,6 +724,10 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
725
724
|
callback.error("getCameraSessionIsPaused() is an ios-only method");
|
|
726
725
|
}
|
|
727
726
|
|
|
727
|
+
private void stopRFIDReaderWithErrorMessage(Callback callback, String message) {
|
|
728
|
+
callback.error("stopRFIDReaderWithErrorMessage() is an ios-only method");
|
|
729
|
+
}
|
|
730
|
+
|
|
728
731
|
@SuppressWarnings("unused")
|
|
729
732
|
private void recognizeImageWithCameraMode(Callback callback, String base64, boolean mode) {
|
|
730
733
|
callback.error("recognizeImageWithCameraMode() is an ios-only method");
|
|
@@ -6,9 +6,11 @@ import org.json.JSONException;
|
|
|
6
6
|
|
|
7
7
|
import com.regula.documentreader.api.DocumentReader;
|
|
8
8
|
import com.regula.documentreader.api.params.ImageQA;
|
|
9
|
+
import com.regula.documentreader.api.params.OnlineProcessingConfig;
|
|
9
10
|
import com.regula.documentreader.api.params.ParamsCustomization;
|
|
10
11
|
import com.regula.documentreader.api.params.Functionality;
|
|
11
12
|
import com.regula.documentreader.api.params.ProcessParam;
|
|
13
|
+
import com.regula.documentreader.api.params.rfid.ReprocParams;
|
|
12
14
|
import com.regula.documentreader.api.params.rfid.dg.DataGroups;
|
|
13
15
|
|
|
14
16
|
import android.content.Context;
|
|
@@ -59,8 +61,6 @@ class RegulaConfig {
|
|
|
59
61
|
editor.setShowCaptureButtonDelayFromDetect(opts.getInt("showCaptureButtonDelayFromDetect"));
|
|
60
62
|
if (opts.has("showCaptureButtonDelayFromStart"))
|
|
61
63
|
editor.setShowCaptureButtonDelayFromStart(opts.getInt("showCaptureButtonDelayFromStart"));
|
|
62
|
-
if (opts.has("isOnlineMode"))
|
|
63
|
-
editor.setOnlineMode(opts.getBoolean("isOnlineMode"));
|
|
64
64
|
if (opts.has("databaseAutoupdate"))
|
|
65
65
|
editor.setDatabaseAutoupdate(opts.getBoolean("databaseAutoupdate"));
|
|
66
66
|
if (opts.has("showSkipNextPageButton"))
|
|
@@ -73,8 +73,6 @@ class RegulaConfig {
|
|
|
73
73
|
editor.setShowCameraSwitchButton(opts.getBoolean("showCameraSwitchButton"));
|
|
74
74
|
if (opts.has("cameraFrame"))
|
|
75
75
|
editor.setCameraFrame(opts.getString("cameraFrame"));
|
|
76
|
-
if (opts.has("serviceURL"))
|
|
77
|
-
editor.setServiceURL(opts.getString("serviceURL"));
|
|
78
76
|
if (opts.has("btDeviceName"))
|
|
79
77
|
editor.setBtDeviceName(opts.getString("btDeviceName"));
|
|
80
78
|
if (opts.has("orientation"))
|
|
@@ -103,6 +101,10 @@ class RegulaConfig {
|
|
|
103
101
|
editor.setManualMultipageMode(opts.getBoolean("manualMultipageMode"));
|
|
104
102
|
if (opts.has("exposure"))
|
|
105
103
|
editor.setExposure(BigDecimal.valueOf(opts.getDouble("exposure")).floatValue());
|
|
104
|
+
if (opts.has("rfidTimeout"))
|
|
105
|
+
editor.setRfidTimeout(opts.getInt("rfidTimeout"));
|
|
106
|
+
if (opts.has("onlineProcessingConfiguration"))
|
|
107
|
+
editor.setOnlineProcessingConfiguration(OnlineProcessingConfigFromJSON(opts.getJSONObject("onlineProcessingConfiguration")));
|
|
106
108
|
|
|
107
109
|
editor.apply();
|
|
108
110
|
}
|
|
@@ -331,6 +333,8 @@ class RegulaConfig {
|
|
|
331
333
|
editor.setHologramAnimationImageMatrix(matrixFromFloatArray(floatArrayFromJson(opts.getJSONArray("hologramAnimationImageMatrix"))));
|
|
332
334
|
if (opts.has("hologramAnimationImageScaleType"))
|
|
333
335
|
editor.setHologramAnimationImageScaleType(ScaleType.valueOf(opts.getString("hologramAnimationImageScaleType")));
|
|
336
|
+
if (opts.has("uiCustomizationLayer"))
|
|
337
|
+
editor.setUiCustomizationLayer(opts.getJSONObject("uiCustomizationLayer"));
|
|
334
338
|
|
|
335
339
|
editor.applyImmediately(context);
|
|
336
340
|
}
|
|
@@ -345,14 +349,12 @@ class RegulaConfig {
|
|
|
345
349
|
object.put("showChangeFrameButton", functionality.isShowChangeFrameButton());
|
|
346
350
|
object.put("showCaptureButtonDelayFromDetect", functionality.getShowCaptureButtonDelayFromDetect());
|
|
347
351
|
object.put("showCaptureButtonDelayFromStart", functionality.getShowCaptureButtonDelayFromStart());
|
|
348
|
-
object.put("isOnlineMode", functionality.isOnlineMode());
|
|
349
352
|
object.put("databaseAutoupdate", functionality.isDatabaseAutoupdate());
|
|
350
353
|
object.put("showSkipNextPageButton", functionality.isShowSkipNextPageButton());
|
|
351
354
|
object.put("useAuthenticator", functionality.isUseAuthenticator());
|
|
352
355
|
object.put("skipFocusingFrames", functionality.isSkipFocusingFrames());
|
|
353
356
|
object.put("showCameraSwitchButton", functionality.isShowCameraSwitchButton());
|
|
354
357
|
object.put("cameraFrame", functionality.getCameraFrame());
|
|
355
|
-
object.put("serviceURL", functionality.getServiceURL());
|
|
356
358
|
object.put("btDeviceName", functionality.getBtDeviceName());
|
|
357
359
|
object.put("orientation", functionality.getOrientation());
|
|
358
360
|
object.put("BTDeviceApiPresent", functionality.isBTDeviceApiPresent());
|
|
@@ -371,6 +373,7 @@ class RegulaConfig {
|
|
|
371
373
|
object.put("recordScanningProcess", functionality.doRecordProcessingVideo());
|
|
372
374
|
object.put("manualMultipageMode", functionality.isManualMultipageMode());
|
|
373
375
|
object.put("exposure", functionality.getExposure());
|
|
376
|
+
object.put("rfidTimeout", functionality.getRfidTimeout());
|
|
374
377
|
|
|
375
378
|
return object;
|
|
376
379
|
}
|
|
@@ -435,6 +438,7 @@ class RegulaConfig {
|
|
|
435
438
|
object.put("hologramAnimationPositionMultiplier", customization.getHologramAnimationPositionMultiplier());
|
|
436
439
|
object.put("hologramAnimationImageMatrix", customization.getHologramAnimationImageMatrix());
|
|
437
440
|
object.put("hologramAnimationImageScaleType", customization.getHologramAnimationImageScaleType());
|
|
441
|
+
object.put("uiCustomizationLayer", customization.getUiCustomizationLayer());
|
|
438
442
|
|
|
439
443
|
return object;
|
|
440
444
|
}
|
|
@@ -597,6 +601,10 @@ class RegulaConfig {
|
|
|
597
601
|
setDataGroups(DocumentReader.Instance().rfidScenario().eIDDataGroups(), opts.getJSONObject("eIDDataGroups"));
|
|
598
602
|
if (opts.has("eDLDataGroups"))
|
|
599
603
|
setDataGroups(DocumentReader.Instance().rfidScenario().eDLDataGroups(), opts.getJSONObject("eDLDataGroups"));
|
|
604
|
+
if (opts.has("reprocessParams"))
|
|
605
|
+
DocumentReader.Instance().rfidScenario().setReprocessParams(ReprocParamsFromJSON(opts.getJSONObject("reprocessParams")));
|
|
606
|
+
if (opts.has("defaultReadingBufferSize"))
|
|
607
|
+
DocumentReader.Instance().rfidScenario().setDefaultReadingBufferSize(opts.getInt("defaultReadingBufferSize"));
|
|
600
608
|
}
|
|
601
609
|
|
|
602
610
|
private static void setDataGroups(DataGroups dataGroup, JSONObject opts) throws JSONException {
|
|
@@ -643,4 +651,42 @@ class RegulaConfig {
|
|
|
643
651
|
if (opts.has("DG21"))
|
|
644
652
|
dataGroup.setDG14(opts.getBoolean("DG21"));
|
|
645
653
|
}
|
|
654
|
+
|
|
655
|
+
private static ReprocParams ReprocParamsFromJSON(JSONObject input) {
|
|
656
|
+
try {
|
|
657
|
+
ReprocParams result;
|
|
658
|
+
if (input.has("serviceUrl"))
|
|
659
|
+
result = new ReprocParams(input.getString("serviceUrl"));
|
|
660
|
+
else return null;
|
|
661
|
+
if (input.has("failIfNoService"))
|
|
662
|
+
result.setFailIfNoService(input.getBoolean("failIfNoService"));
|
|
663
|
+
return result;
|
|
664
|
+
} catch (JSONException e) {
|
|
665
|
+
e.printStackTrace();
|
|
666
|
+
}
|
|
667
|
+
return null;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
private static OnlineProcessingConfig OnlineProcessingConfigFromJSON(JSONObject input) {
|
|
671
|
+
try {
|
|
672
|
+
OnlineProcessingConfig.Builder builder;
|
|
673
|
+
if (input.has("mode"))
|
|
674
|
+
builder = new OnlineProcessingConfig.Builder(input.getInt("mode"));
|
|
675
|
+
else return null;
|
|
676
|
+
if (input.has("imageFormat"))
|
|
677
|
+
builder.setImageFormat(input.getInt("imageFormat"));
|
|
678
|
+
if (input.has("url"))
|
|
679
|
+
builder.setUrl(input.getString("url"));
|
|
680
|
+
if (input.has("imageCompressionQuality"))
|
|
681
|
+
builder.setImageCompressionQuality((float) input.getDouble("imageCompressionQuality"));
|
|
682
|
+
if (input.has("processParams")) {
|
|
683
|
+
ProcessParam params = new ProcessParam();
|
|
684
|
+
setProcessParams(params, input.getJSONObject("processParams"));
|
|
685
|
+
builder.setProcessParams(params);
|
|
686
|
+
}
|
|
687
|
+
} catch (JSONException e) {
|
|
688
|
+
e.printStackTrace();
|
|
689
|
+
}
|
|
690
|
+
return null;
|
|
691
|
+
}
|
|
646
692
|
}
|
package/core/.gitkeep
ADDED
|
File without changes
|