@regulaforensics/cordova-plugin-document-reader-api 6.4.0 → 6.5.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.
@@ -6,9 +6,11 @@ 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
 
14
16
  import android.content.Context;
@@ -59,8 +61,6 @@ class RegulaConfig {
59
61
  editor.setShowCaptureButtonDelayFromDetect(opts.getInt("showCaptureButtonDelayFromDetect"));
60
62
  if (opts.has("showCaptureButtonDelayFromStart"))
61
63
  editor.setShowCaptureButtonDelayFromStart(opts.getInt("showCaptureButtonDelayFromStart"));
62
- if (opts.has("isOnlineMode"))
63
- editor.setOnlineMode(opts.getBoolean("isOnlineMode"));
64
64
  if (opts.has("databaseAutoupdate"))
65
65
  editor.setDatabaseAutoupdate(opts.getBoolean("databaseAutoupdate"));
66
66
  if (opts.has("showSkipNextPageButton"))
@@ -73,8 +73,6 @@ class RegulaConfig {
73
73
  editor.setShowCameraSwitchButton(opts.getBoolean("showCameraSwitchButton"));
74
74
  if (opts.has("cameraFrame"))
75
75
  editor.setCameraFrame(opts.getString("cameraFrame"));
76
- if (opts.has("serviceURL"))
77
- editor.setServiceURL(opts.getString("serviceURL"));
78
76
  if (opts.has("btDeviceName"))
79
77
  editor.setBtDeviceName(opts.getString("btDeviceName"));
80
78
  if (opts.has("orientation"))
@@ -105,6 +103,8 @@ class RegulaConfig {
105
103
  editor.setExposure(BigDecimal.valueOf(opts.getDouble("exposure")).floatValue());
106
104
  if (opts.has("rfidTimeout"))
107
105
  editor.setRfidTimeout(opts.getInt("rfidTimeout"));
106
+ if (opts.has("onlineProcessingConfiguration"))
107
+ editor.setOnlineProcessingConfiguration(OnlineProcessingConfigFromJSON(opts.getJSONObject("onlineProcessingConfiguration")));
108
108
 
109
109
  editor.apply();
110
110
  }
@@ -349,14 +349,12 @@ class RegulaConfig {
349
349
  object.put("showChangeFrameButton", functionality.isShowChangeFrameButton());
350
350
  object.put("showCaptureButtonDelayFromDetect", functionality.getShowCaptureButtonDelayFromDetect());
351
351
  object.put("showCaptureButtonDelayFromStart", functionality.getShowCaptureButtonDelayFromStart());
352
- object.put("isOnlineMode", functionality.isOnlineMode());
353
352
  object.put("databaseAutoupdate", functionality.isDatabaseAutoupdate());
354
353
  object.put("showSkipNextPageButton", functionality.isShowSkipNextPageButton());
355
354
  object.put("useAuthenticator", functionality.isUseAuthenticator());
356
355
  object.put("skipFocusingFrames", functionality.isSkipFocusingFrames());
357
356
  object.put("showCameraSwitchButton", functionality.isShowCameraSwitchButton());
358
357
  object.put("cameraFrame", functionality.getCameraFrame());
359
- object.put("serviceURL", functionality.getServiceURL());
360
358
  object.put("btDeviceName", functionality.getBtDeviceName());
361
359
  object.put("orientation", functionality.getOrientation());
362
360
  object.put("BTDeviceApiPresent", functionality.isBTDeviceApiPresent());
@@ -603,6 +601,10 @@ class RegulaConfig {
603
601
  setDataGroups(DocumentReader.Instance().rfidScenario().eIDDataGroups(), opts.getJSONObject("eIDDataGroups"));
604
602
  if (opts.has("eDLDataGroups"))
605
603
  setDataGroups(DocumentReader.Instance().rfidScenario().eDLDataGroups(), opts.getJSONObject("eDLDataGroups"));
604
+ if (opts.has("reprocessParams"))
605
+ DocumentReader.Instance().rfidScenario().setReprocessParams(ReprocParamsFromJSON(opts.getJSONObject("reprocessParams")));
606
+ if (opts.has("defaultReadingBufferSize"))
607
+ DocumentReader.Instance().rfidScenario().setDefaultReadingBufferSize(opts.getInt("defaultReadingBufferSize"));
606
608
  }
607
609
 
608
610
  private static void setDataGroups(DataGroups dataGroup, JSONObject opts) throws JSONException {
@@ -649,4 +651,42 @@ class RegulaConfig {
649
651
  if (opts.has("DG21"))
650
652
  dataGroup.setDG14(opts.getBoolean("DG21"));
651
653
  }
654
+
655
+ private static ReprocParams ReprocParamsFromJSON(JSONObject input) {
656
+ try {
657
+ ReprocParams result;
658
+ if (input.has("serviceUrl"))
659
+ result = new ReprocParams(input.getString("serviceUrl"));
660
+ else return null;
661
+ if (input.has("failIfNoService"))
662
+ result.setFailIfNoService(input.getBoolean("failIfNoService"));
663
+ return result;
664
+ } catch (JSONException e) {
665
+ e.printStackTrace();
666
+ }
667
+ return null;
668
+ }
669
+
670
+ private static OnlineProcessingConfig OnlineProcessingConfigFromJSON(JSONObject input) {
671
+ try {
672
+ OnlineProcessingConfig.Builder builder;
673
+ if (input.has("mode"))
674
+ builder = new OnlineProcessingConfig.Builder(input.getInt("mode"));
675
+ else return null;
676
+ if (input.has("imageFormat"))
677
+ builder.setImageFormat(input.getInt("imageFormat"));
678
+ if (input.has("url"))
679
+ builder.setUrl(input.getString("url"));
680
+ if (input.has("imageCompressionQuality"))
681
+ builder.setImageCompressionQuality((float) input.getDouble("imageCompressionQuality"));
682
+ if (input.has("processParams")) {
683
+ ProcessParam params = new ProcessParam();
684
+ setProcessParams(params, input.getJSONObject("processParams"));
685
+ builder.setProcessParams(params);
686
+ }
687
+ } catch (JSONException e) {
688
+ e.printStackTrace();
689
+ }
690
+ return null;
691
+ }
652
692
  }
@@ -12,7 +12,7 @@ repositories {
12
12
  }
13
13
 
14
14
  dependencies {
15
- implementation ('com.regula.documentreader:api:6.4.7224'){
15
+ implementation ('com.regula.documentreader:api:6.5.7488'){
16
16
  transitive = true
17
17
  }
18
18
  }
@@ -236,6 +236,8 @@ typedef void (^Callback)(NSString* response);
236
236
  [self prepareDatabase :[args objectAtIndex:0] :successCallback :errorCallback];
237
237
  else if([action isEqualToString:@"recognizeImage"])
238
238
  [self recognizeImage :[args objectAtIndex:0] :successCallback :errorCallback];
239
+ else if([action isEqualToString:@"recognizeData"])
240
+ [self recognizeData :[args objectAtIndex:0] :successCallback :errorCallback];
239
241
  else if([action isEqualToString:@"setRfidSessionStatus"])
240
242
  [self setRfidSessionStatus :[args objectAtIndex:0] :successCallback :errorCallback];
241
243
  else if([action isEqualToString:@"providePACertificates"])
@@ -248,8 +250,6 @@ typedef void (^Callback)(NSString* response);
248
250
  [self parseCoreResults :[args objectAtIndex:0] :successCallback :errorCallback];
249
251
  else if([action isEqualToString:@"setTCCParams"])
250
252
  [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
253
  else if([action isEqualToString:@"recognizeImageWithOpts"])
254
254
  [self recognizeImageWithOpts :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
255
255
  else if([action isEqualToString:@"recognizeVideoFrame"])
@@ -304,12 +304,8 @@ typedef void (^Callback)(NSString* response);
304
304
  [self result:@"getLicenseMessage() is an android-only method" :successCallback];
305
305
  }
306
306
 
307
- - (void) initializeReaderWithDatabase:(NSString*)licenseString :(NSString*)databaseString :(Callback)successCallback :(Callback)errorCallback{
308
- [self result:@"initializeReaderWithDatabase() is an android-only method" :successCallback];
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]];
307
+ - (void) initializeReader:(NSDictionary*)config :(Callback)successCallback :(Callback)errorCallback{
308
+ [RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor RGLConfigFromJson:config] completion:[self getInitCompletion :successCallback :errorCallback]];
313
309
  }
314
310
 
315
311
  - (void) parseCoreResults:(NSString*)json :(Callback)successCallback :(Callback)errorCallback{
@@ -356,6 +352,10 @@ typedef void (^Callback)(NSString* response);
356
352
  [self recognizeImageWith :base64 :false :successCallback :errorCallback];
357
353
  }
358
354
 
355
+ - (void) recognizeData:(NSString*)data :(Callback)successCallback :(Callback)errorCallback{
356
+ [RGLDocReader.shared recognizeData :[[NSData alloc] initWithBase64EncodedString:data options:0] completion:[self getCompletion]];
357
+ }
358
+
359
359
  - (void) recognizeImages:(NSArray*)input :(Callback)successCallback :(Callback)errorCallback{
360
360
  NSMutableArray<UIImage*>* images = [[NSMutableArray alloc] init];
361
361
  for(__strong NSMutableString* base64 in input)
@@ -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;
@@ -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);
@@ -614,7 +634,6 @@
614
634
  result[@"status"] = @(input.status);
615
635
  result[@"extLeSupport"] = @(input.extLeSupport);
616
636
  result[@"processTime"] = @(input.processTime);
617
- result[@"sessionDataStatus"] = [self generateRGLRFIDSessionDataStatus:input.sessionDataStatus];
618
637
 
619
638
  return result;
620
639
  }
@@ -447,6 +447,37 @@
447
447
  return group;
448
448
  }
449
449
 
450
+ +(RGLOnlineProcessingConfig*)RGLOnlineProcessingConfigFromJSON:(NSDictionary*)dict {
451
+ if([dict valueForKey:@"mode"] == nil) return nil;
452
+
453
+ RGLOnlineProcessingConfig *result = [[RGLOnlineProcessingConfig alloc] initWithMode:[[dict valueForKey:@"mode"] integerValue]];
454
+
455
+ if([dict valueForKey:@"imageFormat"] != nil)
456
+ result.imageFormat = [[dict valueForKey:@"imageFormat"] integerValue];
457
+ if([dict valueForKey:@"url"] != nil)
458
+ result.serviceURL = [dict valueForKey:@"url"];
459
+ if([dict valueForKey:@"imageCompressionQuality"] != nil)
460
+ result.imageCompressionQuality = [[dict valueForKey:@"imageCompressionQuality"] floatValue];
461
+ if([dict valueForKey:@"processParams"] != nil) {
462
+ RGLProcessParams *params = [RGLProcessParams new];
463
+ [self setProcessParams:[dict valueForKey:@"processParams"] :params];
464
+ result.processParams = params;
465
+ }
466
+
467
+ return result;
468
+ }
469
+
470
+ +(RGLReprocParams*)RGLReprocParamsFromJSON:(NSDictionary*)dict {
471
+ RGLReprocParams *result = [RGLReprocParams new];
472
+
473
+ if([dict valueForKey:@"serviceUrl"] != nil)
474
+ result.serviceURL = [dict valueForKey:@"serviceUrl"];
475
+ if([dict valueForKey:@"failIfNoService"] != nil)
476
+ result.failIfNoService = [dict valueForKey:@"failIfNoService"];
477
+
478
+ return result;
479
+ }
480
+
450
481
  +(void)setCustomization:(NSDictionary*)options :(RGLCustomization*)customization {
451
482
  if([options valueForKey:@"cameraFrameBorderWidth"] != nil)
452
483
  customization.cameraFrameBorderWidth = [[options valueForKey:@"cameraFrameBorderWidth"] floatValue];
@@ -590,10 +621,6 @@
590
621
  functionality.singleResult = [[options valueForKey:@"singleResult"] boolValue];
591
622
  if([options valueForKey:@"cameraPosition"] != nil)
592
623
  functionality.cameraPosition = [self AVCaptureDevicePositionWithNSInteger:[[options valueForKey:@"cameraPosition"] integerValue]];
593
- if([options valueForKey:@"onlineMode"] != nil)
594
- functionality.onlineMode = [[options valueForKey:@"onlineMode"] boolValue];
595
- if([options valueForKey:@"serviceURL"] != nil)
596
- functionality.serviceURL = [[options valueForKey:@"serviceURL"] stringValue];
597
624
  if([options valueForKey:@"btDeviceName"] != nil)
598
625
  functionality.btDeviceName = [[options valueForKey:@"btDeviceName"] stringValue];
599
626
  if([options valueForKey:@"useAuthenticator"] != nil)
@@ -614,6 +641,8 @@
614
641
  functionality.recordScanningProcess = [[options valueForKey:@"recordScanningProcess"] boolValue];
615
642
  if([options valueForKey:@"manualMultipageMode"] != nil)
616
643
  functionality.manualMultipageMode = [[options valueForKey:@"manualMultipageMode"] boolValue];
644
+ if([options valueForKey:@"onlineProcessingConfiguration"] != nil)
645
+ functionality.onlineProcessingConfig = [self RGLOnlineProcessingConfigFromJSON:[options valueForKey:@"onlineProcessingConfiguration"]];;
617
646
  }
618
647
 
619
648
  +(void)setProcessParams:(NSDictionary*)options :(RGLProcessParams*)processParams {
@@ -797,8 +826,6 @@
797
826
  result[@"videoSessionPreset"] = [NSNumber numberWithInteger:[self NSIntegerWithAVCaptureSessionPreset:functionality.videoSessionPreset]];
798
827
  result[@"videoCaptureMotionControl"] = [NSNumber numberWithBool:functionality.videoCaptureMotionControl];
799
828
  result[@"orientation"] = [NSNumber numberWithInteger:[self NSIntegerWithUIInterfaceOrientationMask:functionality.orientation]];
800
- result[@"onlineMode"] = [NSNumber numberWithBool:functionality.onlineMode];
801
- result[@"serviceURL"] = functionality.serviceURL;
802
829
  result[@"cameraPosition"] = [NSNumber numberWithInteger:[self NSIntegerWithAVCaptureDevicePosition:functionality.cameraPosition]];
803
830
  result[@"btDeviceName"] = functionality.btDeviceName;
804
831
  result[@"useAuthenticator"] = [NSNumber numberWithBool:functionality.isUseAuthenticator];
@@ -969,6 +996,10 @@
969
996
  rfidScenario.authorizedInstallCert = [[options valueForKey:@"authorizedInstallCert"] boolValue];
970
997
  if([options valueForKey:@"authorizedInstallQCert"] != nil)
971
998
  rfidScenario.authorizedInstallQCert = [[options valueForKey:@"authorizedInstallQCert"] boolValue];
999
+ if([options valueForKey:@"reprocessParams"] != nil)
1000
+ rfidScenario.reprocParams = [self RGLReprocParamsFromJSON: [options valueForKey:@"reprocessParams"]];
1001
+ if([options valueForKey:@"defaultReadingBufferSize"] != nil)
1002
+ rfidScenario.defaultReadingBufferSize = [[options valueForKey:@"defaultReadingBufferSize"] intValue];
972
1003
  }
973
1004
 
974
1005
  @end
package/tmp.64209.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@regulaforensics/cordova-plugin-document-reader-api-beta",
3
+ "version": "0.0.136",
4
+ "description": "Cordova plugin for reading and validation of identification documents (API framework)",
5
+ "cordova": {
6
+ "id": "@regulaforensics/cordova-plugin-document-reader-api-beta",
7
+ "platforms": [
8
+ "ios",
9
+ "android"
10
+ ]
11
+ },
12
+ "max_body_size": "1000mb",
13
+ "keywords": [
14
+ "cordova",
15
+ "documentreader",
16
+ "reader",
17
+ "scanner",
18
+ "regula"
19
+ ],
20
+ "author": "RegulaForensics",
21
+ "license": "commercial",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/regulaforensics/DocumentReader-Cordova-Plugin.git"
25
+ },
26
+ "homepage": "https://mobile.regulaforensics.com",
27
+ "publishConfig": {
28
+ "access": "public"
29
+ }
30
+ }