@regulaforensics/react-native-document-reader-api 6.5.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.
@@ -514,6 +514,15 @@
514
514
  result[@"fields"] = array;
515
515
  }
516
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
+ }
517
526
 
518
527
  return result;
519
528
  }
@@ -534,7 +543,22 @@
534
543
  result[@"values"] = array;
535
544
  }
536
545
  result[@"status"] = @(input.status);
537
- result[@"value"] = [self generateRGLDocumentReaderValue:[input getValue]];
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
+ }
538
562
 
539
563
  return result;
540
564
  }
@@ -551,6 +575,14 @@
551
575
  result[@"comparison"] = [self generateNSDictionary:input.comparison];
552
576
  result[@"pageIndex"] = @(input.pageIndex);
553
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];
554
586
 
555
587
  return result;
556
588
  }
@@ -1129,6 +1161,75 @@
1129
1161
  return result;
1130
1162
  }
1131
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
+
1132
1233
  +(NSMutableDictionary* _Nonnull)generateRGLElementRect:(RGLElementRect* _Nullable)input {
1133
1234
  NSMutableDictionary *result = [NSMutableDictionary new];
1134
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"])
@@ -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
  }
@@ -333,11 +363,11 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
333
363
  }
334
364
 
335
365
  - (void) showScanner:(Callback)successCallback :(Callback)errorCallback{
336
- dispatch_async(dispatch_get_main_queue(), ^{
337
- [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
338
- UIViewController *currentViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
339
- [RGLDocReader.shared showScanner:currentViewController completion:[self getCompletion]];
340
- });
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
+ });
341
371
  }
342
372
 
343
373
  - (void) recognizeImage:(NSMutableString*)base64 :(Callback)successCallback :(Callback)errorCallback{
@@ -349,21 +379,22 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
349
379
  }
350
380
 
351
381
  - (void) recognizeImages:(NSArray*)input :(Callback)successCallback :(Callback)errorCallback{
352
- NSMutableArray<UIImage*>* images = [[NSMutableArray alloc] init];
353
- for(__strong NSMutableString* base64 in input)
354
- [images addObject:[UIImage imageWithData:[[NSData alloc]initWithBase64EncodedString:base64 options:NSDataBase64DecodingIgnoreUnknownCharacters]]];
355
- dispatch_async(dispatch_get_main_queue(), ^{
356
- [RGLDocReader.shared recognizeImages:images completion:[self getCompletion]];
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
- NSMutableArray<RGLImageInput*>* images = [[NSMutableArray alloc] init];
362
- for(__strong NSDictionary* image in input)
363
- [images addObject:[RGLWJSONConstructor RGLImageInputFromJson: image]];
364
- dispatch_async(dispatch_get_main_queue(), ^{
365
- [RGLDocReader.shared recognizeImagesWithImageInputs:images completion:[self getCompletion]];
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
- dispatch_async(dispatch_get_main_queue(), ^{
375
- [RGLDocReader.shared recognizeImage:[UIImage imageWithData:[[NSData alloc]initWithBase64EncodedString:base64 options:NSDataBase64DecodingIgnoreUnknownCharacters]] cameraMode:cameraMode completion:[self getCompletion]];
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
- [RegulaConfig setConfig:config :RGLDocReader.shared];
381
- [self result:@"" :successCallback];
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
- [RegulaConfig setRfidScenario:rfidScenario :RGLDocReader.shared.rfidScenario];
390
- [self result:@"" :successCallback];
433
+ [RegulaConfig setRfidScenario:rfidScenario :RGLDocReader.shared.rfidScenario];
434
+ [self result:@"" :successCallback];
391
435
  }
392
436
 
393
437
  - (void) getRfidScenario:(Callback)successCallback :(Callback)errorCallback{
394
- [self result:[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:RGLDocReader.shared.rfidScenario.rfidScenarioDictionary options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding] :successCallback];
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
- [RGLDocReader.shared readRFID:[self getRFIDNotificationCallback] completion:[self getRFIDCompletion]];
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
@@ -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
  }
@@ -622,7 +625,7 @@
622
625
  if([options valueForKey:@"cameraPosition"] != nil)
623
626
  functionality.cameraPosition = [self AVCaptureDevicePositionWithNSInteger:[[options valueForKey:@"cameraPosition"] integerValue]];
624
627
  if([options valueForKey:@"btDeviceName"] != nil)
625
- functionality.btDeviceName = [[options valueForKey:@"btDeviceName"] stringValue];
628
+ functionality.btDeviceName = [options valueForKey:@"btDeviceName"];
626
629
  if([options valueForKey:@"useAuthenticator"] != nil)
627
630
  functionality.useAuthenticator = [[options valueForKey:@"useAuthenticator"] boolValue];
628
631
  if([options valueForKey:@"showCaptureButtonDelayFromDetect"] != nil)
@@ -742,6 +745,20 @@
742
745
  processParams.parseBarcodes = [options valueForKey:@"parseBarcodes"];
743
746
  if([options valueForKey:@"shouldReturnPackageForReprocess"] != nil)
744
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"];
745
762
  }
746
763
 
747
764
  +(NSMutableDictionary *)getCustomization:(RGLCustomization*)customization {
@@ -893,6 +910,13 @@
893
910
  result[@"forceReadMrzBeforeLocate"] = processParams.forceReadMrzBeforeLocate;
894
911
  result[@"parseBarcodes"] = processParams.parseBarcodes;
895
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;
896
920
 
897
921
  return result;
898
922
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regulaforensics/react-native-document-reader-api",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "React Native module for reading and validation of identification documents (API framework)",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/core/.gitkeep DELETED
File without changes