Skip to content

Commit

Permalink
Merge pull request #122 from BlinkID/release/5.3.0
Browse files Browse the repository at this point in the history
Release/5.3.0
  • Loading branch information
juraskrlec authored Mar 19, 2020
2 parents fb9b896 + 5a0bf85 commit c778b27
Show file tree
Hide file tree
Showing 20 changed files with 664 additions and 16 deletions.
2 changes: 1 addition & 1 deletion BlinkID/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blinkid-cordova",
"version": "5.2.0",
"version": "5.3.0",
"description": "A small and powerful ID card scanning library",
"cordova": {
"id": "blinkid-cordova",
Expand Down
5 changes: 4 additions & 1 deletion BlinkID/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="blinkid-cordova"
version="5.2.0">
version="5.3.0">

<name>BlinkIdScanner</name>
<description>A small and powerful ID card scanning library</description>
Expand Down Expand Up @@ -68,6 +68,7 @@
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SuccessFrameGrabberRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/MrtdRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/MrtdCombinedRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/IdBarcodeRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BlinkIdRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BlinkIDSerializationUtils.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/UsdlRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
Expand Down Expand Up @@ -117,6 +118,7 @@
<source-file src="src/ios/sources/Recognizers/Wrappers/MBMrtdCombinedRecognizerWrapper.m" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBPassportRecognizerWrapper.m" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBUsdlCombinedRecognizerWrapper.m" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBIdBarcodeRecognizerWrapper.m" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBBlinkIdRecognizerWrapper.h" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBVisaRecognizerWrapper.h" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBDocumentFaceRecognizerWrapper.h" />
Expand All @@ -126,6 +128,7 @@
<source-file src="src/ios/sources/Recognizers/Wrappers/MBSuccessFrameGrabberRecognizerWrapper.m" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBMrtdRecognizerWrapper.h" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBBlinkIdRecognizerWrapper.m" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBIdBarcodeRecognizerWrapper.h" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBUsdlCombinedRecognizerWrapper.h" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBPassportRecognizerWrapper.h" />
<!-- IOS SOURCE FILES END -->
Expand Down
2 changes: 1 addition & 1 deletion BlinkID/scripts/initIOSFramework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
HERE="$(dirname "$(test -L "$0" && readlink "$0" || echo "$0")")"
pushd "${HERE}/../src/ios/" > /dev/null

LINK='https://github.com/BlinkID/blinkid-ios/releases/download/v5.2.0/blinkid-ios_v5.2.0.zip'
LINK='https://github.com/BlinkID/blinkid-ios/releases/download/v5.3.0/blinkid-ios_v5.3.0.zip'
FILENAME='blinkid-ios.zip'

# check if Microblink framework and bundle already exist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,79 @@
import android.content.Context;

import com.microblink.entities.recognizers.RecognizerBundle;
import com.microblink.fragment.overlay.blinkid.reticleui.ReticleOverlayStrings;
import com.microblink.uisettings.BlinkIdUISettings;
import com.microblink.uisettings.UISettings;
import com.phonegap.plugins.microblink.overlays.OverlaySettingsSerialization;

import org.json.JSONObject;

import static com.phonegap.plugins.microblink.recognizers.serialization.SerializationUtils.getStringFromJSONObject;

public final class BlinkIdOverlaySettingsSerialization implements OverlaySettingsSerialization {
@Override
public UISettings createUISettings(Context context, JSONObject jsonUISettings, RecognizerBundle recognizerBundle) {
// no settings deserialized at the moment
return new BlinkIdUISettings(recognizerBundle);
BlinkIdUISettings settings = new BlinkIdUISettings(recognizerBundle);

boolean requireDocumentSidesDataMatch = jsonUISettings.optBoolean("requireDocumentSidesDataMatch", true);
settings.setDocumentDataMatchRequired(requireDocumentSidesDataMatch);

boolean showNotSupportedDialog = jsonUISettings.optBoolean("showNotSupportedDialog", true);
settings.setShowNotSupportedDialog(showNotSupportedDialog);

long backSideScanningTimeoutMilliseconds = jsonUISettings.optLong("backSideScanningTimeoutMilliseconds", 17000);
settings.setBackSideScanningTimeoutMs(backSideScanningTimeoutMilliseconds);

ReticleOverlayStrings.Builder overlasStringsBuilder = new ReticleOverlayStrings.Builder(context);

String firstSideInstructionsText = getStringFromJSONObject(jsonUISettings, "firstSideInstructionsText");
if (firstSideInstructionsText != null) {
overlasStringsBuilder.setFirstSideInstructionsText(firstSideInstructionsText);
}
String flipInstructions = getStringFromJSONObject(jsonUISettings, "flipInstructions");
if (flipInstructions != null) {
overlasStringsBuilder.setFlipInstructions(flipInstructions);
}
String errorMoveCloser = getStringFromJSONObject(jsonUISettings, "errorMoveCloser");
if (errorMoveCloser != null) {
overlasStringsBuilder.setErrorMoveCloser(errorMoveCloser);
}
String errorMoveFarther = getStringFromJSONObject(jsonUISettings, "errorMoveFarther");
if (errorMoveFarther != null) {
overlasStringsBuilder.setErrorMoveFarther(errorMoveFarther);
}
String sidesNotMatchingTitle = getStringFromJSONObject(jsonUISettings, "sidesNotMatchingTitle");
if (sidesNotMatchingTitle != null) {
overlasStringsBuilder.setSidesNotMatchingTitle(sidesNotMatchingTitle);
}
String sidesNotMatchingMessage = getStringFromJSONObject(jsonUISettings, "sidesNotMatchingMessage");
if (sidesNotMatchingMessage != null) {
overlasStringsBuilder.setSidesNotMatchingMessage(sidesNotMatchingMessage);
}
String unsupportedDocumentTitle = getStringFromJSONObject(jsonUISettings, "unsupportedDocumentTitle");
if (unsupportedDocumentTitle != null) {
overlasStringsBuilder.setUnsupportedDocumentTitle(unsupportedDocumentTitle);
}
String unsupportedDocumentMessage = getStringFromJSONObject(jsonUISettings, "unsupportedDocumentMessage");
if (unsupportedDocumentMessage != null) {
overlasStringsBuilder.setUnsupportedDocumentMessage(unsupportedDocumentMessage);
}
String recognitionTimeoutTitle = getStringFromJSONObject(jsonUISettings, "recognitionTimeoutTitle");
if (recognitionTimeoutTitle != null) {
overlasStringsBuilder.setRecognitionTimeoutTitle(recognitionTimeoutTitle);
}
String recognitionTimeoutMessage = getStringFromJSONObject(jsonUISettings, "recognitionTimeoutMessage");
if (recognitionTimeoutMessage != null) {
overlasStringsBuilder.setRecognitionTimeoutMessage(recognitionTimeoutMessage);
}
String retryButtonText = getStringFromJSONObject(jsonUISettings, "retryButtonText");
if (retryButtonText != null) {
overlasStringsBuilder.setRetryButtonText(retryButtonText);
}

settings.setStrings(overlasStringsBuilder.build());

return settings;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import org.json.JSONObject;

import static com.phonegap.plugins.microblink.recognizers.serialization.SerializationUtils.getStringFromJSONObject;

public final class DocumentVerificationOverlaySettingsSerialization implements OverlaySettingsSerialization {
@Override
public UISettings createUISettings(Context context, JSONObject jsonUISettings, RecognizerBundle recognizerBundle) {
Expand Down Expand Up @@ -41,14 +43,6 @@ public UISettings createUISettings(Context context, JSONObject jsonUISettings, R
return settings;
}

private String getStringFromJSONObject(JSONObject map, String key) {
String value = map.optString(key, null);
if ("null".equals(value)) {
value = null;
}
return value;
}

@Override
public String getJsonName() {
return "DocumentVerificationOverlaySettings";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ private void registerMapping( RecognizerSerialization recognizerSerialization )
registerMapping(new BlinkIdCombinedRecognizerSerialization());
registerMapping(new BlinkIdRecognizerSerialization());
registerMapping(new DocumentFaceRecognizerSerialization());
registerMapping(new IdBarcodeRecognizerSerialization());
registerMapping(new MrtdCombinedRecognizerSerialization());
registerMapping(new MrtdRecognizerSerialization());
registerMapping(new PassportRecognizerSerialization());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public final class BlinkIdCombinedRecognizerSerialization implements RecognizerS
public Recognizer<?> createRecognizer(JSONObject jsonRecognizer) {
com.microblink.entities.recognizers.blinkid.generic.BlinkIdCombinedRecognizer recognizer = new com.microblink.entities.recognizers.blinkid.generic.BlinkIdCombinedRecognizer();
recognizer.setAllowBlurFilter(jsonRecognizer.optBoolean("allowBlurFilter", true));
recognizer.setAllowUnparsedMrzResults(jsonRecognizer.optBoolean("allowUnparsedMrzResults", false));
recognizer.setAllowUnverifiedMrzResults(jsonRecognizer.optBoolean("allowUnverifiedMrzResults", true));
recognizer.setFaceImageDpi(jsonRecognizer.optInt("faceImageDpi", 250));
recognizer.setFullDocumentImageDpi(jsonRecognizer.optInt("fullDocumentImageDpi", 250));
recognizer.setFullDocumentImageExtensionFactors(BlinkIDSerializationUtils.deserializeExtensionFactors(jsonRecognizer.optJSONObject("fullDocumentImageExtensionFactors")));
Expand All @@ -33,6 +35,7 @@ public JSONObject serializeResult(Recognizer<?> recognizer) {
jsonResult.put("conditions", result.getConditions());
jsonResult.put("dateOfBirth", SerializationUtils.serializeDate(result.getDateOfBirth()));
jsonResult.put("dateOfExpiry", SerializationUtils.serializeDate(result.getDateOfExpiry()));
jsonResult.put("dateOfExpiryPermanent", result.isDateOfExpiryPermanent());
jsonResult.put("dateOfIssue", SerializationUtils.serializeDate(result.getDateOfIssue()));
jsonResult.put("digitalSignature", SerializationUtils.encodeByteArrayToBase64(result.getDigitalSignature()));
jsonResult.put("digitalSignatureVersion", (int)result.getDigitalSignatureVersion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public final class BlinkIdRecognizerSerialization implements RecognizerSerializa
public Recognizer<?> createRecognizer(JSONObject jsonRecognizer) {
com.microblink.entities.recognizers.blinkid.generic.BlinkIdRecognizer recognizer = new com.microblink.entities.recognizers.blinkid.generic.BlinkIdRecognizer();
recognizer.setAllowBlurFilter(jsonRecognizer.optBoolean("allowBlurFilter", true));
recognizer.setAllowUnparsedMrzResults(jsonRecognizer.optBoolean("allowUnparsedMrzResults", false));
recognizer.setAllowUnverifiedMrzResults(jsonRecognizer.optBoolean("allowUnverifiedMrzResults", true));
recognizer.setFaceImageDpi(jsonRecognizer.optInt("faceImageDpi", 250));
recognizer.setFullDocumentImageDpi(jsonRecognizer.optInt("fullDocumentImageDpi", 250));
recognizer.setFullDocumentImageExtensionFactors(BlinkIDSerializationUtils.deserializeExtensionFactors(jsonRecognizer.optJSONObject("fullDocumentImageExtensionFactors")));
Expand All @@ -32,6 +34,7 @@ public JSONObject serializeResult(Recognizer<?> recognizer) {
jsonResult.put("conditions", result.getConditions());
jsonResult.put("dateOfBirth", SerializationUtils.serializeDate(result.getDateOfBirth()));
jsonResult.put("dateOfExpiry", SerializationUtils.serializeDate(result.getDateOfExpiry()));
jsonResult.put("dateOfExpiryPermanent", result.isDateOfExpiryPermanent());
jsonResult.put("dateOfIssue", SerializationUtils.serializeDate(result.getDateOfIssue()));
jsonResult.put("documentAdditionalNumber", result.getDocumentAdditionalNumber());
jsonResult.put("documentNumber", result.getDocumentNumber());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.phonegap.plugins.microblink.recognizers.serialization;

import com.microblink.entities.recognizers.Recognizer;
import com.phonegap.plugins.microblink.recognizers.RecognizerSerialization;

import org.json.JSONException;
import org.json.JSONObject;

public final class IdBarcodeRecognizerSerialization implements RecognizerSerialization {

@Override
public Recognizer<?> createRecognizer(JSONObject jsonRecognizer) {
com.microblink.entities.recognizers.blinkid.idbarcode.IdBarcodeRecognizer recognizer = new com.microblink.entities.recognizers.blinkid.idbarcode.IdBarcodeRecognizer();
return recognizer;
}

@Override
public JSONObject serializeResult(Recognizer<?> recognizer) {
com.microblink.entities.recognizers.blinkid.idbarcode.IdBarcodeRecognizer.Result result = ((com.microblink.entities.recognizers.blinkid.idbarcode.IdBarcodeRecognizer)recognizer).getResult();
JSONObject jsonResult = new JSONObject();
try {
SerializationUtils.addCommonResultData(jsonResult, result);
jsonResult.put("additionalAddressInformation", result.getAdditionalAddressInformation());
jsonResult.put("additionalNameInformation", result.getAdditionalNameInformation());
jsonResult.put("address", result.getAddress());
jsonResult.put("barcodeType", SerializationUtils.serializeEnum(result.getBarcodeType()));
jsonResult.put("dateOfBirth", SerializationUtils.serializeDate(result.getDateOfBirth()));
jsonResult.put("dateOfExpiry", SerializationUtils.serializeDate(result.getDateOfExpiry()));
jsonResult.put("dateOfIssue", SerializationUtils.serializeDate(result.getDateOfIssue()));
jsonResult.put("documentAdditionalNumber", result.getDocumentAdditionalNumber());
jsonResult.put("documentNumber", result.getDocumentNumber());
jsonResult.put("documentType", SerializationUtils.serializeEnum(result.getDocumentType()));
jsonResult.put("employer", result.getEmployer());
jsonResult.put("firstName", result.getFirstName());
jsonResult.put("fullName", result.getFullName());
jsonResult.put("issuingAuthority", result.getIssuingAuthority());
jsonResult.put("lastName", result.getLastName());
jsonResult.put("maritalStatus", result.getMaritalStatus());
jsonResult.put("nationality", result.getNationality());
jsonResult.put("personalIdNumber", result.getPersonalIdNumber());
jsonResult.put("placeOfBirth", result.getPlaceOfBirth());
jsonResult.put("profession", result.getProfession());
jsonResult.put("race", result.getRace());
jsonResult.put("rawData", SerializationUtils.encodeByteArrayToBase64(result.getRawData()));
jsonResult.put("religion", result.getReligion());
jsonResult.put("residentialStatus", result.getResidentialStatus());
jsonResult.put("sex", result.getSex());
jsonResult.put("stringData", result.getStringData());
jsonResult.put("uncertain", result.isUncertain());
} catch (JSONException e) {
// see https://developer.android.com/reference/org/json/JSONException
throw new RuntimeException(e);
}
return jsonResult;
}

@Override
public String getJsonName() {
return "IdBarcodeRecognizer";
}

@Override
public Class<?> getRecognizerClass() {
return com.microblink.entities.recognizers.blinkid.idbarcode.IdBarcodeRecognizer.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,12 @@ public static JSONObject serializeQuad(Quadrilateral quad) throws JSONException
jsonQuad.put("lowerRight", serializePoint(quad.getLowerRight()));
return jsonQuad;
}

public static String getStringFromJSONObject(JSONObject map, String key) {
String value = map.optString(key, null);
if ("null".equals(value)) {
value = null;
}
return value;
}
}
2 changes: 1 addition & 1 deletion BlinkID/src/android/libBlinkID.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repositories {
}

dependencies {
implementation('com.microblink:blinkid:5.2.0@aar') {
implementation('com.microblink:blinkid:5.3.0@aar') {
transitive = true
}
}
Expand Down
Loading

0 comments on commit c778b27

Please sign in to comment.