From 882de022513e580ce0d768f8bbd94467782a6dfd Mon Sep 17 00:00:00 2001 From: Jura Skrlec Date: Thu, 25 Apr 2019 13:24:55 +0200 Subject: [PATCH 1/4] [ios] updated wrapper for v4.9.0 --- BlinkID/blinkid-react-native.podspec | 2 +- BlinkID/index.js | 1 + BlinkID/recognizers/documentFaceRecognizer.js | 7 ++ .../recognizers/germanyCombinedRecognizer.js | 5 + BlinkID/recognizers/passportRecognizer.js | 92 +++++++++++++++++++ .../Recognizers/MBRecognizerSerializers.m | 2 + .../MBDocumentFaceRecognizerWrapper.m | 6 ++ .../MBGermanyCombinedRecognizerWrapper.m | 1 + .../Wrappers/MBPassportRecognizerWrapper.h | 6 ++ .../Wrappers/MBPassportRecognizerWrapper.m | 75 +++++++++++++++ demoApp/index.js | 2 +- initReactNativeDemoApp.sh | 4 +- 12 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 BlinkID/recognizers/passportRecognizer.js create mode 100644 BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBPassportRecognizerWrapper.h create mode 100644 BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBPassportRecognizerWrapper.m diff --git a/BlinkID/blinkid-react-native.podspec b/BlinkID/blinkid-react-native.podspec index 7806daa..3ad9573 100644 --- a/BlinkID/blinkid-react-native.podspec +++ b/BlinkID/blinkid-react-native.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| s.source_files = "src/ios", "src/ios/**/*.{h,m}" s.dependency 'React' - s.dependency 'PPBlinkID', '~> 4.8.0' + s.dependency 'PPBlinkID', '~> 4.9.0' s.frameworks = 'UIKit' end diff --git a/BlinkID/index.js b/BlinkID/index.js index c9f2d82..b71479c 100644 --- a/BlinkID/index.js +++ b/BlinkID/index.js @@ -179,6 +179,7 @@ export * from './recognizers/moroccoIdFrontRecognizer' export * from './recognizers/mrtdCombinedRecognizer' export * from './recognizers/mrtdRecognizer' export * from './recognizers/newZealandDlFrontRecognizer' +export * from './recognizers/passportRecognizer' export * from './recognizers/pdf417Recognizer' export * from './recognizers/polandCombinedRecognizer' export * from './recognizers/polandIdBackRecognizer' diff --git a/BlinkID/recognizers/documentFaceRecognizer.js b/BlinkID/recognizers/documentFaceRecognizer.js index 5a229f4..877c0f9 100644 --- a/BlinkID/recognizers/documentFaceRecognizer.js +++ b/BlinkID/recognizers/documentFaceRecognizer.js @@ -104,6 +104,13 @@ export class DocumentFaceRecognizer extends Recognizer { */ this.returnFullDocumentImage = false; + /** + * Setting for control over FaceImageCropProcessor's tryBothOrientations option + * + * + */ + this.tryBothOrientations = false; + this.createResultFromNative = function (nativeResult) { return new DocumentFaceRecognizerResult(nativeResult); } } } \ No newline at end of file diff --git a/BlinkID/recognizers/germanyCombinedRecognizer.js b/BlinkID/recognizers/germanyCombinedRecognizer.js index 35659be..652faa3 100644 --- a/BlinkID/recognizers/germanyCombinedRecognizer.js +++ b/BlinkID/recognizers/germanyCombinedRecognizer.js @@ -115,6 +115,11 @@ export class GermanyCombinedRecognizerResult extends RecognizerResult { */ 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. diff --git a/BlinkID/recognizers/passportRecognizer.js b/BlinkID/recognizers/passportRecognizer.js new file mode 100644 index 0000000..fe45b20 --- /dev/null +++ b/BlinkID/recognizers/passportRecognizer.js @@ -0,0 +1,92 @@ +import { Recognizer, RecognizerResult } from '../recognizer' +import { + Date, + Point, + Quadrilateral, + MrtdDocumentType, + MrzResult, + EudlCountry, + DocumentFaceDetectorType, + ImageExtensionFactors, +} from '../types' + +/** + * Result object for PassportRecognizer. + */ +export class PassportRecognizerResult extends RecognizerResult { + constructor(nativeResult) { + super(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; + + } +} + +/** + * Recognizer which can scan all passports with MRZ. + */ +export class PassportRecognizer extends Recognizer { + constructor() { + super('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); } + } +} \ No newline at end of file diff --git a/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/MBRecognizerSerializers.m b/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/MBRecognizerSerializers.m index 5622693..874f0b7 100644 --- a/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/MBRecognizerSerializers.m +++ b/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/MBRecognizerSerializers.m @@ -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" @@ -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]]; diff --git a/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBDocumentFaceRecognizerWrapper.m b/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBDocumentFaceRecognizerWrapper.m index c035c85..5c399b8 100644 --- a/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBDocumentFaceRecognizerWrapper.m +++ b/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBDocumentFaceRecognizerWrapper.m @@ -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; } diff --git a/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBGermanyCombinedRecognizerWrapper.m b/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBGermanyCombinedRecognizerWrapper.m index 59ab08b..e85e15c 100644 --- a/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBGermanyCombinedRecognizerWrapper.m +++ b/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBGermanyCombinedRecognizerWrapper.m @@ -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"]; diff --git a/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBPassportRecognizerWrapper.h b/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBPassportRecognizerWrapper.h new file mode 100644 index 0000000..ac28fc5 --- /dev/null +++ b/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBPassportRecognizerWrapper.h @@ -0,0 +1,6 @@ +#import "MBRecognizerWrapper.h" +#import + +@interface MBPassportRecognizerCreator : NSObject + +@end \ No newline at end of file diff --git a/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBPassportRecognizerWrapper.m b/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBPassportRecognizerWrapper.m new file mode 100644 index 0000000..a33d7f2 --- /dev/null +++ b/BlinkID/src/ios/MicroblinkModule/MicroblinkModule/Recognizers/Wrappers/MBPassportRecognizerWrapper.m @@ -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 \ No newline at end of file diff --git a/demoApp/index.js b/demoApp/index.js index 166b301..6bd2639 100644 --- a/demoApp/index.js +++ b/demoApp/index.js @@ -18,7 +18,7 @@ import { const licenseKey = Platform.select({ // iOS license key for applicationID: org.reactjs.native.example.BlinkIDReactNative - ios: 'sRwAAAEtb3JnLnJlYWN0anMubmF0aXZlLmV4YW1wbGUuQmxpbmtJRFJlYWN0TmF0aXZlt67qu61k2vMma/KTrphwHMvoHXMjmoOiNv6uxnbg320lcJ/RpFYDaeHwCnSmYXWbcR16T+Sp3nqKT26WY/VGUzrsYfVP8V5wefOfy+IMnMT99E2wsW0ID3GfoZmyOYnhvE9jy66qJyVWb06spHnJ35MuaIL94ySwxwlSBmjaG0vs0Nz902P0tCMTlAgAUZVfacsBrBE3LsXWbO7bm3NbX52JDBYQjGENXT9ZP9oSTPcUOdggYpIM7fDDREdm', + ios: 'sRwAAAEtb3JnLnJlYWN0anMubmF0aXZlLmV4YW1wbGUuQmxpbmtJRFJlYWN0TmF0aXZlt67qu61k2vMma/KTqrh3HKRQDbpa74eiMGdAU9TqJMgdHe8dYsa02Qa29JwPUSSnRIYiNl5jlyhlsFnVizsvMO5LzE/aApMRC63SChp3/WRnzU8kDu5JO3vA7crY1YqrYs5H/QB6ZYjFVjS4orYcbfYet39uNE1uE4uAXmpAdDncB5KSbcVpu3pwZyMOkShi8dh3c+TnrpBTNp7xEEzakeIp9hR+VmeN6qIikNszTUzDjZLNhghptZ1wDsW/', // android license key for applicationID: com.blinkidreactnative android: 'sRwAAAAWY29tLmJsaW5raWRyZWFjdG5hdGl2ZYouOuuUS2CbdVuol25oyKRUaeMN2tXUUHsnmsYZFmU/Q4p3rKzxWcsyPbfyJOarHpp6DAV9+ZtOSJ3VPOp2DY0kN8cxu3JoD+ceI4wngSVkO0LNv9EcuHefI0C+hJ1v+g7FgF5MftcMGQhgt8W5Bvj+vsIWhtBKuVZgJJrbl1jC9/NvmXaua1RpQDZf81ycjJfZRFmSTnRQJexYdfEalCme3cjvxVs95WbROPBjAedixp5g35P7ohxQgBNj5A==' }) diff --git a/initReactNativeDemoApp.sh b/initReactNativeDemoApp.sh index 57e47fb..28d8abb 100755 --- a/initReactNativeDemoApp.sh +++ b/initReactNativeDemoApp.sh @@ -22,7 +22,7 @@ else # use directly source code from this repo instead of npm package # from RN 0.57 symlink does not work any more npm pack $blink_id_plugin_path - npm i --save blinkid-react-native-4.8.0.tgz + npm i --save blinkid-react-native-4.9.0.tgz npm install #pushd node_modules #ln -s $blink_id_plugin_path blinkid-react-native @@ -56,7 +56,7 @@ cat > Podfile << EOF platform :ios, '8.0' target 'BlinkIDReactNative' do - pod 'PPBlinkID', '~> 4.8.0' + pod 'PPBlinkID', '~> 4.9.0' end EOF From a459c2c6ff2cf740b582698a9b63aeeeb2ec4357 Mon Sep 17 00:00:00 2001 From: Ivan Grce Date: Thu, 25 Apr 2019 15:06:33 +0200 Subject: [PATCH 2/4] [android] updated wrapper for v4.9.0 --- BlinkID/src/android/build.gradle | 2 +- .../recognizers/RecognizerSerializers.java | 1 + .../DocumentFaceRecognizerSerialization.java | 3 ++ ...ermanyCombinedRecognizerSerialization.java | 1 + .../PassportRecognizerSerialization.java | 54 +++++++++++++++++++ 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/serialization/PassportRecognizerSerialization.java diff --git a/BlinkID/src/android/build.gradle b/BlinkID/src/android/build.gradle index 575687c..356ca68 100644 --- a/BlinkID/src/android/build.gradle +++ b/BlinkID/src/android/build.gradle @@ -31,7 +31,7 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile "com.android.support:appcompat-v7:28.0.0" compile 'com.facebook.react:react-native:+' - compile('com.microblink:blinkid:4.8.0@aar') { + compile('com.microblink:blinkid:4.9.0@aar') { transitive = false } } diff --git a/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/RecognizerSerializers.java b/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/RecognizerSerializers.java index 4656647..38574a9 100644 --- a/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/RecognizerSerializers.java +++ b/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/RecognizerSerializers.java @@ -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()); diff --git a/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/serialization/DocumentFaceRecognizerSerialization.java b/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/serialization/DocumentFaceRecognizerSerialization.java index 492b90a..203f984 100644 --- a/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/serialization/DocumentFaceRecognizerSerialization.java +++ b/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/serialization/DocumentFaceRecognizerSerialization.java @@ -31,6 +31,9 @@ public final class DocumentFaceRecognizerSerialization implements RecognizerSeri if (jsonRecognizer.hasKey("returnFullDocumentImage")) { recognizer.setReturnFullDocumentImage(jsonRecognizer.getBoolean("returnFullDocumentImage")); } + if (jsonRecognizer.hasKey("tryBothOrientations")) { + recognizer.setTryBothOrientations(jsonRecognizer.getBoolean("tryBothOrientations")); + } return recognizer; } diff --git a/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/serialization/GermanyCombinedRecognizerSerialization.java b/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/serialization/GermanyCombinedRecognizerSerialization.java index d9b6d1e..e85bb1a 100644 --- a/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/serialization/GermanyCombinedRecognizerSerialization.java +++ b/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/serialization/GermanyCombinedRecognizerSerialization.java @@ -103,6 +103,7 @@ public WritableMap serializeResult(Recognizer recognizer) { jsonResult.putBoolean("mrzVerified", result.isMrzVerified()); jsonResult.putString("nationality", result.getNationality()); jsonResult.putString("placeOfBirth", result.getPlaceOfBirth()); + jsonResult.putString("rawMrzString", result.getRawMrzString()); jsonResult.putBoolean("scanningFirstSideDone", result.isScanningFirstSideDone()); jsonResult.putString("sex", result.getSex()); jsonResult.putString("signatureImage", SerializationUtils.encodeImageBase64(result.getSignatureImage())); diff --git a/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/serialization/PassportRecognizerSerialization.java b/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/serialization/PassportRecognizerSerialization.java new file mode 100644 index 0000000..24e1d5c --- /dev/null +++ b/BlinkID/src/android/src/main/java/com/microblink/reactnative/recognizers/serialization/PassportRecognizerSerialization.java @@ -0,0 +1,54 @@ +package com.microblink.reactnative.recognizers.serialization; + +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.bridge.WritableNativeMap; +import com.microblink.entities.recognizers.Recognizer; +import com.microblink.reactnative.recognizers.RecognizerSerialization; + +public final class PassportRecognizerSerialization implements RecognizerSerialization { + @Override + public Recognizer createRecognizer(ReadableMap jsonRecognizer) { + com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer recognizer = new com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer(); + if (jsonRecognizer.hasKey("detectGlare")) { + recognizer.setDetectGlare(jsonRecognizer.getBoolean("detectGlare")); + } + if (jsonRecognizer.hasKey("faceImageDpi")) { + recognizer.setFaceImageDpi(jsonRecognizer.getInt("faceImageDpi")); + } + if (jsonRecognizer.hasKey("fullDocumentImageDpi")) { + recognizer.setFullDocumentImageDpi(jsonRecognizer.getInt("fullDocumentImageDpi")); + } + if (jsonRecognizer.hasKey("fullDocumentImageExtensionFactors")) { + recognizer.setFullDocumentImageExtensionFactors(BlinkIDSerializationUtils.deserializeExtensionFactors(jsonRecognizer.getMap("fullDocumentImageExtensionFactors"))); + } + if (jsonRecognizer.hasKey("returnFaceImage")) { + recognizer.setReturnFaceImage(jsonRecognizer.getBoolean("returnFaceImage")); + } + if (jsonRecognizer.hasKey("returnFullDocumentImage")) { + recognizer.setReturnFullDocumentImage(jsonRecognizer.getBoolean("returnFullDocumentImage")); + } + return recognizer; + } + + @Override + public WritableMap serializeResult(Recognizer recognizer) { + com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer.Result result = ((com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer)recognizer).getResult(); + WritableMap jsonResult = new WritableNativeMap(); + SerializationUtils.addCommonResultData(jsonResult, result); + jsonResult.putString("faceImage", SerializationUtils.encodeImageBase64(result.getFaceImage())); + jsonResult.putString("fullDocumentImage", SerializationUtils.encodeImageBase64(result.getFullDocumentImage())); + jsonResult.putMap("mrzResult", BlinkIDSerializationUtils.serializeMrzResult(result.getMrzResult())); + return jsonResult; + } + + @Override + public String getJsonName() { + return "PassportRecognizer"; + } + + @Override + public Class getRecognizerClass() { + return com.microblink.entities.recognizers.blinkid.passport.PassportRecognizer.class; + } +} \ No newline at end of file From d7b8f3d4bca4a6473348f0cb3374d8b5cc37bb4d Mon Sep 17 00:00:00 2001 From: Ivan Grce Date: Fri, 26 Apr 2019 10:36:01 +0200 Subject: [PATCH 3/4] [android, sample] updated license key for v4.9.0 --- demoApp/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demoApp/index.js b/demoApp/index.js index 6bd2639..2be5f69 100644 --- a/demoApp/index.js +++ b/demoApp/index.js @@ -20,7 +20,7 @@ const licenseKey = Platform.select({ // iOS license key for applicationID: org.reactjs.native.example.BlinkIDReactNative ios: 'sRwAAAEtb3JnLnJlYWN0anMubmF0aXZlLmV4YW1wbGUuQmxpbmtJRFJlYWN0TmF0aXZlt67qu61k2vMma/KTqrh3HKRQDbpa74eiMGdAU9TqJMgdHe8dYsa02Qa29JwPUSSnRIYiNl5jlyhlsFnVizsvMO5LzE/aApMRC63SChp3/WRnzU8kDu5JO3vA7crY1YqrYs5H/QB6ZYjFVjS4orYcbfYet39uNE1uE4uAXmpAdDncB5KSbcVpu3pwZyMOkShi8dh3c+TnrpBTNp7xEEzakeIp9hR+VmeN6qIikNszTUzDjZLNhghptZ1wDsW/', // android license key for applicationID: com.blinkidreactnative - android: 'sRwAAAAWY29tLmJsaW5raWRyZWFjdG5hdGl2ZYouOuuUS2CbdVuol25oyKRUaeMN2tXUUHsnmsYZFmU/Q4p3rKzxWcsyPbfyJOarHpp6DAV9+ZtOSJ3VPOp2DY0kN8cxu3JoD+ceI4wngSVkO0LNv9EcuHefI0C+hJ1v+g7FgF5MftcMGQhgt8W5Bvj+vsIWhtBKuVZgJJrbl1jC9/NvmXaua1RpQDZf81ycjJfZRFmSTnRQJexYdfEalCme3cjvxVs95WbROPBjAedixp5g35P7ohxQgBNj5A==' + android: 'sRwAAAAWY29tLmJsaW5raWRyZWFjdG5hdGl2ZYouOuuUS2CbdVuol2rYYA2v4YK/4PmyekYU/MSHvquNTqD1hDrtpzR337rQoTgQzZJXbzjPsVEGy+9OM/96qJDLAtYb92fGQcy5nYYMLO/hi+81+xpHrm8SmI5JmIUON1oB12O79TMZ64l0cNp1wAuqGUSam89PSNkeDH/9UkCiFiumaQIQf1WoTdfRx/WbpXNqIhe7vqhCtDKprlUY/ctdA43NAKcSBHUMdugsYGEbvw5s14lC1JEsl7Oy0Q==' }) var renderIf = function(condition, content) { From c8f9023b5e9b84b90117528dc448bab8b8d6b713 Mon Sep 17 00:00:00 2001 From: Ivan Grce Date: Fri, 26 Apr 2019 10:36:39 +0200 Subject: [PATCH 4/4] Updated version to 4.9.0 --- BlinkID/package.json | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BlinkID/package.json b/BlinkID/package.json index c48b6b6..bc551af 100644 --- a/BlinkID/package.json +++ b/BlinkID/package.json @@ -1,6 +1,6 @@ { "name": "blinkid-react-native", - "version": "4.8.0", + "version": "4.9.0", "description": "A small and powerful ID card scanning library. Powered by Microblink (www.microblink.com).", "main": "index.js", "repository": { diff --git a/README.md b/README.md index e4393e3..ccfd810 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ react-native link blinkid-react-native platform :ios, '9.0' target 'TargetName' do - pod 'PPBlinkID', '~> 4.8.0' + pod 'PPBlinkID', '~> 4.9.0' end ```