diff --git a/BlinkID/package.json b/BlinkID/package.json index 27fcb93..35aefda 100644 --- a/BlinkID/package.json +++ b/BlinkID/package.json @@ -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", diff --git a/BlinkID/plugin.xml b/BlinkID/plugin.xml index a300fc5..208840e 100644 --- a/BlinkID/plugin.xml +++ b/BlinkID/plugin.xml @@ -2,7 +2,7 @@ + version="5.3.0"> BlinkIdScanner A small and powerful ID card scanning library @@ -68,6 +68,7 @@ + @@ -117,6 +118,7 @@ + @@ -126,6 +128,7 @@ + diff --git a/BlinkID/scripts/initIOSFramework.sh b/BlinkID/scripts/initIOSFramework.sh index f6ada3e..981ad93 100755 --- a/BlinkID/scripts/initIOSFramework.sh +++ b/BlinkID/scripts/initIOSFramework.sh @@ -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 diff --git a/BlinkID/src/android/java/com/phonegap/plugins/microblink/overlays/serialization/BlinkIdOverlaySettingsSerialization.java b/BlinkID/src/android/java/com/phonegap/plugins/microblink/overlays/serialization/BlinkIdOverlaySettingsSerialization.java index f750a39..809a49d 100644 --- a/BlinkID/src/android/java/com/phonegap/plugins/microblink/overlays/serialization/BlinkIdOverlaySettingsSerialization.java +++ b/BlinkID/src/android/java/com/phonegap/plugins/microblink/overlays/serialization/BlinkIdOverlaySettingsSerialization.java @@ -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 diff --git a/BlinkID/src/android/java/com/phonegap/plugins/microblink/overlays/serialization/DocumentVerificationOverlaySettingsSerialization.java b/BlinkID/src/android/java/com/phonegap/plugins/microblink/overlays/serialization/DocumentVerificationOverlaySettingsSerialization.java index 05fb9ed..cc7fc00 100644 --- a/BlinkID/src/android/java/com/phonegap/plugins/microblink/overlays/serialization/DocumentVerificationOverlaySettingsSerialization.java +++ b/BlinkID/src/android/java/com/phonegap/plugins/microblink/overlays/serialization/DocumentVerificationOverlaySettingsSerialization.java @@ -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) { @@ -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"; diff --git a/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/RecognizerSerializers.java b/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/RecognizerSerializers.java index 48f5092..01273ed 100644 --- a/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/RecognizerSerializers.java +++ b/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/RecognizerSerializers.java @@ -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()); diff --git a/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BlinkIdCombinedRecognizerSerialization.java b/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BlinkIdCombinedRecognizerSerialization.java index e436473..8e9bb72 100644 --- a/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BlinkIdCombinedRecognizerSerialization.java +++ b/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BlinkIdCombinedRecognizerSerialization.java @@ -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"))); @@ -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()); diff --git a/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BlinkIdRecognizerSerialization.java b/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BlinkIdRecognizerSerialization.java index d264bc8..816a042 100644 --- a/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BlinkIdRecognizerSerialization.java +++ b/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BlinkIdRecognizerSerialization.java @@ -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"))); @@ -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()); diff --git a/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/IdBarcodeRecognizerSerialization.java b/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/IdBarcodeRecognizerSerialization.java new file mode 100644 index 0000000..1f991b0 --- /dev/null +++ b/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/IdBarcodeRecognizerSerialization.java @@ -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; + } +} \ No newline at end of file diff --git a/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SerializationUtils.java b/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SerializationUtils.java index c6eaebd..57e4603 100644 --- a/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SerializationUtils.java +++ b/BlinkID/src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SerializationUtils.java @@ -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; + } } diff --git a/BlinkID/src/android/libBlinkID.gradle b/BlinkID/src/android/libBlinkID.gradle index 03f686f..bef4ccc 100644 --- a/BlinkID/src/android/libBlinkID.gradle +++ b/BlinkID/src/android/libBlinkID.gradle @@ -5,7 +5,7 @@ repositories { } dependencies { - implementation('com.microblink:blinkid:5.2.0@aar') { + implementation('com.microblink:blinkid:5.3.0@aar') { transitive = true } } diff --git a/BlinkID/src/ios/sources/Overlays/Serialization/MBBlinkIdOverlaySettingsSerialization.m b/BlinkID/src/ios/sources/Overlays/Serialization/MBBlinkIdOverlaySettingsSerialization.m index ec0e99d..6cda0f6 100644 --- a/BlinkID/src/ios/sources/Overlays/Serialization/MBBlinkIdOverlaySettingsSerialization.m +++ b/BlinkID/src/ios/sources/Overlays/Serialization/MBBlinkIdOverlaySettingsSerialization.m @@ -30,6 +30,104 @@ -(MBOverlayViewController *) createOverlayViewController:(NSDictionary *)jsonOve MBBlinkIdOverlaySettings *sett = [[MBBlinkIdOverlaySettings alloc] init]; self.delegate = delegate; + { + id firstSideInstructionsText = [jsonOverlaySettings valueForKey:@"firstSideInstructionsText"]; + if (firstSideInstructionsText != nil) { + sett.firstSideInstructionsText = (NSString *)firstSideInstructionsText; + } + } + + { + id flipInstructions = [jsonOverlaySettings valueForKey:@"flipInstructions"]; + if (flipInstructions != nil) { + sett.flipInstructions = (NSString *)flipInstructions; + } + } + + { + id errorMoveCloser = [jsonOverlaySettings valueForKey:@"errorMoveCloser"]; + if (errorMoveCloser != nil) { + sett.errorMoveCloser = (NSString *)errorMoveCloser; + } + } + + { + id errorMoveFarther = [jsonOverlaySettings valueForKey:@"errorMoveFarther"]; + if (errorMoveFarther != nil) { + sett.errorMoveFarther = (NSString *)errorMoveFarther; + } + } + + { + id sidesNotMatchingTitle = [jsonOverlaySettings valueForKey:@"sidesNotMatchingTitle"]; + if (sidesNotMatchingTitle != nil) { + sett.sidesNotMatchingTitle = (NSString *)sidesNotMatchingTitle; + } + } + + { + id sidesNotMatchingMessage = [jsonOverlaySettings valueForKey:@"sidesNotMatchingMessage"]; + if (sidesNotMatchingMessage != nil) { + sett.sidesNotMatchingMessage = (NSString *)sidesNotMatchingMessage; + } + } + + { + id unsupportedDocumentTitle = [jsonOverlaySettings valueForKey:@"unsupportedDocumentTitle"]; + if (unsupportedDocumentTitle != nil) { + sett.unsupportedDocumentTitle = (NSString *)unsupportedDocumentTitle; + } + } + + { + id unsupportedDocumentMessage = [jsonOverlaySettings valueForKey:@"unsupportedDocumentMessage"]; + if (unsupportedDocumentMessage != nil) { + sett.unsupportedDocumentMessage = (NSString *)unsupportedDocumentMessage; + } + } + + { + id recognitionTimeoutTitle = [jsonOverlaySettings valueForKey:@"recognitionTimeoutTitle"]; + if (recognitionTimeoutTitle != nil) { + sett.recognitionTimeoutTitle = (NSString *)recognitionTimeoutTitle; + } + } + + { + id recognitionTimeoutMessage = [jsonOverlaySettings valueForKey:@"recognitionTimeoutMessage"]; + if (recognitionTimeoutMessage != nil) { + sett.recognitionTimeoutMessage = (NSString *)recognitionTimeoutMessage; + } + } + + { + id retryButtonText = [jsonOverlaySettings valueForKey:@"retryButtonText"]; + if (retryButtonText != nil) { + sett.retryButtonText = (NSString *)retryButtonText; + } + } + + { + id requireDocumentSidesDataMatch = [jsonOverlaySettings valueForKey:@"requireDocumentSidesDataMatch"]; + if (requireDocumentSidesDataMatch != nil) { + sett.requireDocumentSidesDataMatch = [requireDocumentSidesDataMatch boolValue]; + } + } + + { + id showNotSupportedDialog = [jsonOverlaySettings valueForKey:@"showNotSupportedDialog"]; + if (showNotSupportedDialog != nil) { + sett.showNotSupportedDialog = [showNotSupportedDialog boolValue]; + } + } + + { + id backSideScanningTimeoutMilliseconds = [jsonOverlaySettings valueForKey:@"backSideScanningTimeoutMilliseconds"]; + if (backSideScanningTimeoutMilliseconds != nil) { + sett.backSideScanningTimeout = [backSideScanningTimeoutMilliseconds doubleValue] / 1000.0; + } + } + return [[MBBlinkIdOverlayViewController alloc] initWithSettings:sett recognizerCollection:recognizerCollection delegate:self]; } diff --git a/BlinkID/src/ios/sources/Recognizers/MBRecognizerSerializers.m b/BlinkID/src/ios/sources/Recognizers/MBRecognizerSerializers.m index d67dcc6..539c06e 100644 --- a/BlinkID/src/ios/sources/Recognizers/MBRecognizerSerializers.m +++ b/BlinkID/src/ios/sources/Recognizers/MBRecognizerSerializers.m @@ -5,6 +5,7 @@ #import "MBBlinkIdCombinedRecognizerWrapper.h" #import "MBBlinkIdRecognizerWrapper.h" #import "MBDocumentFaceRecognizerWrapper.h" +#import "MBIdBarcodeRecognizerWrapper.h" #import "MBMrtdCombinedRecognizerWrapper.h" #import "MBMrtdRecognizerWrapper.h" #import "MBPassportRecognizerWrapper.h" @@ -33,6 +34,7 @@ - (instancetype)init { [self registerCreator:[[MBBlinkIdCombinedRecognizerCreator alloc] init]]; [self registerCreator:[[MBBlinkIdRecognizerCreator alloc] init]]; [self registerCreator:[[MBDocumentFaceRecognizerCreator alloc] init]]; + [self registerCreator:[[MBIdBarcodeRecognizerCreator alloc] init]]; [self registerCreator:[[MBMrtdCombinedRecognizerCreator alloc] init]]; [self registerCreator:[[MBMrtdRecognizerCreator alloc] init]]; [self registerCreator:[[MBPassportRecognizerCreator alloc] init]]; diff --git a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdCombinedRecognizerWrapper.m b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdCombinedRecognizerWrapper.m index c66d622..3fa3175 100644 --- a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdCombinedRecognizerWrapper.m +++ b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdCombinedRecognizerWrapper.m @@ -22,6 +22,18 @@ -(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer { recognizer.allowBlurFilter = [(NSNumber *)allowBlurFilter boolValue]; } } + { + id allowUnparsedMrzResults = [jsonRecognizer valueForKey:@"allowUnparsedMrzResults"]; + if (allowUnparsedMrzResults != nil) { + recognizer.allowUnparsedMrzResults = [(NSNumber *)allowUnparsedMrzResults boolValue]; + } + } + { + id allowUnverifiedMrzResults = [jsonRecognizer valueForKey:@"allowUnverifiedMrzResults"]; + if (allowUnverifiedMrzResults != nil) { + recognizer.allowUnverifiedMrzResults = [(NSNumber *)allowUnverifiedMrzResults boolValue]; + } + } { id faceImageDpi = [jsonRecognizer valueForKey:@"faceImageDpi"]; if (faceImageDpi != nil) { @@ -77,6 +89,7 @@ -(NSDictionary *) serializeResult { [jsonResult setValue:self.result.conditions forKey:@"conditions"]; [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"]; [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"]; + [jsonResult setValue:[NSNumber numberWithBool:self.result.dateOfExpiryPermanent] forKey:@"dateOfExpiryPermanent"]; [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfIssue] forKey:@"dateOfIssue"]; [jsonResult setValue:[self.result.digitalSignature base64EncodedStringWithOptions:0] forKey:@"digitalSignature"]; [jsonResult setValue:[NSNumber numberWithUnsignedInteger:self.result.digitalSignatureVersion] forKey:@"digitalSignatureVersion"]; diff --git a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdRecognizerWrapper.m b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdRecognizerWrapper.m index 3fd6065..5779782 100644 --- a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdRecognizerWrapper.m +++ b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdRecognizerWrapper.m @@ -22,6 +22,18 @@ -(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer { recognizer.allowBlurFilter = [(NSNumber *)allowBlurFilter boolValue]; } } + { + id allowUnparsedMrzResults = [jsonRecognizer valueForKey:@"allowUnparsedMrzResults"]; + if (allowUnparsedMrzResults != nil) { + recognizer.allowUnparsedMrzResults = [(NSNumber *)allowUnparsedMrzResults boolValue]; + } + } + { + id allowUnverifiedMrzResults = [jsonRecognizer valueForKey:@"allowUnverifiedMrzResults"]; + if (allowUnverifiedMrzResults != nil) { + recognizer.allowUnverifiedMrzResults = [(NSNumber *)allowUnverifiedMrzResults boolValue]; + } + } { id faceImageDpi = [jsonRecognizer valueForKey:@"faceImageDpi"]; if (faceImageDpi != nil) { @@ -71,6 +83,7 @@ -(NSDictionary *) serializeResult { [jsonResult setValue:self.result.conditions forKey:@"conditions"]; [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"]; [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"]; + [jsonResult setValue:[NSNumber numberWithBool:self.result.dateOfExpiryPermanent] forKey:@"dateOfExpiryPermanent"]; [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfIssue] forKey:@"dateOfIssue"]; [jsonResult setValue:self.result.documentAdditionalNumber forKey:@"documentAdditionalNumber"]; [jsonResult setValue:self.result.documentNumber forKey:@"documentNumber"]; diff --git a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBIdBarcodeRecognizerWrapper.h b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBIdBarcodeRecognizerWrapper.h new file mode 100644 index 0000000..84aab31 --- /dev/null +++ b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBIdBarcodeRecognizerWrapper.h @@ -0,0 +1,6 @@ +#import "MBRecognizerWrapper.h" +#import + +@interface MBIdBarcodeRecognizerCreator : NSObject + +@end \ No newline at end of file diff --git a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBIdBarcodeRecognizerWrapper.m b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBIdBarcodeRecognizerWrapper.m new file mode 100644 index 0000000..cf9a634 --- /dev/null +++ b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBIdBarcodeRecognizerWrapper.m @@ -0,0 +1,63 @@ +#import "MBIdBarcodeRecognizerWrapper.h" +#import "MBSerializationUtils.h" +#import "MBBlinkIDSerializationUtils.h" + +@implementation MBIdBarcodeRecognizerCreator + +@synthesize jsonName = _jsonName; + +-(instancetype) init { + self = [super init]; + if (self) { + _jsonName = @"IdBarcodeRecognizer"; + } + return self; +} + +-(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer { + MBIdBarcodeRecognizer *recognizer = [[MBIdBarcodeRecognizer alloc] init]; + + return recognizer; +} + +@end + +@interface MBIdBarcodeRecognizer (JsonSerialization) +@end + +@implementation MBIdBarcodeRecognizer (JsonSerialization) + +-(NSDictionary *) serializeResult { + NSMutableDictionary* jsonResult = (NSMutableDictionary*)[super serializeResult]; + [jsonResult setValue:self.result.additionalAddressInformation forKey:@"additionalAddressInformation"]; + [jsonResult setValue:self.result.additionalNameInformation forKey:@"additionalNameInformation"]; + [jsonResult setValue:self.result.address forKey:@"address"]; + [jsonResult setValue:[NSNumber numberWithInteger:(self.result.barcodeType + 1)] forKey:@"barcodeType"]; + [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"]; + [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"]; + [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfIssue] forKey:@"dateOfIssue"]; + [jsonResult setValue:self.result.documentAdditionalNumber forKey:@"documentAdditionalNumber"]; + [jsonResult setValue:self.result.documentNumber forKey:@"documentNumber"]; + [jsonResult setValue:[NSNumber numberWithInteger:(self.result.documentType + 1)] forKey:@"documentType"]; + [jsonResult setValue:self.result.employer forKey:@"employer"]; + [jsonResult setValue:self.result.firstName forKey:@"firstName"]; + [jsonResult setValue:self.result.fullName forKey:@"fullName"]; + [jsonResult setValue:self.result.issuingAuthority forKey:@"issuingAuthority"]; + [jsonResult setValue:self.result.lastName forKey:@"lastName"]; + [jsonResult setValue:self.result.maritalStatus forKey:@"maritalStatus"]; + [jsonResult setValue:self.result.nationality forKey:@"nationality"]; + [jsonResult setValue:self.result.personalIdNumber forKey:@"personalIdNumber"]; + [jsonResult setValue:self.result.placeOfBirth forKey:@"placeOfBirth"]; + [jsonResult setValue:self.result.profession forKey:@"profession"]; + [jsonResult setValue:self.result.race forKey:@"race"]; + [jsonResult setValue:[self.result.rawData base64EncodedStringWithOptions:0] forKey:@"rawData"]; + [jsonResult setValue:self.result.religion forKey:@"religion"]; + [jsonResult setValue:self.result.residentialStatus forKey:@"residentialStatus"]; + [jsonResult setValue:self.result.sex forKey:@"sex"]; + [jsonResult setValue:self.result.stringData forKey:@"stringData"]; + [jsonResult setValue:[NSNumber numberWithBool:self.result.uncertain] forKey:@"uncertain"]; + + return jsonResult; +} + +@end \ No newline at end of file diff --git a/BlinkID/www/blinkIdScanner.js b/BlinkID/www/blinkIdScanner.js index 2f1d813..6e7474c 100644 --- a/BlinkID/www/blinkIdScanner.js +++ b/BlinkID/www/blinkIdScanner.js @@ -215,6 +215,34 @@ BlinkID.prototype.MrtdDocumentType = Object.freeze( } ); +/** + * Possible types of documents scanned with IdBarcodeRecognizer. + */ +BlinkID.prototype.IdBarcodeDocumentType = Object.freeze( + { + /** No document was scanned */ + None: 1, + /** AAMVACompliant document was scanned */ + AAMVACompliant: 2, + /** Argentina ID document was scanned */ + ArgentinaID: 3, + /** Argentina driver license document was scanned */ + ArgentinaDL: 4, + /** Colombia ID document was scanned */ + ColombiaID: 5, + /** Colombia driver license document was scanned */ + ColombiaDL: 6, + /** NigeriaVoter ID document was scanned */ + NigeriaVoterID: 7, + /** Nigeria driver license document was scanned */ + NigeriaDL: 8, + /** Panama ID document was scanned */ + PanamaID: 9, + /** SouthAfrica ID document was scanned */ + SouthAfricaID: 10 + } +); + /** * Represents data extracted from MRZ (Machine Readable Zone) of Machine Readable Travel Document (MRTD). */ @@ -455,6 +483,82 @@ BlinkID.prototype.DocumentVerificationOverlaySettings = DocumentVerificationOver */ function BlinkIdOverlaySettings() { OverlaySettings.call(this, 'BlinkIdOverlaySettings'); + /** + * String: message that is shown while scanning first side of the document. + * If null, default value will be used. + */ + this.firstSideInstructionsText = null; + /** + * String: instructions to flip document, shown when scanning of the first side is done, before scanning the second + * side of the document. + * If null, default value will be used. + */ + this.flipInstructions = null; + /** + * String: instructions for the user to move the document closer. + * If null, default value will be used. + */ + this.errorMoveCloser = null; + /** + * String: instructions for the user to move the document farther. + * If null, default value will be used. + */ + this.errorMoveFarther = null; + /** + * String: title of the dialog, which is shown when scanned document sides are not from the same document. + * If null, default value will be used. + */ + this.sidesNotMatchingTitle = null; + /** + * String: message inside dialog, which is shown when scanned document sides are not from the same document. + * If null, default value will be used. + */ + this.sidesNotMatchingMessage = null; + /** + * String: title of the dialog, which is shown when unsupported document is scanned. + * If null, default value will be used. + */ + this.unsupportedDocumentTitle = null; + /** + * String: message inside dialog, which is shown when unsupported document is scanned. + * If null, default value will be used. + */ + this.unsupportedDocumentMessage = null; + /** + * String: title of the dialog, which is shown on timeout when scanning is stuck on the back document side. + * If null, default value will be used. + */ + this.recognitionTimeoutTitle = null; + /** + * String: message inside dialog, which is shown on timeout when scanning is stuck on the back document side. + * If null, default value will be used. + */ + this.recognitionTimeoutMessage = null; + /** + * String: text of the "retry" button inside dialog, which is shown on timeout when scanning is stuck on the back + * document side. + */ + this.retryButtonText = null; + + /** + * If true, BlinkIdCombinedRecognizer will check if sides do match when scanning is finished + * Default: true + */ + this.requireDocumentSidesDataMatch = true; + + /** + * Defines whether Document Not Supported dialog will be displayed in UI. + * + * Default: true + */ + this.showNotSupportedDialog = true; + + /** + * Option to configure back side scanning timeout. + * + * Default: 17000 + */ + this.backSideScanningTimeoutMilliseconds = 17000; } BlinkIdOverlaySettings.prototype = new OverlaySettings(); @@ -535,6 +639,11 @@ function BlinkIdCombinedRecognizerResult(nativeResult) { */ this.dateOfExpiry = nativeResult.dateOfExpiry != null ? new Date(nativeResult.dateOfExpiry) : null; + /** + * Determines if date of expiry is permanent. + */ + this.dateOfExpiryPermanent = nativeResult.dateOfExpiryPermanent; + /** * The date of issue of the document. */ @@ -693,6 +802,21 @@ function BlinkIdCombinedRecognizer() { */ this.allowBlurFilter = true; + /** + * Defines whether returning of unparsed MRZ (Machine Readable Zone) results is allowed + * + * + */ + this.allowUnparsedMrzResults = false; + + /** + * Defines whether returning unverified MRZ (Machine Readable Zone) results is allowed + * Unverified MRZ is parsed, but check digits are incorrect + * + * + */ + this.allowUnverifiedMrzResults = true; + /** * Document not supported classifier delegate */ @@ -792,6 +916,11 @@ function BlinkIdRecognizerResult(nativeResult) { */ this.dateOfExpiry = nativeResult.dateOfExpiry != null ? new Date(nativeResult.dateOfExpiry) : null; + /** + * Determines if date of expiry is permanent. + */ + this.dateOfExpiryPermanent = nativeResult.dateOfExpiryPermanent; + /** * The date of issue of the document. */ @@ -921,6 +1050,21 @@ function BlinkIdRecognizer() { */ this.allowBlurFilter = true; + /** + * Defines whether returning of unparsed MRZ (Machine Readable Zone) results is allowed + * + * + */ + this.allowUnparsedMrzResults = false; + + /** + * Defines whether returning unverified MRZ (Machine Readable Zone) results is allowed + * Unverified MRZ is parsed, but check digits are incorrect + * + * + */ + this.allowUnverifiedMrzResults = true; + /** * Document not supported classifier delegate */ @@ -1080,6 +1224,172 @@ DocumentFaceRecognizer.prototype = new Recognizer('DocumentFaceRecognizer'); BlinkID.prototype.DocumentFaceRecognizer = DocumentFaceRecognizer; +/** + * Result object for IdBarcodeRecognizer. + */ +function IdBarcodeRecognizerResult(nativeResult) { + RecognizerResult.call(this, nativeResult.resultState); + + /** + * THe additional address information of the document owner. + */ + this.additionalAddressInformation = nativeResult.additionalAddressInformation; + + /** + * The additional name information of the document owner. + */ + this.additionalNameInformation = nativeResult.additionalNameInformation; + + /** + * The address of the document owner. + */ + this.address = nativeResult.address; + + /** + * Type of the barcode scanned + * + * @return Type of the barcode + */ + this.barcodeType = nativeResult.barcodeType; + + /** + * The date of birth of the document owner. + */ + this.dateOfBirth = nativeResult.dateOfBirth != null ? new Date(nativeResult.dateOfBirth) : null; + + /** + * The date of expiry of the document. + */ + this.dateOfExpiry = nativeResult.dateOfExpiry != null ? new Date(nativeResult.dateOfExpiry) : null; + + /** + * The date of issue of the document. + */ + this.dateOfIssue = nativeResult.dateOfIssue != null ? new Date(nativeResult.dateOfIssue) : null; + + /** + * The additional number of the document. + */ + this.documentAdditionalNumber = nativeResult.documentAdditionalNumber; + + /** + * The document number. + */ + this.documentNumber = nativeResult.documentNumber; + + /** + * The document type deduced from the recognized barcode + * + * @return Type of the document + */ + this.documentType = nativeResult.documentType; + + /** + * The employer of the document owner. + */ + this.employer = nativeResult.employer; + + /** + * The first name of the document owner. + */ + this.firstName = nativeResult.firstName; + + /** + * The full name of the document owner. + */ + this.fullName = nativeResult.fullName; + + /** + * The issuing authority of the document. + */ + this.issuingAuthority = nativeResult.issuingAuthority; + + /** + * The last name of the document owner. + */ + this.lastName = nativeResult.lastName; + + /** + * The marital status of the document owner. + */ + this.maritalStatus = nativeResult.maritalStatus; + + /** + * The nationality of the documet owner. + */ + this.nationality = nativeResult.nationality; + + /** + * The personal identification number. + */ + this.personalIdNumber = nativeResult.personalIdNumber; + + /** + * The place of birth of the document owner. + */ + this.placeOfBirth = nativeResult.placeOfBirth; + + /** + * The profession of the document owner. + */ + this.profession = nativeResult.profession; + + /** + * The race of the document owner. + */ + this.race = nativeResult.race; + + /** + * Byte array with result of the scan + */ + this.rawData = nativeResult.rawData; + + /** + * The religion of the document owner. + */ + this.religion = nativeResult.religion; + + /** + * The residential stauts of the document owner. + */ + this.residentialStatus = nativeResult.residentialStatus; + + /** + * The sex of the document owner. + */ + this.sex = nativeResult.sex; + + /** + * Retrieves string content of scanned data + */ + this.stringData = nativeResult.stringData; + + /** + * Flag indicating uncertain scanning data + * E.g obtained from damaged barcode. + */ + this.uncertain = nativeResult.uncertain; + +} + +IdBarcodeRecognizerResult.prototype = new RecognizerResult(RecognizerResultState.empty); + +BlinkID.prototype.IdBarcodeRecognizerResult = IdBarcodeRecognizerResult; + +/** + * The ID Barcode Recognizer is used for scanning ID Barcode. + */ +function IdBarcodeRecognizer() { + Recognizer.call(this, 'IdBarcodeRecognizer'); + + this.createResultFromNative = function (nativeResult) { return new IdBarcodeRecognizerResult(nativeResult); } + +} + +IdBarcodeRecognizer.prototype = new Recognizer('IdBarcodeRecognizer'); + +BlinkID.prototype.IdBarcodeRecognizer = IdBarcodeRecognizer; + /** * Result object for MrtdCombinedRecognizer. */ diff --git a/Release notes.md b/Release notes.md index dd86f12..0b994fc 100644 --- a/Release notes.md +++ b/Release notes.md @@ -1,3 +1,6 @@ +## 5.3.0 +- Updated to [Android SDK v5.3.0](https://github.com/BlinkID/blinkid-android/releases/tag/v5.3.0) and [iOS SDK v5.3.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v5.3.0) + ## 5.2.0 - Updated to [Android SDK v5.2.0](https://github.com/BlinkID/blinkid-android/releases/tag/v5.2.0) and [iOS SDK v5.2.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v5.2.0) diff --git a/www/js/index.js b/www/js/index.js index 0c88c13..4747114 100644 --- a/www/js/index.js +++ b/www/js/index.js @@ -77,8 +77,8 @@ var app = { // package name/bundleID com.microblink.blinkid var licenseKeys = { - android: 'sRwAAAAWY29tLm1pY3JvYmxpbmsuYmxpbmtpZJ9ew00uWSf86/uxZPNsLDMPOXp1UdfNmlUhMvov7pQ2BPKxOQvgd4e4Gq8RsexLqNUV2HhUZLqsiNT6ZAeHBVSxNtCrxML/LzmtQ6UKkvp2E2vWX8aJtT/kO2dwzuFCs+cRjYFCWs+XS3OGudt53wBMkMtyPE2rpnl7GwUEmQ5lhd/kmeYjKspGNRohQPFcfaGXalD2fudh24WIfP7sgxEWda/PvdrMaBRoaX3OxvFLWcsLHyGBMxrQjBq7P0VDlJ/HCAJMtH4m9fzhWw==', - ios: 'sRwAAAEWY29tLm1pY3JvYmxpbmsuYmxpbmtpZFG2rW9X4lA0y++pNb4tS3UVrd+YrVNFzG8W5Mj3ralCcPA9yeD2S5a+daBzhkQAGz1UMQSg7ijGZWIfDyUOjQSV91Uqh7GybSLCnHnsYYPEvEqOcq8z54hQH9uhXZQXMCTMup5P7P/9Sf2Kg9RW5g0j5D8KtVeewqtNrRX/ftcym49exqfskkg2edxg1geNHWLNjTM3s1rTAverP53r8O3RgolUH7M4isUUlGumkq2L0PckLZ+Kww2w04Aq3cJsdF0XIBhej3CgOOIySQ==' + android: 'sRwAAAAWY29tLm1pY3JvYmxpbmsuYmxpbmtpZJ9ew00uWSf86/uxZPcMKzOCNNOy1ec0P/CixHhywcBYQmwd+wBLbX2mC5NlGNNjn0lNhi/MLrhrgSnzM6A/8DGefBZxOPulaHIkWnWmEvoNq/i9juev6f/4NfVdz1awHmPlGAI2DoYx5ClLcZPvxXONDstVdgnYBO8D3sSY1S1ruae7+cw34L+gSZh2Fp3FWhKI5LG1ALEblkWduzXRYVYx+MjToUNUhxGKefxgSPHaHYEBayecx8u0eP8SNfQcC2rGYxWLXQkqcjVga0a7kQ==', + ios: 'sRwAAAEWY29tLm1pY3JvYmxpbmsuYmxpbmtpZFG2rW9X4lA0y++pNbrNSXU9j08ergMPUmsCXxJMGTuECq91Y5sRP4fq0pZb069yM4V5US2psR7OeYLwjmZr9ixYrpnRWdFFRqO9730tCFmdrK2ZAstMXEBBcLqGI8z9dJwT8eFQlv4caQmAlzTLl0c7VmbKl+ysb8XBQsjUcIv6lwUksFIkt9nBBVrCduzev8HvKwKQw7kmm/xXrcrNxHWzkwgum7r3D5rsFf9cJapU9zoltHdwyyUdcBONELtK1mZvvS6lTGsfebW2F+0pHw==' }; scanButton.addEventListener('click', function() {