@regulaforensics/react-native-document-reader-api 5.8.1 → 6.1.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/README.md +1 -1
- package/RNDocumentReaderApi.podspec +2 -2
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/regula/documentreader/Helpers.java +1 -3
- package/android/src/main/java/com/regula/documentreader/JSONConstructor.java +110 -10
- package/android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.java +8 -12
- package/android/src/main/java/com/regula/documentreader/RegulaConfig.java +3 -0
- package/example/.editorconfig +3 -0
- package/example/.flowconfig +4 -13
- package/example/.gitattributes +3 -1
- package/example/.prettierrc.js +1 -0
- package/example/App.js +30 -18
- package/example/android/app/BUCK +55 -0
- package/example/android/app/build.gradle +35 -17
- package/example/android/app/debug.keystore +0 -0
- package/example/android/app/src/debug/AndroidManifest.xml +6 -1
- package/example/android/app/src/main/AndroidManifest.xml +21 -22
- package/example/android/app/src/main/assets/index.android.bundle +636 -0
- package/example/android/app/src/main/java/com/regula/dr/fullrfid/MainApplication.java +1 -2
- 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/android/build.gradle +12 -6
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/example/android/gradle.properties +2 -1
- package/example/android/gradlew +14 -17
- package/example/android/gradlew.bat +7 -18
- package/example/android/settings.gradle +0 -2
- package/example/ios/DocumentReader/AppDelegate.m +7 -3
- package/example/ios/DocumentReader/Info.plist +8 -10
- package/example/ios/DocumentReader/LaunchScreen.storyboard +47 -0
- package/example/ios/DocumentReader.xcodeproj/project.pbxproj +257 -96
- package/example/ios/DocumentReader.xcodeproj/xcshareddata/xcschemes/DocumentReader.xcscheme +1 -1
- package/example/ios/DocumentReaderTests/DocumentReaderTests.m +65 -0
- package/example/ios/DocumentReaderTests/Info.plist +24 -0
- package/example/ios/Podfile +13 -4
- package/example/metro.config.js +1 -1
- package/example/package.json +17 -18
- package/index.d.ts +713 -514
- package/index.js +661 -510
- package/ios/RGLWJSONConstructor.h +6 -0
- package/ios/RGLWJSONConstructor.m +92 -0
- package/ios/RNRegulaDocumentReader.m +5 -5
- package/ios/RegulaConfig.m +3 -0
- package/package.json +1 -1
- package/example/ios/DocumentReader.xcodeproj/xcshareddata/xcschemes/DocumentReader-tvOS.xcscheme +0 -88
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ If you have issues with license verification when running the application, pleas
|
|
|
46
46
|
6. You placed the `license` into the correct folder as described [here](#how-to-build-demo-application).
|
|
47
47
|
|
|
48
48
|
## Documentation
|
|
49
|
-
You can find documentation on API [here](https://docs.regulaforensics.com/react-native).
|
|
49
|
+
You can find documentation on API [here](https://docs.regulaforensics.com/develop/doc-reader-sdk/mobile/react-native).
|
|
50
50
|
|
|
51
51
|
## Additional information
|
|
52
52
|
If you have any technical questions, feel free to [contact](mailto:react.support@regulaforensics.com) us or create issue [here](https://github.com/regulaforensics/react-native-document-reader/issues).
|
|
@@ -12,8 +12,8 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.homepage = 'https://regulaforensics.com'
|
|
13
13
|
|
|
14
14
|
s.source = { :http => 'file:' + __dir__ }
|
|
15
|
-
s.ios.deployment_target = '
|
|
15
|
+
s.ios.deployment_target = '11.0'
|
|
16
16
|
s.source_files = "ios/*.{h,m}"
|
|
17
|
-
s.dependency 'DocumentReader', '
|
|
17
|
+
s.dependency 'DocumentReader', '6.1.2358'
|
|
18
18
|
s.dependency 'React'
|
|
19
19
|
end
|
package/android/build.gradle
CHANGED
|
@@ -16,7 +16,7 @@ android {
|
|
|
16
16
|
buildToolsVersion "30.0.0"
|
|
17
17
|
|
|
18
18
|
defaultConfig {
|
|
19
|
-
minSdkVersion
|
|
19
|
+
minSdkVersion 21
|
|
20
20
|
targetSdkVersion 30
|
|
21
21
|
versionCode 1
|
|
22
22
|
versionName "1.0"
|
|
@@ -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:
|
|
52
|
+
implementation('com.regula.documentreader:api:6.1.6564') {
|
|
53
53
|
transitive = true
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -24,9 +24,7 @@ import java.util.List;
|
|
|
24
24
|
class Helpers {
|
|
25
25
|
static Bitmap bitmapFromBase64(String base64) {
|
|
26
26
|
byte[] decodedString = Base64.decode(base64, Base64.DEFAULT);
|
|
27
|
-
|
|
28
|
-
options.inPreferredConfig = Bitmap.Config.RGB_565;
|
|
29
|
-
Bitmap result = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length, options);
|
|
27
|
+
Bitmap result = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
|
|
30
28
|
int sizeMultiplier = result.getByteCount() / 5000000;
|
|
31
29
|
if (result.getByteCount() > 5000000)
|
|
32
30
|
result = Bitmap.createScaledBitmap(result, result.getWidth() / (int) Math.sqrt(sizeMultiplier), result.getHeight() / (int) Math.sqrt(sizeMultiplier), false);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
package com.regula.documentreader;
|
|
2
2
|
|
|
3
|
+
import static com.regula.documentreader.api.completions.IRfidNotificationCompletion.RFID_EXTRA_ERROR_CODE;
|
|
4
|
+
|
|
3
5
|
import android.content.Context;
|
|
4
6
|
import android.graphics.Bitmap;
|
|
5
7
|
import android.graphics.BitmapFactory;
|
|
6
8
|
import android.graphics.Rect;
|
|
9
|
+
import android.os.Bundle;
|
|
7
10
|
import android.util.Base64;
|
|
8
11
|
|
|
9
12
|
import com.regula.documentreader.api.enums.DocReaderAction;
|
|
@@ -11,11 +14,13 @@ import com.regula.documentreader.api.enums.PDF417Info;
|
|
|
11
14
|
import com.regula.documentreader.api.enums.eGraphicFieldType;
|
|
12
15
|
import com.regula.documentreader.api.enums.eRPRM_Lights;
|
|
13
16
|
import com.regula.documentreader.api.errors.DocumentReaderException;
|
|
17
|
+
import com.regula.documentreader.api.internal.core.CoreDetailedScenario;
|
|
14
18
|
import com.regula.documentreader.api.params.FaceMetaData;
|
|
15
19
|
import com.regula.documentreader.api.params.rfid.authorization.PAAttribute;
|
|
16
20
|
import com.regula.documentreader.api.params.rfid.authorization.PAResourcesIssuer;
|
|
17
21
|
import com.regula.documentreader.api.params.rfid.authorization.TAChallenge;
|
|
18
22
|
import com.regula.documentreader.api.results.Bounds;
|
|
23
|
+
import com.regula.documentreader.api.results.BytesData;
|
|
19
24
|
import com.regula.documentreader.api.results.Coordinate;
|
|
20
25
|
import com.regula.documentreader.api.results.DocReaderFieldRect;
|
|
21
26
|
import com.regula.documentreader.api.results.DocumentReaderBarcodeField;
|
|
@@ -25,14 +30,15 @@ import com.regula.documentreader.api.results.DocumentReaderGraphicField;
|
|
|
25
30
|
import com.regula.documentreader.api.results.DocumentReaderGraphicResult;
|
|
26
31
|
import com.regula.documentreader.api.results.DocumentReaderNotification;
|
|
27
32
|
import com.regula.documentreader.api.results.DocumentReaderResults;
|
|
33
|
+
import com.regula.documentreader.api.results.DocumentReaderResultsStatus;
|
|
28
34
|
import com.regula.documentreader.api.results.DocumentReaderScenario;
|
|
29
|
-
import com.regula.documentreader.api.results.DocumentReaderScenarioFull;
|
|
30
35
|
import com.regula.documentreader.api.results.DocumentReaderTextField;
|
|
31
36
|
import com.regula.documentreader.api.results.DocumentReaderTextResult;
|
|
32
37
|
import com.regula.documentreader.api.results.DocumentReaderValue;
|
|
33
38
|
import com.regula.documentreader.api.results.ElementPosition;
|
|
34
39
|
import com.regula.documentreader.api.results.ImageQuality;
|
|
35
40
|
import com.regula.documentreader.api.results.ImageQualityGroup;
|
|
41
|
+
import com.regula.documentreader.api.results.VDSNCData;
|
|
36
42
|
import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityCheck;
|
|
37
43
|
import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityElement;
|
|
38
44
|
import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityResult;
|
|
@@ -294,6 +300,18 @@ class JSONConstructor {
|
|
|
294
300
|
return result;
|
|
295
301
|
}
|
|
296
302
|
|
|
303
|
+
static JSONObject generateRfidNotificationCompletion(int notification, Bundle value) {
|
|
304
|
+
JSONObject result = new JSONObject();
|
|
305
|
+
try {
|
|
306
|
+
result.put("notification", notification);
|
|
307
|
+
if(value != null)
|
|
308
|
+
result.put("value", value.get(RFID_EXTRA_ERROR_CODE));
|
|
309
|
+
} catch (JSONException ignored) {
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
314
|
+
|
|
297
315
|
static JSONObject generatePACertificateCompletion(byte[] serialNumber, PAResourcesIssuer issuer) {
|
|
298
316
|
JSONObject result = new JSONObject();
|
|
299
317
|
try {
|
|
@@ -335,8 +353,6 @@ class JSONConstructor {
|
|
|
335
353
|
JSONObject result = new JSONObject();
|
|
336
354
|
if (input == null) return result;
|
|
337
355
|
try {
|
|
338
|
-
result.put("uvTorch", input.uvTorch);
|
|
339
|
-
result.put("seriesProcessMode", input.seriesProcessMode);
|
|
340
356
|
result.put("name", input.name);
|
|
341
357
|
result.put("caption", input.caption);
|
|
342
358
|
result.put("description", input.description);
|
|
@@ -346,7 +362,7 @@ class JSONConstructor {
|
|
|
346
362
|
return result;
|
|
347
363
|
}
|
|
348
364
|
|
|
349
|
-
static JSONObject
|
|
365
|
+
static JSONObject generateCoreDetailedScenario(CoreDetailedScenario input) {
|
|
350
366
|
JSONObject result = new JSONObject();
|
|
351
367
|
if (input == null) return result;
|
|
352
368
|
try {
|
|
@@ -1039,6 +1055,92 @@ class JSONConstructor {
|
|
|
1039
1055
|
return result;
|
|
1040
1056
|
}
|
|
1041
1057
|
|
|
1058
|
+
static JSONObject generateDocumentReaderResultsStatus(DocumentReaderResultsStatus input) {
|
|
1059
|
+
JSONObject result = new JSONObject();
|
|
1060
|
+
if (input == null) return result;
|
|
1061
|
+
try {
|
|
1062
|
+
result.put("overallStatus", input.getOverallStatus());
|
|
1063
|
+
result.put("optical", input.getOptical());
|
|
1064
|
+
result.put("detailsOptical", generateDetailsOptical(input.getDetailsOptical()));
|
|
1065
|
+
result.put("rfid", input.getRfid());
|
|
1066
|
+
result.put("detailsRFID", generateDetailsRFID(input.getDetailsRFID()));
|
|
1067
|
+
result.put("portrait", input.getPortrait());
|
|
1068
|
+
result.put("stopList", input.getStopList());
|
|
1069
|
+
} catch (JSONException e) {
|
|
1070
|
+
e.printStackTrace();
|
|
1071
|
+
}
|
|
1072
|
+
return result;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
static JSONObject generateDetailsOptical(DocumentReaderResultsStatus.DetailsOptical input) {
|
|
1076
|
+
JSONObject result = new JSONObject();
|
|
1077
|
+
if (input == null) return result;
|
|
1078
|
+
try {
|
|
1079
|
+
result.put("overallStatus", input.getOverallStatus());
|
|
1080
|
+
result.put("mrz", input.getMrz());
|
|
1081
|
+
result.put("text", input.getText());
|
|
1082
|
+
result.put("docType", input.getDocType());
|
|
1083
|
+
result.put("security", input.getSecurity());
|
|
1084
|
+
result.put("imageQA", input.getImageQA());
|
|
1085
|
+
result.put("expiry", input.getExpiry());
|
|
1086
|
+
result.put("vds", input.getVds());
|
|
1087
|
+
result.put("pagesCount", input.getPagesCount());
|
|
1088
|
+
} catch (JSONException e) {
|
|
1089
|
+
e.printStackTrace();
|
|
1090
|
+
}
|
|
1091
|
+
return result;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
static JSONObject generateDetailsRFID(DocumentReaderResultsStatus.DetailsRFID input) {
|
|
1095
|
+
JSONObject result = new JSONObject();
|
|
1096
|
+
if (input == null) return result;
|
|
1097
|
+
try {
|
|
1098
|
+
result.put("pa", input.getPA());
|
|
1099
|
+
result.put("ca", input.getCA());
|
|
1100
|
+
result.put("aa", input.getAA());
|
|
1101
|
+
result.put("ta", input.getTA());
|
|
1102
|
+
result.put("bac", input.getBAC());
|
|
1103
|
+
result.put("pace", input.getPACE());
|
|
1104
|
+
result.put("overallStatus", input.getOverallStatus());
|
|
1105
|
+
} catch (JSONException e) {
|
|
1106
|
+
e.printStackTrace();
|
|
1107
|
+
}
|
|
1108
|
+
return result;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
static JSONObject generateVDSNCData(VDSNCData input) {
|
|
1112
|
+
JSONObject result = new JSONObject();
|
|
1113
|
+
if (input == null) return result;
|
|
1114
|
+
try {
|
|
1115
|
+
result.put("type", input.getType());
|
|
1116
|
+
result.put("version", input.getVersion());
|
|
1117
|
+
result.put("issuingCountry", input.getIssuingCountry());
|
|
1118
|
+
result.put("message", input.getMessage());
|
|
1119
|
+
result.put("signatureAlgorithm", input.getSignatureAlg());
|
|
1120
|
+
result.put("signature", generateBytesData(input.getSignature()));
|
|
1121
|
+
result.put("certificate", generateBytesData(input.getCertificate()));
|
|
1122
|
+
result.put("certificateChain", generateList(input.getCertificateChain(), JSONConstructor::generateCertificateChain));
|
|
1123
|
+
result.put("notifications", generateLongArray(input.getNotifications()));
|
|
1124
|
+
} catch (JSONException e) {
|
|
1125
|
+
e.printStackTrace();
|
|
1126
|
+
}
|
|
1127
|
+
return result;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
static JSONObject generateBytesData(BytesData input) {
|
|
1131
|
+
JSONObject result = new JSONObject();
|
|
1132
|
+
if (input == null) return result;
|
|
1133
|
+
try {
|
|
1134
|
+
result.put("data", input.getData());
|
|
1135
|
+
result.put("length", input.getLength());
|
|
1136
|
+
result.put("status", input.getStatus());
|
|
1137
|
+
result.put("type", input.getType());
|
|
1138
|
+
} catch (JSONException e) {
|
|
1139
|
+
e.printStackTrace();
|
|
1140
|
+
}
|
|
1141
|
+
return result;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1042
1144
|
static JSONObject generateDocumentReaderResults(DocumentReaderResults input, Context context) {
|
|
1043
1145
|
JSONObject result = new JSONObject();
|
|
1044
1146
|
if (input == null) return result;
|
|
@@ -1063,6 +1165,8 @@ class JSONConstructor {
|
|
|
1063
1165
|
result.put("authenticityResult", generateDocumentReaderAuthenticityResult(input.authenticityResult, context));
|
|
1064
1166
|
result.put("barcodeResult", generateDocumentReaderBarcodeResult(input.barcodeResult));
|
|
1065
1167
|
result.put("documentType", generateList(input.documentType, JSONConstructor::generateDocumentReaderDocumentType));
|
|
1168
|
+
result.put("status", generateDocumentReaderResultsStatus(input.status));
|
|
1169
|
+
result.put("vdsncData", generateVDSNCData(input.vdsncData));
|
|
1066
1170
|
} catch (JSONException e) {
|
|
1067
1171
|
e.printStackTrace();
|
|
1068
1172
|
}
|
|
@@ -1074,10 +1178,6 @@ class JSONConstructor {
|
|
|
1074
1178
|
static DocumentReaderScenario DocumentReaderScenarioFromJSON(JSONObject input) {
|
|
1075
1179
|
try {
|
|
1076
1180
|
DocumentReaderScenario result = new DocumentReaderScenario();
|
|
1077
|
-
if (input.has("uvTorch"))
|
|
1078
|
-
result.uvTorch = input.getBoolean("uvTorch");
|
|
1079
|
-
if (input.has("seriesProcessMode"))
|
|
1080
|
-
result.seriesProcessMode = input.getBoolean("seriesProcessMode");
|
|
1081
1181
|
if (input.has("name"))
|
|
1082
1182
|
result.name = input.getString("name");
|
|
1083
1183
|
if (input.has("caption"))
|
|
@@ -1091,9 +1191,9 @@ class JSONConstructor {
|
|
|
1091
1191
|
return null;
|
|
1092
1192
|
}
|
|
1093
1193
|
|
|
1094
|
-
static
|
|
1194
|
+
static CoreDetailedScenario CoreDetailedScenarioFromJSON(JSONObject input) {
|
|
1095
1195
|
try {
|
|
1096
|
-
|
|
1196
|
+
CoreDetailedScenario result = new CoreDetailedScenario();
|
|
1097
1197
|
if (input.has("uvTorch"))
|
|
1098
1198
|
result.uvTorch = input.getBoolean("uvTorch");
|
|
1099
1199
|
if (input.has("frameOrientation"))
|
|
@@ -9,6 +9,7 @@ import android.content.IntentFilter;
|
|
|
9
9
|
import android.graphics.Bitmap;
|
|
10
10
|
import android.nfc.NfcAdapter;
|
|
11
11
|
import android.nfc.tech.IsoDep;
|
|
12
|
+
import android.os.Bundle;
|
|
12
13
|
import android.util.Base64;
|
|
13
14
|
|
|
14
15
|
import com.facebook.react.bridge.ActivityEventListener;
|
|
@@ -24,12 +25,12 @@ import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
|
24
25
|
import com.regula.documentreader.api.completions.IDocumentReaderCompletion;
|
|
25
26
|
import com.regula.documentreader.api.completions.IDocumentReaderInitCompletion;
|
|
26
27
|
import com.regula.documentreader.api.completions.IDocumentReaderPrepareCompletion;
|
|
27
|
-
import com.regula.documentreader.api.completions.IRfidNotificationCompletion;
|
|
28
28
|
import com.regula.documentreader.api.completions.IRfidPKDCertificateCompletion;
|
|
29
29
|
import com.regula.documentreader.api.completions.IRfidReaderRequest;
|
|
30
30
|
import com.regula.documentreader.api.completions.IRfidTASignatureCompletion;
|
|
31
31
|
import com.regula.documentreader.api.enums.DocReaderAction;
|
|
32
32
|
import com.regula.documentreader.api.errors.DocumentReaderException;
|
|
33
|
+
import com.regula.documentreader.api.internal.core.CoreScenarioUtil;
|
|
33
34
|
import com.regula.documentreader.api.params.DocReaderConfig;
|
|
34
35
|
import com.regula.documentreader.api.params.ImageInputParam;
|
|
35
36
|
import com.regula.documentreader.api.params.rfid.PKDCertificate;
|
|
@@ -139,8 +140,8 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
139
140
|
send(videoEncoderCompletionEvent, JSONConstructor.generateVideoEncoderCompletion(sessionId, file).toString());
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
private void sendIRfidNotificationCompletion(int notification) {
|
|
143
|
-
send(rfidNotificationCompletionEvent, notification
|
|
143
|
+
private void sendIRfidNotificationCompletion(int notification, Bundle value) {
|
|
144
|
+
send(rfidNotificationCompletionEvent, JSONConstructor.generateRfidNotificationCompletion(notification, value).toString());
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
private void sendPACertificateCompletion(byte[] serialNumber, PAResourcesIssuer issuer) {
|
|
@@ -481,11 +482,11 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
481
482
|
}
|
|
482
483
|
|
|
483
484
|
private void selectedScenario(Callback callback) {
|
|
484
|
-
callback.success(JSONConstructor.
|
|
485
|
+
callback.success(JSONConstructor.generateCoreDetailedScenario(CoreScenarioUtil.getScenario(Instance().processParams().getScenario())).toString());
|
|
485
486
|
}
|
|
486
487
|
|
|
487
488
|
private void getScenario(Callback callback, String scenario) {
|
|
488
|
-
callback.success(JSONConstructor.
|
|
489
|
+
callback.success(JSONConstructor.generateCoreDetailedScenario(CoreScenarioUtil.getScenario(scenario)).toString());
|
|
489
490
|
}
|
|
490
491
|
|
|
491
492
|
private void getLicenseExpiryDate(Callback callback) {
|
|
@@ -633,7 +634,7 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
633
634
|
delegate = getIRfidReaderRequestNoPA();
|
|
634
635
|
if (rfidDelegate == RFIDDelegate.FULL)
|
|
635
636
|
delegate = getIRfidReaderRequest();
|
|
636
|
-
Instance().startRFIDReader(getContext(), getCompletion(), delegate,
|
|
637
|
+
Instance().startRFIDReader(getContext(), getCompletion(), delegate, this::sendIRfidNotificationCompletion);
|
|
637
638
|
}
|
|
638
639
|
|
|
639
640
|
private void stopRFIDReader(Callback callback) {
|
|
@@ -741,7 +742,7 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
741
742
|
private IDocumentReaderCompletion getCompletion() {
|
|
742
743
|
return (action, results, error) -> {
|
|
743
744
|
sendCompletion(action, results, error);
|
|
744
|
-
if (action == DocReaderAction.ERROR || action == DocReaderAction.CANCEL || (action == DocReaderAction.COMPLETE && results.rfidResult == 1))
|
|
745
|
+
if (action == DocReaderAction.ERROR || action == DocReaderAction.CANCEL || (action == DocReaderAction.COMPLETE && results != null && results.rfidResult == 1))
|
|
745
746
|
stopBackgroundRFID();
|
|
746
747
|
};
|
|
747
748
|
}
|
|
@@ -828,9 +829,4 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
828
829
|
public static final int NO_PA = 1;
|
|
829
830
|
public static final int FULL = 2;
|
|
830
831
|
}
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
private IRfidNotificationCompletion getIRfidNotificationCompletion() {
|
|
834
|
-
return (notificationType, value) -> sendIRfidNotificationCompletion(notificationType);
|
|
835
|
-
}
|
|
836
832
|
}
|
|
@@ -209,6 +209,8 @@ class RegulaConfig {
|
|
|
209
209
|
processParams.forceReadMrzBeforeLocate = opts.getBoolean("forceReadMrzBeforeLocate");
|
|
210
210
|
if (opts.has("parseBarcodes"))
|
|
211
211
|
processParams.parseBarcodes = opts.getBoolean("parseBarcodes");
|
|
212
|
+
if (opts.has("shouldReturnPackageForReprocess"))
|
|
213
|
+
processParams.shouldReturnPackageForReprocess = opts.getBoolean("shouldReturnPackageForReprocess");
|
|
212
214
|
}
|
|
213
215
|
|
|
214
216
|
private static void setCustomization(ParamsCustomization customization, JSONObject opts, Context context) throws JSONException {
|
|
@@ -477,6 +479,7 @@ class RegulaConfig {
|
|
|
477
479
|
object.put("mrzFormatsFilter", processParams.mrzFormatsFilter != null ? generateArray(processParams.mrzFormatsFilter) : null);
|
|
478
480
|
object.put("forceReadMrzBeforeLocate", processParams.forceReadMrzBeforeLocate);
|
|
479
481
|
object.put("parseBarcodes", processParams.parseBarcodes);
|
|
482
|
+
object.put("shouldReturnPackageForReprocess", processParams.shouldReturnPackageForReprocess);
|
|
480
483
|
|
|
481
484
|
return object;
|
|
482
485
|
}
|
package/example/.flowconfig
CHANGED
|
@@ -8,10 +8,6 @@
|
|
|
8
8
|
; Ignore polyfills
|
|
9
9
|
node_modules/react-native/Libraries/polyfills/.*
|
|
10
10
|
|
|
11
|
-
; These should not be required directly
|
|
12
|
-
; require from fbjs/lib instead: require('fbjs/lib/warning')
|
|
13
|
-
node_modules/warning/.*
|
|
14
|
-
|
|
15
11
|
; Flow doesn't support platforms
|
|
16
12
|
.*/Libraries/Utilities/LoadingView.js
|
|
17
13
|
|
|
@@ -27,8 +23,9 @@ node_modules/react-native/flow/
|
|
|
27
23
|
[options]
|
|
28
24
|
emoji=true
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
exact_by_default=true
|
|
27
|
+
|
|
28
|
+
format.bracket_spacing=false
|
|
32
29
|
|
|
33
30
|
module.file_ext=.js
|
|
34
31
|
module.file_ext=.json
|
|
@@ -44,10 +41,6 @@ suppress_type=$FlowFixMe
|
|
|
44
41
|
suppress_type=$FlowFixMeProps
|
|
45
42
|
suppress_type=$FlowFixMeState
|
|
46
43
|
|
|
47
|
-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
|
|
48
|
-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
|
|
49
|
-
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
|
|
50
|
-
|
|
51
44
|
[lints]
|
|
52
45
|
sketchy-null-number=warn
|
|
53
46
|
sketchy-null-mixed=warn
|
|
@@ -56,10 +49,8 @@ untyped-type-import=warn
|
|
|
56
49
|
nonstrict-import=warn
|
|
57
50
|
deprecated-type=warn
|
|
58
51
|
unsafe-getters-setters=warn
|
|
59
|
-
inexact-spread=warn
|
|
60
52
|
unnecessary-invariant=warn
|
|
61
53
|
signature-verification-failure=warn
|
|
62
|
-
deprecated-utility=error
|
|
63
54
|
|
|
64
55
|
[strict]
|
|
65
56
|
deprecated-type
|
|
@@ -71,4 +62,4 @@ untyped-import
|
|
|
71
62
|
untyped-type-import
|
|
72
63
|
|
|
73
64
|
[version]
|
|
74
|
-
^0.
|
|
65
|
+
^0.158.0
|
package/example/.gitattributes
CHANGED
package/example/.prettierrc.js
CHANGED
package/example/App.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React, { Component } from 'react'
|
|
2
2
|
import { StyleSheet, View, Button, Text, Image, ScrollView, NativeEventEmitter, Platform, TouchableOpacity } from 'react-native'
|
|
3
|
-
import DocumentReader, { Enum, DocumentReaderCompletion, DocumentReaderScenario,RNRegulaDocumentReader } from '@regulaforensics/react-native-document-reader-api'
|
|
3
|
+
import DocumentReader, { Enum, DocumentReaderCompletion, DocumentReaderScenario, RNRegulaDocumentReader } from '@regulaforensics/react-native-document-reader-api'
|
|
4
4
|
import * as RNFS from 'react-native-fs'
|
|
5
5
|
import RadioGroup from 'react-native-radio-buttons-group'
|
|
6
|
-
import
|
|
6
|
+
import { launchCamera, launchImageLibrary } from 'react-native-image-picker';
|
|
7
7
|
import * as Progress from 'react-native-progress'
|
|
8
8
|
import CheckBox from 'react-native-check-box'
|
|
9
|
+
import { LogBox } from 'react-native';
|
|
9
10
|
|
|
11
|
+
LogBox.ignoreLogs(['new NativeEventEmitter']);
|
|
10
12
|
const eventManager = new NativeEventEmitter(RNRegulaDocumentReader)
|
|
11
13
|
|
|
12
14
|
var licPath = Platform.OS === 'ios' ? (RNFS.MainBundlePath + "/regula.license") : "regula.license"
|
|
@@ -63,14 +65,14 @@ export default class App extends Component {
|
|
|
63
65
|
for (var i in scenariosTemp) {
|
|
64
66
|
scenariosL.push({
|
|
65
67
|
label: DocumentReaderScenario.fromJson(typeof scenariosTemp[i] === "string" ? JSON.parse(scenariosTemp[i]) : scenariosTemp[i]).name,
|
|
66
|
-
|
|
68
|
+
id: i
|
|
67
69
|
})
|
|
68
70
|
}
|
|
69
71
|
this.setState({ scenarios: scenariosL })
|
|
70
72
|
this.setState({ selectedScenario: this.state.scenarios[0]['label'] })
|
|
71
73
|
this.setState({ radio: null })
|
|
72
74
|
this.setState({
|
|
73
|
-
radio: <RadioGroup
|
|
75
|
+
radio: <RadioGroup containerStyle={styles.radio} radioButtons={this.state.scenarios} onPress={(data) => {
|
|
74
76
|
var selectedItem
|
|
75
77
|
for (var index in data)
|
|
76
78
|
if (data[index]['selected'])
|
|
@@ -81,7 +83,7 @@ export default class App extends Component {
|
|
|
81
83
|
DocumentReader.getDocumentReaderIsReady((isReady) => {
|
|
82
84
|
if (isReady) {
|
|
83
85
|
this.setState({ fullName: "Ready" })
|
|
84
|
-
DocumentReader.setRfidDelegate(Enum.RFIDDelegate.NO_PA, (r) => {}, error => console.log(error))
|
|
86
|
+
DocumentReader.setRfidDelegate(Enum.RFIDDelegate.NO_PA, (r) => { }, error => console.log(error))
|
|
85
87
|
// addCertificates()
|
|
86
88
|
} else
|
|
87
89
|
this.setState({ fullName: "Failed" })
|
|
@@ -100,7 +102,7 @@ export default class App extends Component {
|
|
|
100
102
|
selectedScenario: "",
|
|
101
103
|
portrait: require('./images/portrait.png'),
|
|
102
104
|
docFront: require('./images/id.png'),
|
|
103
|
-
radio: <RadioGroup
|
|
105
|
+
radio: <RadioGroup containerStyle={styles.radio} radioButtons={[{ label: 'Loading', id: 0 }]} onPress={null} />
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
108
|
|
|
@@ -221,7 +223,7 @@ export default class App extends Component {
|
|
|
221
223
|
padding: 5,
|
|
222
224
|
}}>
|
|
223
225
|
Portrait
|
|
224
|
-
|
|
226
|
+
</Text>
|
|
225
227
|
<Image
|
|
226
228
|
style={{
|
|
227
229
|
height: 150,
|
|
@@ -238,7 +240,7 @@ export default class App extends Component {
|
|
|
238
240
|
padding: 5,
|
|
239
241
|
}}>
|
|
240
242
|
Document image
|
|
241
|
-
|
|
243
|
+
</Text>
|
|
242
244
|
<Image
|
|
243
245
|
style={{
|
|
244
246
|
height: 150,
|
|
@@ -250,7 +252,7 @@ export default class App extends Component {
|
|
|
250
252
|
</View>
|
|
251
253
|
</View>
|
|
252
254
|
|
|
253
|
-
<ScrollView style={{ padding: 5, alignSelf: '
|
|
255
|
+
<ScrollView style={{ padding: 5, alignSelf: 'center' }} showsVerticalScrollIndicator={false}>
|
|
254
256
|
{this.state.radio}
|
|
255
257
|
</ScrollView>
|
|
256
258
|
|
|
@@ -295,12 +297,21 @@ export default class App extends Component {
|
|
|
295
297
|
<Text style={{ padding: 5 }}></Text>
|
|
296
298
|
<Button color="#4285F4"
|
|
297
299
|
onPress={() => {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
300
|
+
launchImageLibrary({
|
|
301
|
+
mediaType: 'photo',
|
|
302
|
+
includeBase64: true,
|
|
303
|
+
selectionLimit: 10
|
|
304
|
+
}, r => {
|
|
305
|
+
if (r.errorCode != null) {
|
|
306
|
+
console.log("error code: " + r.errorCode)
|
|
307
|
+
console.log("error message: " + r.errorMessage)
|
|
308
|
+
this.setState({ fullName: r.errorMessage })
|
|
309
|
+
return
|
|
310
|
+
}
|
|
311
|
+
if (r.didCancel) return
|
|
312
|
+
this.clearResults()
|
|
313
|
+
this.setState({ fullName: "COPYING IMAGE..." })
|
|
314
|
+
var response = r.assets
|
|
304
315
|
DocumentReader.setConfig({
|
|
305
316
|
functionality: {
|
|
306
317
|
videoCaptureMotionControl: true,
|
|
@@ -319,12 +330,10 @@ export default class App extends Component {
|
|
|
319
330
|
var images = []
|
|
320
331
|
|
|
321
332
|
for (var i = 0; i < response.length; i++) {
|
|
322
|
-
images.push(response[i].
|
|
333
|
+
images.push(response[i].base64)
|
|
323
334
|
}
|
|
324
335
|
this.setState({ fullName: "PROCESSING..." })
|
|
325
336
|
DocumentReader.recognizeImages(images, s => { }, e => console.log(e))
|
|
326
|
-
}).catch(e => {
|
|
327
|
-
console.log("ImagePicker: " + e)
|
|
328
337
|
})
|
|
329
338
|
}}
|
|
330
339
|
title=" Scan image "
|
|
@@ -347,6 +356,9 @@ const styles = StyleSheet.create({
|
|
|
347
356
|
backgroundColor: '#F5FCFF',
|
|
348
357
|
marginBottom: 12,
|
|
349
358
|
},
|
|
359
|
+
radio: {
|
|
360
|
+
alignItems: 'flex-start'
|
|
361
|
+
},
|
|
350
362
|
welcome: {
|
|
351
363
|
fontSize: 20,
|
|
352
364
|
textAlign: 'center',
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# To learn about Buck see [Docs](https://buckbuild.com/).
|
|
2
|
+
# To run your application with Buck:
|
|
3
|
+
# - install Buck
|
|
4
|
+
# - `npm start` - to start the packager
|
|
5
|
+
# - `cd android`
|
|
6
|
+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
|
|
7
|
+
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
|
|
8
|
+
# - `buck install -r android/app` - compile, install and run application
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
|
|
12
|
+
|
|
13
|
+
lib_deps = []
|
|
14
|
+
|
|
15
|
+
create_aar_targets(glob(["libs/*.aar"]))
|
|
16
|
+
|
|
17
|
+
create_jar_targets(glob(["libs/*.jar"]))
|
|
18
|
+
|
|
19
|
+
android_library(
|
|
20
|
+
name = "all-libs",
|
|
21
|
+
exported_deps = lib_deps,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
android_library(
|
|
25
|
+
name = "app-code",
|
|
26
|
+
srcs = glob([
|
|
27
|
+
"src/main/java/**/*.java",
|
|
28
|
+
]),
|
|
29
|
+
deps = [
|
|
30
|
+
":all-libs",
|
|
31
|
+
":build_config",
|
|
32
|
+
":res",
|
|
33
|
+
],
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
android_build_config(
|
|
37
|
+
name = "build_config",
|
|
38
|
+
package = "com.regula.dr.fullrfid",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
android_resource(
|
|
42
|
+
name = "res",
|
|
43
|
+
package = "com.regula.dr.fullrfid",
|
|
44
|
+
res = "src/main/res",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
android_binary(
|
|
48
|
+
name = "app",
|
|
49
|
+
keystore = "//android/keystores:debug",
|
|
50
|
+
manifest = "src/main/AndroidManifest.xml",
|
|
51
|
+
package_type = "debug",
|
|
52
|
+
deps = [
|
|
53
|
+
":app-code",
|
|
54
|
+
],
|
|
55
|
+
)
|