@regulaforensics/cordova-plugin-document-reader-api 6.3.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.
@@ -15,7 +15,9 @@ import com.regula.documentreader.api.enums.eGraphicFieldType;
15
15
  import com.regula.documentreader.api.enums.eRPRM_Lights;
16
16
  import com.regula.documentreader.api.errors.DocumentReaderException;
17
17
  import com.regula.documentreader.api.internal.core.CoreDetailedScenario;
18
- import com.regula.documentreader.api.params.FaceMetaData;
18
+ import com.regula.documentreader.api.params.DocReaderConfig;
19
+ import com.regula.documentreader.api.internal.params.FaceMetaData;
20
+ import com.regula.documentreader.api.params.ImageInputData;
19
21
  import com.regula.documentreader.api.params.rfid.TccParams;
20
22
  import com.regula.documentreader.api.params.rfid.authorization.PAAttribute;
21
23
  import com.regula.documentreader.api.params.rfid.authorization.PAResourcesIssuer;
@@ -55,7 +57,6 @@ import com.regula.documentreader.api.results.rfid.Extension;
55
57
  import com.regula.documentreader.api.results.rfid.File;
56
58
  import com.regula.documentreader.api.results.rfid.FileData;
57
59
  import com.regula.documentreader.api.results.rfid.RFIDSessionData;
58
- import com.regula.documentreader.api.results.rfid.RFIDSessionDataStatus;
59
60
  import com.regula.documentreader.api.results.rfid.SecurityObject;
60
61
  import com.regula.documentreader.api.results.rfid.SecurityObjectCertificates;
61
62
  import com.regula.documentreader.api.results.rfid.SignerInfo;
@@ -360,6 +361,64 @@ class JSONConstructor {
360
361
  return result;
361
362
  }
362
363
 
364
+ static DocReaderConfig DocReaderConfigFromJSON(JSONObject input) {
365
+ DocReaderConfig result = new DocReaderConfig(null);
366
+ byte[] license;
367
+ try {
368
+ if (input.has("license")) {
369
+ license = Base64.decode(input.getString("license"), Base64.DEFAULT);
370
+ result = new DocReaderConfig(license);
371
+ } else return result;
372
+ if (input.has("customDb"))
373
+ result = new DocReaderConfig(license, Base64.decode(input.getString("customDb"), Base64.DEFAULT));
374
+ if (input.has("licenseUpdate"))
375
+ result.setLicenseUpdate(input.getBoolean("licenseUpdate"));
376
+ if (input.has("delayedNNLoad"))
377
+ result.setDelayedNNLoad(input.getBoolean("delayedNNLoad"));
378
+ if (input.has("blackList"))
379
+ result.setBlackList(input.getJSONObject("blackList"));
380
+ } catch (JSONException e) {
381
+ e.printStackTrace();
382
+ }
383
+ return result;
384
+ }
385
+
386
+ static ImageInputData ImageInputDataFromJSON(JSONObject input) {
387
+ ImageInputData result = new ImageInputData(null);
388
+ int pageIndex = 0;
389
+ int light = 6;
390
+ int type = 254;
391
+ int width = 0;
392
+ int height = 0;
393
+ Bitmap bitmap;
394
+ byte[] imgBytes;
395
+
396
+ try {
397
+ if(input.has("pageIndex"))
398
+ pageIndex = input.optInt("pageIndex");
399
+ if(input.has("light"))
400
+ pageIndex = input.optInt("light");
401
+ if(input.has("type"))
402
+ pageIndex = input.optInt("type");
403
+ if (input.has("bitmap")) {
404
+ bitmap = Helpers.bitmapFromBase64(input.getString("bitmap"));
405
+ result = new ImageInputData(bitmap, light, pageIndex);
406
+ }
407
+ if (input.has("imgBytes")) {
408
+ JSONArray jsonArray_data = input.getJSONArray("data");
409
+ byte[] data = new byte[jsonArray_data.length()];
410
+ for (int i = 0; i < jsonArray_data.length(); i++)
411
+ data[i] = (byte) jsonArray_data.get(i);
412
+ imgBytes = data;
413
+ result = new ImageInputData(imgBytes, width, height, light, pageIndex);
414
+ }
415
+ } catch (JSONException e) {
416
+ e.printStackTrace();
417
+ }
418
+
419
+ return result;
420
+ }
421
+
363
422
  static Throwable ThrowableFromJSON(JSONObject jsonObject) {
364
423
  return new Throwable();
365
424
  }
@@ -883,7 +942,6 @@ class JSONConstructor {
883
942
  result.put("extLeSupport", input.extLeSupport);
884
943
  result.put("processTime", input.processTime);
885
944
  result.put("cardProperties", generateCardProperties(input.cardProperties));
886
- result.put("sessionDataStatus", generateRFIDSessionDataStatus(input.sessionDataStatus));
887
945
  result.put("accessControls", generateList(input.accessControls, JSONConstructor::generateAccessControlProcedureType));
888
946
  result.put("applications", generateList(input.applications, JSONConstructor::generateApplication));
889
947
  result.put("securityObjects", generateList(input.securityObjects, JSONConstructor::generateSecurityObject));
@@ -921,23 +979,6 @@ class JSONConstructor {
921
979
  return result;
922
980
  }
923
981
 
924
- static JSONObject generateRFIDSessionDataStatus(RFIDSessionDataStatus input) {
925
- JSONObject result = new JSONObject();
926
- if (input == null) return result;
927
- try {
928
- result.put("AA", input.AA);
929
- result.put("BAC", input.BAC);
930
- result.put("CA", input.CA);
931
- result.put("PA", input.PA);
932
- result.put("PACE", input.PACE);
933
- result.put("TA", input.TA);
934
- result.put("overallStatus", input.overallStatus);
935
- } catch (JSONException e) {
936
- e.printStackTrace();
937
- }
938
- return result;
939
- }
940
-
941
982
  static JSONObject generateDocumentReaderBarcodeResult(DocumentReaderBarcodeResult input) {
942
983
  JSONObject result = new JSONObject();
943
984
  if (input == null) return result;
@@ -1184,12 +1225,28 @@ class JSONConstructor {
1184
1225
  return result;
1185
1226
  }
1186
1227
 
1228
+ static JSONObject generateImageInputData(ImageInputData input) {
1229
+ JSONObject result = new JSONObject();
1230
+ if (input == null) return result;
1231
+ try {
1232
+ result.put("pageIndex", input.getPageIndex());
1233
+ result.put("light", input.getLight());
1234
+ result.put("type", input.getType());
1235
+ result.put("width", input.getWidth());
1236
+ result.put("height", input.getHeight());
1237
+ result.put("bitmap", generateBitmap(input.getBitmap()));
1238
+ result.put("imgBytes", generateByteArray(input.getImgBytes()));
1239
+ } catch (JSONException e) {
1240
+ e.printStackTrace();
1241
+ }
1242
+ return result;
1243
+ }
1244
+
1187
1245
  static JSONObject generateDocumentReaderResults(DocumentReaderResults input, Context context) {
1188
1246
  JSONObject result = new JSONObject();
1189
1247
  if (input == null) return result;
1190
1248
  try {
1191
1249
  result.put("chipPage", input.chipPage);
1192
- result.put("overallResult", input.getOverallResult());
1193
1250
  result.put("processingFinishedStatus", input.processingFinishedStatus);
1194
1251
  result.put("elapsedTime", input.elapsedTime);
1195
1252
  result.put("elapsedTimeRFID", input.elapsedTimeRFID);
@@ -1984,8 +2041,6 @@ class JSONConstructor {
1984
2041
  result.processTime = input.getInt("processTime");
1985
2042
  if (input.has("cardProperties"))
1986
2043
  result.cardProperties = CardPropertiesFromJSON(input.getJSONObject("cardProperties"));
1987
- if (input.has("sessionDataStatus"))
1988
- result.sessionDataStatus = RFIDSessionDataStatusFromJSON(input.getJSONObject("sessionDataStatus"));
1989
2044
  if (input.has("accessControls")){
1990
2045
  JSONArray jsonArray_accessControls = input.getJSONArray("accessControls");
1991
2046
  List<AccessControlProcedureType> accessControls = new ArrayList<>();
@@ -2051,30 +2106,6 @@ class JSONConstructor {
2051
2106
  return null;
2052
2107
  }
2053
2108
 
2054
- static RFIDSessionDataStatus RFIDSessionDataStatusFromJSON(JSONObject input) {
2055
- try {
2056
- RFIDSessionDataStatus result = new RFIDSessionDataStatus();
2057
- if (input.has("AA"))
2058
- result.AA = input.getInt("AA");
2059
- if (input.has("BAC"))
2060
- result.BAC = input.getInt("BAC");
2061
- if (input.has("CA"))
2062
- result.CA = input.getInt("CA");
2063
- if (input.has("PA"))
2064
- result.PA = input.getInt("PA");
2065
- if (input.has("PACE"))
2066
- result.PACE = input.getInt("PACE");
2067
- if (input.has("TA"))
2068
- result.TA = input.getInt("TA");
2069
- if (input.has("overallStatus"))
2070
- result.overallStatus = input.getInt("overallStatus");
2071
- return result;
2072
- } catch (JSONException e) {
2073
- e.printStackTrace();
2074
- }
2075
- return null;
2076
- }
2077
-
2078
2109
  static DocumentReaderBarcodeResult DocumentReaderBarcodeResultFromJSON(JSONObject input) {
2079
2110
  try {
2080
2111
  DocumentReaderBarcodeResult result = new DocumentReaderBarcodeResult();
@@ -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"))
@@ -103,6 +101,10 @@ class RegulaConfig {
103
101
  editor.setManualMultipageMode(opts.getBoolean("manualMultipageMode"));
104
102
  if (opts.has("exposure"))
105
103
  editor.setExposure(BigDecimal.valueOf(opts.getDouble("exposure")).floatValue());
104
+ if (opts.has("rfidTimeout"))
105
+ editor.setRfidTimeout(opts.getInt("rfidTimeout"));
106
+ if (opts.has("onlineProcessingConfiguration"))
107
+ editor.setOnlineProcessingConfiguration(OnlineProcessingConfigFromJSON(opts.getJSONObject("onlineProcessingConfiguration")));
106
108
 
107
109
  editor.apply();
108
110
  }
@@ -331,6 +333,8 @@ class RegulaConfig {
331
333
  editor.setHologramAnimationImageMatrix(matrixFromFloatArray(floatArrayFromJson(opts.getJSONArray("hologramAnimationImageMatrix"))));
332
334
  if (opts.has("hologramAnimationImageScaleType"))
333
335
  editor.setHologramAnimationImageScaleType(ScaleType.valueOf(opts.getString("hologramAnimationImageScaleType")));
336
+ if (opts.has("uiCustomizationLayer"))
337
+ editor.setUiCustomizationLayer(opts.getJSONObject("uiCustomizationLayer"));
334
338
 
335
339
  editor.applyImmediately(context);
336
340
  }
@@ -345,14 +349,12 @@ class RegulaConfig {
345
349
  object.put("showChangeFrameButton", functionality.isShowChangeFrameButton());
346
350
  object.put("showCaptureButtonDelayFromDetect", functionality.getShowCaptureButtonDelayFromDetect());
347
351
  object.put("showCaptureButtonDelayFromStart", functionality.getShowCaptureButtonDelayFromStart());
348
- object.put("isOnlineMode", functionality.isOnlineMode());
349
352
  object.put("databaseAutoupdate", functionality.isDatabaseAutoupdate());
350
353
  object.put("showSkipNextPageButton", functionality.isShowSkipNextPageButton());
351
354
  object.put("useAuthenticator", functionality.isUseAuthenticator());
352
355
  object.put("skipFocusingFrames", functionality.isSkipFocusingFrames());
353
356
  object.put("showCameraSwitchButton", functionality.isShowCameraSwitchButton());
354
357
  object.put("cameraFrame", functionality.getCameraFrame());
355
- object.put("serviceURL", functionality.getServiceURL());
356
358
  object.put("btDeviceName", functionality.getBtDeviceName());
357
359
  object.put("orientation", functionality.getOrientation());
358
360
  object.put("BTDeviceApiPresent", functionality.isBTDeviceApiPresent());
@@ -371,6 +373,7 @@ class RegulaConfig {
371
373
  object.put("recordScanningProcess", functionality.doRecordProcessingVideo());
372
374
  object.put("manualMultipageMode", functionality.isManualMultipageMode());
373
375
  object.put("exposure", functionality.getExposure());
376
+ object.put("rfidTimeout", functionality.getRfidTimeout());
374
377
 
375
378
  return object;
376
379
  }
@@ -435,6 +438,7 @@ class RegulaConfig {
435
438
  object.put("hologramAnimationPositionMultiplier", customization.getHologramAnimationPositionMultiplier());
436
439
  object.put("hologramAnimationImageMatrix", customization.getHologramAnimationImageMatrix());
437
440
  object.put("hologramAnimationImageScaleType", customization.getHologramAnimationImageScaleType());
441
+ object.put("uiCustomizationLayer", customization.getUiCustomizationLayer());
438
442
 
439
443
  return object;
440
444
  }
@@ -597,6 +601,10 @@ class RegulaConfig {
597
601
  setDataGroups(DocumentReader.Instance().rfidScenario().eIDDataGroups(), opts.getJSONObject("eIDDataGroups"));
598
602
  if (opts.has("eDLDataGroups"))
599
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"));
600
608
  }
601
609
 
602
610
  private static void setDataGroups(DataGroups dataGroup, JSONObject opts) throws JSONException {
@@ -643,4 +651,42 @@ class RegulaConfig {
643
651
  if (opts.has("DG21"))
644
652
  dataGroup.setDG14(opts.getBoolean("DG21"));
645
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
+ }
646
692
  }
@@ -12,7 +12,7 @@ repositories {
12
12
  }
13
13
 
14
14
  dependencies {
15
- implementation ('com.regula.documentreader:api:6.3.6939'){
15
+ implementation ('com.regula.documentreader:api:6.5.7488'){
16
16
  transitive = true
17
17
  }
18
18
  }
@@ -178,6 +178,8 @@ typedef void (^Callback)(NSString* response);
178
178
  [self startRFIDReader :successCallback :errorCallback];
179
179
  else if([action isEqualToString:@"stopRFIDReader"])
180
180
  [self stopRFIDReader :successCallback :errorCallback];
181
+ else if([action isEqualToString:@"stopRFIDReaderWithErrorMessage"])
182
+ [self stopRFIDReaderWithErrorMessage :[args objectAtIndex:0] :successCallback :errorCallback];
181
183
  else if([action isEqualToString:@"stopScanner"])
182
184
  [self stopScanner :successCallback :errorCallback];
183
185
  else if([action isEqualToString:@"deinitializeReader"])
@@ -234,6 +236,8 @@ typedef void (^Callback)(NSString* response);
234
236
  [self prepareDatabase :[args objectAtIndex:0] :successCallback :errorCallback];
235
237
  else if([action isEqualToString:@"recognizeImage"])
236
238
  [self recognizeImage :[args objectAtIndex:0] :successCallback :errorCallback];
239
+ else if([action isEqualToString:@"recognizeData"])
240
+ [self recognizeData :[args objectAtIndex:0] :successCallback :errorCallback];
237
241
  else if([action isEqualToString:@"setRfidSessionStatus"])
238
242
  [self setRfidSessionStatus :[args objectAtIndex:0] :successCallback :errorCallback];
239
243
  else if([action isEqualToString:@"providePACertificates"])
@@ -246,20 +250,16 @@ typedef void (^Callback)(NSString* response);
246
250
  [self parseCoreResults :[args objectAtIndex:0] :successCallback :errorCallback];
247
251
  else if([action isEqualToString:@"setTCCParams"])
248
252
  [self setTCCParams :[args objectAtIndex:0] :successCallback :errorCallback];
249
- else if([action isEqualToString:@"initializeReaderWithDatabase"])
250
- [self initializeReaderWithDatabase :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
251
- else if([action isEqualToString:@"recognizeImageFrame"])
252
- [self recognizeImageFrame :[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"])
256
256
  [self recognizeVideoFrame :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
257
257
  else if([action isEqualToString:@"showScannerWithCameraIDAndOpts"])
258
258
  [self showScannerWithCameraIDAndOpts :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
259
- else if([action isEqualToString:@"recognizeImageWithImageInputParams"])
260
- [self recognizeImageWithImageInputParams :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
261
259
  else if([action isEqualToString:@"recognizeImageWithCameraMode"])
262
260
  [self recognizeImageWithCameraMode :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
261
+ else if([action isEqualToString:@"recognizeImagesWithImageInputs"])
262
+ [self recognizeImagesWithImageInputs :[args objectAtIndex:0] :successCallback :errorCallback];
263
263
  else
264
264
  [self result:[NSString stringWithFormat:@"%@/%@", @"method not implemented: ", action] :errorCallback];
265
265
  }
@@ -282,8 +282,10 @@ typedef void (^Callback)(NSString* response);
282
282
  [self result:@"showScannerWithCameraID() is an android-only method" :errorCallback];
283
283
  }
284
284
 
285
- - (void) recognizeImageFrame:(NSString*)base64 :(NSDictionary*)opts :(Callback)successCallback :(Callback)errorCallback{
286
- [self result:@"recognizeImageFrame() is an android-only method" :errorCallback];
285
+ - (void) stopRFIDReaderWithErrorMessage:(NSMutableString*)message :(Callback)successCallback :(Callback)errorCallback{
286
+ [RGLDocReader.shared stopRFIDReaderWithErrorMessage:message completion:^() {
287
+ [self result:@"" :successCallback];
288
+ }];
287
289
  }
288
290
 
289
291
  - (void) recognizeImageWithOpts:(NSString*)base64 :(NSDictionary*)opts :(Callback)successCallback :(Callback)errorCallback{
@@ -298,20 +300,12 @@ typedef void (^Callback)(NSString* response);
298
300
  [self result:@"showScannerWithCameraIDAndOpts() is an android-only method" :errorCallback];
299
301
  }
300
302
 
301
- - (void) recognizeImageWithImageInputParams:(NSString*)base64 :(NSDictionary*)params :(Callback)successCallback :(Callback)errorCallback{
302
- [self result:@"recognizeImageWithImageInputParams() is an android-only method" :errorCallback];
303
- }
304
-
305
303
  - (void) getLicenseMessage:(Callback)successCallback :(Callback)errorCallback{
306
304
  [self result:@"getLicenseMessage() is an android-only method" :successCallback];
307
305
  }
308
306
 
309
- - (void) initializeReaderWithDatabase:(NSString*)licenseString :(NSString*)databaseString :(Callback)successCallback :(Callback)errorCallback{
310
- [self result:@"initializeReaderWithDatabase() is an android-only method" :successCallback];
311
- }
312
-
313
- - (void) initializeReader:(NSString*)licenseString :(Callback)successCallback :(Callback)errorCallback{
314
- [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]];
315
309
  }
316
310
 
317
311
  - (void) parseCoreResults:(NSString*)json :(Callback)successCallback :(Callback)errorCallback{
@@ -358,6 +352,10 @@ typedef void (^Callback)(NSString* response);
358
352
  [self recognizeImageWith :base64 :false :successCallback :errorCallback];
359
353
  }
360
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
+
361
359
  - (void) recognizeImages:(NSArray*)input :(Callback)successCallback :(Callback)errorCallback{
362
360
  NSMutableArray<UIImage*>* images = [[NSMutableArray alloc] init];
363
361
  for(__strong NSMutableString* base64 in input)
@@ -367,6 +365,15 @@ typedef void (^Callback)(NSString* response);
367
365
  });
368
366
  }
369
367
 
368
+ - (void) recognizeImagesWithImageInputs:(NSArray*)input :(Callback)successCallback :(Callback)errorCallback{
369
+ NSMutableArray<RGLImageInput*>* images = [[NSMutableArray alloc] init];
370
+ for(__strong NSDictionary* image in input)
371
+ [images addObject:[RGLWJSONConstructor RGLImageInputFromJson: image]];
372
+ dispatch_async(dispatch_get_main_queue(), ^{
373
+ [RGLDocReader.shared recognizeImagesWithImageInputs:images completion:[self getCompletion]];
374
+ });
375
+ }
376
+
370
377
  - (void) recognizeImageWithCameraMode:(NSMutableString*)base64 :(BOOL)cameraMode :(Callback)successCallback :(Callback)errorCallback{
371
378
  [self recognizeImageWith :base64 :cameraMode :successCallback :errorCallback];
372
379
  }
@@ -12,6 +12,8 @@
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;
16
+ +(RGLImageInput* _Nonnull)RGLImageInputFromJson:(NSDictionary* _Nonnull)input;
15
17
  +(NSInteger)generateDocReaderAction:(RGLDocReaderAction)action;
16
18
  +(NSInteger)generateRFIDCompleteAction:(RGLRFIDCompleteAction)action;
17
19
  +(NSInteger)generateRFIDNotificationAction:(RGLRFIDNotificationAction)action;
@@ -35,6 +35,42 @@
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
+
60
+ +(RGLImageInput*)RGLImageInputFromJson:(NSDictionary*)input {
61
+ NSInteger pageIndex = 0;
62
+ if([input valueForKey:@"pageIndex"] != nil)
63
+ pageIndex = [[input valueForKey:@"pageIndex"] integerValue];
64
+ NSInteger light = 6;
65
+ if([input valueForKey:@"light"] != nil)
66
+ pageIndex = [[input valueForKey:@"light"] integerValue];
67
+ if([input valueForKey:@"bitmap"] != nil){
68
+ UIImage* image = [UIImage imageWithData:[[NSData alloc]initWithBase64EncodedString:[input valueForKey:@"bitmap"] options:NSDataBase64DecodingIgnoreUnknownCharacters]];
69
+ return [[RGLImageInput alloc] initWithImage:image light:light pageIndex:pageIndex];
70
+ }
71
+ return nil;
72
+ }
73
+
38
74
  +(NSMutableDictionary*)generateCGPoint:(CGPoint)input {
39
75
  NSMutableDictionary *result = [NSMutableDictionary new];
40
76
 
@@ -107,6 +143,9 @@
107
143
  case RGLDocReaderActionError:
108
144
  result = 3;
109
145
  break;
146
+ case RGLDocReaderActionProcessTimeout:
147
+ result = 10;
148
+ break;
110
149
  default:
111
150
  break;
112
151
  }
@@ -118,7 +157,7 @@
118
157
  NSInteger result = 0;
119
158
  switch (input) {
120
159
  case RGLRFIDCompleteActionComplete:
121
- result = 10;
160
+ result = 999;
122
161
  break;
123
162
  case RGLRFIDCompleteActionError:
124
163
  result = 3;
@@ -136,6 +175,29 @@
136
175
  return result;
137
176
  }
138
177
 
178
+ +(NSNumber*)generateRGLImageQualityCheckType:(RGLImageQualityCheckType)value {
179
+ if(value == RGLImageQualityCheckTypeImageGlares)
180
+ return @0;
181
+ else if(value == RGLImageQualityCheckTypeImageFocus)
182
+ return @1;
183
+ else if(value == RGLImageQualityCheckTypeImageResolution)
184
+ return @2;
185
+ else if(value == RGLImageQualityCheckTypeImageColorness)
186
+ return @3;
187
+ else if(value == RGLImageQualityCheckTypeImagePerspective)
188
+ return @4;
189
+ else if(value == RGLImageQualityCheckTypeImageBounds)
190
+ return @5;
191
+ else if(value == RGLImageQualityCheckTypeScreenCapture)
192
+ return @6;
193
+ else if(value == RGLImageQualityCheckTypePortrait)
194
+ return @7;
195
+ else if(value == RGLImageQualityCheckTypeHandwritten)
196
+ return @8;
197
+ else
198
+ return @0;
199
+ }
200
+
139
201
  +(NSInteger)generateRFIDNotificationAction:(RGLRFIDNotificationAction)input {
140
202
  return 5;
141
203
  }
@@ -155,6 +217,9 @@
155
217
  case 3:
156
218
  result[@"results"] = [self generateRGLDocumentReaderResults:results];
157
219
  break;
220
+ case 10:
221
+ result[@"results"] = [self generateRGLDocumentReaderResults:results];
222
+ break;
158
223
  case 5:
159
224
  result[@"results"] = [self generateResultsWithNotification:[self generateRGLRFIDNotify:notify]];
160
225
  break;
@@ -164,7 +229,7 @@
164
229
  case 8:
165
230
  result[@"results"] = [self generateRGLDocumentReaderResults:results];
166
231
  break;
167
- case 10:
232
+ case 999:
168
233
  result[@"results"] = [self generateResultsWithRFID :results :1];
169
234
  action = 1;
170
235
  break;
@@ -251,11 +316,9 @@
251
316
  [array addObject:[self generateRGLImageQualityGroup:item]];
252
317
  result[@"imageQuality"] = array;
253
318
  }
254
- result[@"overallResult"] = @(input.overallResult);
255
319
  result[@"authenticityResult"] = [self generateRGLDocumentReaderAuthenticityResult:input.authenticityResults];
256
320
  result[@"rfidSessionData"] = [self generateRGLRFIDSessionData:input.rfidSessionData];
257
321
  result[@"chipPage"] = @(input.chipPage);
258
- result[@"resolutionType"] = @(input.resolutionType);
259
322
  result[@"barcodeResult"] = [self generateRGLDocumentReaderBarcodeResult:input.barcodeResult];
260
323
  result[@"processingFinishedStatus"] = @(input.processingFinishedStatus);
261
324
  result[@"morePagesAvailable"] = @(input.morePagesAvailable);
@@ -400,7 +463,7 @@
400
463
  NSMutableDictionary *result = [NSMutableDictionary new];
401
464
  if(input == nil) return result;
402
465
 
403
- result[@"type"] = input.type;
466
+ result[@"type"] = [self generateRGLImageQualityCheckType:input.type];
404
467
  result[@"result"] = @(input.result);
405
468
  result[@"featureType"] = @(input.featureType);
406
469
  result[@"boundRects"] = [self generateNSArrayCGRect:input.boundRects];
@@ -571,7 +634,6 @@
571
634
  result[@"status"] = @(input.status);
572
635
  result[@"extLeSupport"] = @(input.extLeSupport);
573
636
  result[@"processTime"] = @(input.processTime);
574
- result[@"sessionDataStatus"] = [self generateRGLRFIDSessionDataStatus:input.sessionDataStatus];
575
637
 
576
638
  return result;
577
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];
@@ -550,6 +581,8 @@
550
581
  customization.hologramAnimationPositionMultiplier = [[options valueForKey:@"hologramAnimationPositionMultiplier"] floatValue];
551
582
  if([options valueForKey:@"hologramAnimationImage"] != nil)
552
583
  customization.hologramAnimationImage = [self imageFromBase64:[options valueForKey:@"hologramAnimationImage"]];
584
+ if([options valueForKey:@"uiCustomizationLayer"] != nil)
585
+ customization.customUILayerJSON = [options valueForKey:@"uiCustomizationLayer"];
553
586
  }
554
587
 
555
588
  +(void)setFunctionality:(NSDictionary*)options :(RGLFunctionality*)functionality {
@@ -588,10 +621,6 @@
588
621
  functionality.singleResult = [[options valueForKey:@"singleResult"] boolValue];
589
622
  if([options valueForKey:@"cameraPosition"] != nil)
590
623
  functionality.cameraPosition = [self AVCaptureDevicePositionWithNSInteger:[[options valueForKey:@"cameraPosition"] integerValue]];
591
- if([options valueForKey:@"onlineMode"] != nil)
592
- functionality.onlineMode = [[options valueForKey:@"onlineMode"] boolValue];
593
- if([options valueForKey:@"serviceURL"] != nil)
594
- functionality.serviceURL = [[options valueForKey:@"serviceURL"] stringValue];
595
624
  if([options valueForKey:@"btDeviceName"] != nil)
596
625
  functionality.btDeviceName = [[options valueForKey:@"btDeviceName"] stringValue];
597
626
  if([options valueForKey:@"useAuthenticator"] != nil)
@@ -612,6 +641,8 @@
612
641
  functionality.recordScanningProcess = [[options valueForKey:@"recordScanningProcess"] boolValue];
613
642
  if([options valueForKey:@"manualMultipageMode"] != nil)
614
643
  functionality.manualMultipageMode = [[options valueForKey:@"manualMultipageMode"] boolValue];
644
+ if([options valueForKey:@"onlineProcessingConfiguration"] != nil)
645
+ functionality.onlineProcessingConfig = [self RGLOnlineProcessingConfigFromJSON:[options valueForKey:@"onlineProcessingConfiguration"]];;
615
646
  }
616
647
 
617
648
  +(void)setProcessParams:(NSDictionary*)options :(RGLProcessParams*)processParams {
@@ -755,6 +786,7 @@
755
786
  result[@"toolbarSize"] = [NSNumber numberWithFloat:customization.toolbarSize];
756
787
  result[@"hologramAnimationImageContentMode"] = [NSNumber numberWithInteger:[self NSIntegerWithUIViewContentMode:customization.hologramAnimationImageContentMode]];
757
788
  result[@"hologramAnimationPositionMultiplier"] = [NSNumber numberWithFloat:customization.hologramAnimationPositionMultiplier];
789
+ result[@"uiCustomizationLayer"] = customization.customUILayerJSON;
758
790
  result[@"hologramAnimationImage"] = [UIImageJPEGRepresentation(customization.hologramAnimationImage, 1.0) base64EncodedStringWithOptions:0];
759
791
  if(customization.customLabelStatus != nil)
760
792
  result[@"customLabelStatus"] = customization.customLabelStatus.string;
@@ -794,8 +826,6 @@
794
826
  result[@"videoSessionPreset"] = [NSNumber numberWithInteger:[self NSIntegerWithAVCaptureSessionPreset:functionality.videoSessionPreset]];
795
827
  result[@"videoCaptureMotionControl"] = [NSNumber numberWithBool:functionality.videoCaptureMotionControl];
796
828
  result[@"orientation"] = [NSNumber numberWithInteger:[self NSIntegerWithUIInterfaceOrientationMask:functionality.orientation]];
797
- result[@"onlineMode"] = [NSNumber numberWithBool:functionality.onlineMode];
798
- result[@"serviceURL"] = functionality.serviceURL;
799
829
  result[@"cameraPosition"] = [NSNumber numberWithInteger:[self NSIntegerWithAVCaptureDevicePosition:functionality.cameraPosition]];
800
830
  result[@"btDeviceName"] = functionality.btDeviceName;
801
831
  result[@"useAuthenticator"] = [NSNumber numberWithBool:functionality.isUseAuthenticator];
@@ -966,6 +996,10 @@
966
996
  rfidScenario.authorizedInstallCert = [[options valueForKey:@"authorizedInstallCert"] boolValue];
967
997
  if([options valueForKey:@"authorizedInstallQCert"] != nil)
968
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];
969
1003
  }
970
1004
 
971
1005
  @end