Skip to content

Commit

Permalink
Merge pull request #99 from BlinkID/feature/v4.7.0
Browse files Browse the repository at this point in the history
Feature/v4.7.0
  • Loading branch information
jcular authored Feb 22, 2019
2 parents 0d9c78e + d95aa88 commit 3e7c3d2
Show file tree
Hide file tree
Showing 48 changed files with 4,184 additions and 6,717 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": "4.6.0",
"version": "4.7.0",
"description": "A small and powerful ID card scanning library",
"cordova": {
"id": "blinkid-cordova",
Expand Down
41 changes: 19 additions & 22 deletions BlinkID/plugin.xml

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions 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/v4.6.0/blinkid-ios_v4.6.0.zip'
LINK='https://github.com/BlinkID/blinkid-ios/releases/download/v4.7.0/blinkid-ios_v4.7.0.zip'
FILENAME='blinkid-ios.zip'

# check if Microblink framework and bundle already exist
Expand All @@ -15,18 +15,18 @@ echo "Unzipping ${FILENAME}"
unzip -v > /dev/null 2>&1 || { echo "ERROR: couldn't unzip Microblink framework, install unzip" && exit 1; }
unzip -o "${FILENAME}" > /dev/null 2>&1 && echo "Unzipped ${FILENAME}"

if [ -d 'MicroBlink.bundle' ] ; then
rm -rf MicroBlink.bundle && echo "Removing MicroBlink.bundle"
if [ -d 'Microblink.bundle' ] ; then
rm -rf Microblink.bundle && echo "Removing Microblink.bundle"
fi

if [ -d 'MicroBlink.framework' ] ; then
rm -rf MicroBlink.framework && echo "Removing MicroBlink.framework"
if [ -d 'Microblink.framework' ] ; then
rm -rf Microblink.framework && echo "Removing Microblink.framework"
fi

cd blinkid-ios || exit 1

mv -f MicroBlink.framework ../MicroBlink.framework
mv -f MicroBlink.bundle ../MicroBlink.bundle
mv -f Microblink.framework ../Microblink.framework
mv -f Microblink.bundle ../Microblink.bundle

cd ..

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ private void registerMapping(OverlaySettingsSerialization overlaySettingsSeriali
registerMapping(new BarcodeOverlaySettingsSerialization());
registerMapping(new DocumentOverlaySettingsSerialization());
registerMapping(new DocumentVerificationOverlaySettingsSerialization());
registerMapping(new BlinkCardOverlaySettingsSerialization());
}

public UISettings getOverlaySettings(JSONObject jsonOverlaySettings, RecognizerBundle recognizerBundle) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.phonegap.plugins.microblink.overlays.serialization;

import com.microblink.entities.recognizers.RecognizerBundle;
import com.microblink.uisettings.BlinkCardUISettings;
import com.microblink.uisettings.UISettings;
import com.phonegap.plugins.microblink.overlays.OverlaySettingsSerialization;

import org.json.JSONObject;

public final class BlinkCardOverlaySettingsSerialization implements OverlaySettingsSerialization {
@Override
public UISettings createUISettings(JSONObject jsonUISettings, RecognizerBundle recognizerBundle) {
BlinkCardUISettings settings = new BlinkCardUISettings(recognizerBundle);

String firstSideInstructions = getStringFromJSONObject(jsonUISettings, "firstSideInstructions");
if (firstSideInstructions != null) {
settings.setFirstSideInstructions(firstSideInstructions);
}
String secondSideInstructions = getStringFromJSONObject(jsonUISettings, "secondSideInstructions");
if (secondSideInstructions != null) {
settings.setSecondSideInstructions(secondSideInstructions);
}

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 "BlinkCardOverlaySettings";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ private void registerMapping( RecognizerSerialization recognizerSerialization )
registerMapping(new AustriaIdFrontRecognizerSerialization());
registerMapping(new AustriaPassportRecognizerSerialization());
registerMapping(new BarcodeRecognizerSerialization());
registerMapping(new BlinkCardEliteRecognizerSerialization());
registerMapping(new BlinkCardRecognizerSerialization());
registerMapping(new BruneiIdBackRecognizerSerialization());
registerMapping(new BruneiIdFrontRecognizerSerialization());
registerMapping(new BruneiResidencePermitBackRecognizerSerialization());
registerMapping(new BruneiResidencePermitFrontRecognizerSerialization());
registerMapping(new BruneiTemporaryResidencePermitBackRecognizerSerialization());
registerMapping(new BruneiTemporaryResidencePermitFrontRecognizerSerialization());
registerMapping(new ColombiaDlFrontRecognizerSerialization());
registerMapping(new ColombiaIdBackRecognizerSerialization());
registerMapping(new ColombiaIdFrontRecognizerSerialization());
Expand All @@ -50,9 +54,6 @@ private void registerMapping( RecognizerSerialization recognizerSerialization )
registerMapping(new CzechiaIdFrontRecognizerSerialization());
registerMapping(new DocumentFaceRecognizerSerialization());
registerMapping(new EgyptIdFrontRecognizerSerialization());
registerMapping(new ElitePaymentCardBackRecognizerSerialization());
registerMapping(new ElitePaymentCardCombinedRecognizerSerialization());
registerMapping(new ElitePaymentCardFrontRecognizerSerialization());
registerMapping(new EudlRecognizerSerialization());
registerMapping(new GermanyCombinedRecognizerSerialization());
registerMapping(new GermanyDlBackRecognizerSerialization());
Expand Down Expand Up @@ -83,9 +84,6 @@ private void registerMapping( RecognizerSerialization recognizerSerialization )
registerMapping(new MrtdCombinedRecognizerSerialization());
registerMapping(new MrtdRecognizerSerialization());
registerMapping(new NewZealandDlFrontRecognizerSerialization());
registerMapping(new PaymentCardBackRecognizerSerialization());
registerMapping(new PaymentCardCombinedRecognizerSerialization());
registerMapping(new PaymentCardFrontRecognizerSerialization());
registerMapping(new Pdf417RecognizerSerialization());
registerMapping(new PolandCombinedRecognizerSerialization());
registerMapping(new PolandIdBackRecognizerSerialization());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
import org.json.JSONException;
import org.json.JSONObject;

public final class PaymentCardCombinedRecognizerSerialization implements RecognizerSerialization {
public final class BlinkCardEliteRecognizerSerialization implements RecognizerSerialization {

@Override
public Recognizer<?, ?> createRecognizer(JSONObject jsonRecognizer) {
com.microblink.entities.recognizers.blinkid.paymentcard.PaymentCardCombinedRecognizer recognizer = new com.microblink.entities.recognizers.blinkid.paymentcard.PaymentCardCombinedRecognizer();
com.microblink.entities.recognizers.blinkcard.BlinkCardEliteRecognizer recognizer = new com.microblink.entities.recognizers.blinkcard.BlinkCardEliteRecognizer();
recognizer.setAnonymizeCardNumber(jsonRecognizer.optBoolean("anonymizeCardNumber", false));
recognizer.setAnonymizeCvv(jsonRecognizer.optBoolean("anonymizeCvv", false));
recognizer.setAnonymizeOwner(jsonRecognizer.optBoolean("anonymizeOwner", false));
recognizer.setDetectGlare(jsonRecognizer.optBoolean("detectGlare", true));
recognizer.setExtractInventoryNumber(jsonRecognizer.optBoolean("extractInventoryNumber", true));
recognizer.setExtractOwner(jsonRecognizer.optBoolean("extractOwner", false));
recognizer.setExtractOwner(jsonRecognizer.optBoolean("extractOwner", true));
recognizer.setExtractValidThru(jsonRecognizer.optBoolean("extractValidThru", true));
recognizer.setFullDocumentImageDpi(jsonRecognizer.optInt("fullDocumentImageDpi", 250));
recognizer.setFullDocumentImageExtensionFactors(BlinkIDSerializationUtils.deserializeExtensionFactors(jsonRecognizer.optJSONObject("fullDocumentImageExtensionFactors")));
Expand All @@ -27,7 +27,7 @@ public final class PaymentCardCombinedRecognizerSerialization implements Recogni

@Override
public JSONObject serializeResult(Recognizer<?, ?> recognizer) {
com.microblink.entities.recognizers.blinkid.paymentcard.PaymentCardCombinedRecognizer.Result result = ((com.microblink.entities.recognizers.blinkid.paymentcard.PaymentCardCombinedRecognizer)recognizer).getResult();
com.microblink.entities.recognizers.blinkcard.BlinkCardEliteRecognizer.Result result = ((com.microblink.entities.recognizers.blinkcard.BlinkCardEliteRecognizer)recognizer).getResult();
JSONObject jsonResult = new JSONObject();
try {
SerializationUtils.addCommonResultData(jsonResult, result);
Expand All @@ -51,11 +51,11 @@ public JSONObject serializeResult(Recognizer<?, ?> recognizer) {

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

@Override
public Class<?> getRecognizerClass() {
return com.microblink.entities.recognizers.blinkid.paymentcard.PaymentCardCombinedRecognizer.class;
return com.microblink.entities.recognizers.blinkcard.BlinkCardEliteRecognizer.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
import org.json.JSONException;
import org.json.JSONObject;

public final class ElitePaymentCardCombinedRecognizerSerialization implements RecognizerSerialization {
public final class BlinkCardRecognizerSerialization implements RecognizerSerialization {

@Override
public Recognizer<?, ?> createRecognizer(JSONObject jsonRecognizer) {
com.microblink.entities.recognizers.blinkid.elitepaymentcard.ElitePaymentCardCombinedRecognizer recognizer = new com.microblink.entities.recognizers.blinkid.elitepaymentcard.ElitePaymentCardCombinedRecognizer();
com.microblink.entities.recognizers.blinkcard.BlinkCardRecognizer recognizer = new com.microblink.entities.recognizers.blinkcard.BlinkCardRecognizer();
recognizer.setAnonymizeCardNumber(jsonRecognizer.optBoolean("anonymizeCardNumber", false));
recognizer.setAnonymizeCvv(jsonRecognizer.optBoolean("anonymizeCvv", false));
recognizer.setAnonymizeOwner(jsonRecognizer.optBoolean("anonymizeOwner", false));
recognizer.setDetectGlare(jsonRecognizer.optBoolean("detectGlare", true));
recognizer.setExtractCvv(jsonRecognizer.optBoolean("extractCvv", true));
recognizer.setExtractInventoryNumber(jsonRecognizer.optBoolean("extractInventoryNumber", true));
recognizer.setExtractOwner(jsonRecognizer.optBoolean("extractOwner", true));
recognizer.setExtractOwner(jsonRecognizer.optBoolean("extractOwner", false));
recognizer.setExtractValidThru(jsonRecognizer.optBoolean("extractValidThru", true));
recognizer.setFullDocumentImageDpi(jsonRecognizer.optInt("fullDocumentImageDpi", 250));
recognizer.setFullDocumentImageExtensionFactors(BlinkIDSerializationUtils.deserializeExtensionFactors(jsonRecognizer.optJSONObject("fullDocumentImageExtensionFactors")));
Expand All @@ -27,7 +28,7 @@ public final class ElitePaymentCardCombinedRecognizerSerialization implements Re

@Override
public JSONObject serializeResult(Recognizer<?, ?> recognizer) {
com.microblink.entities.recognizers.blinkid.elitepaymentcard.ElitePaymentCardCombinedRecognizer.Result result = ((com.microblink.entities.recognizers.blinkid.elitepaymentcard.ElitePaymentCardCombinedRecognizer)recognizer).getResult();
com.microblink.entities.recognizers.blinkcard.BlinkCardRecognizer.Result result = ((com.microblink.entities.recognizers.blinkcard.BlinkCardRecognizer)recognizer).getResult();
JSONObject jsonResult = new JSONObject();
try {
SerializationUtils.addCommonResultData(jsonResult, result);
Expand All @@ -39,6 +40,7 @@ public JSONObject serializeResult(Recognizer<?, ?> recognizer) {
jsonResult.put("fullDocumentBackImage", SerializationUtils.encodeImageBase64(result.getFullDocumentBackImage()));
jsonResult.put("fullDocumentFrontImage", SerializationUtils.encodeImageBase64(result.getFullDocumentFrontImage()));
jsonResult.put("inventoryNumber", result.getInventoryNumber());
jsonResult.put("issuer", SerializationUtils.serializeEnum(result.getIssuer()));
jsonResult.put("owner", result.getOwner());
jsonResult.put("scanningFirstSideDone", result.isScanningFirstSideDone());
jsonResult.put("validThru", SerializationUtils.serializeDate(result.getValidThru()));
Expand All @@ -51,11 +53,11 @@ public JSONObject serializeResult(Recognizer<?, ?> recognizer) {

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

@Override
public Class<?> getRecognizerClass() {
return com.microblink.entities.recognizers.blinkid.elitepaymentcard.ElitePaymentCardCombinedRecognizer.class;
return com.microblink.entities.recognizers.blinkcard.BlinkCardRecognizer.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
import org.json.JSONException;
import org.json.JSONObject;

public final class ElitePaymentCardBackRecognizerSerialization implements RecognizerSerialization {
public final class BruneiTemporaryResidencePermitBackRecognizerSerialization implements RecognizerSerialization {

@Override
public Recognizer<?, ?> createRecognizer(JSONObject jsonRecognizer) {
com.microblink.entities.recognizers.blinkid.elitepaymentcard.ElitePaymentCardBackRecognizer recognizer = new com.microblink.entities.recognizers.blinkid.elitepaymentcard.ElitePaymentCardBackRecognizer();
recognizer.setAnonymizeCardNumber(jsonRecognizer.optBoolean("anonymizeCardNumber", false));
recognizer.setAnonymizeCvv(jsonRecognizer.optBoolean("anonymizeCvv", false));
com.microblink.entities.recognizers.blinkid.brunei.BruneiTemporaryResidencePermitBackRecognizer recognizer = new com.microblink.entities.recognizers.blinkid.brunei.BruneiTemporaryResidencePermitBackRecognizer();
recognizer.setDetectGlare(jsonRecognizer.optBoolean("detectGlare", true));
recognizer.setExtractInventoryNumber(jsonRecognizer.optBoolean("extractInventoryNumber", true));
recognizer.setExtractValidThru(jsonRecognizer.optBoolean("extractValidThru", true));
recognizer.setExtractAddress(jsonRecognizer.optBoolean("extractAddress", true));
recognizer.setExtractDateOfIssue(jsonRecognizer.optBoolean("extractDateOfIssue", true));
recognizer.setExtractPassportNumber(jsonRecognizer.optBoolean("extractPassportNumber", true));
recognizer.setFullDocumentImageDpi(jsonRecognizer.optInt("fullDocumentImageDpi", 250));
recognizer.setFullDocumentImageExtensionFactors(BlinkIDSerializationUtils.deserializeExtensionFactors(jsonRecognizer.optJSONObject("fullDocumentImageExtensionFactors")));
recognizer.setReturnFullDocumentImage(jsonRecognizer.optBoolean("returnFullDocumentImage", false));
Expand All @@ -24,15 +23,15 @@ public final class ElitePaymentCardBackRecognizerSerialization implements Recogn

@Override
public JSONObject serializeResult(Recognizer<?, ?> recognizer) {
com.microblink.entities.recognizers.blinkid.elitepaymentcard.ElitePaymentCardBackRecognizer.Result result = ((com.microblink.entities.recognizers.blinkid.elitepaymentcard.ElitePaymentCardBackRecognizer)recognizer).getResult();
com.microblink.entities.recognizers.blinkid.brunei.BruneiTemporaryResidencePermitBackRecognizer.Result result = ((com.microblink.entities.recognizers.blinkid.brunei.BruneiTemporaryResidencePermitBackRecognizer)recognizer).getResult();
JSONObject jsonResult = new JSONObject();
try {
SerializationUtils.addCommonResultData(jsonResult, result);
jsonResult.put("cardNumber", result.getCardNumber());
jsonResult.put("cvv", result.getCvv());
jsonResult.put("address", result.getAddress());
jsonResult.put("dateOfIssue", SerializationUtils.serializeDate(result.getDateOfIssue()));
jsonResult.put("fullDocumentImage", SerializationUtils.encodeImageBase64(result.getFullDocumentImage()));
jsonResult.put("inventoryNumber", result.getInventoryNumber());
jsonResult.put("validThru", SerializationUtils.serializeDate(result.getValidThru()));
jsonResult.put("mrzResult", BlinkIDSerializationUtils.serializeMrzResult(result.getMrzResult()));
jsonResult.put("passportNumber", result.getPassportNumber());
} catch (JSONException e) {
// see https://developer.android.com/reference/org/json/JSONException
throw new RuntimeException(e);
Expand All @@ -42,11 +41,11 @@ public JSONObject serializeResult(Recognizer<?, ?> recognizer) {

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

@Override
public Class<?> getRecognizerClass() {
return com.microblink.entities.recognizers.blinkid.elitepaymentcard.ElitePaymentCardBackRecognizer.class;
return com.microblink.entities.recognizers.blinkid.brunei.BruneiTemporaryResidencePermitBackRecognizer.class;
}
}
Loading

0 comments on commit 3e7c3d2

Please sign in to comment.