Skip to content

Commit

Permalink
6.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins committed May 25, 2023
1 parent 28a6352 commit 27f8a21
Show file tree
Hide file tree
Showing 17 changed files with 394 additions and 183 deletions.
2 changes: 1 addition & 1 deletion RNDocumentReaderApi.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ Pod::Spec.new do |s|
s.source = { :http => 'file:' + __dir__ }
s.ios.deployment_target = '11.0'
s.source_files = "ios/*.{h,m}"
s.dependency 'DocumentReader', '6.7.2863'
s.dependency 'DocumentReader', '6.8.2981'
s.dependency 'React'
end
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+'
//noinspection GradleDependency
implementation('com.regula.documentreader:api:6.7.8311') {
implementation('com.regula.documentreader:api:6.8.8742') {
transitive = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ static JSONObject generateDocumentReaderGraphicField(DocumentReaderGraphicField
result.put("fieldType", input.fieldType);
result.put("lightType", input.light);
result.put("pageIndex", input.pageIndex);
result.put("originalPageIndex", input.originalPageIndex);
result.put("fieldName", eGraphicFieldType.getTranslation(context, input.fieldType));
result.put("lightName", eRPRM_Lights.getTranslation(context, input.light));
result.put("value", input.imageBase64());
Expand Down Expand Up @@ -575,6 +576,7 @@ static JSONObject generateDocumentReaderDocumentType(DocumentReaderDocumentType
result.put("dType", input.dType);
result.put("dFormat", input.dFormat);
result.put("dMRZ", input.dMRZ);
result.put("isDeprecated", input.isDeprecated);
result.put("name", input.name);
result.put("ICAOCode", input.ICAOCode);
result.put("dDescription", input.dDescription);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.nfc.NfcAdapter;
import android.nfc.tech.IsoDep;
Expand Down Expand Up @@ -55,6 +57,7 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import static com.regula.documentreader.api.DocumentReader.Instance;

Expand All @@ -75,6 +78,8 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
private final static String bleOnServiceDisconnectedEvent = "bleOnServiceDisconnectedEvent";
private final static String bleOnDeviceReadyEvent = "bleOnDeviceReadyEvent";

private final static String onCustomButtonTappedEvent = "onCustomButtonTappedEvent";

private static int databaseDownloadProgress = 0;
JSONArray data;
private final ReactContext reactContext;
Expand Down Expand Up @@ -191,6 +196,10 @@ private void sendBleOnDeviceReadyEvent() {
send(reactContext, bleOnDeviceReadyEvent, "");
}

private void sendOnCustomButtonTappedEvent(int tag) {
send(reactContext, onCustomButtonTappedEvent, tag + "");
}

private interface Callback {
void success(Object o);

Expand Down Expand Up @@ -427,6 +436,12 @@ public void error(String s) {
case "recognizeImagesWithImageInputs":
recognizeImagesWithImageInputs(callback, args(0));
break;
case "setOnCustomButtonTappedListener":
setOnCustomButtonTappedListener(callback);
break;
case "setLanguage":
setLanguage(callback, args(0));
break;
case "textFieldValueByType":
textFieldValueByType(callback, args(0), args(1));
break;
Expand Down Expand Up @@ -821,6 +836,21 @@ private void readRFID(@SuppressWarnings("unused") Callback callback) {
startForegroundDispatch(getActivity());
}

private void setOnCustomButtonTappedListener(Callback callback) {
Instance().setOnClickListener(view -> sendOnCustomButtonTappedEvent((int) view.getTag()));
callback.success();
}

private void setLanguage(Callback callback, String language) {
Locale locale = new Locale(language);
Locale.setDefault(locale);
Resources resources = getContext().getResources();
Configuration config = resources.getConfiguration();
config.setLocale(locale);
resources.updateConfiguration(config, resources.getDisplayMetrics());
callback.success();
}

private void providePACertificates(Callback callback, JSONArray certificatesJSON) throws JSONException {
if (paCertificateCompletion == null) {
callback.error("paCertificateCompletion is null");
Expand Down
26 changes: 26 additions & 0 deletions android/src/main/java/com/regula/documentreader/RegulaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.regula.documentreader.api.params.ParamsCustomization;
import com.regula.documentreader.api.params.Functionality;
import com.regula.documentreader.api.params.ProcessParam;
import com.regula.documentreader.api.params.rfid.RFIDParams;
import com.regula.documentreader.api.params.rfid.ReprocParams;
import com.regula.documentreader.api.params.rfid.dg.DataGroups;

Expand Down Expand Up @@ -229,6 +230,10 @@ private static void setProcessParams(ProcessParam processParams, JSONObject opts
processParams.splitNames = opts.getBoolean("splitNames");
if (opts.has("convertCase"))
processParams.convertCase = opts.getInt("convertCase");
if (opts.has("doFlipYAxis"))
processParams.doFlipYAxis = opts.getBoolean("doFlipYAxis");
if (opts.has("rfidParams"))
processParams.rfidParams = RFIDParamsFromJSON(opts.getJSONObject("rfidParams"));
}

private static void setCustomization(ParamsCustomization customization, JSONObject opts, Context context) throws JSONException {
Expand All @@ -251,6 +256,8 @@ private static void setCustomization(ParamsCustomization customization, JSONObje
editor.setMultipageButtonBackgroundColor(opts.getString("multipageButtonBackgroundColor"));
if (opts.has("tintColor"))
editor.setTintColor(opts.getString("tintColor"));
if (opts.has("cameraPreviewBackgroundColor"))
editor.setCameraPreviewBackgroundColor(opts.getString("cameraPreviewBackgroundColor"));
if (opts.has("activityIndicatorColor"))
editor.setActivityIndicatorColor(opts.getString("activityIndicatorColor"));
if (opts.has("showStatusMessages"))
Expand Down Expand Up @@ -351,6 +358,8 @@ private static void setCustomization(ParamsCustomization customization, JSONObje
editor.setHologramAnimationImageScaleType(ScaleType.valueOf(opts.getString("hologramAnimationImageScaleType")));
if (opts.has("uiCustomizationLayer"))
editor.setUiCustomizationLayer(opts.getJSONObject("uiCustomizationLayer"));
if (opts.has("activityIndicatorSize"))
editor.setActivityIndicatorSize(opts.getInt("activityIndicatorSize"));

editor.applyImmediately(context);
}
Expand Down Expand Up @@ -400,6 +409,7 @@ private static JSONObject getCustomization(ParamsCustomization customization) th
object.put("resultStatus", customization.getResultStatus());
object.put("cameraFrameDefaultColor", customization.getCameraFrameDefaultColor());
object.put("cameraFrameActiveColor", customization.getCameraFrameActiveColor());
object.put("cameraPreviewBackgroundColor", customization.getCameraPreviewBackgroundColor());
object.put("statusTextColor", customization.getStatusTextColor());
object.put("resultStatusTextColor", customization.getResultStatusTextColor());
object.put("resultStatusBackgroundColor", customization.getResultStatusBackgroundColor());
Expand Down Expand Up @@ -455,6 +465,7 @@ private static JSONObject getCustomization(ParamsCustomization customization) th
object.put("hologramAnimationImageMatrix", customization.getHologramAnimationImageMatrix());
object.put("hologramAnimationImageScaleType", customization.getHologramAnimationImageScaleType());
object.put("uiCustomizationLayer", customization.getUiCustomizationLayer());
object.put("activityIndicatorSize", customization.getActivityIndicatorSize());

return object;
}
Expand Down Expand Up @@ -519,6 +530,7 @@ private static JSONObject getProcessParams(ProcessParam processParams) throws JS
object.put("respectImageQuality", processParams.respectImageQuality);
object.put("splitNames", processParams.splitNames);
object.put("convertCase", processParams.convertCase);
object.put("doFlipYAxis", processParams.doFlipYAxis);

return object;
}
Expand Down Expand Up @@ -713,4 +725,18 @@ private static OnlineProcessingConfig OnlineProcessingConfigFromJSON(JSONObject
}
return null;
}

private static RFIDParams RFIDParamsFromJSON(JSONObject input) {
try {
RFIDParams result = new RFIDParams();

if (input.has("paIgnoreNotificationCodes"))
result.setPaIgnoreNotificationCodes(JSONConstructor.intArrayFromJSON(input.getJSONArray("paIgnoreNotificationCodes")));

return result;
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
}
1 change: 1 addition & 0 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default class App extends Component {
eventManager.addListener('completionEvent', e => this.handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(e["msg"]))))
eventManager.addListener('rfidNotificationCompletionEvent', e => console.log("rfidNotificationCompletionEvent: " + e["msg"]))
eventManager.addListener('paCertificateCompletionEvent', e => console.log("paCertificateCompletionEvent: " + e["msg"]))
eventManager.addListener('onCustomButtonTappedEvent', e => console.log("onCustomButtonTappedEvent: " + e["msg"]))
DocumentReader.prepareDatabase("Full", (respond) => {
console.log(respond)
readFile(licPath, 'base64').then((res) => {
Expand Down
4 changes: 2 additions & 2 deletions example/ios/DocumentReader.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = com.regula.dr.fullrfid;
PRODUCT_BUNDLE_IDENTIFIER = regula.DocumentReader;
PRODUCT_NAME = DocumentReader;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -528,7 +528,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = com.regula.dr.fullrfid;
PRODUCT_BUNDLE_IDENTIFIER = regula.DocumentReader;
PRODUCT_NAME = DocumentReader;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down
4 changes: 2 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"lint": "eslint ."
},
"dependencies": {
"@regulaforensics/react-native-document-reader-api": "6.7.4",
"@regulaforensics/react-native-document-reader-core-fullrfid": "6.7.0",
"@regulaforensics/react-native-document-reader-api": "6.8.0",
"@regulaforensics/react-native-document-reader-core-fullrfid": "6.8.0",
"react": "17.0.2",
"react-native": "^0.67.0",
"react-native-check-box": "^2.1.7",
Expand Down
49 changes: 45 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export class DocumentReaderGraphicField {
fieldType?: number
lightType?: number
pageIndex?: number
originalPageIndex?: number
fieldName?: string
lightName?: string
value?: string
Expand All @@ -147,6 +148,7 @@ export class DocumentReaderGraphicField {
result.fieldType = jsonObject["fieldType"]
result.lightType = jsonObject["lightType"]
result.pageIndex = jsonObject["pageIndex"]
result.originalPageIndex = jsonObject["originalPageIndex"]
result.fieldName = jsonObject["fieldName"]
result.lightName = jsonObject["lightName"]
result.value = jsonObject["value"]
Expand Down Expand Up @@ -417,6 +419,7 @@ export class DocumentReaderDocumentType {
dType?: number
dFormat?: number
dMRZ?: boolean
isDeprecated?: boolean
name?: string
ICAOCode?: string
dDescription?: string
Expand All @@ -433,6 +436,7 @@ export class DocumentReaderDocumentType {
result.dType = jsonObject["dType"]
result.dFormat = jsonObject["dFormat"]
result.dMRZ = jsonObject["dMRZ"]
result.isDeprecated = jsonObject["isDeprecated"]
result.name = jsonObject["name"]
result.ICAOCode = jsonObject["ICAOCode"]
result.dDescription = jsonObject["dDescription"]
Expand Down Expand Up @@ -1143,6 +1147,8 @@ export class ImageInputParam {
width?: number
height?: number
type?: number
disableFrameShiftIR?: boolean
doFlipYAxis?: boolean

static fromJson(jsonObject?: any): ImageInputParam | undefined {
if (jsonObject == null || jsonObject == undefined) return undefined
Expand All @@ -1151,6 +1157,8 @@ export class ImageInputParam {
result.width = jsonObject["width"]
result.height = jsonObject["height"]
result.type = jsonObject["type"]
result.disableFrameShiftIR = jsonObject["disableFrameShiftIR"]
result.doFlipYAxis = jsonObject["doFlipYAxis"]

return result
}
Expand Down Expand Up @@ -1813,6 +1821,11 @@ export const eRPRM_Authenticity = {
KINEGRAM: 131072,
HOLOGRAMS_DETECTION: 524288,
MRZ: 8388608,
STATUS_ONLY: 0x80000000,
OVI: 0x00000400,
LIVENESS: 0x00200000,
OCR: 0x00400000,
UV: 1 | 4 | 16,
}

export const eRFID_ErrorCodes = {
Expand Down Expand Up @@ -2734,6 +2747,7 @@ export const ScenarioIdentifier = {
SCENARIO_OCR_FREE: "OcrFree",
SCENARIO_CREDIT_CARD: "CreditCard",
SCENARIO_CAPTURE: "Capture",
SCENARIO_BARCODE_AND_LOCATE: "BarcodeAndLocate",
}

export const eRFID_AccessControl_ProcedureType = {
Expand Down Expand Up @@ -2936,9 +2950,18 @@ export const eCheckDiagnose = {
FINISHED_BY_TIMEOUT: 186,
HOLO_PHOTO_DOCUMENT_OUTSIDE_FRAME: 187,
LIVENESS_DEPTH_CHECK_FAILED: 190,
MRZ_QUALITY_WRONG_MRZ_DPI: 200,
MRZ_QUALITY_WRONG_SYMBOL_POSITION: 200,
MRZ_QUALITY_WRONG_BACKGROUND: 201,
LAST_DIAGNOSE_VALUE: 210,
MRZ_QUALITY_WRONG_MRZ_WIDTH: 202,
MRZ_QUALITY_WRONG_MRZ_HEIGHT: 203,
MRZ_QUALITY_WRONG_LINE_POSITION: 204,
MRZ_QUALITY_WRONG_FONT_TYPE: 205,
OCR_QUALITY_TEXT_POSITION: 220,
OCR_QUALITY_INVALID_FONT: 221,
OCR_QUALITY_INVALID_BACKGROUND: 222,
LAS_INK_INVALID_LINES_FREQUENCY: 230,
LAST_DIAGNOSE_VALUE: 250,
DOC_LIVENESS_ELECTRONIC_DEVICE_DETECTED: 240,
}

export const RFIDDelegate = {
Expand Down Expand Up @@ -3712,7 +3735,7 @@ export const BarcodeType = {
}

export const eRPRM_SecurityFeatureType = {
NONE: -1,
SECURITY_FEATURE_TYPE_NONE: -1,
SECURITY_FEATURE_TYPE_BLANK: 0,
SECURITY_FEATURE_TYPE_FILL: 1,
SECURITY_FEATURE_TYPE_PHOTO: 2,
Expand Down Expand Up @@ -3741,7 +3764,22 @@ export const eRPRM_SecurityFeatureType = {
SECURITY_FEATURE_TYPE_PHOTO_COLOR: 25,
SECURITY_FEATURE_TYPE_PHOTO_SHAPE: 26,
SECURITY_FEATURE_TYPE_PHOTO_CORNERS: 27,
DOCUMENT_CANCELLING_DETECTOR: 28,
SECURITY_FEATURE_TYPE_OCR: 28,
SECURITY_FEATURE_TYPE_PORTRAIT_COMPARISON_EXTVS_VISUAL: 29,
SECURITY_FEATURE_TYPE_PORTRAIT_COMPARISON_EXTVS_RFID: 30,
SECURITY_FEATURE_TYPE_PORTRAIT_COMPARISON_EXTVS_LIVE: 31,
SECURITY_FEATURE_TYPE_LIVENESS_DEPTH: 32,
SECURITY_FEATURE_TYPE_MICROTEXT: 33,
SECURITY_FEATURE_TYPE_FLUORESCENT_OBJECT: 34,
SECURITY_FEATURE_TYPE_LANDMARKS_CHECK: 35,
SECURITY_FEATURE_TYPE_FACE_PRESENCE: 36,
SECURITY_FEATURE_TYPE_FACE_ABSENCE: 38,
SECURITY_FEATURE_TYPE_LIVENESS_SCREEN_CAPTURE: 39,
SECURITY_FEATURE_TYPE_LIVENESS_ELECTRONIC_DEVICE: 40,
SECURITY_FEATURE_TYPE_LIVENESS_OVI: 41,
SECURITY_FEATURE_TYPE_BARCODE_SIZE_CHECK: 42,
SECURITY_FEATURE_TYPE_LAS_INK: 43,
SECURITY_FEATURE_TYPE_LIVENESS_MLI: 44,
}

export const OnlineMode = {
Expand Down Expand Up @@ -6697,6 +6735,7 @@ export const eRPRM_Lights = {
RPRM_Light_IR_SIDE: 16,
RPRM_Light_IR_Full: (8 | 16),
RPRM_LIGHT_OVD: 67108864,
RPRM_LIGHT_WHITE_FULL_OVD: (6 | 67108864),

getTranslation(value: number) {
switch (value) {
Expand Down Expand Up @@ -6893,4 +6932,6 @@ export default class DocumentReader {
static showScannerWithCameraIDAndOpts(cameraID: number, options: object, successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
static recognizeImageWithCameraMode(image: string, mode: boolean, successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
static recognizeImagesWithImageInputs(images: ImageInputData[], successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
static setOnCustomButtonTappedListener(successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
static setLanguage(language: string, successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
}
Loading

0 comments on commit 27f8a21

Please sign in to comment.