@regulaforensics/react-native-document-reader-api 6.4.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/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 +24 -47
- package/android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.java +12 -14
- package/android/src/main/java/com/regula/documentreader/RegulaConfig.java +46 -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 +3410 -3289
- package/index.js +3256 -3177
- package/ios/RGLWJSONConstructor.h +1 -0
- package/ios/RGLWJSONConstructor.m +22 -3
- package/ios/RNRegulaDocumentReader.m +8 -8
- package/ios/RegulaConfig.m +37 -6
- 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;
|
|
@@ -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);
|
|
@@ -614,7 +634,6 @@
|
|
|
614
634
|
result[@"status"] = @(input.status);
|
|
615
635
|
result[@"extLeSupport"] = @(input.extLeSupport);
|
|
616
636
|
result[@"processTime"] = @(input.processTime);
|
|
617
|
-
result[@"sessionDataStatus"] = [self generateRGLRFIDSessionDataStatus:input.sessionDataStatus];
|
|
618
637
|
|
|
619
638
|
return result;
|
|
620
639
|
}
|
|
@@ -228,6 +228,8 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
228
228
|
[self prepareDatabase :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
229
229
|
else if([action isEqualToString:@"recognizeImage"])
|
|
230
230
|
[self recognizeImage :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
231
|
+
else if([action isEqualToString:@"recognizeData"])
|
|
232
|
+
[self recognizeData :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
231
233
|
else if([action isEqualToString:@"setRfidSessionStatus"])
|
|
232
234
|
[self setRfidSessionStatus :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
233
235
|
else if([action isEqualToString:@"providePACertificates"])
|
|
@@ -240,8 +242,6 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
240
242
|
[self parseCoreResults :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
241
243
|
else if([action isEqualToString:@"setTCCParams"])
|
|
242
244
|
[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
245
|
else if([action isEqualToString:@"recognizeImageWithOpts"])
|
|
246
246
|
[self recognizeImageWithOpts :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
|
|
247
247
|
else if([action isEqualToString:@"recognizeVideoFrame"])
|
|
@@ -296,12 +296,8 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
296
296
|
[self result:@"getLicenseMessage() is an android-only method" :successCallback];
|
|
297
297
|
}
|
|
298
298
|
|
|
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]];
|
|
299
|
+
- (void) initializeReader:(NSDictionary*)config :(Callback)successCallback :(Callback)errorCallback{
|
|
300
|
+
[RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor RGLConfigFromJson:config] completion:[self getInitCompletion :successCallback :errorCallback]];
|
|
305
301
|
}
|
|
306
302
|
|
|
307
303
|
- (void) parseCoreResults:(NSString*)json :(Callback)successCallback :(Callback)errorCallback{
|
|
@@ -348,6 +344,10 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
348
344
|
[self recognizeImageWith :base64 :false :successCallback :errorCallback];
|
|
349
345
|
}
|
|
350
346
|
|
|
347
|
+
- (void) recognizeData:(NSString*)data :(Callback)successCallback :(Callback)errorCallback{
|
|
348
|
+
[RGLDocReader.shared recognizeData :[[NSData alloc] initWithBase64EncodedString:data options:0] completion:[self getCompletion]];
|
|
349
|
+
}
|
|
350
|
+
|
|
351
351
|
- (void) recognizeImages:(NSArray*)input :(Callback)successCallback :(Callback)errorCallback{
|
|
352
352
|
NSMutableArray<UIImage*>* images = [[NSMutableArray alloc] init];
|
|
353
353
|
for(__strong NSMutableString* base64 in input)
|
package/ios/RegulaConfig.m
CHANGED
|
@@ -447,6 +447,37 @@
|
|
|
447
447
|
return group;
|
|
448
448
|
}
|
|
449
449
|
|
|
450
|
+
+(RGLOnlineProcessingConfig*)RGLOnlineProcessingConfigFromJSON:(NSDictionary*)dict {
|
|
451
|
+
if([dict valueForKey:@"mode"] == nil) return nil;
|
|
452
|
+
|
|
453
|
+
RGLOnlineProcessingConfig *result = [[RGLOnlineProcessingConfig alloc] initWithMode:[[dict valueForKey:@"mode"] integerValue]];
|
|
454
|
+
|
|
455
|
+
if([dict valueForKey:@"imageFormat"] != nil)
|
|
456
|
+
result.imageFormat = [[dict valueForKey:@"imageFormat"] integerValue];
|
|
457
|
+
if([dict valueForKey:@"url"] != nil)
|
|
458
|
+
result.serviceURL = [dict valueForKey:@"url"];
|
|
459
|
+
if([dict valueForKey:@"imageCompressionQuality"] != nil)
|
|
460
|
+
result.imageCompressionQuality = [[dict valueForKey:@"imageCompressionQuality"] floatValue];
|
|
461
|
+
if([dict valueForKey:@"processParams"] != nil) {
|
|
462
|
+
RGLProcessParams *params = [RGLProcessParams new];
|
|
463
|
+
[self setProcessParams:[dict valueForKey:@"processParams"] :params];
|
|
464
|
+
result.processParams = params;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
return result;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
+(RGLReprocParams*)RGLReprocParamsFromJSON:(NSDictionary*)dict {
|
|
471
|
+
RGLReprocParams *result = [RGLReprocParams new];
|
|
472
|
+
|
|
473
|
+
if([dict valueForKey:@"serviceUrl"] != nil)
|
|
474
|
+
result.serviceURL = [dict valueForKey:@"serviceUrl"];
|
|
475
|
+
if([dict valueForKey:@"failIfNoService"] != nil)
|
|
476
|
+
result.failIfNoService = [dict valueForKey:@"failIfNoService"];
|
|
477
|
+
|
|
478
|
+
return result;
|
|
479
|
+
}
|
|
480
|
+
|
|
450
481
|
+(void)setCustomization:(NSDictionary*)options :(RGLCustomization*)customization {
|
|
451
482
|
if([options valueForKey:@"cameraFrameBorderWidth"] != nil)
|
|
452
483
|
customization.cameraFrameBorderWidth = [[options valueForKey:@"cameraFrameBorderWidth"] floatValue];
|
|
@@ -590,10 +621,6 @@
|
|
|
590
621
|
functionality.singleResult = [[options valueForKey:@"singleResult"] boolValue];
|
|
591
622
|
if([options valueForKey:@"cameraPosition"] != nil)
|
|
592
623
|
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
624
|
if([options valueForKey:@"btDeviceName"] != nil)
|
|
598
625
|
functionality.btDeviceName = [[options valueForKey:@"btDeviceName"] stringValue];
|
|
599
626
|
if([options valueForKey:@"useAuthenticator"] != nil)
|
|
@@ -614,6 +641,8 @@
|
|
|
614
641
|
functionality.recordScanningProcess = [[options valueForKey:@"recordScanningProcess"] boolValue];
|
|
615
642
|
if([options valueForKey:@"manualMultipageMode"] != nil)
|
|
616
643
|
functionality.manualMultipageMode = [[options valueForKey:@"manualMultipageMode"] boolValue];
|
|
644
|
+
if([options valueForKey:@"onlineProcessingConfiguration"] != nil)
|
|
645
|
+
functionality.onlineProcessingConfig = [self RGLOnlineProcessingConfigFromJSON:[options valueForKey:@"onlineProcessingConfiguration"]];;
|
|
617
646
|
}
|
|
618
647
|
|
|
619
648
|
+(void)setProcessParams:(NSDictionary*)options :(RGLProcessParams*)processParams {
|
|
@@ -797,8 +826,6 @@
|
|
|
797
826
|
result[@"videoSessionPreset"] = [NSNumber numberWithInteger:[self NSIntegerWithAVCaptureSessionPreset:functionality.videoSessionPreset]];
|
|
798
827
|
result[@"videoCaptureMotionControl"] = [NSNumber numberWithBool:functionality.videoCaptureMotionControl];
|
|
799
828
|
result[@"orientation"] = [NSNumber numberWithInteger:[self NSIntegerWithUIInterfaceOrientationMask:functionality.orientation]];
|
|
800
|
-
result[@"onlineMode"] = [NSNumber numberWithBool:functionality.onlineMode];
|
|
801
|
-
result[@"serviceURL"] = functionality.serviceURL;
|
|
802
829
|
result[@"cameraPosition"] = [NSNumber numberWithInteger:[self NSIntegerWithAVCaptureDevicePosition:functionality.cameraPosition]];
|
|
803
830
|
result[@"btDeviceName"] = functionality.btDeviceName;
|
|
804
831
|
result[@"useAuthenticator"] = [NSNumber numberWithBool:functionality.isUseAuthenticator];
|
|
@@ -969,6 +996,10 @@
|
|
|
969
996
|
rfidScenario.authorizedInstallCert = [[options valueForKey:@"authorizedInstallCert"] boolValue];
|
|
970
997
|
if([options valueForKey:@"authorizedInstallQCert"] != nil)
|
|
971
998
|
rfidScenario.authorizedInstallQCert = [[options valueForKey:@"authorizedInstallQCert"] boolValue];
|
|
999
|
+
if([options valueForKey:@"reprocessParams"] != nil)
|
|
1000
|
+
rfidScenario.reprocParams = [self RGLReprocParamsFromJSON: [options valueForKey:@"reprocessParams"]];
|
|
1001
|
+
if([options valueForKey:@"defaultReadingBufferSize"] != nil)
|
|
1002
|
+
rfidScenario.defaultReadingBufferSize = [[options valueForKey:@"defaultReadingBufferSize"] intValue];
|
|
972
1003
|
}
|
|
973
1004
|
|
|
974
1005
|
@end
|
package/package.json
CHANGED