@regulaforensics/cordova-plugin-document-reader-api 7.4.620 → 7.5.78-rc
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/.gitlab/report.yaml +75 -0
- package/.gitlab-ci.yml +49 -0
- package/README.md +1 -1
- package/example/config.xml +14 -12
- package/example/package.json +4 -4
- package/example/www/js/index.js +5 -0
- package/package.json +4 -8
- package/plugin.xml +7 -5
- package/src/android/BluetoothUtil.kt +105 -59
- package/src/android/Config.kt +63 -5
- package/src/android/DocumentReader.kt +66 -47
- package/src/android/JSONConstructor.kt +39 -14
- package/src/android/Utils.kt +7 -2
- package/src/android/build.gradle +2 -4
- package/src/ios/RGLWConfig.h +2 -0
- package/src/ios/RGLWConfig.m +103 -50
- package/src/ios/RGLWDocumentReader.h +4 -1
- package/src/ios/RGLWDocumentReader.m +71 -21
- package/src/ios/RGLWJSONConstructor.h +8 -0
- package/src/ios/RGLWJSONConstructor.m +77 -9
- package/www/DocumentReader.js +82 -6
- package/.github/ISSUE_TEMPLATE/config.yml +0 -5
|
@@ -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)dtcDataGroupFromJson:(NSDictionary* _Nullable)input;
|
|
67
|
+
+(NSDictionary* _Nullable)generateRGLDTCDataGroup:(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;
|
|
@@ -181,4 +184,9 @@
|
|
|
181
184
|
+(NSDictionary* _Nullable)generateTransactionInfo:(RGLTransactionInfo* _Nullable)input;
|
|
182
185
|
|
|
183
186
|
@end
|
|
187
|
+
|
|
188
|
+
@interface RGLWRequestInterceptorProxy : NSObject <RGLURLRequestInterceptingDelegate>
|
|
189
|
+
- (instancetype _Nonnull)initWithHeaders:(NSDictionary*_Nonnull)headers;
|
|
190
|
+
@end
|
|
191
|
+
|
|
184
192
|
#endif
|
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
@implementation RGLWJSONConstructor
|
|
13
13
|
|
|
14
|
+
static NSMutableArray* weakReferencesHolder;
|
|
15
|
+
+(void) holdWeakReference:(id)reference {
|
|
16
|
+
if(!weakReferencesHolder)
|
|
17
|
+
weakReferencesHolder = [NSMutableArray new];
|
|
18
|
+
[weakReferencesHolder addObject:reference];
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
+(NSString*)dictToString:(NSDictionary*)input {
|
|
15
22
|
if(input == nil) return nil;
|
|
16
23
|
return [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:input options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding];
|
|
@@ -23,6 +30,7 @@
|
|
|
23
30
|
|
|
24
31
|
+(NSData*)base64Decode:(NSString*)input {
|
|
25
32
|
if(input == nil) return nil;
|
|
33
|
+
if ([input hasPrefix:@"data"]) input = [input substringFromIndex:[input rangeOfString:@","].location + 1];
|
|
26
34
|
return [[NSData alloc] initWithBase64EncodedString:input options:0];
|
|
27
35
|
}
|
|
28
36
|
|
|
@@ -103,8 +111,9 @@
|
|
|
103
111
|
|
|
104
112
|
NSString* transactionId = [input valueForKey:@"transactionId"];
|
|
105
113
|
NSString* tag = [input valueForKey:@"tag"];
|
|
114
|
+
NSString* sessionLogFolder = input[@"sessionLogFolder"];
|
|
106
115
|
|
|
107
|
-
return [[RGLTransactionInfo alloc] initWithTag:tag transactionId:transactionId];
|
|
116
|
+
return [[RGLTransactionInfo alloc] initWithTag:tag transactionId:transactionId sessionLogFolder:sessionLogFolder];
|
|
108
117
|
}
|
|
109
118
|
|
|
110
119
|
+(NSDictionary*)generateTransactionInfo:(RGLTransactionInfo*)input {
|
|
@@ -113,6 +122,7 @@
|
|
|
113
122
|
|
|
114
123
|
result[@"transactionId"] = input.transactionId;
|
|
115
124
|
result[@"tag"] = input.tag;
|
|
125
|
+
result[@"sessionLogFolder"] = input.sessionLogFolder;
|
|
116
126
|
|
|
117
127
|
return result;
|
|
118
128
|
}
|
|
@@ -166,6 +176,17 @@
|
|
|
166
176
|
return result;
|
|
167
177
|
}
|
|
168
178
|
|
|
179
|
+
+(RGLBleConfig*)bleDeviceConfigFromJson:(NSDictionary*)input :(RGLBluetooth*)bluetooth {
|
|
180
|
+
if (!input) return nil;
|
|
181
|
+
RGLBleConfig *config = [[RGLBleConfig alloc] initWithBluetooth:bluetooth];
|
|
182
|
+
|
|
183
|
+
if (input[@"databasePath"]) config.databasePath = [[NSBundle mainBundle] pathForResource:input[@"databasePath"] ofType:nil];
|
|
184
|
+
if (input[@"licenseUpdate"]) config.licenseUpdateCheck = [input[@"licenseUpdate"] boolValue];
|
|
185
|
+
if (input[@"delayedNNLoad"]) config.delayedNNLoadEnabled = [input[@"delayedNNLoad"] boolValue];
|
|
186
|
+
|
|
187
|
+
return config;
|
|
188
|
+
}
|
|
189
|
+
|
|
169
190
|
+(RGLScannerConfig*)scannerConfigFromJson:(NSDictionary*)input {
|
|
170
191
|
RGLScannerConfig *config = [RGLScannerConfig alloc];
|
|
171
192
|
if (input[@"scenario"]) config = [config initWithScenario:input[@"scenario"]];
|
|
@@ -216,7 +237,8 @@
|
|
|
216
237
|
if (input[@"scenario"]) config.scenario = input[@"scenario"];
|
|
217
238
|
if (input[@"livePortrait"]) config.livePortrait = [self imageWithBase64:input[@"livePortrait"]];
|
|
218
239
|
if (input[@"extPortrait"]) config.extPortrait = [self imageWithBase64:input[@"extPortrait"]];
|
|
219
|
-
if (input[@"oneShotIdentification"])
|
|
240
|
+
if (input[@"oneShotIdentification"]) config.oneShotIdentification = input[@"oneShotIdentification"];
|
|
241
|
+
if (input[@"dtc"]) config.dtc = [RGLWJSONConstructor base64Decode:input[@"dtc"]];
|
|
220
242
|
|
|
221
243
|
return config;
|
|
222
244
|
}
|
|
@@ -230,6 +252,7 @@
|
|
|
230
252
|
result[@"livePortrait"] = [self base64WithImage: input.livePortrait];
|
|
231
253
|
result[@"extPortrait"] = [self base64WithImage: input.extPortrait];
|
|
232
254
|
result[@"oneShotIdentification"] = @(input.oneShotIdentification);
|
|
255
|
+
result[@"dtc"] = [self base64Encode: input.dtc];
|
|
233
256
|
result[@"image"] = [self base64WithImage: input.image];
|
|
234
257
|
result[@"data"] = [self base64Encode: input.imageData];
|
|
235
258
|
if(input.images != nil) {
|
|
@@ -258,6 +281,7 @@
|
|
|
258
281
|
result.httpHeaders = [input valueForKey:@"httpHeaders"];
|
|
259
282
|
if([input valueForKey:@"rfidServerSideChipVerification"] != nil)
|
|
260
283
|
result.rfidServerSideChipVerification = [input valueForKey:@"rfidServerSideChipVerification"];
|
|
284
|
+
if (input[@"timeoutConnection"]) result.timeoutConnection = input[@"timeoutConnection"];
|
|
261
285
|
|
|
262
286
|
return result;
|
|
263
287
|
}
|
|
@@ -269,6 +293,7 @@
|
|
|
269
293
|
result[@"url"] = input.url;
|
|
270
294
|
result[@"httpHeaders"] = input.httpHeaders;
|
|
271
295
|
result[@"rfidServerSideChipVerification"] = input.rfidServerSideChipVerification;
|
|
296
|
+
result[@"timeoutConnection"] = input.timeoutConnection;
|
|
272
297
|
|
|
273
298
|
return result;
|
|
274
299
|
}
|
|
@@ -333,6 +358,16 @@
|
|
|
333
358
|
return [RGLWConfig getDataGroups:input];
|
|
334
359
|
}
|
|
335
360
|
|
|
361
|
+
+(RGLDTCDataGroup*)dtcDataGroupFromJson:(NSDictionary*)input {
|
|
362
|
+
RGLDTCDataGroup *result = [RGLDTCDataGroup new];
|
|
363
|
+
[RGLWConfig setDTCDataGroup:result dict:input];
|
|
364
|
+
return result;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
+(NSDictionary*)generateRGLDTCDataGroup:(RGLDTCDataGroup*)input {
|
|
368
|
+
return [RGLWConfig getDTCDataGroup:input];
|
|
369
|
+
}
|
|
370
|
+
|
|
336
371
|
+(RGLRFIDScenario*)rfidScenarioFromJson:(NSDictionary*)input {
|
|
337
372
|
RGLRFIDScenario *result = [RGLRFIDScenario new];
|
|
338
373
|
[RGLWConfig setRfidScenario:input :result];
|
|
@@ -380,6 +415,11 @@
|
|
|
380
415
|
[RGLWConfig setProcessParams:[input valueForKey:@"processParams"] :params];
|
|
381
416
|
result.processParams = params;
|
|
382
417
|
}
|
|
418
|
+
if([input valueForKey:@"requestHeaders"] != nil) {
|
|
419
|
+
RGLWRequestInterceptorProxy* proxy = [[RGLWRequestInterceptorProxy alloc] initWithHeaders:[input valueForKey:@"requestHeaders"]];
|
|
420
|
+
[self holdWeakReference: proxy];
|
|
421
|
+
result.requestInterceptingDelegate = proxy;
|
|
422
|
+
}
|
|
383
423
|
|
|
384
424
|
return result;
|
|
385
425
|
}
|
|
@@ -1658,10 +1698,12 @@
|
|
|
1658
1698
|
NSMutableArray<RGLAuthenticityElement*> *array = [NSMutableArray new];
|
|
1659
1699
|
for(NSDictionary* item in [input valueForKey:@"elements"])
|
|
1660
1700
|
[array addObject:[self authenticityElementFromJson:item]];
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1701
|
+
RGLAuthenticityCheck* result = [[RGLAuthenticityCheck alloc]
|
|
1702
|
+
initWithAuthenticity:[[input valueForKey:@"type"] integerValue]
|
|
1703
|
+
elements:array
|
|
1704
|
+
pageIndex:[[input valueForKey:@"pageIndex"] integerValue]];
|
|
1705
|
+
if (input[@"status"]) [result setValue:input[@"status"] forKey:@"status"];
|
|
1706
|
+
return result;;
|
|
1665
1707
|
}
|
|
1666
1708
|
|
|
1667
1709
|
+(NSDictionary*)generateAuthenticityCheck:(RGLAuthenticityCheck*)input {
|
|
@@ -1764,8 +1806,10 @@
|
|
|
1764
1806
|
NSMutableArray<RGLAuthenticityCheck*> *array = [NSMutableArray new];
|
|
1765
1807
|
for(NSDictionary* item in [input valueForKey:@"checks"])
|
|
1766
1808
|
[array addObject:[self authenticityCheckFromJson:item]];
|
|
1767
|
-
|
|
1768
|
-
|
|
1809
|
+
RGLDocumentReaderAuthenticityResult* result = [[RGLDocumentReaderAuthenticityResult alloc]
|
|
1810
|
+
initWithAuthenticityChecks:array];
|
|
1811
|
+
if (input[@"status"]) [result setValue:input[@"status"] forKey:@"_security"];
|
|
1812
|
+
return result;
|
|
1769
1813
|
}
|
|
1770
1814
|
|
|
1771
1815
|
+(NSDictionary*)generateDocumentReaderAuthenticityResult:(RGLDocumentReaderAuthenticityResult*)input {
|
|
@@ -2220,7 +2264,7 @@
|
|
|
2220
2264
|
[imageQuality addObject:[self imageQualityGroupFromJson:item]];
|
|
2221
2265
|
}
|
|
2222
2266
|
|
|
2223
|
-
|
|
2267
|
+
RGLDocumentReaderResults* result = [[RGLDocumentReaderResults alloc]
|
|
2224
2268
|
initWithDocumentTypes:documentType
|
|
2225
2269
|
textResult:[self documentReaderTextResultFromJson: [input valueForKey:@"textResult"]]
|
|
2226
2270
|
graphicResult:[self documentReaderGraphicResultFromJson: [input valueForKey:@"graphicResult"]]
|
|
@@ -2240,6 +2284,10 @@
|
|
|
2240
2284
|
elapsedTime:[[input valueForKey:@"elapsedTime"] integerValue]
|
|
2241
2285
|
elapsedTimeRFID:[[input valueForKey:@"elapsedTimeRFID"] integerValue]
|
|
2242
2286
|
transactionInfo:[self transactionInfoFromJson:[input valueForKey:@"transactionInfo"]]];
|
|
2287
|
+
|
|
2288
|
+
[result setValue:[RGLWJSONConstructor base64Decode:input[@"dtcData"]] forKey:@"dtcData"];
|
|
2289
|
+
|
|
2290
|
+
return result;
|
|
2243
2291
|
}
|
|
2244
2292
|
|
|
2245
2293
|
+(NSDictionary*)generateDocumentReaderResults:(RGLDocumentReaderResults*)input {
|
|
@@ -2289,6 +2337,7 @@
|
|
|
2289
2337
|
result[@"rawResult"] = input.rawResult;
|
|
2290
2338
|
result[@"status"] = [self generateDocumentReaderResultsStatus:input.status];
|
|
2291
2339
|
result[@"vdsncData"] = [self generateVDSNCData:input.vdsncData];
|
|
2340
|
+
result[@"dtcData"] = [self base64Encode: input.dtcData];
|
|
2292
2341
|
result[@"transactionInfo"] = [self generateTransactionInfo:input.transactionInfo];
|
|
2293
2342
|
|
|
2294
2343
|
return result;
|
|
@@ -2305,3 +2354,22 @@
|
|
|
2305
2354
|
}
|
|
2306
2355
|
|
|
2307
2356
|
@end
|
|
2357
|
+
|
|
2358
|
+
@implementation RGLWRequestInterceptorProxy {
|
|
2359
|
+
NSDictionary* _headers;
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
- (instancetype)initWithHeaders:(NSDictionary*)headers {
|
|
2363
|
+
self = [super init];
|
|
2364
|
+
_headers = [headers copy];
|
|
2365
|
+
return self;
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
-(NSURLRequest*)interceptorPrepareRequest:(NSURLRequest*)request {
|
|
2369
|
+
NSMutableURLRequest *interceptedRequest = [request mutableCopy];
|
|
2370
|
+
for (NSString* key in _headers.allKeys)
|
|
2371
|
+
[interceptedRequest addValue:[_headers valueForKey:key] forHTTPHeaderField:key];
|
|
2372
|
+
return interceptedRequest;
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
@end
|