@regulaforensics/cordova-plugin-document-reader-api 6.4.0 → 6.6.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/config.xml +7 -0
- package/example/package.json +5 -5
- package/example/www/index.html +109 -111
- package/example/www/js/index.js +86 -85
- package/package.json +1 -1
- package/plugin.xml +5 -3
- package/src/android/BluetoothUtil.kt +108 -0
- package/src/android/DocumentReader.java +112 -21
- package/src/android/Helpers.java +5 -6
- package/src/android/JSONConstructor.java +171 -1389
- package/src/android/RegulaConfig.java +68 -7
- package/src/android/build.gradle +5 -11
- package/src/ios/RGLDocumentReader.m +78 -34
- package/src/ios/RGLWJSONConstructor.h +7 -0
- package/src/ios/RGLWJSONConstructor.m +124 -4
- package/src/ios/RegulaConfig.m +62 -7
- package/www/DocumentReader.js +3296 -3182
|
@@ -6,11 +6,14 @@ import org.json.JSONException;
|
|
|
6
6
|
|
|
7
7
|
import com.regula.documentreader.api.DocumentReader;
|
|
8
8
|
import com.regula.documentreader.api.params.ImageQA;
|
|
9
|
+
import com.regula.documentreader.api.params.OnlineProcessingConfig;
|
|
9
10
|
import com.regula.documentreader.api.params.ParamsCustomization;
|
|
10
11
|
import com.regula.documentreader.api.params.Functionality;
|
|
11
12
|
import com.regula.documentreader.api.params.ProcessParam;
|
|
13
|
+
import com.regula.documentreader.api.params.rfid.ReprocParams;
|
|
12
14
|
import com.regula.documentreader.api.params.rfid.dg.DataGroups;
|
|
13
15
|
|
|
16
|
+
import android.annotation.SuppressLint;
|
|
14
17
|
import android.content.Context;
|
|
15
18
|
import android.graphics.Paint;
|
|
16
19
|
import android.text.SpannableString;
|
|
@@ -41,6 +44,7 @@ class RegulaConfig {
|
|
|
41
44
|
return object;
|
|
42
45
|
}
|
|
43
46
|
|
|
47
|
+
@SuppressLint("MissingPermission")
|
|
44
48
|
private static void setFunctionality(Functionality functionality, JSONObject opts) throws JSONException {
|
|
45
49
|
Functionality.FunctionalityEditor editor = functionality.edit();
|
|
46
50
|
if (opts.has("pictureOnBoundsReady"))
|
|
@@ -59,8 +63,6 @@ class RegulaConfig {
|
|
|
59
63
|
editor.setShowCaptureButtonDelayFromDetect(opts.getInt("showCaptureButtonDelayFromDetect"));
|
|
60
64
|
if (opts.has("showCaptureButtonDelayFromStart"))
|
|
61
65
|
editor.setShowCaptureButtonDelayFromStart(opts.getInt("showCaptureButtonDelayFromStart"));
|
|
62
|
-
if (opts.has("isOnlineMode"))
|
|
63
|
-
editor.setOnlineMode(opts.getBoolean("isOnlineMode"));
|
|
64
66
|
if (opts.has("databaseAutoupdate"))
|
|
65
67
|
editor.setDatabaseAutoupdate(opts.getBoolean("databaseAutoupdate"));
|
|
66
68
|
if (opts.has("showSkipNextPageButton"))
|
|
@@ -73,8 +75,6 @@ class RegulaConfig {
|
|
|
73
75
|
editor.setShowCameraSwitchButton(opts.getBoolean("showCameraSwitchButton"));
|
|
74
76
|
if (opts.has("cameraFrame"))
|
|
75
77
|
editor.setCameraFrame(opts.getString("cameraFrame"));
|
|
76
|
-
if (opts.has("serviceURL"))
|
|
77
|
-
editor.setServiceURL(opts.getString("serviceURL"));
|
|
78
78
|
if (opts.has("btDeviceName"))
|
|
79
79
|
editor.setBtDeviceName(opts.getString("btDeviceName"));
|
|
80
80
|
if (opts.has("orientation"))
|
|
@@ -105,6 +105,8 @@ class RegulaConfig {
|
|
|
105
105
|
editor.setExposure(BigDecimal.valueOf(opts.getDouble("exposure")).floatValue());
|
|
106
106
|
if (opts.has("rfidTimeout"))
|
|
107
107
|
editor.setRfidTimeout(opts.getInt("rfidTimeout"));
|
|
108
|
+
if (opts.has("onlineProcessingConfiguration"))
|
|
109
|
+
editor.setOnlineProcessingConfiguration(OnlineProcessingConfigFromJSON(opts.getJSONObject("onlineProcessingConfiguration")));
|
|
108
110
|
|
|
109
111
|
editor.apply();
|
|
110
112
|
}
|
|
@@ -213,6 +215,18 @@ class RegulaConfig {
|
|
|
213
215
|
processParams.parseBarcodes = opts.getBoolean("parseBarcodes");
|
|
214
216
|
if (opts.has("shouldReturnPackageForReprocess"))
|
|
215
217
|
processParams.shouldReturnPackageForReprocess = opts.getBoolean("shouldReturnPackageForReprocess");
|
|
218
|
+
if (opts.has("imageOutputMaxHeight"))
|
|
219
|
+
processParams.imageOutputMaxHeight = opts.getInt("imageOutputMaxHeight");
|
|
220
|
+
if (opts.has("imageOutputMaxWidth"))
|
|
221
|
+
processParams.imageOutputMaxWidth = opts.getInt("imageOutputMaxWidth");
|
|
222
|
+
if (opts.has("disablePerforationOCR"))
|
|
223
|
+
processParams.disablePerforationOCR = opts.getBoolean("disablePerforationOCR");
|
|
224
|
+
if (opts.has("documentGroupFilter"))
|
|
225
|
+
processParams.documentGroupFilter = intArrayFromJson(opts.getJSONArray("documentGroupFilter"));
|
|
226
|
+
if (opts.has("respectImageQuality"))
|
|
227
|
+
processParams.respectImageQuality = opts.getBoolean("respectImageQuality");
|
|
228
|
+
if (opts.has("splitNames"))
|
|
229
|
+
processParams.splitNames = opts.getBoolean("splitNames");
|
|
216
230
|
}
|
|
217
231
|
|
|
218
232
|
private static void setCustomization(ParamsCustomization customization, JSONObject opts, Context context) throws JSONException {
|
|
@@ -349,14 +363,12 @@ class RegulaConfig {
|
|
|
349
363
|
object.put("showChangeFrameButton", functionality.isShowChangeFrameButton());
|
|
350
364
|
object.put("showCaptureButtonDelayFromDetect", functionality.getShowCaptureButtonDelayFromDetect());
|
|
351
365
|
object.put("showCaptureButtonDelayFromStart", functionality.getShowCaptureButtonDelayFromStart());
|
|
352
|
-
object.put("isOnlineMode", functionality.isOnlineMode());
|
|
353
366
|
object.put("databaseAutoupdate", functionality.isDatabaseAutoupdate());
|
|
354
367
|
object.put("showSkipNextPageButton", functionality.isShowSkipNextPageButton());
|
|
355
368
|
object.put("useAuthenticator", functionality.isUseAuthenticator());
|
|
356
369
|
object.put("skipFocusingFrames", functionality.isSkipFocusingFrames());
|
|
357
370
|
object.put("showCameraSwitchButton", functionality.isShowCameraSwitchButton());
|
|
358
371
|
object.put("cameraFrame", functionality.getCameraFrame());
|
|
359
|
-
object.put("serviceURL", functionality.getServiceURL());
|
|
360
372
|
object.put("btDeviceName", functionality.getBtDeviceName());
|
|
361
373
|
object.put("orientation", functionality.getOrientation());
|
|
362
374
|
object.put("BTDeviceApiPresent", functionality.isBTDeviceApiPresent());
|
|
@@ -487,7 +499,7 @@ class RegulaConfig {
|
|
|
487
499
|
object.put("matchTextFieldMask", processParams.matchTextFieldMask);
|
|
488
500
|
object.put("fastDocDetect", processParams.fastDocDetect);
|
|
489
501
|
object.put("updateOCRValidityByGlare", processParams.updateOCRValidityByGlare);
|
|
490
|
-
object.put("imageQA", processParams.imageQA
|
|
502
|
+
object.put("imageQA", processParams.imageQA.toJsonObject());
|
|
491
503
|
object.put("forceDocFormat", processParams.forceDocFormat);
|
|
492
504
|
object.put("noGraphics", processParams.noGraphics);
|
|
493
505
|
object.put("documentAreaMin", processParams.documentAreaMin);
|
|
@@ -498,6 +510,12 @@ class RegulaConfig {
|
|
|
498
510
|
object.put("forceReadMrzBeforeLocate", processParams.forceReadMrzBeforeLocate);
|
|
499
511
|
object.put("parseBarcodes", processParams.parseBarcodes);
|
|
500
512
|
object.put("shouldReturnPackageForReprocess", processParams.shouldReturnPackageForReprocess);
|
|
513
|
+
object.put("imageOutputMaxHeight", processParams.imageOutputMaxHeight);
|
|
514
|
+
object.put("imageOutputMaxWidth", processParams.imageOutputMaxWidth);
|
|
515
|
+
object.put("disablePerforationOCR", processParams.disablePerforationOCR);
|
|
516
|
+
object.put("documentGroupFilter", generateIntArray(processParams.documentGroupFilter));
|
|
517
|
+
object.put("respectImageQuality", processParams.respectImageQuality);
|
|
518
|
+
object.put("splitNames", processParams.splitNames);
|
|
501
519
|
|
|
502
520
|
return object;
|
|
503
521
|
}
|
|
@@ -603,6 +621,10 @@ class RegulaConfig {
|
|
|
603
621
|
setDataGroups(DocumentReader.Instance().rfidScenario().eIDDataGroups(), opts.getJSONObject("eIDDataGroups"));
|
|
604
622
|
if (opts.has("eDLDataGroups"))
|
|
605
623
|
setDataGroups(DocumentReader.Instance().rfidScenario().eDLDataGroups(), opts.getJSONObject("eDLDataGroups"));
|
|
624
|
+
if (opts.has("reprocessParams"))
|
|
625
|
+
DocumentReader.Instance().rfidScenario().setReprocessParams(ReprocParamsFromJSON(opts.getJSONObject("reprocessParams")));
|
|
626
|
+
if (opts.has("defaultReadingBufferSize"))
|
|
627
|
+
DocumentReader.Instance().rfidScenario().setDefaultReadingBufferSize(opts.getInt("defaultReadingBufferSize"));
|
|
606
628
|
}
|
|
607
629
|
|
|
608
630
|
private static void setDataGroups(DataGroups dataGroup, JSONObject opts) throws JSONException {
|
|
@@ -649,4 +671,43 @@ class RegulaConfig {
|
|
|
649
671
|
if (opts.has("DG21"))
|
|
650
672
|
dataGroup.setDG14(opts.getBoolean("DG21"));
|
|
651
673
|
}
|
|
674
|
+
|
|
675
|
+
private static ReprocParams ReprocParamsFromJSON(JSONObject input) {
|
|
676
|
+
try {
|
|
677
|
+
ReprocParams result;
|
|
678
|
+
if (input.has("serviceUrl"))
|
|
679
|
+
result = new ReprocParams(input.getString("serviceUrl"));
|
|
680
|
+
else return null;
|
|
681
|
+
if (input.has("failIfNoService"))
|
|
682
|
+
result.setFailIfNoService(input.getBoolean("failIfNoService"));
|
|
683
|
+
return result;
|
|
684
|
+
} catch (JSONException e) {
|
|
685
|
+
e.printStackTrace();
|
|
686
|
+
}
|
|
687
|
+
return null;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
private static OnlineProcessingConfig OnlineProcessingConfigFromJSON(JSONObject input) {
|
|
691
|
+
try {
|
|
692
|
+
OnlineProcessingConfig.Builder builder;
|
|
693
|
+
if (input.has("mode"))
|
|
694
|
+
builder = new OnlineProcessingConfig.Builder(input.getInt("mode"));
|
|
695
|
+
else return null;
|
|
696
|
+
if (input.has("imageFormat"))
|
|
697
|
+
builder.setImageFormat(input.getInt("imageFormat"));
|
|
698
|
+
if (input.has("url"))
|
|
699
|
+
builder.setUrl(input.getString("url"));
|
|
700
|
+
if (input.has("imageCompressionQuality"))
|
|
701
|
+
builder.setImageCompressionQuality((float) input.getDouble("imageCompressionQuality"));
|
|
702
|
+
if (input.has("processParams")) {
|
|
703
|
+
ProcessParam params = new ProcessParam();
|
|
704
|
+
setProcessParams(params, input.getJSONObject("processParams"));
|
|
705
|
+
builder.setProcessParams(params);
|
|
706
|
+
}
|
|
707
|
+
return builder.build();
|
|
708
|
+
} catch (JSONException e) {
|
|
709
|
+
e.printStackTrace();
|
|
710
|
+
}
|
|
711
|
+
return null;
|
|
712
|
+
}
|
|
652
713
|
}
|
package/src/android/build.gradle
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
repositories {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
maven{
|
|
7
|
-
url "https://maven.regulaforensics.com/RegulaDocumentReader"
|
|
8
|
-
}
|
|
9
|
-
maven {
|
|
10
|
-
url "https://maven.regulaforensics.com/RegulaDocumentReader/Beta"
|
|
11
|
-
}
|
|
2
|
+
maven {
|
|
3
|
+
url "https://maven.regulaforensics.com/RegulaDocumentReader"
|
|
4
|
+
}
|
|
12
5
|
}
|
|
13
6
|
|
|
14
7
|
dependencies {
|
|
15
|
-
|
|
8
|
+
//noinspection GradleDependency
|
|
9
|
+
implementation ('com.regula.documentreader:api:6.6.8072'){
|
|
16
10
|
transitive = true
|
|
17
11
|
}
|
|
18
12
|
}
|
|
@@ -138,6 +138,14 @@ typedef void (^Callback)(NSString* response);
|
|
|
138
138
|
|
|
139
139
|
if([action isEqualToString:@"initializeReaderAutomatically"])
|
|
140
140
|
[self initializeReaderAutomatically :successCallback :errorCallback];
|
|
141
|
+
else if([action isEqualToString:@"isBlePermissionsGranted"])
|
|
142
|
+
[self isBlePermissionsGranted :successCallback :errorCallback];
|
|
143
|
+
else if([action isEqualToString:@"startBluetoothService"])
|
|
144
|
+
[self startBluetoothService :successCallback :errorCallback];
|
|
145
|
+
else if([action isEqualToString:@"initializeReaderBleDeviceConfig"])
|
|
146
|
+
[self initializeReaderBleDeviceConfig :successCallback :errorCallback];
|
|
147
|
+
else if([action isEqualToString:@"getTag"])
|
|
148
|
+
[self getTag :successCallback :errorCallback];
|
|
141
149
|
else if([action isEqualToString:@"getAPIVersion"])
|
|
142
150
|
[self getAPIVersion :successCallback :errorCallback];
|
|
143
151
|
else if([action isEqualToString:@"getAvailableScenarios"])
|
|
@@ -218,6 +226,10 @@ typedef void (^Callback)(NSString* response);
|
|
|
218
226
|
[self addPKDCertificates :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
219
227
|
else if([action isEqualToString:@"setCameraSessionIsPaused"])
|
|
220
228
|
[self setCameraSessionIsPaused :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
229
|
+
else if([action isEqualToString:@"setTag"])
|
|
230
|
+
[self setTag :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
231
|
+
else if([action isEqualToString:@"checkDatabaseUpdate"])
|
|
232
|
+
[self checkDatabaseUpdate :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
221
233
|
else if([action isEqualToString:@"getScenario"])
|
|
222
234
|
[self getScenario :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
223
235
|
else if([action isEqualToString:@"recognizeImages"])
|
|
@@ -236,6 +248,8 @@ typedef void (^Callback)(NSString* response);
|
|
|
236
248
|
[self prepareDatabase :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
237
249
|
else if([action isEqualToString:@"recognizeImage"])
|
|
238
250
|
[self recognizeImage :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
251
|
+
else if([action isEqualToString:@"recognizeData"])
|
|
252
|
+
[self recognizeData :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
239
253
|
else if([action isEqualToString:@"setRfidSessionStatus"])
|
|
240
254
|
[self setRfidSessionStatus :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
241
255
|
else if([action isEqualToString:@"providePACertificates"])
|
|
@@ -248,8 +262,6 @@ typedef void (^Callback)(NSString* response);
|
|
|
248
262
|
[self parseCoreResults :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
249
263
|
else if([action isEqualToString:@"setTCCParams"])
|
|
250
264
|
[self setTCCParams :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
251
|
-
else if([action isEqualToString:@"initializeReaderWithDatabase"])
|
|
252
|
-
[self initializeReaderWithDatabase :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
|
|
253
265
|
else if([action isEqualToString:@"recognizeImageWithOpts"])
|
|
254
266
|
[self recognizeImageWithOpts :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
|
|
255
267
|
else if([action isEqualToString:@"recognizeVideoFrame"])
|
|
@@ -270,6 +282,18 @@ typedef void (^Callback)(NSString* response);
|
|
|
270
282
|
[RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:licenseData] completion:[self getInitCompletion :successCallback :errorCallback]];
|
|
271
283
|
}
|
|
272
284
|
|
|
285
|
+
- (void) isBlePermissionsGranted:(Callback)successCallback :(Callback)errorCallback{
|
|
286
|
+
[self result:@"isBlePermissionsGranted() is an android-only method" :errorCallback];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
- (void) startBluetoothService:(Callback)successCallback :(Callback)errorCallback{
|
|
290
|
+
[self result:@"startBluetoothService() is an android-only method" :errorCallback];
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
- (void) initializeReaderBleDeviceConfig:(Callback)successCallback :(Callback)errorCallback{
|
|
294
|
+
[self result:@"initializeReaderBleDeviceConfig() is an android-only method" :errorCallback];
|
|
295
|
+
}
|
|
296
|
+
|
|
273
297
|
- (void) resetConfiguration:(Callback)successCallback :(Callback)errorCallback{
|
|
274
298
|
[self result:@"resetConfiguration() is an android-only method" :errorCallback];
|
|
275
299
|
}
|
|
@@ -304,12 +328,8 @@ typedef void (^Callback)(NSString* response);
|
|
|
304
328
|
[self result:@"getLicenseMessage() is an android-only method" :successCallback];
|
|
305
329
|
}
|
|
306
330
|
|
|
307
|
-
- (void)
|
|
308
|
-
[
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
- (void) initializeReader:(NSString*)licenseString :(Callback)successCallback :(Callback)errorCallback{
|
|
312
|
-
[RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:[[NSData alloc] initWithBase64EncodedString:licenseString options:0]] completion:[self getInitCompletion :successCallback :errorCallback]];
|
|
331
|
+
- (void) initializeReader:(NSDictionary*)config :(Callback)successCallback :(Callback)errorCallback{
|
|
332
|
+
[RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor RGLConfigFromJson:config] completion:[self getInitCompletion :successCallback :errorCallback]];
|
|
313
333
|
}
|
|
314
334
|
|
|
315
335
|
- (void) parseCoreResults:(NSString*)json :(Callback)successCallback :(Callback)errorCallback{
|
|
@@ -345,33 +365,38 @@ typedef void (^Callback)(NSString* response);
|
|
|
345
365
|
}
|
|
346
366
|
|
|
347
367
|
- (void) showScanner:(Callback)successCallback :(Callback)errorCallback{
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
368
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
369
|
+
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
|
|
370
|
+
UIViewController *currentViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
|
|
371
|
+
[RGLDocReader.shared showScanner:currentViewController completion:[self getCompletion]];
|
|
372
|
+
});
|
|
353
373
|
}
|
|
354
374
|
|
|
355
375
|
- (void) recognizeImage:(NSMutableString*)base64 :(Callback)successCallback :(Callback)errorCallback{
|
|
356
376
|
[self recognizeImageWith :base64 :false :successCallback :errorCallback];
|
|
357
377
|
}
|
|
358
378
|
|
|
379
|
+
- (void) recognizeData:(NSString*)data :(Callback)successCallback :(Callback)errorCallback{
|
|
380
|
+
[RGLDocReader.shared recognizeData :[[NSData alloc] initWithBase64EncodedString:data options:0] completion:[self getCompletion]];
|
|
381
|
+
}
|
|
382
|
+
|
|
359
383
|
- (void) recognizeImages:(NSArray*)input :(Callback)successCallback :(Callback)errorCallback{
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
384
|
+
NSMutableArray<UIImage*>* images = [[NSMutableArray alloc] init];
|
|
385
|
+
for(__strong NSMutableString* base64 in input)
|
|
386
|
+
[images addObject:[UIImage imageWithData:[[NSData alloc]initWithBase64EncodedString:base64 options:NSDataBase64DecodingIgnoreUnknownCharacters]]];
|
|
387
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
388
|
+
[RGLDocReader.shared recognizeImages:images completion:[self getCompletion]];
|
|
389
|
+
});
|
|
390
|
+
|
|
366
391
|
}
|
|
367
392
|
|
|
368
393
|
- (void) recognizeImagesWithImageInputs:(NSArray*)input :(Callback)successCallback :(Callback)errorCallback{
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
394
|
+
NSMutableArray<RGLImageInput*>* images = [[NSMutableArray alloc] init];
|
|
395
|
+
for(__strong NSDictionary* image in input)
|
|
396
|
+
[images addObject:[RGLWJSONConstructor RGLImageInputFromJson: image]];
|
|
397
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
398
|
+
[RGLDocReader.shared recognizeImagesWithImageInputs:images completion:[self getCompletion]];
|
|
399
|
+
});
|
|
375
400
|
}
|
|
376
401
|
|
|
377
402
|
- (void) recognizeImageWithCameraMode:(NSMutableString*)base64 :(BOOL)cameraMode :(Callback)successCallback :(Callback)errorCallback{
|
|
@@ -379,31 +404,44 @@ typedef void (^Callback)(NSString* response);
|
|
|
379
404
|
}
|
|
380
405
|
|
|
381
406
|
- (void) recognizeImageWith:(NSMutableString*)base64 :(BOOL)cameraMode :(Callback)successCallback :(Callback)errorCallback{
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
407
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
408
|
+
[RGLDocReader.shared recognizeImage:[UIImage imageWithData:[[NSData alloc]initWithBase64EncodedString:base64 options:NSDataBase64DecodingIgnoreUnknownCharacters]] cameraMode:cameraMode completion:[self getCompletion]];
|
|
409
|
+
});
|
|
385
410
|
}
|
|
386
411
|
|
|
387
412
|
- (void) setConfig:(NSDictionary*)config :(Callback)successCallback :(Callback)errorCallback{
|
|
388
|
-
|
|
389
|
-
|
|
413
|
+
[RegulaConfig setConfig:config :RGLDocReader.shared];
|
|
414
|
+
[self result:@"" :successCallback];
|
|
390
415
|
}
|
|
391
416
|
|
|
392
417
|
- (void) getConfig:(Callback)successCallback :(Callback)errorCallback{
|
|
393
418
|
[self result:[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:[RegulaConfig getConfig:RGLDocReader.shared] options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding] :successCallback];
|
|
394
419
|
}
|
|
395
420
|
|
|
421
|
+
- (void) checkDatabaseUpdate:(NSString*)databaseId :(Callback)successCallback :(Callback)errorCallback{
|
|
422
|
+
[RGLDocReader.shared checkDatabaseUpdate:databaseId completion:[self getCheckDatabaseUpdateCompletion: successCallback: errorCallback]];
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
- (void) getTag:(Callback)successCallback :(Callback)errorCallback{
|
|
426
|
+
[self result:[RGLDocReader.shared tag] :successCallback];
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
- (void) setTag:(NSString*)tag :(Callback)successCallback :(Callback)errorCallback{
|
|
430
|
+
[RGLDocReader.shared setTag:tag];
|
|
431
|
+
[self result:@"" :successCallback];
|
|
432
|
+
}
|
|
433
|
+
|
|
396
434
|
- (void) setRfidScenario:(NSDictionary*)rfidScenario :(Callback)successCallback :(Callback)errorCallback{
|
|
397
|
-
|
|
398
|
-
|
|
435
|
+
[RegulaConfig setRfidScenario:rfidScenario :RGLDocReader.shared.rfidScenario];
|
|
436
|
+
[self result:@"" :successCallback];
|
|
399
437
|
}
|
|
400
438
|
|
|
401
439
|
- (void) getRfidScenario:(Callback)successCallback :(Callback)errorCallback{
|
|
402
|
-
|
|
440
|
+
[self result:[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:RGLDocReader.shared.rfidScenario.rfidScenarioDictionary options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding] :successCallback];
|
|
403
441
|
}
|
|
404
442
|
|
|
405
443
|
- (void) readRFID:(Callback)successCallback :(Callback)errorCallback{
|
|
406
|
-
|
|
444
|
+
[RGLDocReader.shared readRFID:[self getRFIDNotificationCallback] completion:[self getRFIDCompletion]];
|
|
407
445
|
}
|
|
408
446
|
|
|
409
447
|
- (void) stopRFIDReader:(Callback)successCallback :(Callback)errorCallback{
|
|
@@ -652,4 +690,10 @@ typedef void (^Callback)(NSString* response);
|
|
|
652
690
|
};
|
|
653
691
|
}
|
|
654
692
|
|
|
693
|
+
-(RGLDocumentReaderCheckUpdateCompletion)getCheckDatabaseUpdateCompletion:(Callback)successCallback :(Callback)errorCallback{
|
|
694
|
+
return ^(RGLDocReaderDocumentsDatabase* database) {
|
|
695
|
+
[self result:[RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateRGLDocReaderDocumentsDatabase:database]] :successCallback];
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
|
|
655
699
|
@end
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
+(NSMutableDictionary* _Nonnull)generateNSDictionary:(NSDictionary<NSNumber*, NSNumber*>* _Nullable)input;
|
|
13
13
|
+(RGLPKDCertificate* _Nullable)RGLPKDCertificateFromJson:(NSDictionary* _Nullable) dict;
|
|
14
14
|
+(RGLTCCParams* _Nonnull)RGLTCCParamsFromJson:(NSDictionary* _Nonnull)input;
|
|
15
|
+
+(RGLConfig* _Nullable)RGLConfigFromJson:(NSDictionary* _Nonnull)input;
|
|
15
16
|
+(RGLImageInput* _Nonnull)RGLImageInputFromJson:(NSDictionary* _Nonnull)input;
|
|
16
17
|
+(NSInteger)generateDocReaderAction:(RGLDocReaderAction)action;
|
|
17
18
|
+(NSInteger)generateRFIDCompleteAction:(RGLRFIDCompleteAction)action;
|
|
@@ -64,6 +65,12 @@
|
|
|
64
65
|
+(NSMutableDictionary* _Nonnull)generateRGLBytesData:(RGLBytesData* _Nullable)input;
|
|
65
66
|
+(NSMutableDictionary* _Nonnull)generateRGLRFIDNotify:(RGLRFIDNotify* _Nullable)input;
|
|
66
67
|
+(NSMutableDictionary* _Nonnull)generateRGLUVFiberElement:(RGLUVFiberElement* _Nullable)input;
|
|
68
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocReaderDocumentsDatabase:(RGLDocReaderDocumentsDatabase* _Nullable)input;
|
|
69
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderComparison:(RGLDocumentReaderComparison* _Nullable)input;
|
|
70
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderValidity:(RGLDocumentReaderValidity* _Nullable)input;
|
|
71
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderSymbol:(RGLDocumentReaderSymbol* _Nullable)input;
|
|
72
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderTextSource:(RGLDocumentReaderTextSource* _Nullable)input;
|
|
73
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderRfidOrigin:(RGLDocumentReaderRfidOrigin* _Nullable)input;
|
|
67
74
|
+(NSMutableDictionary* _Nonnull)generateRGLElementRect:(RGLElementRect* _Nullable)input;
|
|
68
75
|
|
|
69
76
|
@end
|
|
@@ -35,6 +35,28 @@
|
|
|
35
35
|
return [[RGLTCCParams alloc] initWithServiceTAURLString:serviceTAURLString servicePAURLString:servicePAURLString pfxCertURLString:pfxCertURLString pfxCertData: pfxCertData pfxPassPhrase:pfxPassPhrase];
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
+(RGLConfig*)RGLConfigFromJson:(NSDictionary*)input {
|
|
39
|
+
NSData* license;
|
|
40
|
+
if([input valueForKey:@"license"] != nil)
|
|
41
|
+
license = [[NSData alloc] initWithBase64EncodedString:[input valueForKey:@"license"] options:0];
|
|
42
|
+
else return nil;
|
|
43
|
+
|
|
44
|
+
RGLConfig *config = [[RGLConfig alloc] initWithLicenseData:license];
|
|
45
|
+
|
|
46
|
+
if([input valueForKey:@"databasePath"] != nil){
|
|
47
|
+
config.databasePath = [[input valueForKey:@"databasePath"] stringValue];
|
|
48
|
+
}
|
|
49
|
+
if([input valueForKey:@"licenseUpdate"] != nil){
|
|
50
|
+
config.licenseUpdateCheck = [[input valueForKey:@"licenseUpdate"] boolValue];
|
|
51
|
+
}
|
|
52
|
+
if([input valueForKey:@"delayedNNLoad"] != nil){
|
|
53
|
+
config.delayedNNLoadEnabled = [[input valueForKey:@"delayedNNLoad"] boolValue];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return config;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
38
60
|
+(RGLImageInput*)RGLImageInputFromJson:(NSDictionary*)input {
|
|
39
61
|
NSInteger pageIndex = 0;
|
|
40
62
|
if([input valueForKey:@"pageIndex"] != nil)
|
|
@@ -294,11 +316,9 @@
|
|
|
294
316
|
[array addObject:[self generateRGLImageQualityGroup:item]];
|
|
295
317
|
result[@"imageQuality"] = array;
|
|
296
318
|
}
|
|
297
|
-
result[@"overallResult"] = @(input.overallResult);
|
|
298
319
|
result[@"authenticityResult"] = [self generateRGLDocumentReaderAuthenticityResult:input.authenticityResults];
|
|
299
320
|
result[@"rfidSessionData"] = [self generateRGLRFIDSessionData:input.rfidSessionData];
|
|
300
321
|
result[@"chipPage"] = @(input.chipPage);
|
|
301
|
-
result[@"resolutionType"] = @(input.resolutionType);
|
|
302
322
|
result[@"barcodeResult"] = [self generateRGLDocumentReaderBarcodeResult:input.barcodeResult];
|
|
303
323
|
result[@"processingFinishedStatus"] = @(input.processingFinishedStatus);
|
|
304
324
|
result[@"morePagesAvailable"] = @(input.morePagesAvailable);
|
|
@@ -494,6 +514,15 @@
|
|
|
494
514
|
result[@"fields"] = array;
|
|
495
515
|
}
|
|
496
516
|
result[@"status"] = @(input.status);
|
|
517
|
+
result[@"comparisonStatus"] = @(input.comparisonStatus);
|
|
518
|
+
result[@"validityStatus"] = @(input.validityStatus);
|
|
519
|
+
if(input.availableSourceList != nil){
|
|
520
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
521
|
+
for(RGLDocumentReaderTextSource* item in input.availableSourceList)
|
|
522
|
+
if(item != nil)
|
|
523
|
+
[array addObject:[self generateRGLDocumentReaderTextSource:item]];
|
|
524
|
+
result[@"availableSourceList"] = array;
|
|
525
|
+
}
|
|
497
526
|
|
|
498
527
|
return result;
|
|
499
528
|
}
|
|
@@ -514,7 +543,22 @@
|
|
|
514
543
|
result[@"values"] = array;
|
|
515
544
|
}
|
|
516
545
|
result[@"status"] = @(input.status);
|
|
517
|
-
result[@"value"] =
|
|
546
|
+
result[@"value"] = input.value;
|
|
547
|
+
result[@"getValue"] = [self generateRGLDocumentReaderValue:[input getValue]];
|
|
548
|
+
if(input.comparisonList != nil){
|
|
549
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
550
|
+
for(RGLDocumentReaderComparison* item in input.comparisonList)
|
|
551
|
+
if(item != nil)
|
|
552
|
+
[array addObject:[self generateRGLDocumentReaderComparison:item]];
|
|
553
|
+
result[@"comparisonList"] = array;
|
|
554
|
+
}
|
|
555
|
+
if(input.validityList != nil){
|
|
556
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
557
|
+
for(RGLDocumentReaderValidity* item in input.validityList)
|
|
558
|
+
if(item != nil)
|
|
559
|
+
[array addObject:[self generateRGLDocumentReaderValidity:item]];
|
|
560
|
+
result[@"validityList"] = array;
|
|
561
|
+
}
|
|
518
562
|
|
|
519
563
|
return result;
|
|
520
564
|
}
|
|
@@ -531,6 +575,14 @@
|
|
|
531
575
|
result[@"comparison"] = [self generateNSDictionary:input.comparison];
|
|
532
576
|
result[@"pageIndex"] = @(input.pageIndex);
|
|
533
577
|
result[@"probability"] = @(input.probability);
|
|
578
|
+
if(input.originalSymbols != nil){
|
|
579
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
580
|
+
for(RGLDocumentReaderSymbol* item in input.originalSymbols)
|
|
581
|
+
if(item != nil)
|
|
582
|
+
[array addObject:[self generateRGLDocumentReaderSymbol:item]];
|
|
583
|
+
result[@"originalSymbols"] = array;
|
|
584
|
+
}
|
|
585
|
+
result[@"rfidOrigin"] = [self generateRGLDocumentReaderRfidOrigin:input.rfidOrigin];
|
|
534
586
|
|
|
535
587
|
return result;
|
|
536
588
|
}
|
|
@@ -614,7 +666,6 @@
|
|
|
614
666
|
result[@"status"] = @(input.status);
|
|
615
667
|
result[@"extLeSupport"] = @(input.extLeSupport);
|
|
616
668
|
result[@"processTime"] = @(input.processTime);
|
|
617
|
-
result[@"sessionDataStatus"] = [self generateRGLRFIDSessionDataStatus:input.sessionDataStatus];
|
|
618
669
|
|
|
619
670
|
return result;
|
|
620
671
|
}
|
|
@@ -1110,6 +1161,75 @@
|
|
|
1110
1161
|
return result;
|
|
1111
1162
|
}
|
|
1112
1163
|
|
|
1164
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocReaderDocumentsDatabase:(RGLDocReaderDocumentsDatabase* _Nullable)input {
|
|
1165
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1166
|
+
if(input == nil) return result;
|
|
1167
|
+
|
|
1168
|
+
result[@"databaseID"] = input.databaseID;
|
|
1169
|
+
result[@"version"] = input.version;
|
|
1170
|
+
result[@"date"] = input.date;
|
|
1171
|
+
result[@"databaseDescription"] = input.databaseDescription;
|
|
1172
|
+
result[@"countriesNumber"] = @(input.countriesNumber);
|
|
1173
|
+
result[@"documentsNumber"] = @(input.documentsNumber);
|
|
1174
|
+
|
|
1175
|
+
return result;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderComparison:(RGLDocumentReaderComparison* _Nullable)input {
|
|
1179
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1180
|
+
if(input == nil) return result;
|
|
1181
|
+
|
|
1182
|
+
result[@"sourceTypeLeft"] = @(input.sourceTypeLeft);
|
|
1183
|
+
result[@"sourceTypeRight"] = @(input.sourceTypeRight);
|
|
1184
|
+
result[@"status"] = @(input.status);
|
|
1185
|
+
|
|
1186
|
+
return result;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderValidity:(RGLDocumentReaderValidity* _Nullable)input {
|
|
1190
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1191
|
+
if(input == nil) return result;
|
|
1192
|
+
|
|
1193
|
+
result[@"sourceType"] = @(input.sourceType);
|
|
1194
|
+
result[@"status"] = @(input.status);
|
|
1195
|
+
|
|
1196
|
+
return result;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderSymbol:(RGLDocumentReaderSymbol* _Nullable)input {
|
|
1200
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1201
|
+
if(input == nil) return result;
|
|
1202
|
+
|
|
1203
|
+
result[@"code"] = @(input.code);
|
|
1204
|
+
result[@"rect"] = [self generateCGRect:input.rect];
|
|
1205
|
+
result[@"probability"] = @(input.probability);
|
|
1206
|
+
|
|
1207
|
+
return result;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderTextSource:(RGLDocumentReaderTextSource* _Nullable)input {
|
|
1211
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1212
|
+
if(input == nil) return result;
|
|
1213
|
+
|
|
1214
|
+
result[@"sourceType"] = @(input.sourceType);
|
|
1215
|
+
result[@"source"] = input.source;
|
|
1216
|
+
result[@"validityStatus"] = @(input.validityStatus);
|
|
1217
|
+
|
|
1218
|
+
return result;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderRfidOrigin:(RGLDocumentReaderRfidOrigin* _Nullable)input {
|
|
1222
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1223
|
+
if(input == nil) return result;
|
|
1224
|
+
|
|
1225
|
+
result[@"dg"] = @(input.dg);
|
|
1226
|
+
result[@"dgTag"] = @(input.dgTag);
|
|
1227
|
+
result[@"entryView"] = @(input.entryView);
|
|
1228
|
+
result[@"tagEntry"] = @(input.tagEntry);
|
|
1229
|
+
|
|
1230
|
+
return result;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1113
1233
|
+(NSMutableDictionary* _Nonnull)generateRGLElementRect:(RGLElementRect* _Nullable)input {
|
|
1114
1234
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
1115
1235
|
if(input == nil) return result;
|