@regulaforensics/cordova-plugin-document-reader-api 7.5.648-nightly → 7.5.651-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/example/package.json +4 -4
- package/package.json +1 -1
- package/plugin.xml +6 -4
- package/src/android/BluetoothUtil.kt +95 -45
- package/src/android/Config.kt +43 -2
- package/src/android/DocumentReader.kt +36 -21
- package/src/android/JSONConstructor.kt +27 -13
- package/src/android/Utils.kt +7 -2
- package/src/android/build.gradle +1 -3
- package/src/ios/RGLWConfig.m +45 -0
- package/src/ios/RGLWDocumentReader.h +4 -1
- package/src/ios/RGLWDocumentReader.m +71 -21
- package/src/ios/RGLWJSONConstructor.h +3 -0
- package/src/ios/RGLWJSONConstructor.m +33 -2
- package/www/DocumentReader.js +81 -3
package/src/android/Utils.kt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Utils.
|
|
2
|
+
// Utils.kt
|
|
3
3
|
// DocumentReader
|
|
4
4
|
//
|
|
5
5
|
// Created by Pavel Masiuk on 21.09.2023.
|
|
@@ -225,7 +225,12 @@ fun CustomizationFont.setFont(editor: ParamsCustomization.CustomizationEditor, v
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
internal object Convert {
|
|
228
|
-
fun byteArrayFromBase64(base64: String?)
|
|
228
|
+
fun byteArrayFromBase64(base64: String?): ByteArray? {
|
|
229
|
+
var str = base64 ?: return null
|
|
230
|
+
if (str.startsWith("data")) str = str.substring(str.indexOf(",") + 1)
|
|
231
|
+
return Base64.decode(str, Base64.NO_WRAP)
|
|
232
|
+
}
|
|
233
|
+
|
|
229
234
|
fun generateByteArray(array: ByteArray?) = array?.let { Base64.encodeToString(it, Base64.NO_WRAP) }
|
|
230
235
|
|
|
231
236
|
fun bitmapFromBase64(base64: String?) = base64?.let {
|
package/src/android/build.gradle
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
apply plugin: 'kotlin-android'
|
|
2
|
-
|
|
3
1
|
android {
|
|
4
2
|
compileSdk 34
|
|
5
3
|
|
|
@@ -16,7 +14,7 @@ repositories {
|
|
|
16
14
|
|
|
17
15
|
dependencies {
|
|
18
16
|
//noinspection GradleDependency
|
|
19
|
-
implementation ('com.regula.documentreader:api:7.5.
|
|
17
|
+
implementation ('com.regula.documentreader:api:7.5.10343'){
|
|
20
18
|
transitive = true
|
|
21
19
|
}
|
|
22
20
|
}
|
package/src/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
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#import <Foundation/Foundation.h>
|
|
3
3
|
#import "RGLWJSONConstructor.h"
|
|
4
4
|
#import "RGLWConfig.h"
|
|
5
|
+
#import <CoreBluetooth/CoreBluetooth.h>
|
|
5
6
|
#import <DocumentReader/DocumentReader.h>
|
|
6
7
|
|
|
7
8
|
@class DocReader;
|
|
@@ -13,7 +14,9 @@ typedef void (^RGLWRFIDSignatureCallback)(NSData * _Nonnull signature);
|
|
|
13
14
|
@interface RGLWDocumentReader : CDVPlugin<RGLRecordScanningProcessDelegate,
|
|
14
15
|
RGLDocReaderRFIDDelegate,
|
|
15
16
|
RGLCustomizationActionDelegate,
|
|
16
|
-
RGLDocReaderDatabaseFetchDelegate
|
|
17
|
+
RGLDocReaderDatabaseFetchDelegate,
|
|
18
|
+
RGLBluetoothDelegate,
|
|
19
|
+
CBCentralManagerDelegate>
|
|
17
20
|
|
|
18
21
|
@property (class) CDVInvokedUrlCommand* _Nullable command;
|
|
19
22
|
@property NSNumber* _Nonnull doRequestPACertificates;
|
|
@@ -39,10 +39,6 @@ static RGLWEventSender sendEvent = ^(NSString* event, id data) {
|
|
|
39
39
|
[self getDocumentReaderIsReady :successCallback :errorCallback];
|
|
40
40
|
else if([action isEqualToString:@"getDocumentReaderStatus"])
|
|
41
41
|
[self getDocumentReaderStatus :successCallback :errorCallback];
|
|
42
|
-
else if([action isEqualToString:@"isAuthenticatorAvailableForUse"])
|
|
43
|
-
[self isAuthenticatorAvailableForUse :successCallback :errorCallback];
|
|
44
|
-
else if([action isEqualToString:@"isBlePermissionsGranted"])
|
|
45
|
-
[self isBlePermissionsGranted :successCallback :errorCallback];
|
|
46
42
|
else if([action isEqualToString:@"getRfidSessionStatus"])
|
|
47
43
|
[self getRfidSessionStatus :successCallback :errorCallback];
|
|
48
44
|
else if([action isEqualToString:@"setRfidSessionStatus"])
|
|
@@ -121,8 +117,8 @@ static RGLWEventSender sendEvent = ^(NSString* event, id data) {
|
|
|
121
117
|
[self clearPKDCertificates :successCallback :errorCallback];
|
|
122
118
|
else if([action isEqualToString:@"startNewSession"])
|
|
123
119
|
[self startNewSession :successCallback :errorCallback];
|
|
124
|
-
else if([action isEqualToString:@"
|
|
125
|
-
[self
|
|
120
|
+
else if([action isEqualToString:@"connectBluetoothDevice"])
|
|
121
|
+
[self connectBluetoothDevice :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
126
122
|
else if([action isEqualToString:@"setLocalizationDictionary"])
|
|
127
123
|
[self setLocalizationDictionary :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
128
124
|
else if([action isEqualToString:@"getLicense"])
|
|
@@ -131,6 +127,10 @@ static RGLWEventSender sendEvent = ^(NSString* event, id data) {
|
|
|
131
127
|
[self getAvailableScenarios :successCallback :errorCallback];
|
|
132
128
|
else if([action isEqualToString:@"getIsRFIDAvailableForUse"])
|
|
133
129
|
[self getIsRFIDAvailableForUse :successCallback :errorCallback];
|
|
130
|
+
else if([action isEqualToString:@"isAuthenticatorRFIDAvailableForUse"])
|
|
131
|
+
[self isAuthenticatorRFIDAvailableForUse :successCallback :errorCallback];
|
|
132
|
+
else if([action isEqualToString:@"isAuthenticatorAvailableForUse"])
|
|
133
|
+
[self isAuthenticatorAvailableForUse :successCallback :errorCallback];
|
|
134
134
|
else if([action isEqualToString:@"getDocReaderVersion"])
|
|
135
135
|
[self getDocReaderVersion :successCallback :errorCallback];
|
|
136
136
|
else if([action isEqualToString:@"getDocReaderDocumentsDatabase"])
|
|
@@ -171,6 +171,8 @@ static RGLWEventSender sendEvent = ^(NSString* event, id data) {
|
|
|
171
171
|
[self encryptedContainers :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
172
172
|
else if([action isEqualToString:@"finalizePackage"])
|
|
173
173
|
[self finalizePackage :successCallback :errorCallback];
|
|
174
|
+
else if([action isEqualToString:@"endBackendTransaction"])
|
|
175
|
+
[self endBackendTransaction :successCallback :errorCallback];
|
|
174
176
|
else if([action isEqualToString:@"getTranslation"])
|
|
175
177
|
[self getTranslation :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
|
|
176
178
|
else
|
|
@@ -188,10 +190,6 @@ NSString* RGLWPaCertificateCompletionEvent = @"pa_certificate_completion";
|
|
|
188
190
|
NSString* RGLWTaCertificateCompletionEvent = @"ta_certificate_completion";
|
|
189
191
|
NSString* RGLWTaSignatureCompletionEvent = @"ta_signature_completion";
|
|
190
192
|
|
|
191
|
-
NSString* RGLWBleOnServiceConnectedEvent = @"bleOnServiceConnectedEvent";
|
|
192
|
-
NSString* RGLWBleOnServiceDisconnectedEvent = @"bleOnServiceDisconnectedEvent";
|
|
193
|
-
NSString* RGLWBleOnDeviceReadyEvent = @"bleOnDeviceReadyEvent";
|
|
194
|
-
|
|
195
193
|
NSString* RGLWVideoEncoderCompletionEvent = @"video_encoder_completion";
|
|
196
194
|
NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
|
|
197
195
|
|
|
@@ -203,14 +201,6 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
|
|
|
203
201
|
successCallback(RGLDocReader.shared.documentReaderStatus);
|
|
204
202
|
}
|
|
205
203
|
|
|
206
|
-
- (void) isAuthenticatorAvailableForUse:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
207
|
-
successCallback(RGLDocReader.shared.isAuthenticatorAvailableForUse ? @YES : @NO);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
- (void) isBlePermissionsGranted:(RGLWCallback)successCallback :(RGLWCallback)errorCallback {
|
|
211
|
-
errorCallback(@"isBlePermissionsGranted() is an android-only method");
|
|
212
|
-
}
|
|
213
|
-
|
|
214
204
|
- (void) getRfidSessionStatus:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
215
205
|
successCallback(RGLDocReader.shared.rfidSessionStatus);
|
|
216
206
|
}
|
|
@@ -290,7 +280,7 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
|
|
|
290
280
|
}
|
|
291
281
|
|
|
292
282
|
- (void) initializeReaderWithBleDeviceConfig:(NSDictionary*)config :(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
293
|
-
|
|
283
|
+
[RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor bleDeviceConfigFromJson:config :bluetooth] completion:[self getInitCompletion :successCallback :errorCallback]];
|
|
294
284
|
}
|
|
295
285
|
|
|
296
286
|
- (void) deinitializeReader:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
@@ -434,8 +424,55 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
|
|
|
434
424
|
successCallback(@"");
|
|
435
425
|
}
|
|
436
426
|
|
|
437
|
-
|
|
438
|
-
|
|
427
|
+
RGLBluetooth* bluetooth;
|
|
428
|
+
CBCentralManager* centralManager;
|
|
429
|
+
RGLWCallback savedCallbackForBluetoothResult;
|
|
430
|
+
|
|
431
|
+
- (void) connectBluetoothDevice:(NSString*)deviceName :(RGLWCallback)successCallback :(RGLWCallback)errorCallback {
|
|
432
|
+
// register callback for user's answer to bluetooth permission
|
|
433
|
+
centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
|
|
434
|
+
|
|
435
|
+
// return if already connected
|
|
436
|
+
if (bluetooth && bluetooth.state == RGLBluetoothConnectionStateConnected) return;
|
|
437
|
+
|
|
438
|
+
// start searching devices
|
|
439
|
+
if (!bluetooth) {
|
|
440
|
+
bluetooth = [RGLBluetooth new];
|
|
441
|
+
bluetooth.delegate = self;
|
|
442
|
+
}
|
|
443
|
+
savedCallbackForBluetoothResult = successCallback;
|
|
444
|
+
[bluetooth connectWithDeviceName:deviceName];
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// CBCentralManagerDelegate
|
|
448
|
+
- (void)centralManagerDidUpdateState:(CBCentralManager *)central {
|
|
449
|
+
if (central.state != CBManagerStatePoweredOn && savedCallbackForBluetoothResult)
|
|
450
|
+
[self bluetoothDeviceConnectionFailed];
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// RGLBluetoothDelegate
|
|
454
|
+
- (void)didChangeConnectionState:(RGLBluetooth *)bluetooth state:(RGLBluetoothConnectionState)state {
|
|
455
|
+
if (state == RGLBluetoothConnectionStateNone && savedCallbackForBluetoothResult)
|
|
456
|
+
[self bluetoothDeviceConnectionFailed];
|
|
457
|
+
|
|
458
|
+
// set searching timeout
|
|
459
|
+
if (state == RGLBluetoothConnectionStateSearching)
|
|
460
|
+
[self performSelector:NSSelectorFromString(@"bluetoothDeviceConnectionFailed") withObject:nil afterDelay:7.0];
|
|
461
|
+
|
|
462
|
+
if (state == RGLBluetoothConnectionStateConnected) {
|
|
463
|
+
savedCallbackForBluetoothResult(@YES);
|
|
464
|
+
savedCallbackForBluetoothResult = nil;
|
|
465
|
+
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:NSSelectorFromString(@"bluetoothDeviceConnectionFailed") object:nil];
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
- (void) bluetoothDeviceConnectionFailed {
|
|
470
|
+
if (savedCallbackForBluetoothResult) {
|
|
471
|
+
savedCallbackForBluetoothResult(@NO);
|
|
472
|
+
savedCallbackForBluetoothResult = nil;
|
|
473
|
+
}
|
|
474
|
+
[bluetooth stopSearchDevices];
|
|
475
|
+
[bluetooth disconnect];
|
|
439
476
|
}
|
|
440
477
|
|
|
441
478
|
- (void) setLocalizationDictionary:(NSDictionary*)dictionary :(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
@@ -466,6 +503,14 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
|
|
|
466
503
|
successCallback([RGLWJSONConstructor generateDocReaderVersion:RGLDocReader.shared.version]);
|
|
467
504
|
}
|
|
468
505
|
|
|
506
|
+
- (void) isAuthenticatorRFIDAvailableForUse:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
507
|
+
successCallback(RGLDocReader.shared.isAuthenticatorRFIDAvailableForUse ? @YES : @NO);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
- (void) isAuthenticatorAvailableForUse:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
511
|
+
successCallback(RGLDocReader.shared.isAuthenticatorAvailableForUse ? @YES : @NO);
|
|
512
|
+
}
|
|
513
|
+
|
|
469
514
|
- (void) getDocReaderDocumentsDatabase:(RGLWCallback)successCallback :(RGLWCallback)errorCallback {
|
|
470
515
|
if(RGLDocReader.shared.version != nil)
|
|
471
516
|
successCallback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocReaderDocumentsDatabase:RGLDocReader.shared.version.database]]);
|
|
@@ -579,6 +624,11 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
|
|
|
579
624
|
}];
|
|
580
625
|
}
|
|
581
626
|
|
|
627
|
+
- (void) endBackendTransaction:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
628
|
+
[RGLDocReader.shared endBackendTransaction];
|
|
629
|
+
successCallback(@"");
|
|
630
|
+
}
|
|
631
|
+
|
|
582
632
|
- (void) getTranslation:(NSString*)className :(NSNumber*)value :(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
583
633
|
if([className isEqualToString:@"RFIDErrorCodes"])
|
|
584
634
|
successCallback(RGLRFIDErrorCodesGetStringValue([value intValue]));
|
|
@@ -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"])
|
|
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
|
-
|
|
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;
|