Skip to content

Commit 274017e

Browse files
author
Jenkins
committed
6.4.0
1 parent 4e548b1 commit 274017e

16 files changed

Lines changed: 385 additions & 100 deletions
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve
4+
title: "[BR] "
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Before Submitting, be sure to**
11+
- [ ] Update to the latest stable version.
12+
- [ ] Read and follow the guides described in the [documentation](https://docs.regulaforensics.com?utm_source=github).
13+
- [ ] Try to reproduce in our demo project.
14+
- [ ] Search for your issue in the existing GitHub issues.
15+
16+
**Bug Description**
17+
<!--A clear and concise description of what the bug is.-->
18+
19+
**Steps To Reproduce**
20+
<!--
21+
1. Go to '...'
22+
2. Click on '....'
23+
3. Scroll down to '....'
24+
4. See error
25+
-->
26+
27+
**Expected behavior**
28+
<!--A clear and concise description of what you expected to happen.-->
29+
30+
**Screenshots**
31+
<!--If applicable, add screenshots to help explain your issue.-->
32+
33+
**Environment:**
34+
- Device: <!--[e.g. iPhone 12]-->
35+
- OS: <!--[e.g. iOS]-->
36+
- OS version: <!--[e.g. 10.0]-->
37+
38+
**Additional context**
39+
<!--Add any other context about the problem here.-->

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Regula Help Center
4+
url: https://support.regulaforensics.com/hc/requests/new?utm_source=github
5+
about: Please submit any requests here
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for this product
4+
title: "[FR] "
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
<!--A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]-->
12+
13+
**Describe the solution you'd like**
14+
<!--A clear and concise description of what you want to happen.-->
15+
16+
**Describe alternatives you've considered**
17+
<!--A clear and concise description of any alternative solutions or features you've considered.-->
18+
19+
**Additional context**
20+
<!--Add any other context or screenshots about the feature request here.-->

RNDocumentReaderApi.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ Pod::Spec.new do |s|
1414
s.source = { :http => 'file:' + __dir__ }
1515
s.ios.deployment_target = '11.0'
1616
s.source_files = "ios/*.{h,m}"
17-
s.dependency 'DocumentReader', '6.3.2494'
17+
s.dependency 'DocumentReader', '6.4.2552'
1818
s.dependency 'React'
1919
end

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ dependencies {
4949
//noinspection GradleDynamicVersion
5050
implementation 'com.facebook.react:react-native:+'
5151
//noinspection GradleDependency
52-
implementation('com.regula.documentreader:api:6.3.6946') {
52+
implementation('com.regula.documentreader:api:6.4.7224') {
5353
transitive = true
5454
}
5555
}

android/src/main/java/com/regula/documentreader/JSONConstructor.java

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.regula.documentreader.api.errors.DocumentReaderException;
1717
import com.regula.documentreader.api.internal.core.CoreDetailedScenario;
1818
import com.regula.documentreader.api.params.FaceMetaData;
19+
import com.regula.documentreader.api.params.ImageInputData;
1920
import com.regula.documentreader.api.params.rfid.TccParams;
2021
import com.regula.documentreader.api.params.rfid.authorization.PAAttribute;
2122
import com.regula.documentreader.api.params.rfid.authorization.PAResourcesIssuer;
@@ -360,6 +361,42 @@ static TccParams TCCParamsFromJSON(JSONObject input) {
360361
return result;
361362
}
362363

364+
static ImageInputData ImageInputDataFromJSON(JSONObject input) {
365+
ImageInputData result = new ImageInputData(null);
366+
int pageIndex = 0;
367+
int light = 6;
368+
int type = 254;
369+
int width = 0;
370+
int height = 0;
371+
Bitmap bitmap;
372+
byte[] imgBytes;
373+
374+
try {
375+
if(input.has("pageIndex"))
376+
pageIndex = input.optInt("pageIndex");
377+
if(input.has("light"))
378+
pageIndex = input.optInt("light");
379+
if(input.has("type"))
380+
pageIndex = input.optInt("type");
381+
if (input.has("bitmap")) {
382+
bitmap = Helpers.bitmapFromBase64(input.getString("bitmap"));
383+
result = new ImageInputData(bitmap, light, pageIndex);
384+
}
385+
if (input.has("imgBytes")) {
386+
JSONArray jsonArray_data = input.getJSONArray("data");
387+
byte[] data = new byte[jsonArray_data.length()];
388+
for (int i = 0; i < jsonArray_data.length(); i++)
389+
data[i] = (byte) jsonArray_data.get(i);
390+
imgBytes = data;
391+
result = new ImageInputData(imgBytes, width, height, light, pageIndex);
392+
}
393+
} catch (JSONException e) {
394+
e.printStackTrace();
395+
}
396+
397+
return result;
398+
}
399+
363400
static Throwable ThrowableFromJSON(JSONObject jsonObject) {
364401
return new Throwable();
365402
}
@@ -1184,6 +1221,23 @@ static JSONObject generateDocumentReaderUvFiberElement(DocumentReaderUvFiberElem
11841221
return result;
11851222
}
11861223

1224+
static JSONObject generateImageInputData(ImageInputData input) {
1225+
JSONObject result = new JSONObject();
1226+
if (input == null) return result;
1227+
try {
1228+
result.put("pageIndex", input.getPageIndex());
1229+
result.put("light", input.getLight());
1230+
result.put("type", input.getType());
1231+
result.put("width", input.getWidth());
1232+
result.put("height", input.getHeight());
1233+
result.put("bitmap", generateBitmap(input.getBitmap()));
1234+
result.put("imgBytes", generateByteArray(input.getImgBytes()));
1235+
} catch (JSONException e) {
1236+
e.printStackTrace();
1237+
}
1238+
return result;
1239+
}
1240+
11871241
static JSONObject generateDocumentReaderResults(DocumentReaderResults input, Context context) {
11881242
JSONObject result = new JSONObject();
11891243
if (input == null) return result;

android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import com.regula.documentreader.api.errors.DocumentReaderException;
3434
import com.regula.documentreader.api.internal.core.CoreScenarioUtil;
3535
import com.regula.documentreader.api.params.DocReaderConfig;
36+
import com.regula.documentreader.api.params.ImageInputData;
3637
import com.regula.documentreader.api.params.ImageInputParam;
3738
import com.regula.documentreader.api.params.rfid.PKDCertificate;
3839
import com.regula.documentreader.api.params.rfid.authorization.PAResourcesIssuer;
@@ -253,6 +254,9 @@ public void error(String s) {
253254
case "stopRFIDReader":
254255
stopRFIDReader(callback);
255256
break;
257+
case "stopRFIDReaderWithErrorMessage":
258+
stopRFIDReaderWithErrorMessage(callback, args(0));
259+
break;
256260
case "stopScanner":
257261
stopScanner(callback);
258262
break;
@@ -358,9 +362,6 @@ public void error(String s) {
358362
case "initializeReaderWithDatabase":
359363
initializeReaderWithDatabase(callback, args(0), args(1));
360364
break;
361-
case "recognizeImageFrame":
362-
recognizeImageFrame(callback, args(0), args(1));
363-
break;
364365
case "recognizeImageWithOpts":
365366
recognizeImageWithOpts(callback, args(0), args(1));
366367
break;
@@ -370,12 +371,12 @@ public void error(String s) {
370371
case "showScannerWithCameraIDAndOpts":
371372
showScannerWithCameraIDAndOpts(callback, args(0), args(1));
372373
break;
373-
case "recognizeImageWithImageInputParams":
374-
recognizeImageWithImageInputParams(callback, args(0), args(1));
375-
break;
376374
case "recognizeImageWithCameraMode":
377375
recognizeImageWithCameraMode(callback, args(0), args(1));
378376
break;
377+
case "recognizeImagesWithImageInputs":
378+
recognizeImagesWithImageInputs(callback, args(0));
379+
break;
379380
}
380381
} catch (Exception ignored) {
381382
}
@@ -548,10 +549,6 @@ private void startNewPage(Callback callback) {
548549
callback.success();
549550
}
550551

551-
private void recognizeImageWithImageInputParams(@SuppressWarnings("unused") Callback callback, String base64Image, final JSONObject params) throws JSONException {
552-
Instance().recognizeImage(Helpers.bitmapFromBase64(base64Image), new ImageInputParam(params.getInt("width"), params.getInt("height"), params.getInt("type")), getCompletion());
553-
}
554-
555552
private void recognizeImageWithOpts(Callback callback, String base64Image, final JSONObject opts) throws JSONException {
556553
RegulaConfig.setConfig(Instance(), opts, getContext());
557554
recognizeImage(callback, base64Image);
@@ -570,6 +567,14 @@ private void recognizeImages(@SuppressWarnings("unused") Callback callback, JSON
570567
Instance().recognizeImages(images, getCompletion());
571568
}
572569

570+
private void recognizeImagesWithImageInputs(@SuppressWarnings("unused") Callback callback, JSONArray base64Images) throws JSONException {
571+
stopBackgroundRFID();
572+
ImageInputData[] images = new ImageInputData[base64Images.length()];
573+
for (int i = 0; i < images.length; i++)
574+
images[i] = JSONConstructor.ImageInputDataFromJSON(base64Images.getJSONObject(i));
575+
Instance().recognizeImages(images, getCompletion());
576+
}
577+
573578
private void removeDatabase(Callback callback) {
574579
callback.success(Instance().removeDatabase(getContext()));
575580
}
@@ -603,10 +608,6 @@ private void clearPKDCertificates(Callback callback) {
603608
callback.success();
604609
}
605610

606-
private void recognizeImageFrame(@SuppressWarnings("unused") Callback callback, String base64Image, final JSONObject opts) throws JSONException {
607-
Instance().recognizeImageFrame(Helpers.bitmapFromBase64(base64Image), new ImageInputParam(opts.getInt("width"), opts.getInt("height"), opts.getInt("type")), getCompletion());
608-
}
609-
610611
private void recognizeVideoFrame(@SuppressWarnings("unused") Callback callback, String byteString, final JSONObject opts) throws JSONException {
611612
stopBackgroundRFID();
612613
Instance().recognizeVideoFrame(byteString.getBytes(), new ImageInputParam(opts.getInt("width"), opts.getInt("height"), opts.getInt("type")), getCompletion());
@@ -725,6 +726,10 @@ private void getCameraSessionIsPaused(Callback callback) {
725726
callback.error("getCameraSessionIsPaused() is an ios-only method");
726727
}
727728

729+
private void stopRFIDReaderWithErrorMessage(Callback callback, String message) {
730+
callback.error("stopRFIDReaderWithErrorMessage() is an ios-only method");
731+
}
732+
728733
@SuppressWarnings("unused")
729734
private void recognizeImageWithCameraMode(Callback callback, String base64, boolean mode) {
730735
callback.error("recognizeImageWithCameraMode() is an ios-only method");

android/src/main/java/com/regula/documentreader/RegulaConfig.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ private static void setFunctionality(Functionality functionality, JSONObject opt
103103
editor.setManualMultipageMode(opts.getBoolean("manualMultipageMode"));
104104
if (opts.has("exposure"))
105105
editor.setExposure(BigDecimal.valueOf(opts.getDouble("exposure")).floatValue());
106+
if (opts.has("rfidTimeout"))
107+
editor.setRfidTimeout(opts.getInt("rfidTimeout"));
106108

107109
editor.apply();
108110
}
@@ -331,6 +333,8 @@ private static void setCustomization(ParamsCustomization customization, JSONObje
331333
editor.setHologramAnimationImageMatrix(matrixFromFloatArray(floatArrayFromJson(opts.getJSONArray("hologramAnimationImageMatrix"))));
332334
if (opts.has("hologramAnimationImageScaleType"))
333335
editor.setHologramAnimationImageScaleType(ScaleType.valueOf(opts.getString("hologramAnimationImageScaleType")));
336+
if (opts.has("uiCustomizationLayer"))
337+
editor.setUiCustomizationLayer(opts.getJSONObject("uiCustomizationLayer"));
334338

335339
editor.applyImmediately(context);
336340
}
@@ -371,6 +375,7 @@ private static JSONObject getFunctionality(Functionality functionality) throws J
371375
object.put("recordScanningProcess", functionality.doRecordProcessingVideo());
372376
object.put("manualMultipageMode", functionality.isManualMultipageMode());
373377
object.put("exposure", functionality.getExposure());
378+
object.put("rfidTimeout", functionality.getRfidTimeout());
374379

375380
return object;
376381
}
@@ -435,6 +440,7 @@ private static JSONObject getCustomization(ParamsCustomization customization) th
435440
object.put("hologramAnimationPositionMultiplier", customization.getHologramAnimationPositionMultiplier());
436441
object.put("hologramAnimationImageMatrix", customization.getHologramAnimationImageMatrix());
437442
object.put("hologramAnimationImageScaleType", customization.getHologramAnimationImageScaleType());
443+
object.put("uiCustomizationLayer", customization.getUiCustomizationLayer());
438444

439445
return object;
440446
}

example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"lint": "eslint ."
1111
},
1212
"dependencies": {
13-
"@regulaforensics/react-native-document-reader-api": "^6.3.1",
14-
"@regulaforensics/react-native-document-reader-core-fullrfid": "^6.3.0",
13+
"@regulaforensics/react-native-document-reader-api": "^6.4.0",
14+
"@regulaforensics/react-native-document-reader-core-fullrfid": "^6.4.0",
1515
"react": "17.0.2",
1616
"react-native": "^0.67.0",
1717
"react-native-check-box": "^2.1.7",

0 commit comments

Comments
 (0)