Skip to content

Commit

Permalink
6.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins committed Aug 18, 2022
1 parent 274017e commit dc7a708
Show file tree
Hide file tree
Showing 17 changed files with 6,997 additions and 6,732 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.4.2552'
s.dependency 'DocumentReader', '6.5.2633'
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 @@ -49,7 +49,7 @@ dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+'
//noinspection GradleDependency
implementation('com.regula.documentreader:api:6.4.7224') {
implementation('com.regula.documentreader:api:6.5.7488') {
transitive = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import android.util.Base64;

import com.regula.documentreader.api.enums.BarcodeType;
import com.regula.documentreader.api.params.FaceMetaData;
import com.regula.documentreader.api.internal.params.FaceMetaData;
import com.regula.documentreader.api.results.Bounds;

import org.json.JSONArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import com.regula.documentreader.api.enums.eRPRM_Lights;
import com.regula.documentreader.api.errors.DocumentReaderException;
import com.regula.documentreader.api.internal.core.CoreDetailedScenario;
import com.regula.documentreader.api.params.FaceMetaData;
import com.regula.documentreader.api.params.DocReaderConfig;
import com.regula.documentreader.api.internal.params.FaceMetaData;
import com.regula.documentreader.api.params.ImageInputData;
import com.regula.documentreader.api.params.rfid.TccParams;
import com.regula.documentreader.api.params.rfid.authorization.PAAttribute;
Expand Down Expand Up @@ -56,7 +57,6 @@
import com.regula.documentreader.api.results.rfid.File;
import com.regula.documentreader.api.results.rfid.FileData;
import com.regula.documentreader.api.results.rfid.RFIDSessionData;
import com.regula.documentreader.api.results.rfid.RFIDSessionDataStatus;
import com.regula.documentreader.api.results.rfid.SecurityObject;
import com.regula.documentreader.api.results.rfid.SecurityObjectCertificates;
import com.regula.documentreader.api.results.rfid.SignerInfo;
Expand Down Expand Up @@ -361,6 +361,28 @@ static TccParams TCCParamsFromJSON(JSONObject input) {
return result;
}

static DocReaderConfig DocReaderConfigFromJSON(JSONObject input) {
DocReaderConfig result = new DocReaderConfig(null);
byte[] license;
try {
if (input.has("license")) {
license = Base64.decode(input.getString("license"), Base64.DEFAULT);
result = new DocReaderConfig(license);
} else return result;
if (input.has("customDb"))
result = new DocReaderConfig(license, Base64.decode(input.getString("customDb"), Base64.DEFAULT));
if (input.has("licenseUpdate"))
result.setLicenseUpdate(input.getBoolean("licenseUpdate"));
if (input.has("delayedNNLoad"))
result.setDelayedNNLoad(input.getBoolean("delayedNNLoad"));
if (input.has("blackList"))
result.setBlackList(input.getJSONObject("blackList"));
} catch (JSONException e) {
e.printStackTrace();
}
return result;
}

static ImageInputData ImageInputDataFromJSON(JSONObject input) {
ImageInputData result = new ImageInputData(null);
int pageIndex = 0;
Expand Down Expand Up @@ -920,7 +942,6 @@ static JSONObject generateRFIDSessionData(RFIDSessionData input) {
result.put("extLeSupport", input.extLeSupport);
result.put("processTime", input.processTime);
result.put("cardProperties", generateCardProperties(input.cardProperties));
result.put("sessionDataStatus", generateRFIDSessionDataStatus(input.sessionDataStatus));
result.put("accessControls", generateList(input.accessControls, JSONConstructor::generateAccessControlProcedureType));
result.put("applications", generateList(input.applications, JSONConstructor::generateApplication));
result.put("securityObjects", generateList(input.securityObjects, JSONConstructor::generateSecurityObject));
Expand Down Expand Up @@ -958,23 +979,6 @@ static JSONObject generatePDF417Info(PDF417Info input) {
return result;
}

static JSONObject generateRFIDSessionDataStatus(RFIDSessionDataStatus input) {
JSONObject result = new JSONObject();
if (input == null) return result;
try {
result.put("AA", input.AA);
result.put("BAC", input.BAC);
result.put("CA", input.CA);
result.put("PA", input.PA);
result.put("PACE", input.PACE);
result.put("TA", input.TA);
result.put("overallStatus", input.overallStatus);
} catch (JSONException e) {
e.printStackTrace();
}
return result;
}

static JSONObject generateDocumentReaderBarcodeResult(DocumentReaderBarcodeResult input) {
JSONObject result = new JSONObject();
if (input == null) return result;
Expand Down Expand Up @@ -1243,7 +1247,6 @@ static JSONObject generateDocumentReaderResults(DocumentReaderResults input, Con
if (input == null) return result;
try {
result.put("chipPage", input.chipPage);
result.put("overallResult", input.getOverallResult());
result.put("processingFinishedStatus", input.processingFinishedStatus);
result.put("elapsedTime", input.elapsedTime);
result.put("elapsedTimeRFID", input.elapsedTimeRFID);
Expand Down Expand Up @@ -2038,8 +2041,6 @@ static RFIDSessionData RFIDSessionDataFromJSON(JSONObject input) {
result.processTime = input.getInt("processTime");
if (input.has("cardProperties"))
result.cardProperties = CardPropertiesFromJSON(input.getJSONObject("cardProperties"));
if (input.has("sessionDataStatus"))
result.sessionDataStatus = RFIDSessionDataStatusFromJSON(input.getJSONObject("sessionDataStatus"));
if (input.has("accessControls")){
JSONArray jsonArray_accessControls = input.getJSONArray("accessControls");
List<AccessControlProcedureType> accessControls = new ArrayList<>();
Expand Down Expand Up @@ -2105,30 +2106,6 @@ static PDF417Info PDF417InfoFromJSON(JSONObject input) {
return null;
}

static RFIDSessionDataStatus RFIDSessionDataStatusFromJSON(JSONObject input) {
try {
RFIDSessionDataStatus result = new RFIDSessionDataStatus();
if (input.has("AA"))
result.AA = input.getInt("AA");
if (input.has("BAC"))
result.BAC = input.getInt("BAC");
if (input.has("CA"))
result.CA = input.getInt("CA");
if (input.has("PA"))
result.PA = input.getInt("PA");
if (input.has("PACE"))
result.PACE = input.getInt("PACE");
if (input.has("TA"))
result.TA = input.getInt("TA");
if (input.has("overallStatus"))
result.overallStatus = input.getInt("overallStatus");
return result;
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}

static DocumentReaderBarcodeResult DocumentReaderBarcodeResultFromJSON(JSONObject input) {
try {
DocumentReaderBarcodeResult result = new DocumentReaderBarcodeResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
import com.regula.documentreader.api.internal.core.CoreScenarioUtil;
import com.regula.documentreader.api.params.DocReaderConfig;
import com.regula.documentreader.api.params.ImageInputData;
import com.regula.documentreader.api.params.ImageInputParam;
import com.regula.documentreader.api.internal.params.ImageInputParam;
import com.regula.documentreader.api.params.rfid.PKDCertificate;
import com.regula.documentreader.api.params.rfid.authorization.PAResourcesIssuer;
import com.regula.documentreader.api.params.rfid.authorization.TAChallenge;
import com.regula.documentreader.api.results.DocumentReaderResults;
import com.regula.documentreader.api.parser.DocReaderResultsJsonParser;
import com.regula.documentreader.api.internal.parser.DocReaderResultsJsonParser;

import org.json.JSONArray;
import org.json.JSONException;
Expand Down Expand Up @@ -341,6 +341,9 @@ public void error(String s) {
case "recognizeImage":
recognizeImage(callback, args(0));
break;
case "recognizeData":
recognizeData(callback, args(0));
break;
case "setRfidSessionStatus":
setRfidSessionStatus(callback, args(0));
break;
Expand All @@ -359,9 +362,6 @@ public void error(String s) {
case "setTCCParams":
setTCCParams(callback, args(0));
break;
case "initializeReaderWithDatabase":
initializeReaderWithDatabase(callback, args(0), args(1));
break;
case "recognizeImageWithOpts":
recognizeImageWithOpts(callback, args(0), args(1));
break;
Expand Down Expand Up @@ -525,16 +525,9 @@ private void isRFIDAvailableForUse(Callback callback) {
callback.success(Instance().isRFIDAvailableForUse());
}

private void initializeReader(Callback callback, Object license) {
if (!Instance().isReady())
Instance().initializeReader(getContext(), new DocReaderConfig(Base64.decode(license.toString(), Base64.DEFAULT)), getInitCompletion(callback));
else
callback.success("already initialized");
}

private void initializeReaderWithDatabase(Callback callback, Object license, Object db) {
private void initializeReader(Callback callback, JSONObject config) {
if (!Instance().isReady())
Instance().initializeReader(getContext(), new DocReaderConfig(Base64.decode(license.toString(), Base64.DEFAULT), Base64.decode(db.toString(), Base64.DEFAULT)), getInitCompletion(callback));
Instance().initializeReader(getContext(), JSONConstructor.DocReaderConfigFromJSON(config), getInitCompletion(callback));
else
callback.success("already initialized");
}
Expand All @@ -559,6 +552,11 @@ private void recognizeImage(@SuppressWarnings("unused") Callback callback, Strin
Instance().recognizeImage(Helpers.bitmapFromBase64(base64Image), getCompletion());
}

private void recognizeData(@SuppressWarnings("unused") Callback callback, Object data) {
stopBackgroundRFID();
Instance().recognizeImage(Base64.decode(data.toString(), Base64.DEFAULT), getCompletion());
}

private void recognizeImages(@SuppressWarnings("unused") Callback callback, JSONArray base64Images) throws JSONException {
stopBackgroundRFID();
Bitmap[] images = new Bitmap[base64Images.length()];
Expand Down
52 changes: 46 additions & 6 deletions android/src/main/java/com/regula/documentreader/RegulaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

import com.regula.documentreader.api.DocumentReader;
import com.regula.documentreader.api.params.ImageQA;
import com.regula.documentreader.api.params.OnlineProcessingConfig;
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.ReprocParams;
import com.regula.documentreader.api.params.rfid.dg.DataGroups;

import android.content.Context;
Expand Down Expand Up @@ -59,8 +61,6 @@ private static void setFunctionality(Functionality functionality, JSONObject opt
editor.setShowCaptureButtonDelayFromDetect(opts.getInt("showCaptureButtonDelayFromDetect"));
if (opts.has("showCaptureButtonDelayFromStart"))
editor.setShowCaptureButtonDelayFromStart(opts.getInt("showCaptureButtonDelayFromStart"));
if (opts.has("isOnlineMode"))
editor.setOnlineMode(opts.getBoolean("isOnlineMode"));
if (opts.has("databaseAutoupdate"))
editor.setDatabaseAutoupdate(opts.getBoolean("databaseAutoupdate"));
if (opts.has("showSkipNextPageButton"))
Expand All @@ -73,8 +73,6 @@ private static void setFunctionality(Functionality functionality, JSONObject opt
editor.setShowCameraSwitchButton(opts.getBoolean("showCameraSwitchButton"));
if (opts.has("cameraFrame"))
editor.setCameraFrame(opts.getString("cameraFrame"));
if (opts.has("serviceURL"))
editor.setServiceURL(opts.getString("serviceURL"));
if (opts.has("btDeviceName"))
editor.setBtDeviceName(opts.getString("btDeviceName"));
if (opts.has("orientation"))
Expand Down Expand Up @@ -105,6 +103,8 @@ private static void setFunctionality(Functionality functionality, JSONObject opt
editor.setExposure(BigDecimal.valueOf(opts.getDouble("exposure")).floatValue());
if (opts.has("rfidTimeout"))
editor.setRfidTimeout(opts.getInt("rfidTimeout"));
if (opts.has("onlineProcessingConfiguration"))
editor.setOnlineProcessingConfiguration(OnlineProcessingConfigFromJSON(opts.getJSONObject("onlineProcessingConfiguration")));

editor.apply();
}
Expand Down Expand Up @@ -349,14 +349,12 @@ private static JSONObject getFunctionality(Functionality functionality) throws J
object.put("showChangeFrameButton", functionality.isShowChangeFrameButton());
object.put("showCaptureButtonDelayFromDetect", functionality.getShowCaptureButtonDelayFromDetect());
object.put("showCaptureButtonDelayFromStart", functionality.getShowCaptureButtonDelayFromStart());
object.put("isOnlineMode", functionality.isOnlineMode());
object.put("databaseAutoupdate", functionality.isDatabaseAutoupdate());
object.put("showSkipNextPageButton", functionality.isShowSkipNextPageButton());
object.put("useAuthenticator", functionality.isUseAuthenticator());
object.put("skipFocusingFrames", functionality.isSkipFocusingFrames());
object.put("showCameraSwitchButton", functionality.isShowCameraSwitchButton());
object.put("cameraFrame", functionality.getCameraFrame());
object.put("serviceURL", functionality.getServiceURL());
object.put("btDeviceName", functionality.getBtDeviceName());
object.put("orientation", functionality.getOrientation());
object.put("BTDeviceApiPresent", functionality.isBTDeviceApiPresent());
Expand Down Expand Up @@ -603,6 +601,10 @@ static void setRfidScenario(JSONObject opts) throws JSONException {
setDataGroups(DocumentReader.Instance().rfidScenario().eIDDataGroups(), opts.getJSONObject("eIDDataGroups"));
if (opts.has("eDLDataGroups"))
setDataGroups(DocumentReader.Instance().rfidScenario().eDLDataGroups(), opts.getJSONObject("eDLDataGroups"));
if (opts.has("reprocessParams"))
DocumentReader.Instance().rfidScenario().setReprocessParams(ReprocParamsFromJSON(opts.getJSONObject("reprocessParams")));
if (opts.has("defaultReadingBufferSize"))
DocumentReader.Instance().rfidScenario().setDefaultReadingBufferSize(opts.getInt("defaultReadingBufferSize"));
}

private static void setDataGroups(DataGroups dataGroup, JSONObject opts) throws JSONException {
Expand Down Expand Up @@ -649,4 +651,42 @@ private static void setDataGroups(DataGroups dataGroup, JSONObject opts) throws
if (opts.has("DG21"))
dataGroup.setDG14(opts.getBoolean("DG21"));
}

private static ReprocParams ReprocParamsFromJSON(JSONObject input) {
try {
ReprocParams result;
if (input.has("serviceUrl"))
result = new ReprocParams(input.getString("serviceUrl"));
else return null;
if (input.has("failIfNoService"))
result.setFailIfNoService(input.getBoolean("failIfNoService"));
return result;
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}

private static OnlineProcessingConfig OnlineProcessingConfigFromJSON(JSONObject input) {
try {
OnlineProcessingConfig.Builder builder;
if (input.has("mode"))
builder = new OnlineProcessingConfig.Builder(input.getInt("mode"));
else return null;
if (input.has("imageFormat"))
builder.setImageFormat(input.getInt("imageFormat"));
if (input.has("url"))
builder.setUrl(input.getString("url"));
if (input.has("imageCompressionQuality"))
builder.setImageCompressionQuality((float) input.getDouble("imageCompressionQuality"));
if (input.has("processParams")) {
ProcessParam params = new ProcessParam();
setProcessParams(params, input.getJSONObject("processParams"));
builder.setProcessParams(params);
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
}
Empty file added core/.gitkeep
Empty file.
Loading

0 comments on commit dc7a708

Please sign in to comment.