@regulaforensics/react-native-document-reader-api 6.4.0 → 6.6.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 +4 -29
- package/android/src/main/AndroidManifest.xml +5 -1
- package/android/src/main/java/com/regula/documentreader/BluetoothUtil.kt +108 -0
- package/android/src/main/java/com/regula/documentreader/Helpers.java +5 -6
- package/android/src/main/java/com/regula/documentreader/JSONConstructor.java +171 -1389
- package/android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.java +111 -26
- package/android/src/main/java/com/regula/documentreader/RegulaConfig.java +68 -7
- package/example/App.js +170 -168
- package/example/android/app/build.gradle +0 -6
- package/example/android/app/src/main/AndroidManifest.xml +2 -0
- package/example/android/build.gradle +5 -10
- package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/example/ios/Podfile +8 -0
- package/example/metro.config.js +10 -8
- package/example/package.json +2 -2
- package/index.d.ts +3552 -3393
- package/index.js +3361 -3247
- package/ios/RGLWJSONConstructor.h +7 -0
- package/ios/RGLWJSONConstructor.m +124 -4
- package/ios/RNRegulaDocumentReader.m +85 -35
- package/ios/RegulaConfig.m +62 -7
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
+(NSMutableDictionary* _Nonnull)generateNSDictionary:(NSDictionary<NSNumber*, NSNumber*>* _Nullable)input;
|
|
13
13
|
+(RGLPKDCertificate* _Nullable)RGLPKDCertificateFromJson:(NSDictionary* _Nullable) dict;
|
|
14
14
|
+(RGLTCCParams* _Nonnull)RGLTCCParamsFromJson:(NSDictionary* _Nonnull)input;
|
|
15
|
+
+(RGLConfig* _Nullable)RGLConfigFromJson:(NSDictionary* _Nonnull)input;
|
|
15
16
|
+(RGLImageInput* _Nonnull)RGLImageInputFromJson:(NSDictionary* _Nonnull)input;
|
|
16
17
|
+(NSInteger)generateDocReaderAction:(RGLDocReaderAction)action;
|
|
17
18
|
+(NSInteger)generateRFIDCompleteAction:(RGLRFIDCompleteAction)action;
|
|
@@ -64,6 +65,12 @@
|
|
|
64
65
|
+(NSMutableDictionary* _Nonnull)generateRGLBytesData:(RGLBytesData* _Nullable)input;
|
|
65
66
|
+(NSMutableDictionary* _Nonnull)generateRGLRFIDNotify:(RGLRFIDNotify* _Nullable)input;
|
|
66
67
|
+(NSMutableDictionary* _Nonnull)generateRGLUVFiberElement:(RGLUVFiberElement* _Nullable)input;
|
|
68
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocReaderDocumentsDatabase:(RGLDocReaderDocumentsDatabase* _Nullable)input;
|
|
69
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderComparison:(RGLDocumentReaderComparison* _Nullable)input;
|
|
70
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderValidity:(RGLDocumentReaderValidity* _Nullable)input;
|
|
71
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderSymbol:(RGLDocumentReaderSymbol* _Nullable)input;
|
|
72
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderTextSource:(RGLDocumentReaderTextSource* _Nullable)input;
|
|
73
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderRfidOrigin:(RGLDocumentReaderRfidOrigin* _Nullable)input;
|
|
67
74
|
+(NSMutableDictionary* _Nonnull)generateRGLElementRect:(RGLElementRect* _Nullable)input;
|
|
68
75
|
|
|
69
76
|
@end
|
|
@@ -35,6 +35,28 @@
|
|
|
35
35
|
return [[RGLTCCParams alloc] initWithServiceTAURLString:serviceTAURLString servicePAURLString:servicePAURLString pfxCertURLString:pfxCertURLString pfxCertData: pfxCertData pfxPassPhrase:pfxPassPhrase];
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
+(RGLConfig*)RGLConfigFromJson:(NSDictionary*)input {
|
|
39
|
+
NSData* license;
|
|
40
|
+
if([input valueForKey:@"license"] != nil)
|
|
41
|
+
license = [[NSData alloc] initWithBase64EncodedString:[input valueForKey:@"license"] options:0];
|
|
42
|
+
else return nil;
|
|
43
|
+
|
|
44
|
+
RGLConfig *config = [[RGLConfig alloc] initWithLicenseData:license];
|
|
45
|
+
|
|
46
|
+
if([input valueForKey:@"databasePath"] != nil){
|
|
47
|
+
config.databasePath = [[input valueForKey:@"databasePath"] stringValue];
|
|
48
|
+
}
|
|
49
|
+
if([input valueForKey:@"licenseUpdate"] != nil){
|
|
50
|
+
config.licenseUpdateCheck = [[input valueForKey:@"licenseUpdate"] boolValue];
|
|
51
|
+
}
|
|
52
|
+
if([input valueForKey:@"delayedNNLoad"] != nil){
|
|
53
|
+
config.delayedNNLoadEnabled = [[input valueForKey:@"delayedNNLoad"] boolValue];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return config;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
38
60
|
+(RGLImageInput*)RGLImageInputFromJson:(NSDictionary*)input {
|
|
39
61
|
NSInteger pageIndex = 0;
|
|
40
62
|
if([input valueForKey:@"pageIndex"] != nil)
|
|
@@ -294,11 +316,9 @@
|
|
|
294
316
|
[array addObject:[self generateRGLImageQualityGroup:item]];
|
|
295
317
|
result[@"imageQuality"] = array;
|
|
296
318
|
}
|
|
297
|
-
result[@"overallResult"] = @(input.overallResult);
|
|
298
319
|
result[@"authenticityResult"] = [self generateRGLDocumentReaderAuthenticityResult:input.authenticityResults];
|
|
299
320
|
result[@"rfidSessionData"] = [self generateRGLRFIDSessionData:input.rfidSessionData];
|
|
300
321
|
result[@"chipPage"] = @(input.chipPage);
|
|
301
|
-
result[@"resolutionType"] = @(input.resolutionType);
|
|
302
322
|
result[@"barcodeResult"] = [self generateRGLDocumentReaderBarcodeResult:input.barcodeResult];
|
|
303
323
|
result[@"processingFinishedStatus"] = @(input.processingFinishedStatus);
|
|
304
324
|
result[@"morePagesAvailable"] = @(input.morePagesAvailable);
|
|
@@ -494,6 +514,15 @@
|
|
|
494
514
|
result[@"fields"] = array;
|
|
495
515
|
}
|
|
496
516
|
result[@"status"] = @(input.status);
|
|
517
|
+
result[@"comparisonStatus"] = @(input.comparisonStatus);
|
|
518
|
+
result[@"validityStatus"] = @(input.validityStatus);
|
|
519
|
+
if(input.availableSourceList != nil){
|
|
520
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
521
|
+
for(RGLDocumentReaderTextSource* item in input.availableSourceList)
|
|
522
|
+
if(item != nil)
|
|
523
|
+
[array addObject:[self generateRGLDocumentReaderTextSource:item]];
|
|
524
|
+
result[@"availableSourceList"] = array;
|
|
525
|
+
}
|
|
497
526
|
|
|
498
527
|
return result;
|
|
499
528
|
}
|
|
@@ -514,7 +543,22 @@
|
|
|
514
543
|
result[@"values"] = array;
|
|
515
544
|
}
|
|
516
545
|
result[@"status"] = @(input.status);
|
|
517
|
-
result[@"value"] =
|
|
546
|
+
result[@"value"] = input.value;
|
|
547
|
+
result[@"getValue"] = [self generateRGLDocumentReaderValue:[input getValue]];
|
|
548
|
+
if(input.comparisonList != nil){
|
|
549
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
550
|
+
for(RGLDocumentReaderComparison* item in input.comparisonList)
|
|
551
|
+
if(item != nil)
|
|
552
|
+
[array addObject:[self generateRGLDocumentReaderComparison:item]];
|
|
553
|
+
result[@"comparisonList"] = array;
|
|
554
|
+
}
|
|
555
|
+
if(input.validityList != nil){
|
|
556
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
557
|
+
for(RGLDocumentReaderValidity* item in input.validityList)
|
|
558
|
+
if(item != nil)
|
|
559
|
+
[array addObject:[self generateRGLDocumentReaderValidity:item]];
|
|
560
|
+
result[@"validityList"] = array;
|
|
561
|
+
}
|
|
518
562
|
|
|
519
563
|
return result;
|
|
520
564
|
}
|
|
@@ -531,6 +575,14 @@
|
|
|
531
575
|
result[@"comparison"] = [self generateNSDictionary:input.comparison];
|
|
532
576
|
result[@"pageIndex"] = @(input.pageIndex);
|
|
533
577
|
result[@"probability"] = @(input.probability);
|
|
578
|
+
if(input.originalSymbols != nil){
|
|
579
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
580
|
+
for(RGLDocumentReaderSymbol* item in input.originalSymbols)
|
|
581
|
+
if(item != nil)
|
|
582
|
+
[array addObject:[self generateRGLDocumentReaderSymbol:item]];
|
|
583
|
+
result[@"originalSymbols"] = array;
|
|
584
|
+
}
|
|
585
|
+
result[@"rfidOrigin"] = [self generateRGLDocumentReaderRfidOrigin:input.rfidOrigin];
|
|
534
586
|
|
|
535
587
|
return result;
|
|
536
588
|
}
|
|
@@ -614,7 +666,6 @@
|
|
|
614
666
|
result[@"status"] = @(input.status);
|
|
615
667
|
result[@"extLeSupport"] = @(input.extLeSupport);
|
|
616
668
|
result[@"processTime"] = @(input.processTime);
|
|
617
|
-
result[@"sessionDataStatus"] = [self generateRGLRFIDSessionDataStatus:input.sessionDataStatus];
|
|
618
669
|
|
|
619
670
|
return result;
|
|
620
671
|
}
|
|
@@ -1110,6 +1161,75 @@
|
|
|
1110
1161
|
return result;
|
|
1111
1162
|
}
|
|
1112
1163
|
|
|
1164
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocReaderDocumentsDatabase:(RGLDocReaderDocumentsDatabase* _Nullable)input {
|
|
1165
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1166
|
+
if(input == nil) return result;
|
|
1167
|
+
|
|
1168
|
+
result[@"databaseID"] = input.databaseID;
|
|
1169
|
+
result[@"version"] = input.version;
|
|
1170
|
+
result[@"date"] = input.date;
|
|
1171
|
+
result[@"databaseDescription"] = input.databaseDescription;
|
|
1172
|
+
result[@"countriesNumber"] = @(input.countriesNumber);
|
|
1173
|
+
result[@"documentsNumber"] = @(input.documentsNumber);
|
|
1174
|
+
|
|
1175
|
+
return result;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderComparison:(RGLDocumentReaderComparison* _Nullable)input {
|
|
1179
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1180
|
+
if(input == nil) return result;
|
|
1181
|
+
|
|
1182
|
+
result[@"sourceTypeLeft"] = @(input.sourceTypeLeft);
|
|
1183
|
+
result[@"sourceTypeRight"] = @(input.sourceTypeRight);
|
|
1184
|
+
result[@"status"] = @(input.status);
|
|
1185
|
+
|
|
1186
|
+
return result;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderValidity:(RGLDocumentReaderValidity* _Nullable)input {
|
|
1190
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1191
|
+
if(input == nil) return result;
|
|
1192
|
+
|
|
1193
|
+
result[@"sourceType"] = @(input.sourceType);
|
|
1194
|
+
result[@"status"] = @(input.status);
|
|
1195
|
+
|
|
1196
|
+
return result;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderSymbol:(RGLDocumentReaderSymbol* _Nullable)input {
|
|
1200
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1201
|
+
if(input == nil) return result;
|
|
1202
|
+
|
|
1203
|
+
result[@"code"] = @(input.code);
|
|
1204
|
+
result[@"rect"] = [self generateCGRect:input.rect];
|
|
1205
|
+
result[@"probability"] = @(input.probability);
|
|
1206
|
+
|
|
1207
|
+
return result;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderTextSource:(RGLDocumentReaderTextSource* _Nullable)input {
|
|
1211
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1212
|
+
if(input == nil) return result;
|
|
1213
|
+
|
|
1214
|
+
result[@"sourceType"] = @(input.sourceType);
|
|
1215
|
+
result[@"source"] = input.source;
|
|
1216
|
+
result[@"validityStatus"] = @(input.validityStatus);
|
|
1217
|
+
|
|
1218
|
+
return result;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderRfidOrigin:(RGLDocumentReaderRfidOrigin* _Nullable)input {
|
|
1222
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1223
|
+
if(input == nil) return result;
|
|
1224
|
+
|
|
1225
|
+
result[@"dg"] = @(input.dg);
|
|
1226
|
+
result[@"dgTag"] = @(input.dgTag);
|
|
1227
|
+
result[@"entryView"] = @(input.entryView);
|
|
1228
|
+
result[@"tagEntry"] = @(input.tagEntry);
|
|
1229
|
+
|
|
1230
|
+
return result;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1113
1233
|
+(NSMutableDictionary* _Nonnull)generateRGLElementRect:(RGLElementRect* _Nullable)input {
|
|
1114
1234
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1115
1235
|
if(input == nil) return result;
|
|
@@ -5,6 +5,9 @@ NSString* rfidNotificationCompletionEvent = @"rfidNotificationCompletionEvent";
|
|
|
5
5
|
NSString* paCertificateCompletionEvent = @"paCertificateCompletionEvent";
|
|
6
6
|
NSString* taCertificateCompletionEvent = @"taCertificateCompletionEvent";
|
|
7
7
|
NSString* taSignatureCompletionEvent = @"taSignatureCompletionEvent";
|
|
8
|
+
NSString* bleOnServiceConnectedEvent = @"bleOnServiceConnectedEvent";
|
|
9
|
+
NSString* bleOnServiceDisconnectedEvent = @"bleOnServiceDisconnectedEvent";
|
|
10
|
+
NSString* bleOnDeviceReadyEvent = @"bleOnDeviceReadyEvent";
|
|
8
11
|
RGLRFIDCertificatesCallback paCertificateCompletion;
|
|
9
12
|
RGLRFIDCertificatesCallback taCertificateCompletion;
|
|
10
13
|
RFIDDelegateNoPA* rfidDelegateNoPA;
|
|
@@ -47,7 +50,10 @@ RCT_EXPORT_MODULE();
|
|
|
47
50
|
rfidNotificationCompletionEvent,
|
|
48
51
|
paCertificateCompletionEvent,
|
|
49
52
|
taCertificateCompletionEvent,
|
|
50
|
-
taSignatureCompletionEvent
|
|
53
|
+
taSignatureCompletionEvent,
|
|
54
|
+
bleOnServiceConnectedEvent,
|
|
55
|
+
bleOnServiceDisconnectedEvent,
|
|
56
|
+
bleOnDeviceReadyEvent];
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
static NSNumber* _databasePercentageDownloaded;
|
|
@@ -130,6 +136,14 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
130
136
|
|
|
131
137
|
if([action isEqualToString:@"initializeReaderAutomatically"])
|
|
132
138
|
[self initializeReaderAutomatically :successCallback :errorCallback];
|
|
139
|
+
else if([action isEqualToString:@"isBlePermissionsGranted"])
|
|
140
|
+
[self isBlePermissionsGranted :successCallback :errorCallback];
|
|
141
|
+
else if([action isEqualToString:@"startBluetoothService"])
|
|
142
|
+
[self startBluetoothService :successCallback :errorCallback];
|
|
143
|
+
else if([action isEqualToString:@"initializeReaderBleDeviceConfig"])
|
|
144
|
+
[self initializeReaderBleDeviceConfig :successCallback :errorCallback];
|
|
145
|
+
else if([action isEqualToString:@"getTag"])
|
|
146
|
+
[self getTag :successCallback :errorCallback];
|
|
133
147
|
else if([action isEqualToString:@"getAPIVersion"])
|
|
134
148
|
[self getAPIVersion :successCallback :errorCallback];
|
|
135
149
|
else if([action isEqualToString:@"getAvailableScenarios"])
|
|
@@ -210,6 +224,10 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
210
224
|
[self addPKDCertificates :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
211
225
|
else if([action isEqualToString:@"setCameraSessionIsPaused"])
|
|
212
226
|
[self setCameraSessionIsPaused :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
227
|
+
else if([action isEqualToString:@"setTag"])
|
|
228
|
+
[self setTag :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
229
|
+
else if([action isEqualToString:@"checkDatabaseUpdate"])
|
|
230
|
+
[self checkDatabaseUpdate :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
213
231
|
else if([action isEqualToString:@"getScenario"])
|
|
214
232
|
[self getScenario :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
215
233
|
else if([action isEqualToString:@"recognizeImages"])
|
|
@@ -228,6 +246,8 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
228
246
|
[self prepareDatabase :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
229
247
|
else if([action isEqualToString:@"recognizeImage"])
|
|
230
248
|
[self recognizeImage :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
249
|
+
else if([action isEqualToString:@"recognizeData"])
|
|
250
|
+
[self recognizeData :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
231
251
|
else if([action isEqualToString:@"setRfidSessionStatus"])
|
|
232
252
|
[self setRfidSessionStatus :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
233
253
|
else if([action isEqualToString:@"providePACertificates"])
|
|
@@ -240,8 +260,6 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
240
260
|
[self parseCoreResults :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
241
261
|
else if([action isEqualToString:@"setTCCParams"])
|
|
242
262
|
[self setTCCParams :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
243
|
-
else if([action isEqualToString:@"initializeReaderWithDatabase"])
|
|
244
|
-
[self initializeReaderWithDatabase :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
|
|
245
263
|
else if([action isEqualToString:@"recognizeImageWithOpts"])
|
|
246
264
|
[self recognizeImageWithOpts :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
|
|
247
265
|
else if([action isEqualToString:@"recognizeVideoFrame"])
|
|
@@ -262,6 +280,18 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
262
280
|
[RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:licenseData] completion:[self getInitCompletion :successCallback :errorCallback]];
|
|
263
281
|
}
|
|
264
282
|
|
|
283
|
+
- (void) isBlePermissionsGranted:(Callback)successCallback :(Callback)errorCallback{
|
|
284
|
+
[self result:@"isBlePermissionsGranted() is an android-only method" :errorCallback];
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
- (void) startBluetoothService:(Callback)successCallback :(Callback)errorCallback{
|
|
288
|
+
[self result:@"startBluetoothService() is an android-only method" :errorCallback];
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
- (void) initializeReaderBleDeviceConfig:(Callback)successCallback :(Callback)errorCallback{
|
|
292
|
+
[self result:@"initializeReaderBleDeviceConfig() is an android-only method" :errorCallback];
|
|
293
|
+
}
|
|
294
|
+
|
|
265
295
|
- (void) resetConfiguration:(Callback)successCallback :(Callback)errorCallback{
|
|
266
296
|
[self result:@"resetConfiguration() is an android-only method" :errorCallback];
|
|
267
297
|
}
|
|
@@ -296,12 +326,8 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
296
326
|
[self result:@"getLicenseMessage() is an android-only method" :successCallback];
|
|
297
327
|
}
|
|
298
328
|
|
|
299
|
-
- (void)
|
|
300
|
-
[
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
- (void) initializeReader:(NSString*)licenseString :(Callback)successCallback :(Callback)errorCallback{
|
|
304
|
-
[RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:[[NSData alloc] initWithBase64EncodedString:licenseString options:0]] completion:[self getInitCompletion :successCallback :errorCallback]];
|
|
329
|
+
- (void) initializeReader:(NSDictionary*)config :(Callback)successCallback :(Callback)errorCallback{
|
|
330
|
+
[RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor RGLConfigFromJson:config] completion:[self getInitCompletion :successCallback :errorCallback]];
|
|
305
331
|
}
|
|
306
332
|
|
|
307
333
|
- (void) parseCoreResults:(NSString*)json :(Callback)successCallback :(Callback)errorCallback{
|
|
@@ -337,33 +363,38 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
337
363
|
}
|
|
338
364
|
|
|
339
365
|
- (void) showScanner:(Callback)successCallback :(Callback)errorCallback{
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
366
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
367
|
+
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
|
|
368
|
+
UIViewController *currentViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
|
|
369
|
+
[RGLDocReader.shared showScanner:currentViewController completion:[self getCompletion]];
|
|
370
|
+
});
|
|
345
371
|
}
|
|
346
372
|
|
|
347
373
|
- (void) recognizeImage:(NSMutableString*)base64 :(Callback)successCallback :(Callback)errorCallback{
|
|
348
374
|
[self recognizeImageWith :base64 :false :successCallback :errorCallback];
|
|
349
375
|
}
|
|
350
376
|
|
|
377
|
+
- (void) recognizeData:(NSString*)data :(Callback)successCallback :(Callback)errorCallback{
|
|
378
|
+
[RGLDocReader.shared recognizeData :[[NSData alloc] initWithBase64EncodedString:data options:0] completion:[self getCompletion]];
|
|
379
|
+
}
|
|
380
|
+
|
|
351
381
|
- (void) recognizeImages:(NSArray*)input :(Callback)successCallback :(Callback)errorCallback{
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
382
|
+
NSMutableArray<UIImage*>* images = [[NSMutableArray alloc] init];
|
|
383
|
+
for(__strong NSMutableString* base64 in input)
|
|
384
|
+
[images addObject:[UIImage imageWithData:[[NSData alloc]initWithBase64EncodedString:base64 options:NSDataBase64DecodingIgnoreUnknownCharacters]]];
|
|
385
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
386
|
+
[RGLDocReader.shared recognizeImages:images completion:[self getCompletion]];
|
|
387
|
+
});
|
|
388
|
+
|
|
358
389
|
}
|
|
359
390
|
|
|
360
391
|
- (void) recognizeImagesWithImageInputs:(NSArray*)input :(Callback)successCallback :(Callback)errorCallback{
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
392
|
+
NSMutableArray<RGLImageInput*>* images = [[NSMutableArray alloc] init];
|
|
393
|
+
for(__strong NSDictionary* image in input)
|
|
394
|
+
[images addObject:[RGLWJSONConstructor RGLImageInputFromJson: image]];
|
|
395
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
396
|
+
[RGLDocReader.shared recognizeImagesWithImageInputs:images completion:[self getCompletion]];
|
|
397
|
+
});
|
|
367
398
|
}
|
|
368
399
|
|
|
369
400
|
- (void) recognizeImageWithCameraMode:(NSMutableString*)base64 :(BOOL)cameraMode :(Callback)successCallback :(Callback)errorCallback{
|
|
@@ -371,31 +402,44 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
371
402
|
}
|
|
372
403
|
|
|
373
404
|
- (void) recognizeImageWith:(NSMutableString*)base64 :(BOOL)cameraMode :(Callback)successCallback :(Callback)errorCallback{
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
405
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
406
|
+
[RGLDocReader.shared recognizeImage:[UIImage imageWithData:[[NSData alloc]initWithBase64EncodedString:base64 options:NSDataBase64DecodingIgnoreUnknownCharacters]] cameraMode:cameraMode completion:[self getCompletion]];
|
|
407
|
+
});
|
|
377
408
|
}
|
|
378
409
|
|
|
379
410
|
- (void) setConfig:(NSDictionary*)config :(Callback)successCallback :(Callback)errorCallback{
|
|
380
|
-
|
|
381
|
-
|
|
411
|
+
[RegulaConfig setConfig:config :RGLDocReader.shared];
|
|
412
|
+
[self result:@"" :successCallback];
|
|
382
413
|
}
|
|
383
414
|
|
|
384
415
|
- (void) getConfig:(Callback)successCallback :(Callback)errorCallback{
|
|
385
416
|
[self result:[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:[RegulaConfig getConfig:RGLDocReader.shared] options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding] :successCallback];
|
|
386
417
|
}
|
|
387
418
|
|
|
419
|
+
- (void) checkDatabaseUpdate:(NSString*)databaseId :(Callback)successCallback :(Callback)errorCallback{
|
|
420
|
+
[RGLDocReader.shared checkDatabaseUpdate:databaseId completion:[self getCheckDatabaseUpdateCompletion: successCallback: errorCallback]];
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
- (void) getTag:(Callback)successCallback :(Callback)errorCallback{
|
|
424
|
+
[self result:[RGLDocReader.shared tag] :successCallback];
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
- (void) setTag:(NSString*)tag :(Callback)successCallback :(Callback)errorCallback{
|
|
428
|
+
[RGLDocReader.shared setTag:tag];
|
|
429
|
+
[self result:@"" :successCallback];
|
|
430
|
+
}
|
|
431
|
+
|
|
388
432
|
- (void) setRfidScenario:(NSDictionary*)rfidScenario :(Callback)successCallback :(Callback)errorCallback{
|
|
389
|
-
|
|
390
|
-
|
|
433
|
+
[RegulaConfig setRfidScenario:rfidScenario :RGLDocReader.shared.rfidScenario];
|
|
434
|
+
[self result:@"" :successCallback];
|
|
391
435
|
}
|
|
392
436
|
|
|
393
437
|
- (void) getRfidScenario:(Callback)successCallback :(Callback)errorCallback{
|
|
394
|
-
|
|
438
|
+
[self result:[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:RGLDocReader.shared.rfidScenario.rfidScenarioDictionary options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding] :successCallback];
|
|
395
439
|
}
|
|
396
440
|
|
|
397
441
|
- (void) readRFID:(Callback)successCallback :(Callback)errorCallback{
|
|
398
|
-
|
|
442
|
+
[RGLDocReader.shared readRFID:[self getRFIDNotificationCallback] completion:[self getRFIDCompletion]];
|
|
399
443
|
}
|
|
400
444
|
|
|
401
445
|
- (void) stopRFIDReader:(Callback)successCallback :(Callback)errorCallback{
|
|
@@ -644,4 +688,10 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
644
688
|
};
|
|
645
689
|
}
|
|
646
690
|
|
|
691
|
+
-(RGLDocumentReaderCheckUpdateCompletion)getCheckDatabaseUpdateCompletion:(Callback)successCallback :(Callback)errorCallback{
|
|
692
|
+
return ^(RGLDocReaderDocumentsDatabase* database) {
|
|
693
|
+
[self result:[RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateRGLDocReaderDocumentsDatabase:database]] :successCallback];
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
|
|
647
697
|
@end
|
package/ios/RegulaConfig.m
CHANGED
|
@@ -305,6 +305,8 @@
|
|
|
305
305
|
[expectedPass addObject:str];
|
|
306
306
|
image.expectedPass = expectedPass;
|
|
307
307
|
}
|
|
308
|
+
if([dict valueForKey:@"documentPositionIndent"] != nil)
|
|
309
|
+
image.documentPositionIndent = [dict valueForKey:@"documentPositionIndent"];
|
|
308
310
|
|
|
309
311
|
return image;
|
|
310
312
|
}
|
|
@@ -320,6 +322,7 @@
|
|
|
320
322
|
result[@"colornessCheck"] = input.colornessCheck;
|
|
321
323
|
result[@"moireCheck"] = input.moireCheck;
|
|
322
324
|
result[@"expectedPass"] = input.expectedPass;
|
|
325
|
+
result[@"documentPositionIndent"] = input.documentPositionIndent;
|
|
323
326
|
|
|
324
327
|
return result;
|
|
325
328
|
}
|
|
@@ -447,6 +450,37 @@
|
|
|
447
450
|
return group;
|
|
448
451
|
}
|
|
449
452
|
|
|
453
|
+
+(RGLOnlineProcessingConfig*)RGLOnlineProcessingConfigFromJSON:(NSDictionary*)dict {
|
|
454
|
+
if([dict valueForKey:@"mode"] == nil) return nil;
|
|
455
|
+
|
|
456
|
+
RGLOnlineProcessingConfig *result = [[RGLOnlineProcessingConfig alloc] initWithMode:[[dict valueForKey:@"mode"] integerValue]];
|
|
457
|
+
|
|
458
|
+
if([dict valueForKey:@"imageFormat"] != nil)
|
|
459
|
+
result.imageFormat = [[dict valueForKey:@"imageFormat"] integerValue];
|
|
460
|
+
if([dict valueForKey:@"url"] != nil)
|
|
461
|
+
result.serviceURL = [dict valueForKey:@"url"];
|
|
462
|
+
if([dict valueForKey:@"imageCompressionQuality"] != nil)
|
|
463
|
+
result.imageCompressionQuality = [[dict valueForKey:@"imageCompressionQuality"] floatValue];
|
|
464
|
+
if([dict valueForKey:@"processParams"] != nil) {
|
|
465
|
+
RGLProcessParams *params = [RGLProcessParams new];
|
|
466
|
+
[self setProcessParams:[dict valueForKey:@"processParams"] :params];
|
|
467
|
+
result.processParams = params;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
return result;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
+(RGLReprocParams*)RGLReprocParamsFromJSON:(NSDictionary*)dict {
|
|
474
|
+
RGLReprocParams *result = [RGLReprocParams new];
|
|
475
|
+
|
|
476
|
+
if([dict valueForKey:@"serviceUrl"] != nil)
|
|
477
|
+
result.serviceURL = [dict valueForKey:@"serviceUrl"];
|
|
478
|
+
if([dict valueForKey:@"failIfNoService"] != nil)
|
|
479
|
+
result.failIfNoService = [dict valueForKey:@"failIfNoService"];
|
|
480
|
+
|
|
481
|
+
return result;
|
|
482
|
+
}
|
|
483
|
+
|
|
450
484
|
+(void)setCustomization:(NSDictionary*)options :(RGLCustomization*)customization {
|
|
451
485
|
if([options valueForKey:@"cameraFrameBorderWidth"] != nil)
|
|
452
486
|
customization.cameraFrameBorderWidth = [[options valueForKey:@"cameraFrameBorderWidth"] floatValue];
|
|
@@ -590,12 +624,8 @@
|
|
|
590
624
|
functionality.singleResult = [[options valueForKey:@"singleResult"] boolValue];
|
|
591
625
|
if([options valueForKey:@"cameraPosition"] != nil)
|
|
592
626
|
functionality.cameraPosition = [self AVCaptureDevicePositionWithNSInteger:[[options valueForKey:@"cameraPosition"] integerValue]];
|
|
593
|
-
if([options valueForKey:@"onlineMode"] != nil)
|
|
594
|
-
functionality.onlineMode = [[options valueForKey:@"onlineMode"] boolValue];
|
|
595
|
-
if([options valueForKey:@"serviceURL"] != nil)
|
|
596
|
-
functionality.serviceURL = [[options valueForKey:@"serviceURL"] stringValue];
|
|
597
627
|
if([options valueForKey:@"btDeviceName"] != nil)
|
|
598
|
-
functionality.btDeviceName = [
|
|
628
|
+
functionality.btDeviceName = [options valueForKey:@"btDeviceName"];
|
|
599
629
|
if([options valueForKey:@"useAuthenticator"] != nil)
|
|
600
630
|
functionality.useAuthenticator = [[options valueForKey:@"useAuthenticator"] boolValue];
|
|
601
631
|
if([options valueForKey:@"showCaptureButtonDelayFromDetect"] != nil)
|
|
@@ -614,6 +644,8 @@
|
|
|
614
644
|
functionality.recordScanningProcess = [[options valueForKey:@"recordScanningProcess"] boolValue];
|
|
615
645
|
if([options valueForKey:@"manualMultipageMode"] != nil)
|
|
616
646
|
functionality.manualMultipageMode = [[options valueForKey:@"manualMultipageMode"] boolValue];
|
|
647
|
+
if([options valueForKey:@"onlineProcessingConfiguration"] != nil)
|
|
648
|
+
functionality.onlineProcessingConfig = [self RGLOnlineProcessingConfigFromJSON:[options valueForKey:@"onlineProcessingConfiguration"]];;
|
|
617
649
|
}
|
|
618
650
|
|
|
619
651
|
+(void)setProcessParams:(NSDictionary*)options :(RGLProcessParams*)processParams {
|
|
@@ -713,6 +745,20 @@
|
|
|
713
745
|
processParams.parseBarcodes = [options valueForKey:@"parseBarcodes"];
|
|
714
746
|
if([options valueForKey:@"shouldReturnPackageForReprocess"] != nil)
|
|
715
747
|
processParams.shouldReturnPackageForReprocess = [options valueForKey:@"shouldReturnPackageForReprocess"];
|
|
748
|
+
if([options valueForKey:@"imageOutputMaxWidth"] != nil)
|
|
749
|
+
processParams.imageOutputMaxWidth = [options valueForKey:@"imageOutputMaxWidth"];
|
|
750
|
+
if([options valueForKey:@"imageOutputMaxHeight"] != nil)
|
|
751
|
+
processParams.imageOutputMaxHeight = [options valueForKey:@"imageOutputMaxHeight"];
|
|
752
|
+
if([options valueForKey:@"disablePerforationOCR"] != nil)
|
|
753
|
+
processParams.disablePerforationOCR = [options valueForKey:@"disablePerforationOCR"];
|
|
754
|
+
if([options valueForKey:@"respectImageQuality"] != nil)
|
|
755
|
+
processParams.respectImageQuality = [options valueForKey:@"respectImageQuality"];
|
|
756
|
+
if([options valueForKey:@"splitNames"] != nil)
|
|
757
|
+
processParams.splitNames = [options valueForKey:@"splitNames"];
|
|
758
|
+
if([options valueForKey:@"processAuth"] != nil)
|
|
759
|
+
processParams.processAuth = [options valueForKey:@"processAuth"];
|
|
760
|
+
if([options valueForKey:@"documentGroupFilter"] != nil)
|
|
761
|
+
processParams.documentGroupFilter = [options mutableArrayValueForKey:@"documentGroupFilter"];
|
|
716
762
|
}
|
|
717
763
|
|
|
718
764
|
+(NSMutableDictionary *)getCustomization:(RGLCustomization*)customization {
|
|
@@ -797,8 +843,6 @@
|
|
|
797
843
|
result[@"videoSessionPreset"] = [NSNumber numberWithInteger:[self NSIntegerWithAVCaptureSessionPreset:functionality.videoSessionPreset]];
|
|
798
844
|
result[@"videoCaptureMotionControl"] = [NSNumber numberWithBool:functionality.videoCaptureMotionControl];
|
|
799
845
|
result[@"orientation"] = [NSNumber numberWithInteger:[self NSIntegerWithUIInterfaceOrientationMask:functionality.orientation]];
|
|
800
|
-
result[@"onlineMode"] = [NSNumber numberWithBool:functionality.onlineMode];
|
|
801
|
-
result[@"serviceURL"] = functionality.serviceURL;
|
|
802
846
|
result[@"cameraPosition"] = [NSNumber numberWithInteger:[self NSIntegerWithAVCaptureDevicePosition:functionality.cameraPosition]];
|
|
803
847
|
result[@"btDeviceName"] = functionality.btDeviceName;
|
|
804
848
|
result[@"useAuthenticator"] = [NSNumber numberWithBool:functionality.isUseAuthenticator];
|
|
@@ -866,6 +910,13 @@
|
|
|
866
910
|
result[@"forceReadMrzBeforeLocate"] = processParams.forceReadMrzBeforeLocate;
|
|
867
911
|
result[@"parseBarcodes"] = processParams.parseBarcodes;
|
|
868
912
|
result[@"shouldReturnPackageForReprocess"] = processParams.shouldReturnPackageForReprocess;
|
|
913
|
+
result[@"imageOutputMaxWidth"] = processParams.imageOutputMaxWidth;
|
|
914
|
+
result[@"imageOutputMaxHeight"] = processParams.imageOutputMaxHeight;
|
|
915
|
+
result[@"disablePerforationOCR"] = processParams.disablePerforationOCR;
|
|
916
|
+
result[@"respectImageQuality"] = processParams.respectImageQuality;
|
|
917
|
+
result[@"splitNames"] = processParams.splitNames;
|
|
918
|
+
result[@"processAuth"] = processParams.processAuth;
|
|
919
|
+
result[@"documentGroupFilter"] = processParams.documentGroupFilter;
|
|
869
920
|
|
|
870
921
|
return result;
|
|
871
922
|
}
|
|
@@ -969,6 +1020,10 @@
|
|
|
969
1020
|
rfidScenario.authorizedInstallCert = [[options valueForKey:@"authorizedInstallCert"] boolValue];
|
|
970
1021
|
if([options valueForKey:@"authorizedInstallQCert"] != nil)
|
|
971
1022
|
rfidScenario.authorizedInstallQCert = [[options valueForKey:@"authorizedInstallQCert"] boolValue];
|
|
1023
|
+
if([options valueForKey:@"reprocessParams"] != nil)
|
|
1024
|
+
rfidScenario.reprocParams = [self RGLReprocParamsFromJSON: [options valueForKey:@"reprocessParams"]];
|
|
1025
|
+
if([options valueForKey:@"defaultReadingBufferSize"] != nil)
|
|
1026
|
+
rfidScenario.defaultReadingBufferSize = [[options valueForKey:@"defaultReadingBufferSize"] intValue];
|
|
972
1027
|
}
|
|
973
1028
|
|
|
974
1029
|
@end
|
package/package.json
CHANGED