From b3d784792641aa985fb2e975f4d72ef62b6b5eba Mon Sep 17 00:00:00 2001 From: mparadina Date: Thu, 21 Dec 2023 10:38:50 +0100 Subject: [PATCH 1/4] 6.4 release --- .../BlinkIDSerializationUtils.java | 29 +++++++++++----- ...inkIdMultiSideRecognizerSerialization.java | 4 +-- ...nkIdSingleSideRecognizerSerialization.java | 4 +-- .../ios/sources/MBBlinkIDSerializationUtils.m | 3 +- .../src/ios/sources/MBSerializationUtils.m | 6 ++-- .../MBBlinkIdOverlaySettingsSerialization.m | 3 +- BlinkID/www/blinkIdScanner.js | 34 +++++++++++++++++++ 7 files changed, 62 insertions(+), 21 deletions(-) diff --git a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/recognizers/serialization/BlinkIDSerializationUtils.java b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/recognizers/serialization/BlinkIDSerializationUtils.java index 8d51426..1b96a34 100644 --- a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/recognizers/serialization/BlinkIDSerializationUtils.java +++ b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/recognizers/serialization/BlinkIDSerializationUtils.java @@ -27,6 +27,8 @@ import com.microblink.blinkid.entities.recognizers.blinkid.generic.classinfo.Region; import com.microblink.blinkid.entities.recognizers.blinkid.generic.classinfo.Type; import com.microblink.blinkid.entities.recognizers.blinkid.generic.AlphabetType; +import com.microblink.blinkid.entities.recognizers.blinkid.generic.Side; +import com.microblink.blinkid.entities.recognizers.blinkid.generic.imageanalysis.CardRotation; import org.json.JSONArray; import org.json.JSONException; @@ -120,6 +122,7 @@ public static JSONObject serializeImageAnalysisResult(ImageAnalysisResult imageA jsonImageAnalysis.put("faceDetectionStatus", SerializationUtils.serializeEnum(imageAnalysisResult.getFaceDetectionStatus())); jsonImageAnalysis.put("mrzDetectionStatus", SerializationUtils.serializeEnum(imageAnalysisResult.getMrzDetectionStatus())); jsonImageAnalysis.put("barcodeDetectionStatus", SerializationUtils.serializeEnum(imageAnalysisResult.getBarcodeDetectionStatus())); + jsonImageAnalysis.put("cardRotation", BlinkIDSerializationUtils.serializeCardRotation(imageAnalysisResult.getCardRotation())); return jsonImageAnalysis; } @@ -274,15 +277,9 @@ public static JSONObject serializeStringResult(StringResult stringResult) throws jsonStringResult.put("location", jsonFieldLocations); JSONObject jsonDocumentSides = new JSONObject(); - if (stringResult.side(AlphabetType.Latin) != null) { - jsonDocumentSides.put("latin",stringResult.side(AlphabetType.Latin).ordinal()); - } - if (stringResult.side(AlphabetType.Arabic) != null) { - jsonDocumentSides.put("arabic",stringResult.side(AlphabetType.Arabic).ordinal()); - } - if (stringResult.side(AlphabetType.Cyrillic) != null) { - jsonDocumentSides.put("cyrillic",stringResult.side(AlphabetType.Cyrillic).ordinal()); - } + jsonDocumentSides.put("latin",serializeSide(stringResult.side(AlphabetType.Latin))); + jsonDocumentSides.put("arabic",serializeSide(stringResult.side(AlphabetType.Arabic))); + jsonDocumentSides.put("cyrillic",serializeSide(stringResult.side(AlphabetType.Cyrillic))); jsonStringResult.put("side", jsonDocumentSides); } return jsonStringResult; @@ -308,6 +305,20 @@ public static JSONObject serializeAdditionalProcessingInfo(AdditionalProcessingI return jsonAdditionalProcessingInfo; } + public static int serializeSide(Side side) { + if (side != null) { + return side.ordinal() + 1; + } + return 0; + } + + public static int serializeCardRotation(CardRotation rotation) { + if (rotation != null) { + return rotation.ordinal(); + } + return 4; + } + public static ClassAnonymizationSettings[] deserializeClassAnonymizationSettings (JSONArray jsonArray) { if (jsonArray != null && jsonArray.length() > 0) { diff --git a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/recognizers/serialization/BlinkIdMultiSideRecognizerSerialization.java b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/recognizers/serialization/BlinkIdMultiSideRecognizerSerialization.java index 970c520..f123114 100644 --- a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/recognizers/serialization/BlinkIdMultiSideRecognizerSerialization.java +++ b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/recognizers/serialization/BlinkIdMultiSideRecognizerSerialization.java @@ -67,9 +67,7 @@ public JSONObject serializeResult(Recognizer recognizer) { jsonResult.put("expired", result.isExpired()); jsonResult.put("faceImage", SerializationUtils.encodeImageBase64(result.getFaceImage())); jsonResult.put("faceImageLocation", SerializationUtils.serializeRectangle(result.getFaceImageLocation())); - if (result.getFaceImageSide() != null) { - jsonResult.put("faceImageSide", SerializationUtils.serializeEnum(result.getFaceImageSide())); - } + jsonResult.put("faceImageSide", BlinkIDSerializationUtils.serializeSide(result.getFaceImageSide())); jsonResult.put("fathersName", BlinkIDSerializationUtils.serializeStringResult(result.getFathersName())); jsonResult.put("firstName", BlinkIDSerializationUtils.serializeStringResult(result.getFirstName())); jsonResult.put("frontAdditionalProcessingInfo", BlinkIDSerializationUtils.serializeAdditionalProcessingInfo(result.getFrontAdditionalProcessingInfo())); diff --git a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/recognizers/serialization/BlinkIdSingleSideRecognizerSerialization.java b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/recognizers/serialization/BlinkIdSingleSideRecognizerSerialization.java index 3c3e878..982f6b8 100644 --- a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/recognizers/serialization/BlinkIdSingleSideRecognizerSerialization.java +++ b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/recognizers/serialization/BlinkIdSingleSideRecognizerSerialization.java @@ -60,9 +60,7 @@ public JSONObject serializeResult(Recognizer recognizer) { jsonResult.put("expired", result.isExpired()); jsonResult.put("faceImage", SerializationUtils.encodeImageBase64(result.getFaceImage())); jsonResult.put("faceImageLocation", SerializationUtils.serializeRectangle(result.getFaceImageLocation())); - if (result.getFaceImageSide() != null) { - jsonResult.put("faceImageSide", SerializationUtils.serializeEnum(result.getFaceImageSide())); - } + jsonResult.put("faceImageSide", BlinkIDSerializationUtils.serializeSide(result.getFaceImageSide())); jsonResult.put("fathersName", BlinkIDSerializationUtils.serializeStringResult(result.getFathersName())); jsonResult.put("firstName", BlinkIDSerializationUtils.serializeStringResult(result.getFirstName())); jsonResult.put("fullDocumentImage", SerializationUtils.encodeImageBase64(result.getFullDocumentImage())); diff --git a/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m b/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m index fde8002..fe6a5e1 100644 --- a/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m +++ b/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m @@ -213,7 +213,8 @@ +(NSDictionary *) serializeImageAnalysisResult:(MBImageAnalysisResult *)imageAna @"documentImageMoireStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.documentImageMoireStatus)], @"faceDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.faceDetectionStatus)], @"mrzDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.mrzDetectionStatus)], - @"barcodeDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.barcodeDetectionStatus)] + @"barcodeDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.barcodeDetectionStatus)], + @"cardRotation" : [NSNumber numberWithInteger:(imageAnalysisResult.cardRotation)] }; } diff --git a/BlinkID/src/ios/sources/MBSerializationUtils.m b/BlinkID/src/ios/sources/MBSerializationUtils.m index 0e4e25d..765d3b8 100644 --- a/BlinkID/src/ios/sources/MBSerializationUtils.m +++ b/BlinkID/src/ios/sources/MBSerializationUtils.m @@ -44,9 +44,9 @@ + (NSDictionary *)serializeMBStringResult:(MBStringResult *) value { [dict setValue:location forKey:@"location"]; NSMutableDictionary *side = [NSMutableDictionary dictionary]; - [side setValue:[MBSerializationUtils serializeMBSide:[value sideForAlphabetType:MBAlphabetTypeLatin]] forKey:@"latin"]; - [side setValue:[MBSerializationUtils serializeMBSide:[value sideForAlphabetType:MBAlphabetTypeLatin]] forKey:@"arabic"]; - [side setValue:[MBSerializationUtils serializeMBSide:[value sideForAlphabetType:MBAlphabetTypeLatin]] forKey:@"cyrillic"]; + [side setValue:[NSNumber numberWithInteger:[value sideForAlphabetType:MBAlphabetTypeLatin]] forKey:@"latin"]; + [side setValue:[NSNumber numberWithInteger:[value sideForAlphabetType:MBAlphabetTypeArabic]] forKey:@"arabic"]; + [side setValue:[NSNumber numberWithInteger:[value sideForAlphabetType:MBAlphabetTypeCyrillic]] forKey:@"cyrillic"]; [dict setValue:side forKey:@"side"]; return dict; diff --git a/BlinkID/src/ios/sources/Overlays/Serialization/MBBlinkIdOverlaySettingsSerialization.m b/BlinkID/src/ios/sources/Overlays/Serialization/MBBlinkIdOverlaySettingsSerialization.m index 6286e0d..6c24aea 100644 --- a/BlinkID/src/ios/sources/Overlays/Serialization/MBBlinkIdOverlaySettingsSerialization.m +++ b/BlinkID/src/ios/sources/Overlays/Serialization/MBBlinkIdOverlaySettingsSerialization.m @@ -189,12 +189,11 @@ -(MBOverlayViewController *) createOverlayViewController:(NSDictionary *)jsonOve { id onboardingButtonTooltipDelay = [jsonOverlaySettings valueForKey:@"onboardingButtonTooltipDelay"]; if (onboardingButtonTooltipDelay != nil) { - sett.onboardingButtonTooltipDelay = [onboardingButtonTooltipDelay doubleValue] / 10000.0; + sett.onboardingButtonTooltipDelay = [onboardingButtonTooltipDelay doubleValue] / 1000.0; } } { - id showMandatoryFieldsMissing = [jsonOverlaySettings valueForKey: @"showMandatoryFieldsMissing"]; if (showMandatoryFieldsMissing != nil) { sett.defineSpecificMissingMandatoryFields = [showMandatoryFieldsMissing boolValue]; diff --git a/BlinkID/www/blinkIdScanner.js b/BlinkID/www/blinkIdScanner.js index e78b8cd..6175c34 100644 --- a/BlinkID/www/blinkIdScanner.js +++ b/BlinkID/www/blinkIdScanner.js @@ -387,6 +387,28 @@ BlinkID.prototype.RecognitionMode = Object.freeze( } ); +/** + * Defines possible document card rotation positions + */ + BlinkID.prototype.CardRotation = Object.freeze( + { + /** Zero degrees */ + Zero: 0, + + /** Clockwise 90 degrees */ + Clockwise90: 1, + + /** Counter clockwise 90 degrees */ + CounterClockwise90: 2, + + /** Upside down */ + UpsideDown: 3, + + /** Card rotation was not performed */ + None: 4 + } +); + /** * Defines possible color and moire statuses determined from scanned image. */ @@ -405,6 +427,8 @@ function ImageAnalysisResult(nativeImageAnalysisResult) { this.barcodeDetectionStatus = nativeImageAnalysisResult.barcodeDetectionStatus; /** Orientation determined from the scanned image. */ this.cardOrientation = nativeImageAnalysisResult.cardOrientation; + /** Document card rotation positions */ + this.cardRotation = nativeImageAnalysisResult.cardRotation; } /** @@ -830,6 +854,14 @@ BlinkID.prototype.Region = Object.freeze( NorthwestTerritories: 121, Nunavut: 122, PrinceEdwardIsland: 123, + DistritoFederal: 124, + Maranhao: 125, + MatoGrosso: 126, + MinasGerais: 127, + Para: 128, + Parana: 129, + Pernambuco: 130, + SantaCatarina: 131, } ); @@ -898,6 +930,8 @@ BlinkID.prototype.Type = Object.freeze( SpecialId: 57, UniformedServicesId: 58, ImmigrantVisa: 59, + ConsularVoterId: 60, + TwicCard: 61, } ); From 66a45e34d7dd64b8e2a3e7af36ddba445b17263d Mon Sep 17 00:00:00 2001 From: mparadina Date: Thu, 21 Dec 2023 10:43:34 +0100 Subject: [PATCH 2/4] Update SDK version --- BlinkID/package.json | 2 +- BlinkID/plugin.xml | 2 +- BlinkID/scripts/initIOSFramework.sh | 15 +++++++++++---- BlinkID/src/android/libBlinkID.gradle | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/BlinkID/package.json b/BlinkID/package.json index 65648ea..d7f42ee 100644 --- a/BlinkID/package.json +++ b/BlinkID/package.json @@ -1,6 +1,6 @@ { "name": "blinkid-cordova", - "version": "6.3.1", + "version": "6.4.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 cf43c0e..35d7465 100644 --- a/BlinkID/plugin.xml +++ b/BlinkID/plugin.xml @@ -2,7 +2,7 @@ + version="6.4.0"> BlinkIdScanner A small and powerful ID card scanning library diff --git a/BlinkID/scripts/initIOSFramework.sh b/BlinkID/scripts/initIOSFramework.sh index 6618c4a..4cb221d 100755 --- a/BlinkID/scripts/initIOSFramework.sh +++ b/BlinkID/scripts/initIOSFramework.sh @@ -4,12 +4,19 @@ HERE="$(dirname "$(test -L "$0" && readlink "$0" || echo "$0")")" pushd "${HERE}/../src/ios/" > /dev/null -LINK='https://github.com/BlinkID/blinkid-ios/releases/download/v6.3.0/BlinkID.xcframework.zip' +LINK='https://github.com/BlinkID/blinkid-ios/releases/download/v6.4.0/BlinkID.xcframework.zip' FILENAME='BlinkID.xcframework.zip' -# check if BlinkID framework and bundle already exist -wget --version > /dev/null 2>&1 || { echo "ERROR: couldn't download BlinkID framework, install wget" && exit 1; } -wget -O "${FILENAME}" "${LINK}" -nv --show-progress || ( echo "ERROR: couldn't download BlinkID framework, Something went wrong while downloading framework from ${LINK}" && exit 1 ) +# BlinkID framework will be obtained via wget or curl +if which wget >/dev/null ; then + echo "Downloading BlinkID framework via wget:" + wget -O "${FILENAME}" "${LINK}" -nv --show-progress || ( echo "ERROR: couldn't download BlinkID framework, something went wrong while downloading framework from ${LINK}" && exit 1 ) +elif which curl >/dev/null ; then + echo "Downloading BlinkID framework via curl:" + curl -o "${FILENAME}" -L "${LINK}" --progress-bar --show-error || ( echo "ERROR: couldn't download BlinkID framework, something went wrong while downloading framework from ${LINK}" && exit 1 ) +else + echo "Couldn't download BlinkID framework, neither wget nor curl is available." +fi if [ -d 'BlinkID.bundle' ] ; then rm -rf BlinkID.bundle && echo "Removing BlinkID.bundle" diff --git a/BlinkID/src/android/libBlinkID.gradle b/BlinkID/src/android/libBlinkID.gradle index 086d0da..c15df66 100644 --- a/BlinkID/src/android/libBlinkID.gradle +++ b/BlinkID/src/android/libBlinkID.gradle @@ -6,7 +6,7 @@ repositories { } dependencies { - implementation('com.microblink:blinkid:6.3.0@aar') { + implementation('com.microblink:blinkid:6.4.0@aar') { transitive = true } } From d1fed22f45ce2bc64cb8dfcb3d397c01dbbd9e28 Mon Sep 17 00:00:00 2001 From: mparadina Date: Thu, 21 Dec 2023 10:45:40 +0100 Subject: [PATCH 3/4] License key update --- sample_files/www/js/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sample_files/www/js/index.js b/sample_files/www/js/index.js index e948e82..4fc9229 100644 --- a/sample_files/www/js/index.js +++ b/sample_files/www/js/index.js @@ -77,8 +77,8 @@ var app = { // package name/bundleID com.microblink.sample var licenseKeys = { - android: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUAbGV5SkRjbVZoZEdWa1QyNGlPakUyT1RrNU5qSXdNelkxTnpVc0lrTnlaV0YwWldSR2IzSWlPaUkwT1RabFpEQXpaUzAwT0RBeExUUXpZV1F0WVRrMU5DMDBNemMyWlRObU9UTTVNR1FpZlE9PR/xSZGfWMnKChCewgMM+aZNwdmuX3jYYQm7fny/fpCzBCXoRHTBmD/mqcRBPYlNovoa5DWNPLunVTjyq9kUxxGqQh3MmSxisksojMz7YZPtphYUmjqQRbrJOBDTUDIoC2+ZqdK4KkQgfaBYwtL8zDOqoRv0AcIUYDsEriFgNb91', - ios: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUBbGV5SkRjbVZoZEdWa1QyNGlPakUyT1RrNU5qSXdPRE15TmpFc0lrTnlaV0YwWldSR2IzSWlPaUkwT1RabFpEQXpaUzAwT0RBeExUUXpZV1F0WVRrMU5DMDBNemMyWlRObU9UTTVNR1FpZlE9PQ9q+vkq3TBpv3FH3lRotnl1YFD6n+Yy6ROfIFampMtAZME7BqLdjz42Bj5JvidAEUNtrvlQOgOdpwprPNecbQ6MmBUehXu70S6ugWeyIksYTFhwPYaHIDcbebeCjEJGN7+s+7TpMXD5iM/IlnDYc5s5fVvSeWZQ0qggG82OLn8z' + android: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUAbGV5SkRjbVZoZEdWa1QyNGlPakUzTURNd056Y3lNRE0xTWpnc0lrTnlaV0YwWldSR2IzSWlPaUkwT1RabFpEQXpaUzAwT0RBeExUUXpZV1F0WVRrMU5DMDBNemMyWlRObU9UTTVNR1FpZlE9PY6A6Eq56GBOfiH4PZYVCf1vcY3/GuHCOkdOhF5rUKHodDOB3Q01339g0q22TM/fWv5f06CvIiAamEhg1m8xAYWSQt2VVSsVJaAncz+bGexcASnuhlHA+LTLnSZGIxSgnNKBJbizQypDRsyFKKpBq7K2SfVi+gM=', + ios: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUBbGV5SkRjbVZoZEdWa1QyNGlPakUzTURNd056Y3hORFkzT1RJc0lrTnlaV0YwWldSR2IzSWlPaUkwT1RabFpEQXpaUzAwT0RBeExUUXpZV1F0WVRrMU5DMDBNemMyWlRObU9UTTVNR1FpZlE9PYPwAuE88FDjP95RyiGUewj+e6SGUoHitmTt0i2T87nVbH79ynAtPdmuQV49+U4ulln6j4ku3momxVE2igI9howeOZwxK5IbpMVG3ooDibChEXUccclpCCv08w3gEUwsP7hGOIBbA4HP45vru2nkan74SUYXWVU=' }; function buildResult(result, key) { From c407afddc370c431415038907c4090ce8dd7b453 Mon Sep 17 00:00:00 2001 From: mparadina Date: Thu, 21 Dec 2023 10:57:41 +0100 Subject: [PATCH 4/4] Update Release notes.md --- Release notes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Release notes.md b/Release notes.md index bbca112..5c8cc32 100644 --- a/Release notes.md +++ b/Release notes.md @@ -1,3 +1,6 @@ +## 6.4.0 +- Updated to [Android SDK v6.4.0](https://github.com/BlinkID/blinkid-android/releases/tag/v6.4.0) and [iOS SDK v6.4.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.4.0) + ## 6.3.0 - Updated to [Android SDK v6.3.0](https://github.com/BlinkID/blinkid-android/releases/tag/v6.3.0) and [iOS SDK v6.3.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.3.0)