@regulaforensics/react-native-document-reader-api 5.8.0 → 6.1.2

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.
Files changed (54) hide show
  1. package/README.md +2 -2
  2. package/RNDocumentReaderApi.podspec +2 -2
  3. package/android/build.gradle +4 -6
  4. package/android/src/main/java/com/regula/documentreader/Helpers.java +8 -3
  5. package/android/src/main/java/com/regula/documentreader/JSONConstructor.java +110 -10
  6. package/android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.java +58 -26
  7. package/android/src/main/java/com/regula/documentreader/RegulaConfig.java +72 -9
  8. package/example/.editorconfig +3 -0
  9. package/example/.flowconfig +4 -13
  10. package/example/.gitattributes +3 -1
  11. package/example/.prettierrc.js +1 -0
  12. package/example/App.js +30 -18
  13. package/example/android/app/BUCK +55 -0
  14. package/example/android/app/build.gradle +35 -17
  15. package/example/android/app/debug.keystore +0 -0
  16. package/example/android/app/src/debug/AndroidManifest.xml +6 -1
  17. package/example/android/app/src/main/AndroidManifest.xml +21 -22
  18. package/example/android/app/src/main/assets/index.android.bundle +636 -0
  19. package/example/android/app/src/main/java/com/regula/dr/fullrfid/MainApplication.java +1 -2
  20. package/example/android/app/src/main/res/drawable-mdpi/images_id.png +0 -0
  21. package/example/android/app/src/main/res/drawable-mdpi/images_portrait.png +0 -0
  22. package/example/android/app/src/main/res/drawable-mdpi/node_modules_reactnativecheckbox_img_ic_check_box.png +0 -0
  23. package/example/android/app/src/main/res/drawable-mdpi/node_modules_reactnativecheckbox_img_ic_check_box_outline_blank.png +0 -0
  24. package/example/android/app/src/main/res/drawable-mdpi/node_modules_reactnativecheckbox_img_ic_indeterminate_check_box.png +0 -0
  25. package/example/android/app/src/main/res/drawable-xhdpi/node_modules_reactnativecheckbox_img_ic_check_box.png +0 -0
  26. package/example/android/app/src/main/res/drawable-xhdpi/node_modules_reactnativecheckbox_img_ic_check_box_outline_blank.png +0 -0
  27. package/example/android/app/src/main/res/drawable-xxhdpi/node_modules_reactnativecheckbox_img_ic_check_box.png +0 -0
  28. package/example/android/app/src/main/res/drawable-xxhdpi/node_modules_reactnativecheckbox_img_ic_check_box_outline_blank.png +0 -0
  29. package/example/android/build.gradle +12 -6
  30. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  31. package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  32. package/example/android/gradle.properties +2 -1
  33. package/example/android/gradlew +14 -17
  34. package/example/android/gradlew.bat +7 -18
  35. package/example/android/settings.gradle +0 -2
  36. package/example/ios/DocumentReader/AppDelegate.m +7 -3
  37. package/example/ios/DocumentReader/Info.plist +8 -10
  38. package/example/ios/DocumentReader/LaunchScreen.storyboard +47 -0
  39. package/example/ios/DocumentReader.xcodeproj/project.pbxproj +257 -96
  40. package/example/ios/DocumentReader.xcodeproj/xcshareddata/xcschemes/DocumentReader.xcscheme +1 -1
  41. package/example/ios/DocumentReaderTests/DocumentReaderTests.m +65 -0
  42. package/example/ios/DocumentReaderTests/Info.plist +24 -0
  43. package/example/ios/Podfile +13 -4
  44. package/example/metro.config.js +1 -1
  45. package/example/package.json +17 -18
  46. package/index.d.ts +724 -514
  47. package/index.js +672 -510
  48. package/ios/RGLWJSONConstructor.h +6 -0
  49. package/ios/RGLWJSONConstructor.m +92 -0
  50. package/ios/RNRegulaDocumentReader.m +34 -25
  51. package/ios/RegulaConfig.h +2 -0
  52. package/ios/RegulaConfig.m +119 -31
  53. package/package.json +1 -1
  54. package/example/ios/DocumentReader.xcodeproj/xcshareddata/xcschemes/DocumentReader-tvOS.xcscheme +0 -88
@@ -7,6 +7,8 @@
7
7
 
8
8
  @interface RGLWJSONConstructor : NSObject
9
9
  +(NSString* _Nonnull)dictToString:(NSMutableDictionary* _Nonnull)input;
10
+ +(NSMutableDictionary* _Nonnull)generateRfidNotificationCompletion:(NSInteger)notification;
11
+ +(NSMutableDictionary* _Nonnull)generateRfidNotificationCompletionWithError:(NSInteger)notification : (NSInteger)value;
10
12
  +(NSMutableDictionary* _Nonnull)generateNSDictionary:(NSDictionary<NSNumber*, NSNumber*>* _Nullable)input;
11
13
  +(RGLPKDCertificate* _Nullable)RGLPKDCertificateFromJson:(NSDictionary* _Nullable) dict;
12
14
  +(NSInteger)generateDocReaderAction:(RGLDocReaderAction)action;
@@ -54,6 +56,10 @@
54
56
  +(NSMutableDictionary* _Nonnull)generateRGLPAResourcesIssuer:(RGLPAResourcesIssuer* _Nullable)input;
55
57
  +(NSMutableDictionary* _Nonnull)generateRGLPAAttribute:(RGLPAAttribute* _Nullable)input;
56
58
  +(NSMutableDictionary* _Nonnull)generateRGLTAChallenge:(RGLTAChallenge* _Nullable)input;
59
+ +(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderResultsStatus:(RGLDocumentReaderResultsStatus* _Nullable)input;
60
+ +(NSMutableDictionary* _Nonnull)generateRGLOpticalStatus:(RGLOpticalStatus* _Nullable)input;
61
+ +(NSMutableDictionary* _Nonnull)generateRGLVDSNCData:(RGLVDSNCData* _Nullable)input;
62
+ +(NSMutableDictionary* _Nonnull)generateRGLBytesData:(RGLBytesData* _Nullable)input;
57
63
  +(NSMutableDictionary* _Nonnull)generateRGLRFIDNotify:(RGLRFIDNotify* _Nullable)input;
58
64
 
59
65
  @end
@@ -62,6 +62,23 @@
62
62
  return result;
63
63
  }
64
64
 
65
+ +(NSMutableDictionary*)generateRfidNotificationCompletion:(NSInteger)notification {
66
+ NSMutableDictionary *result = [NSMutableDictionary new];
67
+
68
+ result[@"notification"] = [NSNumber numberWithInteger:notification];
69
+
70
+ return result;
71
+ }
72
+
73
+ +(NSMutableDictionary*)generateRfidNotificationCompletionWithError:(NSInteger)notification :(NSInteger)value {
74
+ NSMutableDictionary *result = [NSMutableDictionary new];
75
+
76
+ result[@"notification"] = [NSNumber numberWithInteger:notification];
77
+ result[@"value"] = [NSNumber numberWithInteger:value];
78
+
79
+ return result;
80
+ }
81
+
65
82
  +(NSInteger)generateDocReaderAction:(RGLDocReaderAction)input {
66
83
  NSInteger result = 0;
67
84
  switch (input) {
@@ -235,6 +252,8 @@
235
252
  result[@"elapsedTime"] = @(input.elapsedTime);
236
253
  result[@"elapsedTimeRFID"] = @(input.elapsedTimeRFID);
237
254
  result[@"rawResult"] = input.rawResult;
255
+ result[@"status"] = [self generateRGLDocumentReaderResultsStatus:input.status];
256
+ result[@"vdsncData"] = [self generateRGLVDSNCData:input.vdsncData];
238
257
 
239
258
  return result;
240
259
  }
@@ -904,6 +923,79 @@
904
923
  return result;
905
924
  }
906
925
 
926
+ +(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderResultsStatus:(RGLDocumentReaderResultsStatus* _Nullable)input {
927
+ NSMutableDictionary *result = [NSMutableDictionary new];
928
+ if(input == nil) return result;
929
+
930
+ result[@"overallStatus"] = @(input.overallStatus);
931
+ result[@"optical"] = @(input.optical);
932
+ result[@"detailsOptical"] = [self generateRGLOpticalStatus:input.detailsOptical];
933
+ result[@"rfid"] = @(input.rfid);
934
+ result[@"detailsRFID"] = [self generateRGLRFIDSessionDataStatus:input.detailsRFID];
935
+ result[@"portrait"] = @(input.portrait);
936
+ result[@"stopList"] = @(input.stopList);
937
+
938
+ return result;
939
+ }
940
+
941
+ +(NSMutableDictionary* _Nonnull)generateRGLOpticalStatus:(RGLOpticalStatus* _Nullable)input {
942
+ NSMutableDictionary *result = [NSMutableDictionary new];
943
+ if(input == nil) return result;
944
+
945
+ result[@"overallStatus"] = @(input.overallStatus);
946
+ result[@"mrz"] = @(input.mrz);
947
+ result[@"text"] = @(input.text);
948
+ result[@"docType"] = @(input.docType);
949
+ result[@"security"] = @(input.security);
950
+ result[@"imageQA"] = @(input.imageQA);
951
+ result[@"expiry"] = @(input.expiry);
952
+ result[@"vds"] = @(input.vds);
953
+ result[@"pagesCount"] = @(input.pagesCount);
954
+
955
+ return result;
956
+ }
957
+
958
+ +(NSMutableDictionary* _Nonnull)generateRGLVDSNCData:(RGLVDSNCData* _Nullable)input {
959
+ NSMutableDictionary *result = [NSMutableDictionary new];
960
+ if(input == nil) return result;
961
+
962
+ result[@"type"] = input.type;
963
+ result[@"version"] = @(input.version);
964
+ result[@"issuingCountry"] = input.issuingCountry;
965
+ result[@"message"] = [self generateNSDictionary:input.message];
966
+ result[@"signatureAlgorithm"] = input.signatureAlgorithm;
967
+ result[@"signature"] = [self generateRGLBytesData:input.signature];
968
+ result[@"certificate"] = [self generateRGLBytesData:input.certificate];
969
+ if(input.certificateChain != nil){
970
+ NSMutableArray *array = [NSMutableArray new];
971
+ for(RGLCertificateChain* item in input.certificateChain)
972
+ if(item != nil)
973
+ [array addObject:[self generateRGLCertificateChain:item]];
974
+ result[@"certificateChain"] = array;
975
+ }
976
+ if(input.notifications != nil){
977
+ NSMutableArray *array = [NSMutableArray new];
978
+ for(NSNumber* item in input.notifications)
979
+ if(item != nil)
980
+ [array addObject:item];
981
+ result[@"notifications"] = array;
982
+ }
983
+
984
+ return result;
985
+ }
986
+
987
+ +(NSMutableDictionary* _Nonnull)generateRGLBytesData:(RGLBytesData* _Nullable)input {
988
+ NSMutableDictionary *result = [NSMutableDictionary new];
989
+ if(input == nil) return result;
990
+
991
+ result[@"data"] = input.data;
992
+ result[@"length"] = @(input.length);
993
+ result[@"status"] = @(input.status);
994
+ result[@"type"] = @(input.type);
995
+
996
+ return result;
997
+ }
998
+
907
999
  +(NSMutableDictionary* _Nonnull)generateRGLRFIDNotify:(RGLRFIDNotify* _Nullable)input {
908
1000
  NSMutableDictionary *result = [NSMutableDictionary new];
909
1001
  if(input == nil) return result;
@@ -1,9 +1,6 @@
1
1
  @import UIKit;
2
2
  #import "RNRegulaDocumentReader.h"
3
3
 
4
- NSString* videoEncoderCompletionEvent = @"videoEncoderCompletionEvent";
5
- NSString* completionEvent = @"completionEvent";
6
- NSString* prepareDatabaseProgressChangeEvent = @"prepareDatabaseProgressChangeEvent";
7
4
  NSString* rfidNotificationCompletionEvent = @"rfidNotificationCompletionEvent";
8
5
  NSString* paCertificateCompletionEvent = @"paCertificateCompletionEvent";
9
6
  NSString* taCertificateCompletionEvent = @"taCertificateCompletionEvent";
@@ -28,11 +25,11 @@ RNRegulaDocumentReader* plugin;
28
25
  }
29
26
 
30
27
  - (void)didChipConnected {
31
- [plugin sendEventWithName:rfidNotificationCompletionEvent body:@{@"msg": @1}]; // int RFID_EVENT_CHIP_DETECTED = 1;
28
+ [plugin sendEventWithName:rfidNotificationCompletionEvent body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateRfidNotificationCompletion:1]]}]; // int RFID_EVENT_CHIP_DETECTED = 1;
32
29
  }
33
30
 
34
31
  - (void)didReceivedError:(RGLRFIDErrorCodes)errorCode {
35
- [plugin sendEventWithName:rfidNotificationCompletionEvent body:@{@"msg": @2}]; // int RFID_EVENT_READING_ERROR = 2;
32
+ [plugin sendEventWithName:rfidNotificationCompletionEvent body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateRfidNotificationCompletionWithError:2:errorCode]]}]; // int RFID_EVENT_CHIP_DETECTED = 1;
36
33
  }
37
34
 
38
35
  @end
@@ -44,15 +41,13 @@ RNRegulaDocumentReader* plugin;
44
41
  RCT_EXPORT_MODULE();
45
42
 
46
43
  - (NSArray<NSString*>*)supportedEvents {
47
- return @[
48
- prepareDatabaseProgressChangeEvent,
49
- completionEvent,
50
- videoEncoderCompletionEvent,
51
- rfidNotificationCompletionEvent,
52
- paCertificateCompletionEvent,
53
- taCertificateCompletionEvent,
54
- taSignatureCompletionEvent
55
- ];
44
+ return @[@"prepareDatabaseProgressChangeEvent",
45
+ @"completionEvent",
46
+ @"videoEncoderCompletionEvent",
47
+ rfidNotificationCompletionEvent,
48
+ paCertificateCompletionEvent,
49
+ taCertificateCompletionEvent,
50
+ taSignatureCompletionEvent];
56
51
  }
57
52
 
58
53
  static NSNumber* _databasePercentageDownloaded;
@@ -69,7 +64,7 @@ typedef void (^Callback)(NSString* response);
69
64
  -(void (^_Nullable)(NSProgress * _Nonnull progress))getProgressHandler:(Callback)successCallback :(Callback)errorCallback{
70
65
  return ^(NSProgress * _Nonnull progress) {
71
66
  if(RNRegulaDocumentReader.databasePercentageDownloaded != [NSNumber numberWithDouble:progress.fractionCompleted * 100]){
72
- [self sendEventWithName:prepareDatabaseProgressChangeEvent body:@{@"msg": [NSString stringWithFormat:@"%.1f", progress.fractionCompleted * 100]}];
67
+ [self sendEventWithName:@"prepareDatabaseProgressChangeEvent" body:@{@"msg": [NSString stringWithFormat:@"%.1f", progress.fractionCompleted * 100]}];
73
68
  [RNRegulaDocumentReader setDatabasePercentageDownloaded:[NSNumber numberWithDouble:progress.fractionCompleted * 100]];
74
69
  }
75
70
  };
@@ -77,28 +72,28 @@ typedef void (^Callback)(NSString* response);
77
72
 
78
73
  -(RGLDocumentReaderCompletion _Nonnull)getCompletion {
79
74
  return ^(RGLDocReaderAction action, RGLDocumentReaderResults * _Nullable results, NSError * _Nullable error) {
80
- [self sendEventWithName:completionEvent body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateCompletion:[RGLWJSONConstructor generateDocReaderAction: action] :results :error :nil]]}];
75
+ [self sendEventWithName:@"completionEvent" body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateCompletion:[RGLWJSONConstructor generateDocReaderAction: action] :results :error :nil]]}];
81
76
  };
82
77
  }
83
78
 
84
79
  -(RGLRFIDProcessCompletion _Nonnull)getRFIDCompletion {
85
80
  return ^(RGLRFIDCompleteAction action, RGLDocumentReaderResults * _Nullable results, NSError * _Nullable error, RGLRFIDErrorCodes errorCode) {
86
- [self sendEventWithName:completionEvent body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateCompletion:[RGLWJSONConstructor generateRFIDCompleteAction: action] :results :error :nil]]}];
81
+ [self sendEventWithName:@"completionEvent" body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateCompletion:[RGLWJSONConstructor generateRFIDCompleteAction: action] :results :error :nil]]}];
87
82
  };
88
83
  }
89
84
 
90
85
  -(RGLRFIDNotificationCallback _Nonnull)getRFIDNotificationCallback {
91
86
  return ^(RGLRFIDNotificationAction notificationAction, RGLRFIDNotify* _Nullable notify) {
92
- [self sendEventWithName:completionEvent body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateCompletion:[RGLWJSONConstructor generateRFIDNotificationAction:notificationAction] :nil :nil :notify]]}];
87
+ [self sendEventWithName:@"completionEvent" body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateCompletion:[RGLWJSONConstructor generateRFIDNotificationAction:notificationAction] :nil :nil :notify]]}];
93
88
  };
94
89
  }
95
90
 
96
91
  - (void)didFinishRecordingToFile:(NSURL *)fileURL {
97
- [self sendEventWithName:videoEncoderCompletionEvent body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateVideoEncoderCompletion:fileURL :nil]]}];
92
+ [self sendEventWithName:@"videoEncoderCompletionEvent" body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateVideoEncoderCompletion:fileURL :nil]]}];
98
93
  }
99
94
 
100
95
  - (void)didFailWithError:(NSError *)error {
101
- [self sendEventWithName:videoEncoderCompletionEvent body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateVideoEncoderCompletion:nil :error]]}];
96
+ [self sendEventWithName:@"videoEncoderCompletionEvent" body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateVideoEncoderCompletion:nil :error]]}];
102
97
  }
103
98
 
104
99
  - (void)onRequestPACertificatesWithSerial:(NSData *)serialNumber issuer:(RGLPAResourcesIssuer *)issuer callback:(RGLRFIDCertificatesCallback)callback {
@@ -117,11 +112,11 @@ typedef void (^Callback)(NSString* response);
117
112
  }
118
113
 
119
114
  - (void)didChipConnected {
120
- [self sendEventWithName:rfidNotificationCompletionEvent body:@{@"msg": @1}]; // int RFID_EVENT_CHIP_DETECTED = 1;
115
+ [plugin sendEventWithName:rfidNotificationCompletionEvent body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateRfidNotificationCompletion:1]]}]; // int RFID_EVENT_CHIP_DETECTED = 1;
121
116
  }
122
117
 
123
118
  - (void)didReceivedError:(RGLRFIDErrorCodes)errorCode {
124
- [self sendEventWithName:rfidNotificationCompletionEvent body:@{@"msg": @2}]; // int RFID_EVENT_READING_ERROR = 2;
119
+ [plugin sendEventWithName:rfidNotificationCompletionEvent body:@{@"msg": [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateRfidNotificationCompletionWithError:2:errorCode]]}]; // int RFID_EVENT_CHIP_DETECTED = 1;
125
120
  }
126
121
 
127
122
  RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(RCTResponseSenderBlock)sCallback:(RCTResponseSenderBlock)eCallback) {
@@ -133,7 +128,9 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
133
128
  eCallback(@[response]);
134
129
  };
135
130
 
136
- if([action isEqualToString:@"getAPIVersion"])
131
+ if([action isEqualToString:@"initializeReaderAutomatically"])
132
+ [self initializeReaderAutomatically :successCallback :errorCallback];
133
+ else if([action isEqualToString:@"getAPIVersion"])
137
134
  [self getAPIVersion :successCallback :errorCallback];
138
135
  else if([action isEqualToString:@"getAvailableScenarios"])
139
136
  [self getAvailableScenarios :successCallback :errorCallback];
@@ -237,6 +234,8 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
237
234
  [self provideTACertificates :[args objectAtIndex:0] :successCallback :errorCallback];
238
235
  else if([action isEqualToString:@"provideTASignature"])
239
236
  [self provideTASignature :[args objectAtIndex:0] :successCallback :errorCallback];
237
+ else if([action isEqualToString:@"parseCoreResults"])
238
+ [self parseCoreResults :[args objectAtIndex:0] :successCallback :errorCallback];
240
239
  else if([action isEqualToString:@"initializeReaderWithDatabasePath"])
241
240
  [self initializeReaderWithDatabasePath :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
242
241
  else if([action isEqualToString:@"initializeReaderWithDatabase"])
@@ -257,6 +256,12 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
257
256
  [self result:[NSString stringWithFormat:@"%@/%@", @"method not implemented: ", action] :errorCallback];
258
257
  }
259
258
 
259
+ - (void) initializeReaderAutomatically:(Callback)successCallback :(Callback)errorCallback{
260
+ NSString *dataPath = [[NSBundle mainBundle] pathForResource:@"regula.license" ofType:nil];
261
+ NSData *licenseData = [NSData dataWithContentsOfFile:dataPath];
262
+ [RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:licenseData] completion:[self getInitCompletion :successCallback :errorCallback]];
263
+ }
264
+
260
265
  - (void) resetConfiguration:(Callback)successCallback :(Callback)errorCallback{
261
266
  [self result:@"resetConfiguration() is an android-only method" :errorCallback];
262
267
  }
@@ -298,7 +303,11 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
298
303
  }
299
304
 
300
305
  - (void) initializeReader:(NSString*)licenseString :(Callback)successCallback :(Callback)errorCallback{
301
- [RGLDocReader.shared initializeReader:[[NSData alloc] initWithBase64EncodedString:licenseString options:0] completion:[self getInitCompletion :successCallback :errorCallback]];
306
+ [RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:[[NSData alloc] initWithBase64EncodedString:licenseString options:0]] completion:[self getInitCompletion :successCallback :errorCallback]];
307
+ }
308
+
309
+ - (void) parseCoreResults:(NSString*)json :(Callback)successCallback :(Callback)errorCallback{
310
+ [self result:[RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateRGLDocumentReaderResults:[RGLDocumentReaderResults initWithRawString: json]]] :successCallback];
302
311
  }
303
312
 
304
313
  - (void) startRFIDReader:(Callback)successCallback :(Callback)errorCallback{
@@ -308,7 +317,7 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
308
317
  }
309
318
 
310
319
  - (void) initializeReaderWithDatabasePath:(NSString*)licenseString :(NSString*)databasePath :(Callback)successCallback :(Callback)errorCallback{
311
- [RGLDocReader.shared initializeReader:[[NSData alloc] initWithBase64EncodedString:licenseString options:0] databasePath:databasePath completion:[self getInitCompletion :successCallback :errorCallback]];
320
+ [RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:[[NSData alloc] initWithBase64EncodedString:licenseString options:0] licenseUpdateCheck:true databasePath:databasePath delayedNNLoadEnabled:false] completion:[self getInitCompletion :successCallback :errorCallback]];
312
321
  }
313
322
 
314
323
  - (void) prepareDatabase:(NSString*)dbID :(Callback)successCallback :(Callback)errorCallback{
@@ -19,5 +19,7 @@
19
19
  +(RGLePassportDataGroup*)RGLePassportDataGroupFromJson:(NSDictionary *) dict;
20
20
  +(RGLeIDDataGroup*)RGLeIDDataGroupFromJson:(NSDictionary*) dict;
21
21
  +(RGLeDLDataGroup*)RGLeDLDataGroupFromJson:(NSDictionary*) dict;
22
+ +(RGLImageQA*)ImageQAFromJson:(NSDictionary*) dict;
23
+ +(NSDictionary*)ImageQAToJson:(RGLImageQA*) input;
22
24
  @end
23
25
  #endif
@@ -284,6 +284,39 @@
284
284
  }
285
285
  }
286
286
 
287
+ +(RGLImageQA*)ImageQAFromJson:(NSDictionary*)dict {
288
+ RGLImageQA *image = [RGLImageQA new];
289
+
290
+ if([dict valueForKey:@"dpiThreshold"] != nil)
291
+ image.dpiThreshold = [dict valueForKey:@"dpiThreshold"];
292
+ if([dict valueForKey:@"angleThreshold"] != nil)
293
+ image.angleThreshold = [dict valueForKey:@"angleThreshold"];
294
+ if([dict valueForKey:@"focusCheck"] != nil)
295
+ image.focusCheck = [dict valueForKey:@"focusCheck"];
296
+ if([dict valueForKey:@"glaresCheck"] != nil)
297
+ image.glaresCheck = [dict valueForKey:@"glaresCheck"];
298
+ if([dict valueForKey:@"colornessCheck"] != nil)
299
+ image.colornessCheck = [dict valueForKey:@"colornessCheck"];
300
+ if([dict valueForKey:@"moireCheck"] != nil)
301
+ image.moireCheck = [dict valueForKey:@"moireCheck"];
302
+
303
+ return image;
304
+ }
305
+
306
+ +(NSDictionary*)ImageQAToJson:(RGLImageQA*)input {
307
+ NSMutableDictionary *result = [NSMutableDictionary new];
308
+ if(input == nil) return result;
309
+
310
+ result[@"dpiThreshold"] = input.dpiThreshold;
311
+ result[@"angleThreshold"] = input.angleThreshold;
312
+ result[@"focusCheck"] = input.focusCheck;
313
+ result[@"glaresCheck"] = input.glaresCheck;
314
+ result[@"colornessCheck"] = input.colornessCheck;
315
+ result[@"moireCheck"] = input.moireCheck;
316
+
317
+ return result;
318
+ }
319
+
287
320
  +(RGLePassportDataGroup*)RGLePassportDataGroupFromJson:(NSDictionary*)dict {
288
321
  RGLePassportDataGroup *group = [[RGLePassportDataGroup alloc] init];
289
322
 
@@ -570,17 +603,17 @@
570
603
 
571
604
  +(void)setProcessParams:(NSDictionary*)options :(RGLProcessParams*)processParams {
572
605
  if([options valueForKey:@"multipageProcessing"] != nil)
573
- processParams.multipageProcessing = [[options valueForKey:@"multipageProcessing"] boolValue];
606
+ processParams.multipageProcessing = [NSNumber numberWithBool:[[options valueForKey:@"multipageProcessing"] boolValue]];
574
607
  if([options valueForKey:@"dateFormat"] != nil)
575
608
  processParams.dateFormat = [options valueForKey:@"dateFormat"];
576
609
  if([options valueForKey:@"logs"] != nil)
577
- processParams.logs = [[options valueForKey:@"logs"] boolValue];
610
+ processParams.logs = [NSNumber numberWithBool:[[options valueForKey:@"logs"] boolValue]];
578
611
  if([options valueForKey:@"debugSaveImages"] != nil)
579
- processParams.debugSaveImages = [[options valueForKey:@"debugSaveImages"] boolValue];
612
+ processParams.debugSaveImages = [NSNumber numberWithBool:[[options valueForKey:@"debugSaveImages"] boolValue]];
580
613
  if([options valueForKey:@"debugSaveCroppedImages"] != nil)
581
- processParams.debugSaveCroppedImages = [[options valueForKey:@"debugSaveCroppedImages"] boolValue];
614
+ processParams.debugSaveCroppedImages = [NSNumber numberWithBool:[[options valueForKey:@"debugSaveCroppedImages"] boolValue]];
582
615
  if([options valueForKey:@"debugSaveLogs"] != nil)
583
- processParams.debugSaveLogs = [[options valueForKey:@"debugSaveLogs"] boolValue];
616
+ processParams.debugSaveLogs = [NSNumber numberWithBool:[[options valueForKey:@"debugSaveLogs"] boolValue]];
584
617
  if([options valueForKey:@"scenario"] != nil)
585
618
  processParams.scenario = [options valueForKey:@"scenario"];
586
619
  if([options valueForKey:@"barcodeTypes"] != nil)
@@ -590,43 +623,81 @@
590
623
  if([options valueForKey:@"fieldTypesFilter"] != nil)
591
624
  processParams.fieldTypesFilter = [options valueForKey:@"fieldTypesFilter"];
592
625
  if([options valueForKey:@"disableFocusingCheck"] != nil)
593
- processParams.disableFocusingCheck = [[options valueForKey:@"disableFocusingCheck"] boolValue];
626
+ processParams.disableFocusingCheck = [NSNumber numberWithBool:[[options valueForKey:@"disableFocusingCheck"] boolValue]];
594
627
  if([options valueForKey:@"captureButtonScenario"] != nil)
595
628
  processParams.captureButtonScenario = [options valueForKey:@"captureButtonScenario"];
596
- if([options valueForKey:@"sessionLogFolder"] != nil)
597
- [processParams setSessionLogFolder:[[options valueForKey:@"sessionLogFolder"] stringValue]];
598
629
  if([options valueForKey:@"measureSystem"] != nil)
599
630
  processParams.measureSystem = [[options valueForKey:@"measureSystem"] integerValue];
600
631
  if([options valueForKey:@"returnUncroppedImage"] != nil)
601
- processParams.returnUncroppedImage = [[options valueForKey:@"returnUncroppedImage"] boolValue];
632
+ processParams.returnUncroppedImage = [NSNumber numberWithBool:[[options valueForKey:@"returnUncroppedImage"] boolValue]];
602
633
  if([options valueForKey:@"customParams"] != nil)
603
634
  processParams.customParams = [options objectForKey:@"customParams"];
604
635
  if([options valueForKey:@"debugSaveRFIDSession"] != nil)
605
- processParams.debugSaveRFIDSession = [[options valueForKey:@"debugSaveRFIDSession"] boolValue];
636
+ processParams.debugSaveRFIDSession = [NSNumber numberWithBool:[[options valueForKey:@"debugSaveRFIDSession"] boolValue]];
606
637
  if([options valueForKey:@"doublePageSpread"] != nil)
607
- processParams.doublePageSpread = [[options valueForKey:@"doublePageSpread"] boolValue];
638
+ processParams.doublePageSpread = [NSNumber numberWithBool:[[options valueForKey:@"doublePageSpread"] boolValue]];
608
639
  if([options valueForKey:@"barcodeParserType"] != nil)
609
- processParams.barcodeParserType = [[options valueForKey:@"barcodeParserType"] integerValue];
640
+ processParams.barcodeParserType = [NSNumber numberWithInteger:[[options valueForKey:@"barcodeParserType"] integerValue]];
610
641
  if([options valueForKey:@"timeout"] != nil)
611
- processParams.timeout = [[options valueForKey:@"timeout"] doubleValue];
642
+ processParams.timeout = [NSNumber numberWithDouble:[[options valueForKey:@"timeout"] doubleValue]];
612
643
  if([options valueForKey:@"timeoutFromFirstDetect"] != nil)
613
- processParams.timeoutFromFirstDetect = [[options valueForKey:@"timeoutFromFirstDetect"] doubleValue];
644
+ processParams.timeoutFromFirstDetect = [NSNumber numberWithDouble:[[options valueForKey:@"timeoutFromFirstDetect"] doubleValue]];
614
645
  if([options valueForKey:@"timeoutFromFirstDocType"] != nil)
615
- processParams.timeoutFromFirstDocType = [[options valueForKey:@"timeoutFromFirstDocType"] doubleValue];
646
+ processParams.timeoutFromFirstDocType = [NSNumber numberWithDouble:[[options valueForKey:@"timeoutFromFirstDocType"] doubleValue]];
616
647
  if([options valueForKey:@"manualCrop"] != nil)
617
- processParams.manualCrop = [[options valueForKey:@"manualCrop"] boolValue];
648
+ processParams.manualCrop = [NSNumber numberWithBool:[[options valueForKey:@"manualCrop"] boolValue]];
618
649
  if([options valueForKey:@"perspectiveAngle"] != nil)
619
- processParams.perspectiveAngle = [[options valueForKey:@"perspectiveAngle"] integerValue];
650
+ processParams.perspectiveAngle = [NSNumber numberWithInteger:[[options valueForKey:@"perspectiveAngle"] integerValue]];
620
651
  if([options valueForKey:@"minDPI"] != nil)
621
- processParams.minDPI = [[options valueForKey:@"minDPI"] integerValue];
652
+ processParams.minDPI = [NSNumber numberWithInteger:[[options valueForKey:@"minDPI"] integerValue]];
622
653
  if([options valueForKey:@"integralImage"] != nil)
623
- processParams.integralImage = [[options valueForKey:@"integralImage"] boolValue];
654
+ processParams.integralImage = [NSNumber numberWithBool:[[options valueForKey:@"integralImage"] boolValue]];
624
655
  if([options valueForKey:@"returnCroppedBarcode"] != nil)
625
- processParams.returnCroppedBarcode = [[options valueForKey:@"returnCroppedBarcode"] boolValue];
656
+ processParams.returnCroppedBarcode = [NSNumber numberWithBool:[[options valueForKey:@"returnCroppedBarcode"] boolValue]];
626
657
  if([options valueForKey:@"checkHologram"] != nil)
627
- processParams.checkHologram = [[options valueForKey:@"checkHologram"] boolValue];
658
+ processParams.checkHologram = [NSNumber numberWithBool:[[options valueForKey:@"checkHologram"] boolValue]];
628
659
  if([options valueForKey:@"checkRequiredTextFields"] != nil)
629
- processParams.checkRequiredTextFields = [[options valueForKey:@"checkRequiredTextFields"] boolValue];
660
+ processParams.checkRequiredTextFields = [NSNumber numberWithBool:[[options valueForKey:@"checkRequiredTextFields"] boolValue]];
661
+ if([options valueForKey:@"depersonalizeLog"] != nil)
662
+ processParams.depersonalizeLog = [options valueForKey:@"depersonalizeLog"];
663
+ if([options valueForKey:@"resultTypeOutput"] != nil)
664
+ processParams.resultTypeOutput = [options valueForKey:@"resultTypeOutput"];
665
+ if([options valueForKey:@"generateDoublePageSpreadImage"] != nil)
666
+ processParams.generateDoublePageSpreadImage = [options valueForKey:@"generateDoublePageSpreadImage"];
667
+ if([options valueForKey:@"imageDpiOutMax"] != nil)
668
+ processParams.imageDpiOutMax = [options valueForKey:@"imageDpiOutMax"];
669
+ if([options valueForKey:@"alreadyCropped"] != nil)
670
+ processParams.alreadyCropped = [options valueForKey:@"alreadyCropped"];
671
+ if([options valueForKey:@"forceDocID"] != nil)
672
+ processParams.forceDocID = [options valueForKey:@"forceDocID"];
673
+ if([options valueForKey:@"matchTextFieldMask"] != nil)
674
+ processParams.matchTextFieldMask = [options valueForKey:@"matchTextFieldMask"];
675
+ if([options valueForKey:@"fastDocDetect"] != nil)
676
+ processParams.fastDocDetect = [options valueForKey:@"fastDocDetect"];
677
+ if([options valueForKey:@"updateOCRValidityByGlare"] != nil)
678
+ processParams.updateOCRValidityByGlare = [options valueForKey:@"updateOCRValidityByGlare"];
679
+ if([options valueForKey:@"imageQA"] != nil)
680
+ processParams.imageQA = [RegulaConfig ImageQAFromJson:[options valueForKey:@"imageQA"]];
681
+ if([options valueForKey:@"forceDocFormat"] != nil)
682
+ processParams.forceDocFormat = [options valueForKey:@"forceDocFormat"];
683
+ if([options valueForKey:@"noGraphics"] != nil)
684
+ processParams.noGraphics = [options valueForKey:@"noGraphics"];
685
+ if([options valueForKey:@"documentAreaMin"] != nil)
686
+ processParams.documentAreaMin = [options valueForKey:@"documentAreaMin"];
687
+ if([options valueForKey:@"multiDocOnImage"] != nil)
688
+ processParams.multiDocOnImage = [options valueForKey:@"multiDocOnImage"];
689
+ if([options valueForKey:@"shiftExpiryDate"] != nil)
690
+ processParams.shiftExpiryDate = [options valueForKey:@"shiftExpiryDate"];
691
+ if([options valueForKey:@"minimalHolderAge"] != nil)
692
+ processParams.minimalHolderAge = [options valueForKey:@"minimalHolderAge"];
693
+ if([options valueForKey:@"mrzFormatsFilter"] != nil)
694
+ processParams.mrzFormatsFilter = [options valueForKey:@"mrzFormatsFilter"];
695
+ if([options valueForKey:@"forceReadMrzBeforeLocate"] != nil)
696
+ processParams.forceReadMrzBeforeLocate = [options valueForKey:@"forceReadMrzBeforeLocate"];
697
+ if([options valueForKey:@"parseBarcodes"] != nil)
698
+ processParams.parseBarcodes = [options valueForKey:@"parseBarcodes"];
699
+ if([options valueForKey:@"shouldReturnPackageForReprocess"] != nil)
700
+ processParams.shouldReturnPackageForReprocess = [options valueForKey:@"shouldReturnPackageForReprocess"];
630
701
  }
631
702
 
632
703
  +(NSMutableDictionary *)getCustomization:(RGLCustomization*)customization {
@@ -745,20 +816,37 @@
745
816
  result[@"customParams"] = processParams.customParams;
746
817
  result[@"debugSaveRFIDSession"] = [NSNumber numberWithBool:processParams.debugSaveRFIDSession];
747
818
  result[@"doublePageSpread"] = [NSNumber numberWithBool:processParams.doublePageSpread];
748
- result[@"barcodeParserType"] = [NSNumber numberWithInteger:processParams.barcodeParserType];
749
- result[@"processParamsDictionary"] = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:processParams.processParamsDictionary options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding];
750
- result[@"coreParamsDictionary"] = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:processParams.coreParamsDictionary options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding];
751
- result[@"rfidParamsDictionary"] = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:processParams.rfidParamsDictionary options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding];
752
- result[@"timeout"] = [NSNumber numberWithDouble:processParams.timeout];
753
- result[@"timeoutFromFirstDetect"] = [NSNumber numberWithDouble:processParams.timeoutFromFirstDetect];
754
- result[@"timeoutFromFirstDocType"] = [NSNumber numberWithDouble:processParams.timeoutFromFirstDocType];
819
+ result[@"barcodeParserType"] = processParams.barcodeParserType;
820
+ result[@"timeout"] = processParams.timeout;
821
+ result[@"timeoutFromFirstDetect"] = processParams.timeoutFromFirstDetect;
822
+ result[@"timeoutFromFirstDocType"] = processParams.timeoutFromFirstDocType;
755
823
  result[@"manualCrop"] = [NSNumber numberWithBool:processParams.manualCrop];
756
- result[@"perspectiveAngle"] = [NSNumber numberWithInteger:processParams.perspectiveAngle];
757
- result[@"minDPI"] = [NSNumber numberWithInteger:processParams.minDPI];
824
+ result[@"perspectiveAngle"] = processParams.perspectiveAngle;
825
+ result[@"minDPI"] = processParams.minDPI;
758
826
  result[@"integralImage"] = [NSNumber numberWithBool:processParams.integralImage];
759
827
  result[@"returnCroppedBarcode"] = [NSNumber numberWithBool:processParams.returnCroppedBarcode];
760
828
  result[@"checkHologram"] = [NSNumber numberWithBool:processParams.checkHologram];
761
829
  result[@"checkRequiredTextFields"] = [NSNumber numberWithBool:processParams.checkRequiredTextFields];
830
+ result[@"depersonalizeLog"] = processParams.depersonalizeLog;
831
+ result[@"resultTypeOutput"] = processParams.resultTypeOutput;
832
+ result[@"generateDoublePageSpreadImage"] = processParams.generateDoublePageSpreadImage;
833
+ result[@"imageDpiOutMax"] = processParams.imageDpiOutMax;
834
+ result[@"alreadyCropped"] = processParams.alreadyCropped;
835
+ result[@"forceDocID"] = processParams.forceDocID;
836
+ result[@"matchTextFieldMask"] = processParams.matchTextFieldMask;
837
+ result[@"fastDocDetect"] = processParams.fastDocDetect;
838
+ result[@"updateOCRValidityByGlare"] = processParams.updateOCRValidityByGlare;
839
+ result[@"imageQA"] = [RegulaConfig ImageQAToJson:processParams.imageQA];
840
+ result[@"forceDocFormat"] = processParams.forceDocFormat;
841
+ result[@"noGraphics"] = processParams.noGraphics;
842
+ result[@"documentAreaMin"] = processParams.documentAreaMin;
843
+ result[@"multiDocOnImage"] = processParams.multiDocOnImage;
844
+ result[@"shiftExpiryDate"] = processParams.shiftExpiryDate;
845
+ result[@"minimalHolderAge"] = processParams.minimalHolderAge;
846
+ result[@"mrzFormatsFilter"] = processParams.mrzFormatsFilter;
847
+ result[@"forceReadMrzBeforeLocate"] = processParams.forceReadMrzBeforeLocate;
848
+ result[@"parseBarcodes"] = processParams.parseBarcodes;
849
+ result[@"shouldReturnPackageForReprocess"] = processParams.shouldReturnPackageForReprocess;
762
850
 
763
851
  return result;
764
852
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regulaforensics/react-native-document-reader-api",
3
- "version": "5.8.0",
3
+ "version": "6.1.2",
4
4
  "description": "React Native module for reading and validation of identification documents (API framework)",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,88 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Scheme
3
- LastUpgradeVersion = "1130"
4
- version = "1.3">
5
- <BuildAction
6
- parallelizeBuildables = "YES"
7
- buildImplicitDependencies = "YES">
8
- <BuildActionEntries>
9
- <BuildActionEntry
10
- buildForTesting = "YES"
11
- buildForRunning = "YES"
12
- buildForProfiling = "YES"
13
- buildForArchiving = "YES"
14
- buildForAnalyzing = "YES">
15
- <BuildableReference
16
- BuildableIdentifier = "primary"
17
- BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
18
- BuildableName = "DocumentReader-tvOS.app"
19
- BlueprintName = "DocumentReader-tvOS"
20
- ReferencedContainer = "container:DocumentReader.xcodeproj">
21
- </BuildableReference>
22
- </BuildActionEntry>
23
- </BuildActionEntries>
24
- </BuildAction>
25
- <TestAction
26
- buildConfiguration = "Debug"
27
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
- shouldUseLaunchSchemeArgsEnv = "YES">
30
- <Testables>
31
- <TestableReference
32
- skipped = "NO">
33
- <BuildableReference
34
- BuildableIdentifier = "primary"
35
- BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
36
- BuildableName = "DocumentReader-tvOSTests.xctest"
37
- BlueprintName = "DocumentReader-tvOSTests"
38
- ReferencedContainer = "container:DocumentReader.xcodeproj">
39
- </BuildableReference>
40
- </TestableReference>
41
- </Testables>
42
- </TestAction>
43
- <LaunchAction
44
- buildConfiguration = "Debug"
45
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
46
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47
- launchStyle = "0"
48
- useCustomWorkingDirectory = "NO"
49
- ignoresPersistentStateOnLaunch = "NO"
50
- debugDocumentVersioning = "YES"
51
- debugServiceExtension = "internal"
52
- allowLocationSimulation = "YES">
53
- <BuildableProductRunnable
54
- runnableDebuggingMode = "0">
55
- <BuildableReference
56
- BuildableIdentifier = "primary"
57
- BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
58
- BuildableName = "DocumentReader-tvOS.app"
59
- BlueprintName = "DocumentReader-tvOS"
60
- ReferencedContainer = "container:DocumentReader.xcodeproj">
61
- </BuildableReference>
62
- </BuildableProductRunnable>
63
- </LaunchAction>
64
- <ProfileAction
65
- buildConfiguration = "Release"
66
- shouldUseLaunchSchemeArgsEnv = "YES"
67
- savedToolIdentifier = ""
68
- useCustomWorkingDirectory = "NO"
69
- debugDocumentVersioning = "YES">
70
- <BuildableProductRunnable
71
- runnableDebuggingMode = "0">
72
- <BuildableReference
73
- BuildableIdentifier = "primary"
74
- BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
75
- BuildableName = "DocumentReader-tvOS.app"
76
- BlueprintName = "DocumentReader-tvOS"
77
- ReferencedContainer = "container:DocumentReader.xcodeproj">
78
- </BuildableReference>
79
- </BuildableProductRunnable>
80
- </ProfileAction>
81
- <AnalyzeAction
82
- buildConfiguration = "Debug">
83
- </AnalyzeAction>
84
- <ArchiveAction
85
- buildConfiguration = "Release"
86
- revealArchiveInOrganizer = "YES">
87
- </ArchiveAction>
88
- </Scheme>