Skip to content

Commit

Permalink
[ios] updated bindings for v4.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
juraskrlec committed Apr 25, 2019
1 parent e683555 commit 772f65d
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 2 deletions.
2 changes: 2 additions & 0 deletions BlinkID/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,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 +382,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
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
2 changes: 1 addition & 1 deletion www/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ var app = {
// package name/bundleID com.microblink.blinkid
var licenseKeys = {
android: 'sRwAAAAWY29tLm1pY3JvYmxpbmsuYmxpbmtpZJ9ew00uWSf86/ux5PGYgpVxe8daSAIioOFooMH1zSjCtUFYDv9AqV87Ew8fx8H/ag2O5/E1nN18stdwBpBjEvyG+tOKGyUYC3WecONS+6edT6mBfhwXh11Qgkn/eMeip1ep/k/tMcs4IPI6xLzevdpUY8YLwcWAlBGoCmYo6ijxrnKXcRck2FpXUdZedgOH0mRtTrSyT40DBjuA6O11rYPnCX1phzsobd2S71qVLoZ+zHg+60e3ePigLxIKiA==',
ios: 'sRwAAAEWY29tLm1pY3JvYmxpbmsuYmxpbmtpZFG2rW9X4lA0y++ptby56tjjJxcwi2w3o+JAeNhIYMY5L6BLVFWcAs12PilSay+gzrckE5oqyLvoz+/3OetjSSfjR69q2W0pmm23dX2IvFUqw5VNK1MGgcauw6wGsDFKyD5T8YJv6bRz180DRH/XZaRbP6AajJ8vD+BpRN08dckzZP6xE+9BQwtMJFKY3Y9uSCJx42LII8SblOZVe2x2awwIGwrXcMGMQsqpcBCDx8Hq9s83augQ2bpgn0uKow=='
ios: 'sRwAAAEWY29tLm1pY3JvYmxpbmsuYmxpbmtpZFG2rW9X4lA0y++ptbiZ7dj1E80ExjC//oFNqdO1aP3BzyX/8qAoWiV5mCPgIIDWRIXc2UdU0OrG+6/mEPb2u6EGhxMIXonSGsd8WICdxSV+baMRJck21qyZoCgRwz+eC0MXrTaPt1jqWVKHjYT7BvPaC8p+EV8RY6Vph89PLKDZxsvxM93HVFB7cah4xN12S6gNrtm25aIMEbpBInI40zmtpCBGoU8KR3U21A8spXVHZyGcGsG3guOSsqpsNg=='
};

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

0 comments on commit 772f65d

Please sign in to comment.