Skip to content

Commit

Permalink
Merge pull request #105 from BlinkID/release/v4.9.0
Browse files Browse the repository at this point in the history
Release/v4.9.0
  • Loading branch information
juraskrlec authored Apr 26, 2019
2 parents e683555 + 21fbeda commit c9e11bd
Show file tree
Hide file tree
Showing 16 changed files with 251 additions and 6 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.8.0",
"version": "4.9.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="4.8.0">
version="4.9.0">

<name>BlinkIdScanner</name>
<description>A small and powerful ID card scanning library</description>
Expand Down Expand Up @@ -138,6 +138,7 @@
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BruneiTemporaryResidencePermitFrontRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SloveniaCombinedRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SingaporeDlFrontRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/PassportRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/EudlRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/CroatiaCombinedRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SingaporeChangiEmployeeIdRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
Expand Down Expand Up @@ -270,6 +271,7 @@
<header-file src="src/ios/sources/Recognizers/Wrappers/MBSloveniaIdFrontRecognizerWrapper.h" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBPolandCombinedRecognizerWrapper.m" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBSlovakiaIdBackRecognizerWrapper.m" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBPassportRecognizerWrapper.m" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBAustriaIdFrontRecognizerWrapper.m" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBSlovakiaIdFrontRecognizerWrapper.m" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBSwitzerlandPassportRecognizerWrapper.m" />
Expand Down Expand Up @@ -381,6 +383,7 @@
<header-file src="src/ios/sources/Recognizers/Wrappers/MBAustriaIdFrontRecognizerWrapper.h" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBSlovakiaIdFrontRecognizerWrapper.h" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBSwitzerlandPassportRecognizerWrapper.h" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBPassportRecognizerWrapper.h" />
<!-- IOS SOURCE FILES END -->

<framework src="libc++.dylib" />
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/v4.8.0/blinkid-ios_v4.8.0.zip'
LINK='https://github.com/BlinkID/blinkid-ios/releases/download/v4.9.0/blinkid-ios_v4.9.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 @@ -86,6 +86,7 @@ private void registerMapping( RecognizerSerialization recognizerSerialization )
registerMapping(new MrtdCombinedRecognizerSerialization());
registerMapping(new MrtdRecognizerSerialization());
registerMapping(new NewZealandDlFrontRecognizerSerialization());
registerMapping(new PassportRecognizerSerialization());
registerMapping(new Pdf417RecognizerSerialization());
registerMapping(new PolandCombinedRecognizerSerialization());
registerMapping(new PolandIdBackRecognizerSerialization());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public final class DocumentFaceRecognizerSerialization implements RecognizerSeri
recognizer.setNumStableDetectionsThreshold(jsonRecognizer.optInt("numStableDetectionsThreshold", 6));
recognizer.setReturnFaceImage(jsonRecognizer.optBoolean("returnFaceImage", false));
recognizer.setReturnFullDocumentImage(jsonRecognizer.optBoolean("returnFullDocumentImage", false));
recognizer.setTryBothOrientations(jsonRecognizer.optBoolean("tryBothOrientations", true));
return recognizer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public JSONObject serializeResult(Recognizer<?, ?> recognizer) {
jsonResult.put("mrzVerified", result.isMrzVerified());
jsonResult.put("nationality", result.getNationality());
jsonResult.put("placeOfBirth", result.getPlaceOfBirth());
jsonResult.put("rawMrzString", result.getRawMrzString());
jsonResult.put("scanningFirstSideDone", result.isScanningFirstSideDone());
jsonResult.put("sex", result.getSex());
jsonResult.put("signatureImage", SerializationUtils.encodeImageBase64(result.getSignatureImage()));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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 PassportRecognizerSerialization implements RecognizerSerialization {

@Override
public Recognizer<?, ?> createRecognizer(JSONObject jsonRecognizer) {
com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer recognizer = new com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer();
recognizer.setDetectGlare(jsonRecognizer.optBoolean("detectGlare", true));
recognizer.setFaceImageDpi(jsonRecognizer.optInt("faceImageDpi", 250));
recognizer.setFullDocumentImageDpi(jsonRecognizer.optInt("fullDocumentImageDpi", 250));
recognizer.setFullDocumentImageExtensionFactors(BlinkIDSerializationUtils.deserializeExtensionFactors(jsonRecognizer.optJSONObject("fullDocumentImageExtensionFactors")));
recognizer.setReturnFaceImage(jsonRecognizer.optBoolean("returnFaceImage", false));
recognizer.setReturnFullDocumentImage(jsonRecognizer.optBoolean("returnFullDocumentImage", false));
return recognizer;
}

@Override
public JSONObject serializeResult(Recognizer<?, ?> recognizer) {
com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer.Result result = ((com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer)recognizer).getResult();
JSONObject jsonResult = new JSONObject();
try {
SerializationUtils.addCommonResultData(jsonResult, result);
jsonResult.put("faceImage", SerializationUtils.encodeImageBase64(result.getFaceImage()));
jsonResult.put("fullDocumentImage", SerializationUtils.encodeImageBase64(result.getFullDocumentImage()));
jsonResult.put("mrzResult", BlinkIDSerializationUtils.serializeMrzResult(result.getMrzResult()));
} catch (JSONException e) {
// see https://developer.android.com/reference/org/json/JSONException
throw new RuntimeException(e);
}
return jsonResult;
}

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

@Override
public Class<?> getRecognizerClass() {
return com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer.class;
}
}
2 changes: 1 addition & 1 deletion BlinkID/src/android/libBlinkID.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repositories {

dependencies {
implementation "com.android.support:appcompat-v7:27.1.1"
implementation('com.microblink:blinkid:4.8.0@aar') {
implementation('com.microblink:blinkid:4.9.0@aar') {
transitive = false
}
}
Expand Down
2 changes: 2 additions & 0 deletions BlinkID/src/ios/sources/Recognizers/MBRecognizerSerializers.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#import "MBMrtdCombinedRecognizerWrapper.h"
#import "MBMrtdRecognizerWrapper.h"
#import "MBNewZealandDlFrontRecognizerWrapper.h"
#import "MBPassportRecognizerWrapper.h"
#import "MBPdf417RecognizerWrapper.h"
#import "MBPolandCombinedRecognizerWrapper.h"
#import "MBPolandIdBackRecognizerWrapper.h"
Expand Down Expand Up @@ -176,6 +177,7 @@ - (instancetype)init {
[self registerCreator:[[MBMrtdCombinedRecognizerCreator alloc] init]];
[self registerCreator:[[MBMrtdRecognizerCreator alloc] init]];
[self registerCreator:[[MBNewZealandDlFrontRecognizerCreator alloc] init]];
[self registerCreator:[[MBPassportRecognizerCreator alloc] init]];
[self registerCreator:[[MBPdf417RecognizerCreator alloc] init]];
[self registerCreator:[[MBPolandCombinedRecognizerCreator alloc] init]];
[self registerCreator:[[MBPolandIdBackRecognizerCreator alloc] init]];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ -(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer {
recognizer.returnFullDocumentImage = [(NSNumber *)returnFullDocumentImage boolValue];
}
}
{
id tryBothOrientations = [jsonRecognizer valueForKey:@"tryBothOrientations"];
if (tryBothOrientations != nil) {
recognizer.tryBothOrientations = [(NSNumber *)tryBothOrientations boolValue];
}
}

return recognizer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ -(NSDictionary *) serializeResult {
[jsonResult setValue:[NSNumber numberWithBool:self.result.mrzVerified] forKey:@"mrzVerified"];
[jsonResult setValue:self.result.nationality forKey:@"nationality"];
[jsonResult setValue:self.result.placeOfBirth forKey:@"placeOfBirth"];
[jsonResult setValue:self.result.rawMrzString forKey:@"rawMrzString"];
[jsonResult setValue:[NSNumber numberWithBool:self.result.scanningFirstSideDone] forKey:@"scanningFirstSideDone"];
[jsonResult setValue:self.result.sex forKey:@"sex"];
[jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.signatureImage] forKey:@"signatureImage"];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#import "MBRecognizerWrapper.h"
#import <MicroBlink/MicroBlink.h>

@interface MBPassportRecognizerCreator : NSObject<MBRecognizerCreator>

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#import "MBPassportRecognizerWrapper.h"
#import "MBSerializationUtils.h"
#import "MBBlinkIDSerializationUtils.h"

@implementation MBPassportRecognizerCreator

@synthesize jsonName = _jsonName;

-(instancetype) init {
self = [super init];
if (self) {
_jsonName = @"PassportRecognizer";
}
return self;
}

-(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer {
MBPassportRecognizer *recognizer = [[MBPassportRecognizer alloc] init];
{
id detectGlare = [jsonRecognizer valueForKey:@"detectGlare"];
if (detectGlare != nil) {
recognizer.detectGlare = [(NSNumber *)detectGlare boolValue];
}
}
{
id faceImageDpi = [jsonRecognizer valueForKey:@"faceImageDpi"];
if (faceImageDpi != nil) {
recognizer.faceImageDpi = [(NSNumber *)faceImageDpi unsignedIntegerValue];
}
}
{
id fullDocumentImageDpi = [jsonRecognizer valueForKey:@"fullDocumentImageDpi"];
if (fullDocumentImageDpi != nil) {
recognizer.fullDocumentImageDpi = [(NSNumber *)fullDocumentImageDpi unsignedIntegerValue];
}
}
{
id fullDocumentImageExtensionFactors = [jsonRecognizer valueForKey:@"fullDocumentImageExtensionFactors"];
if (fullDocumentImageExtensionFactors != nil) {
recognizer.fullDocumentImageExtensionFactors = [MBBlinkIDSerializationUtils deserializeMBImageExtensionFactors:(NSDictionary*)fullDocumentImageExtensionFactors];
}
}
{
id returnFaceImage = [jsonRecognizer valueForKey:@"returnFaceImage"];
if (returnFaceImage != nil) {
recognizer.returnFaceImage = [(NSNumber *)returnFaceImage boolValue];
}
}
{
id returnFullDocumentImage = [jsonRecognizer valueForKey:@"returnFullDocumentImage"];
if (returnFullDocumentImage != nil) {
recognizer.returnFullDocumentImage = [(NSNumber *)returnFullDocumentImage boolValue];
}
}

return recognizer;
}

@end

@interface MBPassportRecognizer (JsonSerialization)
@end

@implementation MBPassportRecognizer (JsonSerialization)

-(NSDictionary *) serializeResult {
NSMutableDictionary* jsonResult = (NSMutableDictionary*)[super serializeResult];
[jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.faceImage] forKey:@"faceImage"];
[jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.fullDocumentImage] forKey:@"fullDocumentImage"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeMrzResult:self.result.mrzResult] forKey:@"mrzResult"];

return jsonResult;
}

@end
98 changes: 98 additions & 0 deletions BlinkID/www/blinkIdScanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5369,6 +5369,13 @@ function DocumentFaceRecognizer() {
*/
this.returnFullDocumentImage = false;

/**
* Setting for control over FaceImageCropProcessor's tryBothOrientations option
*
*
*/
this.tryBothOrientations = false;

this.createResultFromNative = function (nativeResult) { return new DocumentFaceRecognizerResult(nativeResult); }

}
Expand Down Expand Up @@ -5747,6 +5754,11 @@ function GermanyCombinedRecognizerResult(nativeResult) {
*/
this.placeOfBirth = nativeResult.placeOfBirth;

/**
* The full mrz string result.
*/
this.rawMrzString = nativeResult.rawMrzString;

/**
* Returns true if recognizer has finished scanning first side and is now scanning back side,
* false if it's still scanning first side.
Expand Down Expand Up @@ -10344,6 +10356,92 @@ NewZealandDlFrontRecognizer.prototype = new Recognizer('NewZealandDlFrontRecogni

BlinkID.prototype.NewZealandDlFrontRecognizer = NewZealandDlFrontRecognizer;

/**
* Result object for PassportRecognizer.
*/
function PassportRecognizerResult(nativeResult) {
RecognizerResult.call(this, nativeResult.resultState);

/**
* face image from the document if enabled with returnFaceImage property.
*/
this.faceImage = nativeResult.faceImage;

/**
* full document image if enabled with returnFullDocumentImage property.
*/
this.fullDocumentImage = nativeResult.fullDocumentImage;

/**
* The data extracted from the machine readable zone.
*/
this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null;

}

PassportRecognizerResult.prototype = new RecognizerResult(RecognizerResultState.empty);

BlinkID.prototype.PassportRecognizerResult = PassportRecognizerResult;

/**
* Recognizer which can scan all passports with MRZ.
*/
function PassportRecognizer() {
Recognizer.call(this, 'PassportRecognizer');

/**
* Defines if glare detection should be turned on/off.
*
*
*/
this.detectGlare = true;

/**
* Property for setting DPI for face images
* Valid ranges are [100,400]. Setting DPI out of valid ranges throws an exception
*
*
*/
this.faceImageDpi = 250;

/**
* Property for setting DPI for full document images
* Valid ranges are [100,400]. Setting DPI out of valid ranges throws an exception
*
*
*/
this.fullDocumentImageDpi = 250;

/**
* Image extension factors for full document image.
*
* @see ImageExtensionFactors
*
*/
this.fullDocumentImageExtensionFactors = new ImageExtensionFactors();

/**
* Sets whether face image from ID card should be extracted
*
*
*/
this.returnFaceImage = false;

/**
* Sets whether full document image of ID card should be extracted.
*
*
*/
this.returnFullDocumentImage = false;

this.createResultFromNative = function (nativeResult) { return new PassportRecognizerResult(nativeResult); }

}

PassportRecognizer.prototype = new Recognizer('PassportRecognizer');

BlinkID.prototype.PassportRecognizer = PassportRecognizer;

/**
* Result object for Pdf417Recognizer.
*/
Expand Down
3 changes: 3 additions & 0 deletions Release notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 4.9.0
- Updated to [Android SDK v4.9.0](https://github.com/BlinkID/blinkid-android/releases/tag/v4.9.0) and [iOS SDK v4.9.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v4.9.0)

## 4.8.0
- Updated to [Android SDK v4.8.0](https://github.com/BlinkID/blinkid-android/releases/tag/v4.8.0) and [iOS SDK v4.8.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v4.8.0)

Expand Down
4 changes: 2 additions & 2 deletions www/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ var app = {

// package name/bundleID com.microblink.blinkid
var licenseKeys = {
android: 'sRwAAAAWY29tLm1pY3JvYmxpb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7cah4xN12S6gNrtm25aIMEbpBInI40zmtpCBGoU8KR3U21A8spXVHZyGcGsG3guOSsqpsNg=='
};

scanButton.addEventListener('click', function() {
Expand Down

0 comments on commit c9e11bd

Please sign in to comment.