@regulaforensics/cordova-plugin-document-reader-api 6.8.1 → 6.9.1
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/config.xml +1 -8
- package/example/package.json +8 -12
- package/example/www/js/index.js +21 -10
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/src/android/BluetoothUtil.kt +6 -6
- package/src/android/DocumentReader.java +147 -136
- package/src/android/Helpers.java +117 -3
- package/src/android/JSONConstructor.java +182 -261
- package/src/android/RegulaConfig.java +114 -26
- package/src/android/build.gradle +9 -1
- package/src/ios/RGLWDocumentReader.m +42 -36
- package/src/ios/RGLWJSONConstructor.h +8 -6
- package/src/ios/RGLWJSONConstructor.m +109 -92
- package/src/ios/RGLWRegulaConfig.h +2 -1
- package/src/ios/RGLWRegulaConfig.m +139 -41
- package/www/DocumentReader.js +263 -2958
|
@@ -12,6 +12,16 @@
|
|
|
12
12
|
return [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:input options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
+(NSMutableDictionary* _Nonnull)generateNSError:(NSError* _Nullable)input {
|
|
16
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
17
|
+
if(input == nil) return result;
|
|
18
|
+
|
|
19
|
+
result[@"errorCode"] = [NSNumber numberWithInteger:input.code];
|
|
20
|
+
result[@"message"] = input.localizedDescription;
|
|
21
|
+
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
|
|
15
25
|
+(NSMutableDictionary* _Nonnull)generateNSDictionary:(NSDictionary<NSNumber*, NSNumber*>* _Nullable)input {
|
|
16
26
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
17
27
|
if(input == nil) return result;
|
|
@@ -22,6 +32,16 @@
|
|
|
22
32
|
return result;
|
|
23
33
|
}
|
|
24
34
|
|
|
35
|
+
+(UIImage*)imageWithBase64:(NSString*)input {
|
|
36
|
+
if(input == nil) return nil;
|
|
37
|
+
return [UIImage imageWithData:[[NSData alloc]initWithBase64EncodedString:input options:NSDataBase64DecodingIgnoreUnknownCharacters]];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
+(NSString*)base64WithImage:(UIImage*)input {
|
|
41
|
+
if(input == nil) return nil;
|
|
42
|
+
return [UIImageJPEGRepresentation(input, 1.0) base64EncodedStringWithOptions:0];
|
|
43
|
+
}
|
|
44
|
+
|
|
25
45
|
+(RGLPKDCertificate*)RGLPKDCertificateFromJson:(NSDictionary*)input {
|
|
26
46
|
NSInteger type = [[input valueForKey:@"resourceType"] integerValue];
|
|
27
47
|
NSData* binaryData = [[NSData alloc] initWithBase64EncodedString:[input objectForKey:@"binaryData"] options:0];
|
|
@@ -41,26 +61,67 @@
|
|
|
41
61
|
}
|
|
42
62
|
|
|
43
63
|
+(RGLConfig*)RGLConfigFromJson:(NSDictionary*)input {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
license = [[NSData alloc] initWithBase64EncodedString:[input valueForKey:@"license"] options:0];
|
|
47
|
-
else return nil;
|
|
48
|
-
|
|
49
|
-
RGLConfig *config = [[RGLConfig alloc] initWithLicenseData:license];
|
|
64
|
+
if([input valueForKey:@"license"] == nil) return nil;
|
|
65
|
+
RGLConfig *config = [[RGLConfig alloc] initWithLicenseData:[[NSData alloc] initWithBase64EncodedString:[input valueForKey:@"license"] options:0]];
|
|
50
66
|
|
|
51
|
-
if([input valueForKey:@"databasePath"] != nil)
|
|
67
|
+
if([input valueForKey:@"databasePath"] != nil)
|
|
52
68
|
config.databasePath = [[input valueForKey:@"databasePath"] stringValue];
|
|
53
|
-
|
|
54
|
-
if([input valueForKey:@"licenseUpdate"] != nil){
|
|
69
|
+
if([input valueForKey:@"licenseUpdate"] != nil)
|
|
55
70
|
config.licenseUpdateCheck = [[input valueForKey:@"licenseUpdate"] boolValue];
|
|
56
|
-
|
|
57
|
-
if([input valueForKey:@"delayedNNLoad"] != nil){
|
|
71
|
+
if([input valueForKey:@"delayedNNLoad"] != nil)
|
|
58
72
|
config.delayedNNLoadEnabled = [[input valueForKey:@"delayedNNLoad"] boolValue];
|
|
59
|
-
}
|
|
60
73
|
|
|
61
74
|
return config;
|
|
62
75
|
}
|
|
63
76
|
|
|
77
|
+
+(RGLScannerConfig*)RGLScannerConfigFromJson:(NSDictionary*)input {
|
|
78
|
+
if([input valueForKey:@"scenario"] == nil && [input valueForKey:@"onlineProcessingConfig"] == nil) return nil;
|
|
79
|
+
RGLScannerConfig *config = [RGLScannerConfig new];
|
|
80
|
+
|
|
81
|
+
if([input valueForKey:@"scenario"] != nil)
|
|
82
|
+
config.scenario = [input valueForKey:@"scenario"];
|
|
83
|
+
if([input valueForKey:@"onlineProcessingConfig"] != nil)
|
|
84
|
+
config.onlineProcessingConfig = [RGLWRegulaConfig RGLOnlineProcessingConfigFromJSON:[input valueForKey:@"onlineProcessingConfig"]];
|
|
85
|
+
if([input valueForKey:@"livePortrait"] != nil)
|
|
86
|
+
config.livePortrait = [self imageWithBase64:[input valueForKey:@"livePortrait"]];
|
|
87
|
+
if([input valueForKey:@"extPortrait"] != nil)
|
|
88
|
+
config.extPortrait = [self imageWithBase64:[input valueForKey:@"extPortrait"]];
|
|
89
|
+
|
|
90
|
+
return config;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
+(RGLRecognizeConfig*)RGLRecognizeConfigFromJson:(NSDictionary*)input {
|
|
94
|
+
if([input valueForKey:@"scenario"] == nil && [input valueForKey:@"onlineProcessingConfig"] == nil) return nil;
|
|
95
|
+
if([input valueForKey:@"image"] == nil && [input valueForKey:@"images"] == nil && [input valueForKey:@"imageInputs"] == nil) return nil;
|
|
96
|
+
RGLRecognizeConfig *config = [RGLRecognizeConfig alloc];
|
|
97
|
+
|
|
98
|
+
if([input valueForKey:@"image"] != nil)
|
|
99
|
+
config = [config initWithImage:[RGLWJSONConstructor imageWithBase64:[input valueForKey:@"image"]]];
|
|
100
|
+
else if([input valueForKey:@"images"] != nil){
|
|
101
|
+
NSMutableArray<UIImage*>* images = [[NSMutableArray alloc] init];
|
|
102
|
+
for(NSMutableString* base64 in [input valueForKey:@"images"])
|
|
103
|
+
[images addObject:[RGLWJSONConstructor imageWithBase64:base64]];
|
|
104
|
+
config = [config initWithImages:images];
|
|
105
|
+
} else if([input valueForKey:@"imageInputs"] != nil){
|
|
106
|
+
NSMutableArray<RGLImageInput*>* images = [[NSMutableArray alloc] init];
|
|
107
|
+
for(NSDictionary* image in [input valueForKey:@"imageInputs"])
|
|
108
|
+
[images addObject:[RGLWJSONConstructor RGLImageInputFromJson: image]];
|
|
109
|
+
config = [config initWithImageInputs:images];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if([input valueForKey:@"scenario"] != nil)
|
|
113
|
+
config.scenario = [input valueForKey:@"scenario"];
|
|
114
|
+
if([input valueForKey:@"onlineProcessingConfig"] != nil)
|
|
115
|
+
config.onlineProcessingConfig = [RGLWRegulaConfig RGLOnlineProcessingConfigFromJSON:[input valueForKey:@"onlineProcessingConfig"]];
|
|
116
|
+
if([input valueForKey:@"livePortrait"] != nil)
|
|
117
|
+
config.livePortrait = [self imageWithBase64:[input valueForKey:@"livePortrait"]];
|
|
118
|
+
if([input valueForKey:@"extPortrait"] != nil)
|
|
119
|
+
config.extPortrait = [self imageWithBase64:[input valueForKey:@"extPortrait"]];
|
|
120
|
+
if([input valueForKey:@"oneShotIdentification"] != nil)
|
|
121
|
+
config.oneShotIdentification = [input valueForKey:@"oneShotIdentification"];
|
|
122
|
+
|
|
123
|
+
return config;
|
|
124
|
+
}
|
|
64
125
|
|
|
65
126
|
+(RGLImageInput*)RGLImageInputFromJson:(NSDictionary*)input {
|
|
66
127
|
NSInteger pageIndex = 0;
|
|
@@ -68,11 +129,9 @@
|
|
|
68
129
|
pageIndex = [[input valueForKey:@"pageIndex"] integerValue];
|
|
69
130
|
NSInteger light = 6;
|
|
70
131
|
if([input valueForKey:@"light"] != nil)
|
|
71
|
-
|
|
72
|
-
if([input valueForKey:@"
|
|
73
|
-
|
|
74
|
-
return [[RGLImageInput alloc] initWithImage:image light:light pageIndex:pageIndex];
|
|
75
|
-
}
|
|
132
|
+
light = [[input valueForKey:@"light"] integerValue];
|
|
133
|
+
if([input valueForKey:@"image"] != nil)
|
|
134
|
+
return [[RGLImageInput alloc] initWithImage:[self imageWithBase64:[input valueForKey:@"image"]] light:light pageIndex:pageIndex];
|
|
76
135
|
return nil;
|
|
77
136
|
}
|
|
78
137
|
|
|
@@ -113,23 +172,6 @@
|
|
|
113
172
|
return result;
|
|
114
173
|
}
|
|
115
174
|
|
|
116
|
-
+(NSMutableDictionary*)generateRfidNotificationCompletion:(NSInteger)notification {
|
|
117
|
-
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
118
|
-
|
|
119
|
-
result[@"notification"] = [NSNumber numberWithInteger:notification];
|
|
120
|
-
|
|
121
|
-
return result;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
+(NSMutableDictionary*)generateRfidNotificationCompletionWithError:(NSInteger)notification :(NSInteger)value {
|
|
125
|
-
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
126
|
-
|
|
127
|
-
result[@"notification"] = [NSNumber numberWithInteger:notification];
|
|
128
|
-
result[@"value"] = [NSNumber numberWithInteger:value];
|
|
129
|
-
|
|
130
|
-
return result;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
175
|
+(NSInteger)generateDocReaderAction:(RGLDocReaderAction)input {
|
|
134
176
|
NSInteger result = -1;
|
|
135
177
|
switch (input) {
|
|
@@ -168,7 +210,7 @@
|
|
|
168
210
|
NSInteger result = 0;
|
|
169
211
|
switch (input) {
|
|
170
212
|
case RGLRFIDCompleteActionComplete:
|
|
171
|
-
result =
|
|
213
|
+
result = 0;
|
|
172
214
|
break;
|
|
173
215
|
case RGLRFIDCompleteActionError:
|
|
174
216
|
result = 4;
|
|
@@ -186,51 +228,13 @@
|
|
|
186
228
|
return result;
|
|
187
229
|
}
|
|
188
230
|
|
|
189
|
-
+(NSInteger)
|
|
190
|
-
return 101;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
+(NSMutableDictionary*)generateCompletion:(NSInteger)action :(RGLDocumentReaderResults*)results :(NSError*)error :(RGLRFIDNotify*)notify {
|
|
231
|
+
+(NSMutableDictionary*)generateCompletion:(NSInteger)action :(RGLDocumentReaderResults*)results :(NSError*)error {
|
|
194
232
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
195
233
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
case 2:
|
|
199
|
-
case 3:
|
|
200
|
-
case 4:
|
|
201
|
-
case 6:
|
|
202
|
-
result[@"results"] = [self generateRGLDocumentReaderResults:results];
|
|
203
|
-
break;
|
|
204
|
-
case 101:
|
|
205
|
-
result[@"results"] = [self generateResultsWithNotification:[self generateRGLRFIDNotify:notify]];
|
|
206
|
-
break;
|
|
207
|
-
case 999:
|
|
208
|
-
result[@"results"] = [self generateResultsWithRFID :results :1];
|
|
209
|
-
action = 0;
|
|
210
|
-
break;
|
|
211
|
-
default:
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
|
|
234
|
+
if(action == 0 || action == 2 || action == 3 || action == 4 || action == 6)
|
|
235
|
+
result[@"results"] = [self generateRGLDocumentReaderResults:results];
|
|
215
236
|
result[@"action"] = [NSNumber numberWithInteger:action];
|
|
216
|
-
|
|
217
|
-
result[@"error"] = [self generateNSError:error];
|
|
218
|
-
|
|
219
|
-
return result;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
+(NSMutableDictionary*)generateResultsWithNotification:(NSMutableDictionary*)input {
|
|
223
|
-
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
224
|
-
|
|
225
|
-
result[@"documentReaderNotification"] = input;
|
|
226
|
-
|
|
227
|
-
return result;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
+(NSMutableDictionary*)generateResultsWithRFID:(RGLDocumentReaderResults*)results :(NSInteger)input {
|
|
231
|
-
NSMutableDictionary *result = [self generateRGLDocumentReaderResults:results];
|
|
232
|
-
|
|
233
|
-
result[@"rfidResult"] = [NSNumber numberWithInteger:input];
|
|
237
|
+
result[@"error"] = [self generateNSError:error];
|
|
234
238
|
|
|
235
239
|
return result;
|
|
236
240
|
}
|
|
@@ -271,15 +275,13 @@
|
|
|
271
275
|
return result;
|
|
272
276
|
}
|
|
273
277
|
|
|
274
|
-
+(NSMutableDictionary* _Nonnull)
|
|
278
|
+
+(NSMutableDictionary* _Nonnull)generateDocumentReaderNotification:(RGLRFIDNotify* _Nullable)input{
|
|
275
279
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
276
280
|
if(input == nil) return result;
|
|
277
281
|
|
|
278
|
-
result[@"code"] = @(input.code);
|
|
279
|
-
result[@"value"] = @(input.value);
|
|
280
282
|
result[@"notificationCode"] = @(input.code & 0xFFFF0000);
|
|
281
283
|
result[@"dataFileType"] = @(input.code & 0x0000FFFF);
|
|
282
|
-
|
|
284
|
+
result[@"progress"] = @((int)input.value & 0xFFFFFFF0);
|
|
283
285
|
|
|
284
286
|
return result;
|
|
285
287
|
}
|
|
@@ -506,7 +508,7 @@
|
|
|
506
508
|
result[@"fieldName"] = input.fieldName;
|
|
507
509
|
result[@"fieldRect"] = [self generateCGRect:input.boundRect];
|
|
508
510
|
result[@"value"] = [UIImageJPEGRepresentation(input.value, 1.0) base64EncodedStringWithOptions:0];
|
|
509
|
-
result[@"
|
|
511
|
+
result[@"light"] = @(input.lightType);
|
|
510
512
|
result[@"lightName"] = input.lightName;
|
|
511
513
|
result[@"pageIndex"] = @(input.pageIndex);
|
|
512
514
|
result[@"originalPageIndex"] = @(input.originalPageIndex);
|
|
@@ -679,6 +681,30 @@
|
|
|
679
681
|
result[@"status"] = @(input.status);
|
|
680
682
|
result[@"extLeSupport"] = @(input.extLeSupport);
|
|
681
683
|
result[@"processTime"] = @(input.processTime);
|
|
684
|
+
if(input.dataGroups != nil){
|
|
685
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
686
|
+
for(NSNumber* item in input.dataGroups)
|
|
687
|
+
if(item != nil)
|
|
688
|
+
[array addObject:item];
|
|
689
|
+
result[@"dataGroups"] = array;
|
|
690
|
+
}
|
|
691
|
+
if(input.dataFields != nil){
|
|
692
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
693
|
+
for(RGLDataField* item in input.dataFields)
|
|
694
|
+
if(item != nil)
|
|
695
|
+
[array addObject:[self generateRGLDataField:item]];
|
|
696
|
+
result[@"dataFields"] = array;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
return result;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDataField:(RGLDataField* _Nullable)input {
|
|
703
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
704
|
+
if(input == nil) return result;
|
|
705
|
+
|
|
706
|
+
result[@"data"] = input.data;
|
|
707
|
+
result[@"fieldType"] = @(input.fieldType);
|
|
682
708
|
|
|
683
709
|
return result;
|
|
684
710
|
}
|
|
@@ -990,16 +1016,6 @@
|
|
|
990
1016
|
return result;
|
|
991
1017
|
}
|
|
992
1018
|
|
|
993
|
-
+(NSMutableDictionary* _Nonnull)generateNSError:(NSError* _Nullable)input {
|
|
994
|
-
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
995
|
-
if(input == nil) return result;
|
|
996
|
-
|
|
997
|
-
result[@"code"] = @(input.code);
|
|
998
|
-
result[@"localizedDescription"] = input.localizedDescription;
|
|
999
|
-
|
|
1000
|
-
return result;
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
1019
|
+(NSMutableDictionary* _Nonnull)generateRGLPAResourcesIssuer:(RGLPAResourcesIssuer* _Nullable)input {
|
|
1004
1020
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1005
1021
|
if(input == nil) return result;
|
|
@@ -1173,6 +1189,7 @@
|
|
|
1173
1189
|
result[@"databaseDescription"] = input.databaseDescription;
|
|
1174
1190
|
result[@"countriesNumber"] = @(input.countriesNumber);
|
|
1175
1191
|
result[@"documentsNumber"] = @(input.documentsNumber);
|
|
1192
|
+
result[@"size"] = input.size;
|
|
1176
1193
|
|
|
1177
1194
|
return result;
|
|
1178
1195
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#ifndef RGLWRegulaConfig_h
|
|
2
2
|
#define RGLWRegulaConfig_h
|
|
3
3
|
#import <DocumentReader/DocumentReader.h>
|
|
4
|
+
#import "RGLWJSONConstructor.h"
|
|
4
5
|
@import CoreGraphics;
|
|
5
6
|
@import UIKit;
|
|
6
7
|
@import AVFoundation;
|
|
@@ -15,11 +16,11 @@
|
|
|
15
16
|
+(void)setProcessParams:(NSDictionary*) options : (RGLProcessParams*) processParams;
|
|
16
17
|
+(UIColor *)getUIColorObjectFromHexString:(NSString *)hexStr alpha:(CGFloat)alpha;
|
|
17
18
|
+(unsigned int)intFromHexString:(NSString *)hexStr;
|
|
18
|
-
+(UIImage*)imageFromBase64:(NSString *)base64image;
|
|
19
19
|
+(RGLePassportDataGroup*)RGLePassportDataGroupFromJson:(NSDictionary *) dict;
|
|
20
20
|
+(RGLeIDDataGroup*)RGLeIDDataGroupFromJson:(NSDictionary*) dict;
|
|
21
21
|
+(RGLeDLDataGroup*)RGLeDLDataGroupFromJson:(NSDictionary*) dict;
|
|
22
22
|
+(RGLImageQA*)ImageQAFromJson:(NSDictionary*) dict;
|
|
23
23
|
+(NSDictionary*)ImageQAToJson:(RGLImageQA*) input;
|
|
24
|
+
+(RGLOnlineProcessingConfig*)RGLOnlineProcessingConfigFromJSON:(NSDictionary*) dict;
|
|
24
25
|
@end
|
|
25
26
|
#endif
|
|
@@ -114,16 +114,6 @@
|
|
|
114
114
|
return hexInt;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
+(UIImage*)imageFromBase64:(NSString *)base64image {
|
|
118
|
-
NSMutableString *base64 = [NSMutableString stringWithString: base64image];
|
|
119
|
-
if(![[base64image substringToIndex:10] isEqualToString:@"data:image"])
|
|
120
|
-
base64 = [NSMutableString stringWithFormat: @"%@%@", @"data:image/jpeg;base64,", base64image];
|
|
121
|
-
NSURL *url = [NSURL URLWithString:base64];
|
|
122
|
-
NSData *imageData = [NSData dataWithContentsOfURL:url];
|
|
123
|
-
UIImage *image = [UIImage imageWithData:imageData];
|
|
124
|
-
return image;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
117
|
+(CGLineCap)CGLineCapWithNSInteger:(NSInteger)value {
|
|
128
118
|
switch(value){
|
|
129
119
|
case 0:
|
|
@@ -205,6 +195,33 @@
|
|
|
205
195
|
}
|
|
206
196
|
}
|
|
207
197
|
|
|
198
|
+
+(NSNumber*)NSNumberWithRGLTextProcessing:(RGLTextProcessing*)value {
|
|
199
|
+
if(value == RGLTextProcessing.noChange)
|
|
200
|
+
return @0;
|
|
201
|
+
if(value == RGLTextProcessing.uppercase)
|
|
202
|
+
return @1;
|
|
203
|
+
if(value == RGLTextProcessing.lowercase)
|
|
204
|
+
return @2;
|
|
205
|
+
if(value == RGLTextProcessing.capital)
|
|
206
|
+
return @3;
|
|
207
|
+
return @0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
+(RGLTextProcessing*)RGLTextProcessingWithNSInteger:(NSNumber*)value {
|
|
211
|
+
switch([value integerValue]){
|
|
212
|
+
case 0:
|
|
213
|
+
return RGLTextProcessing.noChange;
|
|
214
|
+
case 1:
|
|
215
|
+
return RGLTextProcessing.uppercase;
|
|
216
|
+
case 2:
|
|
217
|
+
return RGLTextProcessing.lowercase;
|
|
218
|
+
case 3:
|
|
219
|
+
return RGLTextProcessing.capital;
|
|
220
|
+
default:
|
|
221
|
+
return RGLTextProcessing.noChange;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
208
225
|
+(NSInteger)NSIntegerWithAVCaptureDevicePosition:(AVCaptureDevicePosition)value {
|
|
209
226
|
switch(value){
|
|
210
227
|
case AVCaptureDevicePositionFront:
|
|
@@ -301,8 +318,8 @@
|
|
|
301
318
|
image.moireCheck = [dict valueForKey:@"moireCheck"];
|
|
302
319
|
if([dict valueForKey:@"expectedPass"] != nil){
|
|
303
320
|
NSMutableArray<RGLImageQualityCheckType> *expectedPass = [NSMutableArray new];
|
|
304
|
-
for(
|
|
305
|
-
[expectedPass addObject:
|
|
321
|
+
for(NSNumber* item in [dict valueForKey:@"expectedPass"])
|
|
322
|
+
[expectedPass addObject:[self RGLImageQualityCheckTypeWithNSNumber: item]];
|
|
306
323
|
image.expectedPass = expectedPass;
|
|
307
324
|
}
|
|
308
325
|
if([dict valueForKey:@"documentPositionIndent"] != nil)
|
|
@@ -321,12 +338,44 @@
|
|
|
321
338
|
result[@"glaresCheck"] = input.glaresCheck;
|
|
322
339
|
result[@"colornessCheck"] = input.colornessCheck;
|
|
323
340
|
result[@"moireCheck"] = input.moireCheck;
|
|
324
|
-
|
|
341
|
+
if(input.expectedPass != nil) {
|
|
342
|
+
NSMutableArray* array = [NSMutableArray new];
|
|
343
|
+
for(RGLImageQualityCheckType item in input.expectedPass)
|
|
344
|
+
[array addObject:[self NSNumberWithRGLImageQualityCheckType:item]];
|
|
345
|
+
result[@"expectedPass"] = array;
|
|
346
|
+
} else result[@"expectedPass"] = nil;
|
|
325
347
|
result[@"documentPositionIndent"] = input.documentPositionIndent;
|
|
326
348
|
|
|
327
349
|
return result;
|
|
328
350
|
}
|
|
329
351
|
|
|
352
|
+
+(NSNumber*)NSNumberWithRGLImageQualityCheckType:(RGLImageQualityCheckType)value {
|
|
353
|
+
if(value == RGLImageQualityCheckTypeImageGlares) return @0;
|
|
354
|
+
if(value == RGLImageQualityCheckTypeImageFocus) return @1;
|
|
355
|
+
if(value == RGLImageQualityCheckTypeImageResolution) return @2;
|
|
356
|
+
if(value == RGLImageQualityCheckTypeImageColorness) return @3;
|
|
357
|
+
if(value == RGLImageQualityCheckTypeImagePerspective) return @4;
|
|
358
|
+
if(value == RGLImageQualityCheckTypeImageBounds) return @5;
|
|
359
|
+
if(value == RGLImageQualityCheckTypeScreenCapture) return @6;
|
|
360
|
+
if(value == RGLImageQualityCheckTypePortrait) return @7;
|
|
361
|
+
if(value == RGLImageQualityCheckTypeHandwritten) return @8;
|
|
362
|
+
return 0;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
+(RGLImageQualityCheckType)RGLImageQualityCheckTypeWithNSNumber:(NSNumber*)input {
|
|
366
|
+
int value = [input intValue];
|
|
367
|
+
if(value == 0) return RGLImageQualityCheckTypeImageGlares;
|
|
368
|
+
if(value == 1) return RGLImageQualityCheckTypeImageFocus;
|
|
369
|
+
if(value == 2) return RGLImageQualityCheckTypeImageResolution;
|
|
370
|
+
if(value == 3) return RGLImageQualityCheckTypeImageColorness;
|
|
371
|
+
if(value == 4) return RGLImageQualityCheckTypeImagePerspective;
|
|
372
|
+
if(value == 5) return RGLImageQualityCheckTypeImageBounds;
|
|
373
|
+
if(value == 6) return RGLImageQualityCheckTypeScreenCapture;
|
|
374
|
+
if(value == 7) return RGLImageQualityCheckTypePortrait;
|
|
375
|
+
if(value == 8) return RGLImageQualityCheckTypeHandwritten;
|
|
376
|
+
return RGLImageQualityCheckTypeImageGlares;
|
|
377
|
+
}
|
|
378
|
+
|
|
330
379
|
+(RGLePassportDataGroup*)RGLePassportDataGroupFromJson:(NSDictionary*)dict {
|
|
331
380
|
RGLePassportDataGroup *group = [[RGLePassportDataGroup alloc] init];
|
|
332
381
|
|
|
@@ -451,9 +500,12 @@
|
|
|
451
500
|
}
|
|
452
501
|
|
|
453
502
|
+(RGLOnlineProcessingConfig*)RGLOnlineProcessingConfigFromJSON:(NSDictionary*)dict {
|
|
503
|
+
if(dict == nil) return nil;
|
|
454
504
|
if([dict valueForKey:@"mode"] == nil) return nil;
|
|
455
505
|
|
|
456
506
|
RGLOnlineProcessingConfig *result = [[RGLOnlineProcessingConfig alloc] initWithMode:[[dict valueForKey:@"mode"] integerValue]];
|
|
507
|
+
if([dict valueForKey:@"url"] != nil)
|
|
508
|
+
result.serviceURL = [dict valueForKey:@"url"];
|
|
457
509
|
|
|
458
510
|
if([dict valueForKey:@"imageFormat"] != nil)
|
|
459
511
|
result.imageFormat = [[dict valueForKey:@"imageFormat"] integerValue];
|
|
@@ -477,6 +529,8 @@
|
|
|
477
529
|
result.serviceURL = [dict valueForKey:@"serviceUrl"];
|
|
478
530
|
if([dict valueForKey:@"failIfNoService"] != nil)
|
|
479
531
|
result.failIfNoService = [dict valueForKey:@"failIfNoService"];
|
|
532
|
+
if([dict valueForKey:@"httpHeaders"] != nil)
|
|
533
|
+
result.httpHeaders = [dict valueForKey:@"httpHeaders"];
|
|
480
534
|
|
|
481
535
|
return result;
|
|
482
536
|
}
|
|
@@ -519,11 +573,11 @@
|
|
|
519
573
|
if([options valueForKey:@"showNextPageAnimation"] != nil)
|
|
520
574
|
customization.showNextPageAnimation = [[options valueForKey:@"showNextPageAnimation"] boolValue];
|
|
521
575
|
if([options valueForKey:@"helpAnimationImage"] != nil)
|
|
522
|
-
customization.helpAnimationImage = [
|
|
576
|
+
customization.helpAnimationImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"helpAnimationImage"]];
|
|
523
577
|
if([options valueForKey:@"multipageAnimationFrontImage"] != nil)
|
|
524
|
-
customization.multipageAnimationFrontImage = [
|
|
578
|
+
customization.multipageAnimationFrontImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"multipageAnimationFrontImage"]];
|
|
525
579
|
if([options valueForKey:@"multipageAnimationBackImage"] != nil)
|
|
526
|
-
customization.multipageAnimationBackImage = [
|
|
580
|
+
customization.multipageAnimationBackImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"multipageAnimationBackImage"]];
|
|
527
581
|
if([options valueForKey:@"tintColor"] != nil)
|
|
528
582
|
customization.tintColor = [self getUIColorObjectFromHexString:[options valueForKey:@"tintColor"] alpha:1];
|
|
529
583
|
if([options valueForKey:@"multipageButtonBackgroundColor"] != nil)
|
|
@@ -533,7 +587,7 @@
|
|
|
533
587
|
if([options valueForKey:@"showBackgroundMask"] != nil)
|
|
534
588
|
customization.showBackgroundMask = [[options valueForKey:@"showBackgroundMask"] boolValue];
|
|
535
589
|
if([options valueForKey:@"borderBackgroundImage"] != nil)
|
|
536
|
-
customization.borderBackgroundImage = [
|
|
590
|
+
customization.borderBackgroundImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"borderBackgroundImage"]];
|
|
537
591
|
if([options valueForKey:@"backgroundMaskAlpha"] != nil)
|
|
538
592
|
customization.backgroundMaskAlpha = [[options valueForKey:@"backgroundMaskAlpha"] floatValue];
|
|
539
593
|
if([options valueForKey:@"helpAnimationImageContentMode"] != nil)
|
|
@@ -553,19 +607,19 @@
|
|
|
553
607
|
if([options valueForKey:@"cameraFrameCornerRadius"] != nil)
|
|
554
608
|
customization.cameraFrameCornerRadius = [[options valueForKey:@"cameraFrameCornerRadius"] floatValue];
|
|
555
609
|
if([options valueForKey:@"torchButtonOnImage"] != nil)
|
|
556
|
-
customization.torchButtonOnImage = [
|
|
610
|
+
customization.torchButtonOnImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"torchButtonOnImage"]];
|
|
557
611
|
if([options valueForKey:@"torchButtonOffImage"] != nil)
|
|
558
|
-
customization.torchButtonOffImage = [
|
|
612
|
+
customization.torchButtonOffImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"torchButtonOffImage"]];
|
|
559
613
|
if([options valueForKey:@"closeButtonImage"] != nil)
|
|
560
|
-
customization.closeButtonImage = [
|
|
614
|
+
customization.closeButtonImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"closeButtonImage"]];
|
|
561
615
|
if([options valueForKey:@"captureButtonImage"] != nil)
|
|
562
|
-
customization.captureButtonImage = [
|
|
616
|
+
customization.captureButtonImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"captureButtonImage"]];
|
|
563
617
|
if([options valueForKey:@"changeFrameButtonCollapseImage"] != nil)
|
|
564
|
-
customization.changeFrameButtonCollapseImage = [
|
|
618
|
+
customization.changeFrameButtonCollapseImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"changeFrameButtonCollapseImage"]];
|
|
565
619
|
if([options valueForKey:@"changeFrameButtonExpandImage"] != nil)
|
|
566
|
-
customization.changeFrameButtonExpandImage = [
|
|
620
|
+
customization.changeFrameButtonExpandImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"changeFrameButtonExpandImage"]];
|
|
567
621
|
if([options valueForKey:@"cameraSwitchButtonImage"] != nil)
|
|
568
|
-
customization.cameraSwitchButtonImage = [
|
|
622
|
+
customization.cameraSwitchButtonImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"cameraSwitchButtonImage"]];
|
|
569
623
|
if([options valueForKey:@"cameraFrameLineCap"] != nil)
|
|
570
624
|
customization.cameraFrameLineCap = [self CGLineCapWithNSInteger:[[options valueForKey:@"cameraFrameLineCap"] integerValue]];
|
|
571
625
|
if([options valueForKey:@"cameraFrameOffsetWidth"] != nil)
|
|
@@ -585,7 +639,7 @@
|
|
|
585
639
|
if([options valueForKey:@"hologramAnimationPositionMultiplier"] != nil)
|
|
586
640
|
customization.hologramAnimationPositionMultiplier = [[options valueForKey:@"hologramAnimationPositionMultiplier"] floatValue];
|
|
587
641
|
if([options valueForKey:@"hologramAnimationImage"] != nil)
|
|
588
|
-
customization.hologramAnimationImage = [
|
|
642
|
+
customization.hologramAnimationImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"hologramAnimationImage"]];
|
|
589
643
|
if([options valueForKey:@"uiCustomizationLayer"] != nil)
|
|
590
644
|
customization.customUILayerJSON = [options valueForKey:@"uiCustomizationLayer"];
|
|
591
645
|
}
|
|
@@ -764,18 +818,24 @@
|
|
|
764
818
|
if([options valueForKey:@"processAuth"] != nil)
|
|
765
819
|
processParams.processAuth = [options valueForKey:@"processAuth"];
|
|
766
820
|
if([options valueForKey:@"documentGroupFilter"] != nil)
|
|
767
|
-
processParams.documentGroupFilter = [options
|
|
821
|
+
processParams.documentGroupFilter = [options valueForKey:@"documentGroupFilter"];
|
|
768
822
|
if([options valueForKey:@"convertCase"] != nil)
|
|
769
|
-
processParams.convertCase = [options valueForKey:@"convertCase"];
|
|
823
|
+
processParams.convertCase = [RGLWRegulaConfig RGLTextProcessingWithNSInteger:[options valueForKey:@"convertCase"]];
|
|
770
824
|
if([options valueForKey:@"rfidParams"] != nil)
|
|
771
825
|
processParams.rfidParams = [self RGLRFIDParamsFromJSON:[options valueForKey:@"rfidParams"]];
|
|
826
|
+
if([options valueForKey:@"doDetectCan"] != nil)
|
|
827
|
+
processParams.doDetectCan = [NSNumber numberWithBool:[[options valueForKey:@"doDetectCan"] boolValue]];
|
|
828
|
+
if([options valueForKey:@"useFaceApi"] != nil)
|
|
829
|
+
processParams.useFaceApi = [NSNumber numberWithBool:[[options valueForKey:@"useFaceApi"] boolValue]];
|
|
830
|
+
if([options valueForKey:@"faceApiParams"] != nil)
|
|
831
|
+
processParams.faceApiParams = [self RGLFaceAPIParamsFromJSON:[options valueForKey:@"faceApiParams"]];
|
|
772
832
|
}
|
|
773
833
|
|
|
774
834
|
+(NSMutableDictionary *)getCustomization:(RGLCustomization*)customization {
|
|
775
835
|
NSMutableDictionary *result = [[NSMutableDictionary alloc] init];
|
|
776
836
|
|
|
777
837
|
result[@"showHelpAnimation"] = [NSNumber numberWithBool:customization.showHelpAnimation];
|
|
778
|
-
result[@"helpAnimationImage"] = [
|
|
838
|
+
result[@"helpAnimationImage"] = [RGLWJSONConstructor base64WithImage:customization.helpAnimationImage];
|
|
779
839
|
result[@"showStatusMessages"] = [NSNumber numberWithBool:customization.showStatusMessages];
|
|
780
840
|
result[@"status"] = customization.status;
|
|
781
841
|
result[@"resultStatus"] = customization.resultStatus;
|
|
@@ -785,12 +845,12 @@
|
|
|
785
845
|
result[@"resultStatusTextFont"] = customization.resultStatusTextFont.fontName;
|
|
786
846
|
result[@"cameraFrameBorderWidth"] = [NSNumber numberWithFloat:customization.cameraFrameBorderWidth];
|
|
787
847
|
result[@"statusTextFont"] = customization.statusTextFont.fontName;
|
|
788
|
-
result[@"multipageAnimationFrontImage"] = [
|
|
789
|
-
result[@"multipageAnimationBackImage"] = [
|
|
848
|
+
result[@"multipageAnimationFrontImage"] = [RGLWJSONConstructor base64WithImage:customization.multipageAnimationFrontImage];
|
|
849
|
+
result[@"multipageAnimationBackImage"] = [RGLWJSONConstructor base64WithImage:customization.multipageAnimationBackImage];
|
|
790
850
|
result[@"cameraFrameLineLength"] = [NSNumber numberWithFloat:customization.cameraFrameLineLength];
|
|
791
851
|
result[@"showNextPageAnimation"] = [NSNumber numberWithBool:customization.showNextPageAnimation];
|
|
792
852
|
result[@"showBackgroundMask"] = [NSNumber numberWithBool:customization.showBackgroundMask];
|
|
793
|
-
result[@"borderBackgroundImage"] = [
|
|
853
|
+
result[@"borderBackgroundImage"] = [RGLWJSONConstructor base64WithImage:customization.borderBackgroundImage];
|
|
794
854
|
result[@"backgroundMaskAlpha"] = [NSNumber numberWithFloat:customization.backgroundMaskAlpha];
|
|
795
855
|
result[@"helpAnimationImageContentMode"] = [NSNumber numberWithInteger:[self NSIntegerWithUIViewContentMode:customization.helpAnimationImageContentMode]];
|
|
796
856
|
result[@"multipageAnimationFrontImageContentMode"] = [NSNumber numberWithInteger:[self NSIntegerWithUIViewContentMode:customization.multipageAnimationFrontImageContentMode]];
|
|
@@ -799,13 +859,13 @@
|
|
|
799
859
|
result[@"cameraFrameVerticalPositionMultiplier"] = [NSNumber numberWithFloat:customization.cameraFrameVerticalPositionMultiplier];
|
|
800
860
|
result[@"customStatusPositionMultiplier"] = [NSNumber numberWithFloat:customization.customStatusPositionMultiplier];
|
|
801
861
|
result[@"cameraFrameCornerRadius"] = [NSNumber numberWithFloat:customization.cameraFrameCornerRadius];
|
|
802
|
-
result[@"torchButtonOnImage"] = [
|
|
803
|
-
result[@"torchButtonOffImage"] = [
|
|
804
|
-
result[@"closeButtonImage"] = [
|
|
805
|
-
result[@"captureButtonImage"] = [
|
|
806
|
-
result[@"changeFrameButtonCollapseImage"] = [
|
|
807
|
-
result[@"changeFrameButtonExpandImage"] = [
|
|
808
|
-
result[@"cameraSwitchButtonImage"] = [
|
|
862
|
+
result[@"torchButtonOnImage"] = [RGLWJSONConstructor base64WithImage:customization.torchButtonOnImage];
|
|
863
|
+
result[@"torchButtonOffImage"] = [RGLWJSONConstructor base64WithImage:customization.torchButtonOffImage];
|
|
864
|
+
result[@"closeButtonImage"] = [RGLWJSONConstructor base64WithImage:customization.closeButtonImage];
|
|
865
|
+
result[@"captureButtonImage"] = [RGLWJSONConstructor base64WithImage:customization.captureButtonImage];
|
|
866
|
+
result[@"changeFrameButtonCollapseImage"] = [RGLWJSONConstructor base64WithImage:customization.changeFrameButtonCollapseImage];
|
|
867
|
+
result[@"changeFrameButtonExpandImage"] = [RGLWJSONConstructor base64WithImage:customization.changeFrameButtonExpandImage];
|
|
868
|
+
result[@"cameraSwitchButtonImage"] = [RGLWJSONConstructor base64WithImage:customization.cameraSwitchButtonImage];
|
|
809
869
|
result[@"cameraFrameLineCap"] = [NSNumber numberWithInteger:[self NSIntegerWithCGLineCap:customization.cameraFrameLineCap]];
|
|
810
870
|
result[@"cameraFrameOffsetWidth"] = [NSNumber numberWithFloat:customization.cameraFrameOffsetWidth];
|
|
811
871
|
result[@"cameraFramePortraitAspectRatio"] = [NSNumber numberWithFloat:customization.cameraFramePortraitAspectRatio];
|
|
@@ -814,7 +874,7 @@
|
|
|
814
874
|
result[@"hologramAnimationImageContentMode"] = [NSNumber numberWithInteger:[self NSIntegerWithUIViewContentMode:customization.hologramAnimationImageContentMode]];
|
|
815
875
|
result[@"hologramAnimationPositionMultiplier"] = [NSNumber numberWithFloat:customization.hologramAnimationPositionMultiplier];
|
|
816
876
|
result[@"uiCustomizationLayer"] = customization.customUILayerJSON;
|
|
817
|
-
result[@"hologramAnimationImage"] = [
|
|
877
|
+
result[@"hologramAnimationImage"] = [RGLWJSONConstructor base64WithImage:customization.hologramAnimationImage];
|
|
818
878
|
if(customization.customLabelStatus != nil)
|
|
819
879
|
result[@"customLabelStatus"] = customization.customLabelStatus.string;
|
|
820
880
|
if(customization.activityIndicatorColor != nil)
|
|
@@ -932,7 +992,9 @@
|
|
|
932
992
|
result[@"splitNames"] = processParams.splitNames;
|
|
933
993
|
result[@"processAuth"] = processParams.processAuth;
|
|
934
994
|
result[@"documentGroupFilter"] = processParams.documentGroupFilter;
|
|
935
|
-
result[@"convertCase"] = processParams.convertCase;
|
|
995
|
+
result[@"convertCase"] = [RGLWRegulaConfig NSNumberWithRGLTextProcessing:processParams.convertCase];
|
|
996
|
+
result[@"doDetectCan"] = [NSNumber numberWithBool:processParams.doDetectCan];
|
|
997
|
+
result[@"useFaceApi"] = [NSNumber numberWithBool:processParams.useFaceApi];
|
|
936
998
|
|
|
937
999
|
return result;
|
|
938
1000
|
}
|
|
@@ -1037,7 +1099,7 @@
|
|
|
1037
1099
|
if([options valueForKey:@"authorizedInstallQCert"] != nil)
|
|
1038
1100
|
rfidScenario.authorizedInstallQCert = [[options valueForKey:@"authorizedInstallQCert"] boolValue];
|
|
1039
1101
|
if([options valueForKey:@"reprocessParams"] != nil)
|
|
1040
|
-
rfidScenario.reprocParams = [self RGLReprocParamsFromJSON:
|
|
1102
|
+
rfidScenario.reprocParams = [self RGLReprocParamsFromJSON:[options valueForKey:@"reprocessParams"]];
|
|
1041
1103
|
if([options valueForKey:@"defaultReadingBufferSize"] != nil)
|
|
1042
1104
|
rfidScenario.defaultReadingBufferSize = [[options valueForKey:@"defaultReadingBufferSize"] intValue];
|
|
1043
1105
|
}
|
|
@@ -1051,4 +1113,40 @@
|
|
|
1051
1113
|
return result;
|
|
1052
1114
|
}
|
|
1053
1115
|
|
|
1116
|
+
+(RGLFaceAPIParams*)RGLFaceAPIParamsFromJSON:(NSDictionary*)input {
|
|
1117
|
+
RGLFaceAPIParams* result = [RGLFaceAPIParams new];
|
|
1118
|
+
|
|
1119
|
+
if([input valueForKey:@"url"] != nil)
|
|
1120
|
+
result.url = [input valueForKey:@"url"];
|
|
1121
|
+
if([input valueForKey:@"mode"] != nil)
|
|
1122
|
+
result.mode = [input valueForKey:@"mode"];
|
|
1123
|
+
if([input valueForKey:@"threshold"] != nil)
|
|
1124
|
+
result.threshold = [input valueForKey:@"threshold"];
|
|
1125
|
+
if([input valueForKey:@"searchParams"] != nil)
|
|
1126
|
+
result.searchParams = [self RGLFaceAPISearchParamsFromJSON:[input valueForKey:@"searchParams"]];
|
|
1127
|
+
if([input valueForKey:@"serviceTimeout"] != nil)
|
|
1128
|
+
result.serviceTimeout = [input valueForKey:@"serviceTimeout"];
|
|
1129
|
+
if([input valueForKey:@"proxy"] != nil)
|
|
1130
|
+
result.proxy = [input valueForKey:@"proxy"];
|
|
1131
|
+
if([input valueForKey:@"proxyPassword"] != nil)
|
|
1132
|
+
result.proxyPassword = [input valueForKey:@"proxyPassword"];
|
|
1133
|
+
if([input valueForKey:@"proxyType"] != nil)
|
|
1134
|
+
result.proxyType = [input valueForKey:@"proxyType"];
|
|
1135
|
+
|
|
1136
|
+
return result;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
+(RGLFaceAPISearchParams*)RGLFaceAPISearchParamsFromJSON:(NSDictionary*)input {
|
|
1140
|
+
RGLFaceAPISearchParams* result = [RGLFaceAPISearchParams new];
|
|
1141
|
+
|
|
1142
|
+
if([input valueForKey:@"limit"] != nil)
|
|
1143
|
+
result.limit = [input valueForKey:@"limit"];
|
|
1144
|
+
if([input valueForKey:@"threshold"] != nil)
|
|
1145
|
+
result.threshold = [input valueForKey:@"threshold"];
|
|
1146
|
+
if([input valueForKey:@"groupIds"] != nil)
|
|
1147
|
+
result.groupIDs = [input valueForKey:@"groupIds"];
|
|
1148
|
+
|
|
1149
|
+
return result;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1054
1152
|
@end
|