@regulaforensics/react-native-document-reader-api 7.5.763-nightly → 7.5.766-nightly

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/ios/RGLWConfig.m CHANGED
@@ -173,6 +173,7 @@
173
173
  processParams.disablePerforationOCR = [options valueForKey:@"disablePerforationOCR"];
174
174
  if([options valueForKey:@"respectImageQuality"] != nil)
175
175
  processParams.respectImageQuality = [options valueForKey:@"respectImageQuality"];
176
+ if (options[@"strictImageQuality"]) processParams.strictImageQuality = options[@"strictImageQuality"];
176
177
  if([options valueForKey:@"splitNames"] != nil)
177
178
  processParams.splitNames = [options valueForKey:@"splitNames"];
178
179
  if([options valueForKey:@"doDetectCan"] != nil)
@@ -184,6 +185,9 @@
184
185
  if([options valueForKey:@"checkHologram"] != nil)
185
186
  processParams.checkHologram = [options valueForKey:@"checkHologram"];
186
187
  if (options[@"generateNumericCodes"]) processParams.generateNumericCodes = options[@"generateNumericCodes"];
188
+ if (options[@"strictBarcodeDigitalSignatureCheck"]) processParams.strictBarcodeDigitalSignatureCheck = options[@"strictBarcodeDigitalSignatureCheck"];
189
+ if (options[@"selectLongestNames"]) processParams.selectLongestNames = options[@"selectLongestNames"];
190
+ if (options[@"generateDTCVC"]) processParams.generateDTCVC = options[@"generateDTCVC"];
187
191
 
188
192
  // Int
189
193
  if([options valueForKey:@"measureSystem"] != nil)
@@ -301,12 +305,16 @@
301
305
  result[@"shouldReturnPackageForReprocess"] = processParams.shouldReturnPackageForReprocess;
302
306
  result[@"disablePerforationOCR"] = processParams.disablePerforationOCR;
303
307
  result[@"respectImageQuality"] = processParams.respectImageQuality;
308
+ result[@"strictImageQuality"] = processParams.strictImageQuality;
304
309
  result[@"splitNames"] = processParams.splitNames;
305
310
  result[@"doDetectCan"] = processParams.doDetectCan;
306
311
  result[@"useFaceApi"] = processParams.useFaceApi;
307
312
  result[@"useAuthenticityCheck"] = processParams.useAuthenticityCheck;
308
313
  result[@"checkHologram"] = processParams.checkHologram;
309
314
  result[@"generateNumericCodes"] = processParams.generateNumericCodes;
315
+ result[@"strictBarcodeDigitalSignatureCheck"] = processParams.strictBarcodeDigitalSignatureCheck;
316
+ result[@"selectLongestNames"] = processParams.selectLongestNames;
317
+ result[@"generateDTCVC"] = processParams.generateDTCVC;
310
318
 
311
319
  // Int
312
320
  result[@"measureSystem"] = [NSNumber numberWithInteger:processParams.measureSystem];
@@ -383,6 +391,8 @@
383
391
  customization.cameraFrameShapeType = [[options valueForKey:@"cameraFrameShapeType"] integerValue];
384
392
  if([options valueForKey:@"cameraFrameOffsetWidth"] != nil)
385
393
  customization.cameraFrameOffsetWidth = [[options valueForKey:@"cameraFrameOffsetWidth"] floatValue];
394
+ if(options[@"nextPageAnimationStartDelay"]) customization.nextPageAnimationStartDelay = [options[@"nextPageAnimationStartDelay"] floatValue];
395
+ if(options[@"nextPageAnimationEndDelay"]) customization.nextPageAnimationEndDelay = [options[@"nextPageAnimationEndDelay"] floatValue];
386
396
 
387
397
  // String
388
398
  if([options valueForKey:@"status"] != nil)
@@ -411,6 +421,8 @@
411
421
  customization.statusBackgroundColor = [self colorWithInt:[options valueForKey:@"statusBackgroundColor"]];
412
422
  if([options valueForKey:@"cameraPreviewBackgroundColor"] != nil)
413
423
  customization.cameraPreviewBackgroundColor = [self colorWithInt:[options valueForKey:@"cameraPreviewBackgroundColor"]];
424
+ if([options valueForKey:@"backgroundMaskColor"] != nil)
425
+ customization.backgroundMaskColor = [self colorWithInt:[options valueForKey:@"backgroundMaskColor"]];
414
426
 
415
427
  // Float
416
428
  if([options valueForKey:@"statusPositionMultiplier"] != nil)
@@ -509,6 +521,8 @@
509
521
  result[@"cameraFrameLineLength"] = [NSNumber numberWithFloat:customization.cameraFrameLineLength];
510
522
  result[@"cameraFrameShapeType"] = [NSNumber numberWithFloat:customization.cameraFrameShapeType];
511
523
  result[@"cameraFrameOffsetWidth"] = [NSNumber numberWithFloat:customization.cameraFrameOffsetWidth];
524
+ result[@"nextPageAnimationStartDelay"] = [NSNumber numberWithFloat:customization.nextPageAnimationStartDelay];
525
+ result[@"nextPageAnimationEndDelay"] = [NSNumber numberWithFloat:customization.nextPageAnimationEndDelay];
512
526
 
513
527
  // String
514
528
  result[@"status"] = customization.status;
@@ -525,6 +539,7 @@
525
539
  result[@"activityIndicatorColor"] = [self intWithColor:customization.activityIndicatorColor];
526
540
  result[@"statusBackgroundColor"] = [self intWithColor:customization.statusBackgroundColor];
527
541
  result[@"cameraPreviewBackgroundColor"] = [self intWithColor:customization.cameraPreviewBackgroundColor];
542
+ result[@"backgroundMaskColor"] = [self intWithColor:customization.backgroundMaskColor];
528
543
 
529
544
  // Float
530
545
  result[@"statusPositionMultiplier"] = [NSNumber numberWithFloat:customization.statusPositionMultiplier];
@@ -645,6 +660,8 @@
645
660
  rfidScenario.autoSettings = [[options valueForKey:@"autoSettings"] boolValue];
646
661
  if([options valueForKey:@"proceedReadingAlways"] != nil)
647
662
  rfidScenario.proceedReadingAlways = [[options valueForKey:@"proceedReadingAlways"] boolValue];
663
+ if(options[@"readDTC"]) rfidScenario.readDTC = [options[@"readDTC"] boolValue];
664
+ if(options[@"mrzStrictCheck"]) rfidScenario.mrzStrictCheck = options[@"mrzStrictCheck"];
648
665
 
649
666
  // Int
650
667
  if([options valueForKey:@"signManagementAction"] != nil)
@@ -679,6 +696,7 @@
679
696
  rfidScenario.eSignPINDefault = [options valueForKey:@"eSignPINDefault"];
680
697
  if([options valueForKey:@"eSignPINNewValue"] != nil)
681
698
  rfidScenario.eSignPINNewValue = [options valueForKey:@"eSignPINNewValue"];
699
+ if(options[@"cardAccess"]) rfidScenario.cardAccess = options[@"cardAccess"];
682
700
 
683
701
  // DataGroup
684
702
  if([options valueForKey:@"ePassportDataGroups"] != nil)
@@ -687,6 +705,7 @@
687
705
  [self setDataGroups :rfidScenario.eIDDataGroups dict:[options valueForKey:@"eIDDataGroups"]];
688
706
  if([options valueForKey:@"eDLDataGroups"] != nil)
689
707
  [self setDataGroups :rfidScenario.eDLDataGroups dict:[options valueForKey:@"eDLDataGroups"]];
708
+ if(options[@"dtcDataGroups"]) [self setDataGroups :rfidScenario.DTCDataGroups dict:options[@"dtcDataGroups"]];
690
709
  }
691
710
 
692
711
  +(NSDictionary*)getRfidScenario:(RGLRFIDScenario*)rfidScenario {
@@ -727,6 +746,8 @@
727
746
  result[@"applyAmendments"] = [NSNumber numberWithBool:rfidScenario.applyAmendments];
728
747
  result[@"autoSettings"] = [NSNumber numberWithBool:rfidScenario.autoSettings];
729
748
  result[@"proceedReadingAlways"] = [NSNumber numberWithBool:rfidScenario.proceedReadingAlways];
749
+ result[@"readDTC"] = [NSNumber numberWithBool:rfidScenario.readDTC];
750
+ result[@"mrzStrictCheck"] = [NSNumber numberWithBool:rfidScenario.mrzStrictCheck];
730
751
 
731
752
  // Int
732
753
  result[@"signManagementAction"] = [NSNumber numberWithInteger:rfidScenario.signManagementAction];
@@ -746,11 +767,13 @@
746
767
  result[@"mrz"] = rfidScenario.mrz;
747
768
  result[@"eSignPINDefault"] = rfidScenario.eSignPINDefault;
748
769
  result[@"eSignPINNewValue"] = rfidScenario.eSignPINNewValue;
770
+ result[@"cardAccess"] = rfidScenario.cardAccess;
749
771
 
750
772
  // DataGroup
751
773
  result[@"eDLDataGroups"] = [self getDataGroups:rfidScenario.eDLDataGroups];
752
774
  result[@"ePassportDataGroups"] = [self getDataGroups:rfidScenario.ePassportDataGroups];
753
775
  result[@"eIDDataGroups"] = [self getDataGroups:rfidScenario.eIDDataGroups];
776
+ result[@"dtcDataGroups"] = [self getDataGroups:rfidScenario.DTCDataGroups];
754
777
 
755
778
  return result;
756
779
  }
@@ -812,6 +835,17 @@
812
835
  if([dict valueForKey:@"DG21"] != nil)
813
836
  ((RGLeIDDataGroup*)dataGroup).dG21 = [[dict valueForKey:@"DG21"] boolValue];
814
837
  }
838
+
839
+ // DTCDataGroups: 1-18 & 22-24
840
+ if ([dataGroup class] == [RGLDTCDataGroup class]) {
841
+ if(dict[@"DG15"]) ((RGLDTCDataGroup*)dataGroup).dG15 = [dict[@"DG15"] boolValue];
842
+ if(dict[@"DG16"]) ((RGLDTCDataGroup*)dataGroup).dG16 = [dict[@"DG16"] boolValue];
843
+ if(dict[@"DG17"]) ((RGLDTCDataGroup*)dataGroup).dG17 = [dict[@"DG17"] boolValue];
844
+ if(dict[@"DG18"]) ((RGLDTCDataGroup*)dataGroup).dG18 = [dict[@"DG18"] boolValue];
845
+ if(dict[@"DG22"]) ((RGLDTCDataGroup*)dataGroup).dG22 = [dict[@"DG22"] boolValue];
846
+ if(dict[@"DG23"]) ((RGLDTCDataGroup*)dataGroup).dG23 = [dict[@"DG23"] boolValue];
847
+ if(dict[@"DG24"]) ((RGLDTCDataGroup*)dataGroup).dG24 = [dict[@"DG24"] boolValue];
848
+ }
815
849
  }
816
850
 
817
851
  +(NSDictionary *)getDataGroups:(RGLDataGroup*)dataGroup {
@@ -850,6 +884,17 @@
850
884
  result[@"DG21"] = [NSNumber numberWithBool:((RGLeIDDataGroup*)dataGroup).dG21];
851
885
  }
852
886
 
887
+ // DTCDataGroups: 1-18 & 22-24
888
+ if ([dataGroup class] == [RGLDTCDataGroup class]) {
889
+ result[@"DG15"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG15];
890
+ result[@"DG16"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG16];
891
+ result[@"DG17"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG17];
892
+ result[@"DG18"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG18];
893
+ result[@"DG22"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG22];
894
+ result[@"DG23"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG23];
895
+ result[@"DG24"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG24];
896
+ }
897
+
853
898
  return result;
854
899
  }
855
900
 
@@ -30,6 +30,7 @@
30
30
 
31
31
  +(RGLConfig* _Nullable)configFromJson:(NSDictionary* _Nullable)input;
32
32
  +(NSDictionary* _Nullable)generateConfig:(RGLConfig* _Nullable)input;
33
+ +(RGLBleConfig* _Nullable)bleDeviceConfigFromJson:(NSDictionary* _Nullable)input :(RGLBluetooth* _Nonnull)bluetooth;
33
34
  +(RGLOnlineProcessingConfig* _Nullable)onlineProcessingConfigFromJson:(NSDictionary* _Nullable)input;
34
35
  +(NSDictionary* _Nullable)generateOnlineProcessingConfig:(RGLOnlineProcessingConfig* _Nullable)input;
35
36
  +(RGLImageInput* _Nullable)imageInputFromJson:(NSDictionary* _Nullable)input;
@@ -62,6 +63,8 @@
62
63
  +(NSDictionary* _Nullable)generateEPassportDataGroups:(RGLePassportDataGroup* _Nullable)input;
63
64
  +(RGLeIDDataGroup* _Nullable)eIDDataGroupsFromJson:(NSDictionary* _Nullable)input;
64
65
  +(NSDictionary* _Nullable)generateEIDDataGroups:(RGLeIDDataGroup* _Nullable)input;
66
+ +(RGLeIDDataGroup* _Nullable)dtcDataGroupsFromJson:(NSDictionary* _Nullable)input;
67
+ +(NSDictionary* _Nullable)generateRGLDTCDataGroups:(RGLeIDDataGroup* _Nullable)input;
65
68
  +(RGLRFIDScenario* _Nullable)rfidScenarioFromJson:(NSDictionary* _Nullable)input;
66
69
  +(NSDictionary* _Nullable)generateRFIDScenario:(RGLRFIDScenario* _Nullable)input;
67
70
  +(RGLCustomization* _Nullable)customizationFromJson:(NSDictionary* _Nullable)input;
@@ -23,6 +23,7 @@
23
23
 
24
24
  +(NSData*)base64Decode:(NSString*)input {
25
25
  if(input == nil) return nil;
26
+ if ([input hasPrefix:@"data"]) input = [input substringFromIndex:[input rangeOfString:@","].location + 1];
26
27
  return [[NSData alloc] initWithBase64EncodedString:input options:0];
27
28
  }
28
29
 
@@ -166,6 +167,17 @@
166
167
  return result;
167
168
  }
168
169
 
170
+ +(RGLBleConfig*)bleDeviceConfigFromJson:(NSDictionary*)input :(RGLBluetooth*)bluetooth {
171
+ if (!input) return nil;
172
+ RGLBleConfig *config = [[RGLBleConfig alloc] initWithBluetooth:bluetooth];
173
+
174
+ if (input[@"databasePath"]) config.databasePath = [[NSBundle mainBundle] pathForResource:input[@"databasePath"] ofType:nil];
175
+ if (input[@"licenseUpdate"]) config.licenseUpdateCheck = [input[@"licenseUpdate"] boolValue];
176
+ if (input[@"delayedNNLoad"]) config.delayedNNLoadEnabled = [input[@"delayedNNLoad"] boolValue];
177
+
178
+ return config;
179
+ }
180
+
169
181
  +(RGLScannerConfig*)scannerConfigFromJson:(NSDictionary*)input {
170
182
  RGLScannerConfig *config = [RGLScannerConfig alloc];
171
183
  if (input[@"scenario"]) config = [config initWithScenario:input[@"scenario"]];
@@ -216,7 +228,8 @@
216
228
  if (input[@"scenario"]) config.scenario = input[@"scenario"];
217
229
  if (input[@"livePortrait"]) config.livePortrait = [self imageWithBase64:input[@"livePortrait"]];
218
230
  if (input[@"extPortrait"]) config.extPortrait = [self imageWithBase64:input[@"extPortrait"]];
219
- if (input[@"oneShotIdentification"]) config.oneShotIdentification = input[@"oneShotIdentification"];
231
+ if (input[@"oneShotIdentification"]) config.oneShotIdentification = input[@"oneShotIdentification"];
232
+ if (input[@"dtc"]) config.dtc = [RGLWJSONConstructor base64Decode:input[@"dtc"]];
220
233
 
221
234
  return config;
222
235
  }
@@ -230,6 +243,7 @@
230
243
  result[@"livePortrait"] = [self base64WithImage: input.livePortrait];
231
244
  result[@"extPortrait"] = [self base64WithImage: input.extPortrait];
232
245
  result[@"oneShotIdentification"] = @(input.oneShotIdentification);
246
+ result[@"dtc"] = [self base64Encode: input.dtc];
233
247
  result[@"image"] = [self base64WithImage: input.image];
234
248
  result[@"data"] = [self base64Encode: input.imageData];
235
249
  if(input.images != nil) {
@@ -258,6 +272,7 @@
258
272
  result.httpHeaders = [input valueForKey:@"httpHeaders"];
259
273
  if([input valueForKey:@"rfidServerSideChipVerification"] != nil)
260
274
  result.rfidServerSideChipVerification = [input valueForKey:@"rfidServerSideChipVerification"];
275
+ if (input[@"timeoutConnection"]) result.timeoutConnection = input[@"timeoutConnection"];
261
276
 
262
277
  return result;
263
278
  }
@@ -269,6 +284,7 @@
269
284
  result[@"url"] = input.url;
270
285
  result[@"httpHeaders"] = input.httpHeaders;
271
286
  result[@"rfidServerSideChipVerification"] = input.rfidServerSideChipVerification;
287
+ result[@"timeoutConnection"] = input.timeoutConnection;
272
288
 
273
289
  return result;
274
290
  }
@@ -333,6 +349,16 @@
333
349
  return [RGLWConfig getDataGroups:input];
334
350
  }
335
351
 
352
+ +(RGLDTCDataGroup*)dtcDataGroupsFromJson:(NSDictionary*)input {
353
+ RGLDTCDataGroup *result = [RGLDTCDataGroup new];
354
+ [RGLWConfig setDataGroups :result dict:input];
355
+ return result;
356
+ }
357
+
358
+ +(NSDictionary*)generateRGLDTCDataGroups:(RGLDTCDataGroup*)input {
359
+ return [RGLWConfig getDataGroups:input];
360
+ }
361
+
336
362
  +(RGLRFIDScenario*)rfidScenarioFromJson:(NSDictionary*)input {
337
363
  RGLRFIDScenario *result = [RGLRFIDScenario new];
338
364
  [RGLWConfig setRfidScenario:input :result];
@@ -2220,7 +2246,7 @@
2220
2246
  [imageQuality addObject:[self imageQualityGroupFromJson:item]];
2221
2247
  }
2222
2248
 
2223
- return [[RGLDocumentReaderResults alloc]
2249
+ RGLDocumentReaderResults* result = [[RGLDocumentReaderResults alloc]
2224
2250
  initWithDocumentTypes:documentType
2225
2251
  textResult:[self documentReaderTextResultFromJson: [input valueForKey:@"textResult"]]
2226
2252
  graphicResult:[self documentReaderGraphicResultFromJson: [input valueForKey:@"graphicResult"]]
@@ -2240,6 +2266,10 @@
2240
2266
  elapsedTime:[[input valueForKey:@"elapsedTime"] integerValue]
2241
2267
  elapsedTimeRFID:[[input valueForKey:@"elapsedTimeRFID"] integerValue]
2242
2268
  transactionInfo:[self transactionInfoFromJson:[input valueForKey:@"transactionInfo"]]];
2269
+
2270
+ [result setValue:[RGLWJSONConstructor base64Decode:input[@"dtcData"]] forKey:@"dtcData"];
2271
+
2272
+ return result;
2243
2273
  }
2244
2274
 
2245
2275
  +(NSDictionary*)generateDocumentReaderResults:(RGLDocumentReaderResults*)input {
@@ -2289,6 +2319,7 @@
2289
2319
  result[@"rawResult"] = input.rawResult;
2290
2320
  result[@"status"] = [self generateDocumentReaderResultsStatus:input.status];
2291
2321
  result[@"vdsncData"] = [self generateVDSNCData:input.vdsncData];
2322
+ result[@"dtcData"] = [self base64Encode: input.dtcData];
2292
2323
  result[@"transactionInfo"] = [self generateTransactionInfo:input.transactionInfo];
2293
2324
 
2294
2325
  return result;
@@ -1,5 +1,6 @@
1
1
  #import <React/RCTBridgeModule.h>
2
2
  #import <React/RCTEventEmitter.h>
3
+ #import <CoreBluetooth/CoreBluetooth.h>
3
4
  #import <DocumentReader/DocumentReader.h>
4
5
  #import "RGLWJSONConstructor.h"
5
6
  #import "RGLWConfig.h"
@@ -12,7 +13,9 @@ typedef void (^RGLWRFIDSignatureCallback)(NSData * _Nonnull signature);
12
13
  RGLRecordScanningProcessDelegate,
13
14
  RGLDocReaderRFIDDelegate,
14
15
  RGLCustomizationActionDelegate,
15
- RGLDocReaderDatabaseFetchDelegate>
16
+ RGLDocReaderDatabaseFetchDelegate,
17
+ RGLBluetoothDelegate,
18
+ CBCentralManagerDelegate>
16
19
 
17
20
  @property NSNumber* _Nonnull doRequestPACertificates;
18
21
  @property NSNumber* _Nonnull doRequestTACertificates;
@@ -17,9 +17,6 @@ RCT_EXPORT_MODULE();
17
17
  RGLWPaCertificateCompletionEvent,
18
18
  RGLWTaCertificateCompletionEvent,
19
19
  RGLWTaSignatureCompletionEvent,
20
- RGLWBleOnServiceConnectedEvent,
21
- RGLWBleOnServiceDisconnectedEvent,
22
- RGLWBleOnDeviceReadyEvent,
23
20
  RGLWOnCustomButtonTappedEvent];
24
21
  }
25
22
 
@@ -49,10 +46,6 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
49
46
  [self getDocumentReaderIsReady :successCallback :errorCallback];
50
47
  else if([action isEqualToString:@"getDocumentReaderStatus"])
51
48
  [self getDocumentReaderStatus :successCallback :errorCallback];
52
- else if([action isEqualToString:@"isAuthenticatorAvailableForUse"])
53
- [self isAuthenticatorAvailableForUse :successCallback :errorCallback];
54
- else if([action isEqualToString:@"isBlePermissionsGranted"])
55
- [self isBlePermissionsGranted :successCallback :errorCallback];
56
49
  else if([action isEqualToString:@"getRfidSessionStatus"])
57
50
  [self getRfidSessionStatus :successCallback :errorCallback];
58
51
  else if([action isEqualToString:@"setRfidSessionStatus"])
@@ -131,8 +124,8 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
131
124
  [self clearPKDCertificates :successCallback :errorCallback];
132
125
  else if([action isEqualToString:@"startNewSession"])
133
126
  [self startNewSession :successCallback :errorCallback];
134
- else if([action isEqualToString:@"startBluetoothService"])
135
- [self startBluetoothService :successCallback :errorCallback];
127
+ else if([action isEqualToString:@"connectBluetoothDevice"])
128
+ [self connectBluetoothDevice :[args objectAtIndex:0] :successCallback :errorCallback];
136
129
  else if([action isEqualToString:@"setLocalizationDictionary"])
137
130
  [self setLocalizationDictionary :[args objectAtIndex:0] :successCallback :errorCallback];
138
131
  else if([action isEqualToString:@"getLicense"])
@@ -141,6 +134,10 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
141
134
  [self getAvailableScenarios :successCallback :errorCallback];
142
135
  else if([action isEqualToString:@"getIsRFIDAvailableForUse"])
143
136
  [self getIsRFIDAvailableForUse :successCallback :errorCallback];
137
+ else if([action isEqualToString:@"isAuthenticatorRFIDAvailableForUse"])
138
+ [self isAuthenticatorRFIDAvailableForUse :successCallback :errorCallback];
139
+ else if([action isEqualToString:@"isAuthenticatorAvailableForUse"])
140
+ [self isAuthenticatorAvailableForUse :successCallback :errorCallback];
144
141
  else if([action isEqualToString:@"getDocReaderVersion"])
145
142
  [self getDocReaderVersion :successCallback :errorCallback];
146
143
  else if([action isEqualToString:@"getDocReaderDocumentsDatabase"])
@@ -181,6 +178,8 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
181
178
  [self encryptedContainers :[args objectAtIndex:0] :successCallback :errorCallback];
182
179
  else if([action isEqualToString:@"finalizePackage"])
183
180
  [self finalizePackage :successCallback :errorCallback];
181
+ else if([action isEqualToString:@"endBackendTransaction"])
182
+ [self endBackendTransaction :successCallback :errorCallback];
184
183
  else if([action isEqualToString:@"getTranslation"])
185
184
  [self getTranslation :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
186
185
  else
@@ -198,10 +197,6 @@ NSString* RGLWPaCertificateCompletionEvent = @"pa_certificate_completion";
198
197
  NSString* RGLWTaCertificateCompletionEvent = @"ta_certificate_completion";
199
198
  NSString* RGLWTaSignatureCompletionEvent = @"ta_signature_completion";
200
199
 
201
- NSString* RGLWBleOnServiceConnectedEvent = @"bleOnServiceConnectedEvent";
202
- NSString* RGLWBleOnServiceDisconnectedEvent = @"bleOnServiceDisconnectedEvent";
203
- NSString* RGLWBleOnDeviceReadyEvent = @"bleOnDeviceReadyEvent";
204
-
205
200
  NSString* RGLWVideoEncoderCompletionEvent = @"video_encoder_completion";
206
201
  NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
207
202
 
@@ -213,14 +208,6 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
213
208
  successCallback(RGLDocReader.shared.documentReaderStatus);
214
209
  }
215
210
 
216
- - (void) isAuthenticatorAvailableForUse:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
217
- successCallback(RGLDocReader.shared.isAuthenticatorAvailableForUse ? @YES : @NO);
218
- }
219
-
220
- - (void) isBlePermissionsGranted:(RGLWCallback)successCallback :(RGLWCallback)errorCallback {
221
- errorCallback(@"isBlePermissionsGranted() is an android-only method");
222
- }
223
-
224
211
  - (void) getRfidSessionStatus:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
225
212
  successCallback(RGLDocReader.shared.rfidSessionStatus);
226
213
  }
@@ -300,7 +287,7 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
300
287
  }
301
288
 
302
289
  - (void) initializeReaderWithBleDeviceConfig:(NSDictionary*)config :(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
303
- errorCallback(@"initializeReaderWithBleDeviceConfig() is an android-only method");
290
+ [RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor bleDeviceConfigFromJson:config :bluetooth] completion:[self getInitCompletion :successCallback :errorCallback]];
304
291
  }
305
292
 
306
293
  - (void) deinitializeReader:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
@@ -444,8 +431,55 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
444
431
  successCallback(@"");
445
432
  }
446
433
 
447
- - (void) startBluetoothService:(RGLWCallback)successCallback :(RGLWCallback)errorCallback {
448
- errorCallback(@"startBluetoothService() is an android-only method");
434
+ RGLBluetooth* bluetooth;
435
+ CBCentralManager* centralManager;
436
+ RGLWCallback savedCallbackForBluetoothResult;
437
+
438
+ - (void) connectBluetoothDevice:(NSString*)deviceName :(RGLWCallback)successCallback :(RGLWCallback)errorCallback {
439
+ // register callback for user's answer to bluetooth permission
440
+ centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
441
+
442
+ // return if already connected
443
+ if (bluetooth && bluetooth.state == RGLBluetoothConnectionStateConnected) return;
444
+
445
+ // start searching devices
446
+ if (!bluetooth) {
447
+ bluetooth = [RGLBluetooth new];
448
+ bluetooth.delegate = self;
449
+ }
450
+ savedCallbackForBluetoothResult = successCallback;
451
+ [bluetooth connectWithDeviceName:deviceName];
452
+ }
453
+
454
+ // CBCentralManagerDelegate
455
+ - (void)centralManagerDidUpdateState:(CBCentralManager *)central {
456
+ if (central.state != CBManagerStatePoweredOn && savedCallbackForBluetoothResult)
457
+ [self bluetoothDeviceConnectionFailed];
458
+ }
459
+
460
+ // RGLBluetoothDelegate
461
+ - (void)didChangeConnectionState:(RGLBluetooth *)bluetooth state:(RGLBluetoothConnectionState)state {
462
+ if (state == RGLBluetoothConnectionStateNone && savedCallbackForBluetoothResult)
463
+ [self bluetoothDeviceConnectionFailed];
464
+
465
+ // set searching timeout
466
+ if (state == RGLBluetoothConnectionStateSearching)
467
+ [self performSelector:NSSelectorFromString(@"bluetoothDeviceConnectionFailed") withObject:nil afterDelay:7.0];
468
+
469
+ if (state == RGLBluetoothConnectionStateConnected) {
470
+ savedCallbackForBluetoothResult(@YES);
471
+ savedCallbackForBluetoothResult = nil;
472
+ [NSObject cancelPreviousPerformRequestsWithTarget:self selector:NSSelectorFromString(@"bluetoothDeviceConnectionFailed") object:nil];
473
+ }
474
+ }
475
+
476
+ - (void) bluetoothDeviceConnectionFailed {
477
+ if (savedCallbackForBluetoothResult) {
478
+ savedCallbackForBluetoothResult(@NO);
479
+ savedCallbackForBluetoothResult = nil;
480
+ }
481
+ [bluetooth stopSearchDevices];
482
+ [bluetooth disconnect];
449
483
  }
450
484
 
451
485
  - (void) setLocalizationDictionary:(NSDictionary*)dictionary :(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
@@ -476,6 +510,14 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
476
510
  successCallback([RGLWJSONConstructor generateDocReaderVersion:RGLDocReader.shared.version]);
477
511
  }
478
512
 
513
+ - (void) isAuthenticatorRFIDAvailableForUse:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
514
+ successCallback(RGLDocReader.shared.isAuthenticatorRFIDAvailableForUse ? @YES : @NO);
515
+ }
516
+
517
+ - (void) isAuthenticatorAvailableForUse:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
518
+ successCallback(RGLDocReader.shared.isAuthenticatorAvailableForUse ? @YES : @NO);
519
+ }
520
+
479
521
  - (void) getDocReaderDocumentsDatabase:(RGLWCallback)successCallback :(RGLWCallback)errorCallback {
480
522
  if(RGLDocReader.shared.version != nil)
481
523
  successCallback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocReaderDocumentsDatabase:RGLDocReader.shared.version.database]]);
@@ -589,6 +631,11 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
589
631
  }];
590
632
  }
591
633
 
634
+ - (void) endBackendTransaction:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
635
+ [RGLDocReader.shared endBackendTransaction];
636
+ successCallback(@"");
637
+ }
638
+
592
639
  - (void) getTranslation:(NSString*)className :(NSNumber*)value :(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
593
640
  if([className isEqualToString:@"RFIDErrorCodes"])
594
641
  successCallback(RGLRFIDErrorCodesGetStringValue([value intValue]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regulaforensics/react-native-document-reader-api",
3
- "version": "7.5.763-nightly",
3
+ "version": "7.5.766-nightly",
4
4
  "description": "React Native module for reading and validation of identification documents (API framework)",
5
5
  "main": "index.js",
6
6
  "scripts": {