@regulaforensics/cordova-plugin-document-reader-api 7.1.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/package.json +2 -2
- package/example/www/js/index.js +7 -6
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/src/android/Config.kt +9 -7
- package/src/android/DocumentReader.kt +15 -16
- package/src/android/JSONConstructor.kt +13 -2
- package/src/android/Utils.kt +21 -16
- package/src/android/build.gradle +1 -1
- package/src/ios/RGLWConfig.m +24 -37
- package/src/ios/RGLWDocumentReader.h +3 -3
- package/src/ios/RGLWDocumentReader.m +21 -28
- package/src/ios/RGLWJSONConstructor.m +30 -39
- package/www/DocumentReader.js +680 -214
|
@@ -170,18 +170,17 @@
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
+(RGLScannerConfig*)scannerConfigFromJson:(NSDictionary*)input {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
173
|
+
RGLScannerConfig *config = [RGLScannerConfig alloc];
|
|
174
|
+
if (input[@"scenario"]) config = [config initWithScenario:input[@"scenario"]];
|
|
175
|
+
else config = [config initWithOnlineProcessingConfig:[self onlineProcessingConfigFromJson:input[@"onlineProcessingConfig"]]];
|
|
176
|
+
|
|
177
|
+
if(input[@"onlineProcessingConfig"])
|
|
178
|
+
config.onlineProcessingConfig = [self onlineProcessingConfigFromJson:input[@"onlineProcessingConfig"]];
|
|
179
|
+
if(input[@"livePortrait"])
|
|
180
|
+
config.livePortrait = [self imageWithBase64:input[@"livePortrait"]];
|
|
181
|
+
if(input[@"extPortrait"])
|
|
182
|
+
config.extPortrait = [self imageWithBase64:input[@"extPortrait"]];
|
|
183
|
+
|
|
185
184
|
return config;
|
|
186
185
|
}
|
|
187
186
|
|
|
@@ -198,37 +197,29 @@
|
|
|
198
197
|
}
|
|
199
198
|
|
|
200
199
|
+(RGLRecognizeConfig*)recognizeConfigFromJson:(NSDictionary*)input {
|
|
201
|
-
if([input valueForKey:@"scenario"] == nil && [input valueForKey:@"onlineProcessingConfig"] == nil) return nil;
|
|
202
|
-
if([input valueForKey:@"image"] == nil && [input valueForKey:@"data"] == nil && [input valueForKey:@"images"] == nil && [input valueForKey:@"imageInputs"] == nil) return nil;
|
|
203
200
|
RGLRecognizeConfig *config = [RGLRecognizeConfig alloc];
|
|
201
|
+
if (input[@"scenario"]) config = [config initWithScenario:input[@"scenario"]];
|
|
202
|
+
else config = [config initWithOnlineProcessingConfig:[self onlineProcessingConfigFromJson:input[@"onlineProcessingConfig"]]];
|
|
204
203
|
|
|
205
|
-
if([
|
|
206
|
-
|
|
207
|
-
if([
|
|
208
|
-
config = [config initWithImageData:[RGLWJSONConstructor base64Decode:[input valueForKey:@"data"]]];
|
|
209
|
-
if([input valueForKey:@"images"] != nil) {
|
|
204
|
+
if (input[@"image"]) config.image = [RGLWJSONConstructor imageWithBase64:input[@"image"]];
|
|
205
|
+
if (input[@"data"]) config.imageData = [RGLWJSONConstructor base64Decode:input[@"data"]];
|
|
206
|
+
if (input[@"images"]) {
|
|
210
207
|
NSMutableArray<UIImage*>* images = [NSMutableArray new];
|
|
211
|
-
for(NSString* base64 in [
|
|
208
|
+
for(NSString* base64 in input[@"images"])
|
|
212
209
|
[images addObject:[RGLWJSONConstructor imageWithBase64:base64]];
|
|
213
|
-
config =
|
|
214
|
-
}
|
|
215
|
-
if([
|
|
216
|
-
NSMutableArray<RGLImageInput*>*
|
|
217
|
-
for(NSDictionary*
|
|
218
|
-
[
|
|
219
|
-
config =
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if([
|
|
223
|
-
|
|
224
|
-
if([
|
|
225
|
-
|
|
226
|
-
if([input valueForKey:@"livePortrait"] != nil)
|
|
227
|
-
config.livePortrait = [self imageWithBase64:[input valueForKey:@"livePortrait"]];
|
|
228
|
-
if([input valueForKey:@"extPortrait"] != nil)
|
|
229
|
-
config.extPortrait = [self imageWithBase64:[input valueForKey:@"extPortrait"]];
|
|
230
|
-
if([input valueForKey:@"oneShotIdentification"] != nil)
|
|
231
|
-
config.oneShotIdentification = [input valueForKey:@"oneShotIdentification"];
|
|
210
|
+
config.images = images;
|
|
211
|
+
}
|
|
212
|
+
if(input[@"imageInputData"]) {
|
|
213
|
+
NSMutableArray<RGLImageInput*>* imageInputs = [NSMutableArray new];
|
|
214
|
+
for(NSDictionary* imageInput in input[@"imageInputData"])
|
|
215
|
+
[imageInputs addObject:[RGLWJSONConstructor imageInputFromJson: imageInput]];
|
|
216
|
+
config.imageInputs = imageInputs;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (input[@"scenario"]) config.scenario = input[@"scenario"];
|
|
220
|
+
if (input[@"livePortrait"]) config.livePortrait = [self imageWithBase64:input[@"livePortrait"]];
|
|
221
|
+
if (input[@"extPortrait"]) config.extPortrait = [self imageWithBase64:input[@"extPortrait"]];
|
|
222
|
+
if (input[@"oneShotIdentification"]) config.oneShotIdentification = input[@"oneShotIdentification"];
|
|
232
223
|
|
|
233
224
|
return config;
|
|
234
225
|
}
|