@regulaforensics/react-native-document-reader-api 5.8.1 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +1 -1
  2. package/RNDocumentReaderApi.podspec +2 -2
  3. package/android/build.gradle +2 -2
  4. package/android/src/main/java/com/regula/documentreader/Helpers.java +1 -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 +8 -12
  7. package/android/src/main/java/com/regula/documentreader/RegulaConfig.java +3 -0
  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 +713 -514
  47. package/index.js +661 -510
  48. package/ios/RGLWJSONConstructor.h +6 -0
  49. package/ios/RGLWJSONConstructor.m +92 -0
  50. package/ios/RNRegulaDocumentReader.m +5 -5
  51. package/ios/RegulaConfig.m +3 -0
  52. package/package.json +1 -1
  53. 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;
@@ -25,11 +25,11 @@ RNRegulaDocumentReader* plugin;
25
25
  }
26
26
 
27
27
  - (void)didChipConnected {
28
- [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;
29
29
  }
30
30
 
31
31
  - (void)didReceivedError:(RGLRFIDErrorCodes)errorCode {
32
- [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;
33
33
  }
34
34
 
35
35
  @end
@@ -112,11 +112,11 @@ typedef void (^Callback)(NSString* response);
112
112
  }
113
113
 
114
114
  - (void)didChipConnected {
115
- [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;
116
116
  }
117
117
 
118
118
  - (void)didReceivedError:(RGLRFIDErrorCodes)errorCode {
119
- [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;
120
120
  }
121
121
 
122
122
  RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(RCTResponseSenderBlock)sCallback:(RCTResponseSenderBlock)eCallback) {
@@ -317,7 +317,7 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
317
317
  }
318
318
 
319
319
  - (void) initializeReaderWithDatabasePath:(NSString*)licenseString :(NSString*)databasePath :(Callback)successCallback :(Callback)errorCallback{
320
- [RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:[[NSData alloc] initWithBase64EncodedString:licenseString options:0] licenseUpdateCheck:true 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]];
321
321
  }
322
322
 
323
323
  - (void) prepareDatabase:(NSString*)dbID :(Callback)successCallback :(Callback)errorCallback{
@@ -696,6 +696,8 @@
696
696
  processParams.forceReadMrzBeforeLocate = [options valueForKey:@"forceReadMrzBeforeLocate"];
697
697
  if([options valueForKey:@"parseBarcodes"] != nil)
698
698
  processParams.parseBarcodes = [options valueForKey:@"parseBarcodes"];
699
+ if([options valueForKey:@"shouldReturnPackageForReprocess"] != nil)
700
+ processParams.shouldReturnPackageForReprocess = [options valueForKey:@"shouldReturnPackageForReprocess"];
699
701
  }
700
702
 
701
703
  +(NSMutableDictionary *)getCustomization:(RGLCustomization*)customization {
@@ -844,6 +846,7 @@
844
846
  result[@"mrzFormatsFilter"] = processParams.mrzFormatsFilter;
845
847
  result[@"forceReadMrzBeforeLocate"] = processParams.forceReadMrzBeforeLocate;
846
848
  result[@"parseBarcodes"] = processParams.parseBarcodes;
849
+ result[@"shouldReturnPackageForReprocess"] = processParams.shouldReturnPackageForReprocess;
847
850
 
848
851
  return result;
849
852
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regulaforensics/react-native-document-reader-api",
3
- "version": "5.8.1",
3
+ "version": "6.1.0",
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>