From 113a5ca9436767fc6616b79388d49e1c3efc8afe Mon Sep 17 00:00:00 2001 From: mparadina Date: Wed, 3 Apr 2024 11:15:15 +0200 Subject: [PATCH 01/14] 6.6 release --- .../plugins/cordova/BlinkIDScanner.java | 192 ++++++- .../BlinkIdOverlaySettingsSerialization.java | 6 + ...inkIdMultiSideRecognizerSerialization.java | 2 + ...nkIdSingleSideRecognizerSerialization.java | 2 + BlinkID/src/ios/sources/CDVBlinkIDScanner.h | 5 + BlinkID/src/ios/sources/CDVBlinkIDScanner.m | 138 ++++- .../ios/sources/MBBlinkIDSerializationUtils.h | 6 +- .../ios/sources/MBBlinkIDSerializationUtils.m | 131 +++-- .../src/ios/sources/MBSerializationUtils.h | 5 +- .../src/ios/sources/MBSerializationUtils.m | 52 +- .../MBBlinkIdOverlaySettingsSerialization.m | 14 + .../MBBlinkIdMultiSideRecognizerWrapper.m | 56 +- .../MBBlinkIdSingleSideRecognizerWrapper.m | 56 +- .../Wrappers/MBIdBarcodeRecognizerWrapper.m | 6 +- .../MBUsdlCombinedRecognizerWrapper.m | 6 +- .../Wrappers/MBUsdlRecognizerWrapper.m | 6 +- BlinkID/www/blinkIdScanner.js | 516 +++++++++++------- 17 files changed, 812 insertions(+), 387 deletions(-) diff --git a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/BlinkIDScanner.java b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/BlinkIDScanner.java index 0ce44f9..15a98d4 100644 --- a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/BlinkIDScanner.java +++ b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/BlinkIDScanner.java @@ -11,6 +11,10 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; +import androidx.annotation.NonNull; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.util.Base64; import com.microblink.blinkid.MicroblinkSDK; import com.microblink.blinkid.entities.recognizers.RecognizerBundle; @@ -18,6 +22,14 @@ import com.microblink.blinkid.uisettings.UISettings; import com.microblink.blinkid.plugins.cordova.overlays.OverlaySettingsSerializers; import com.microblink.blinkid.plugins.cordova.recognizers.RecognizerSerializers; +import com.microblink.blinkid.locale.LanguageUtils; +import com.microblink.blinkid.directApi.DirectApiErrorListener; +import com.microblink.blinkid.directApi.RecognizerRunner; +import com.microblink.blinkid.hardware.orientation.Orientation; +import com.microblink.blinkid.metadata.recognition.FirstSideRecognitionCallback; +import com.microblink.blinkid.recognition.RecognitionSuccessType; +import com.microblink.blinkid.metadata.MetadataCallbacks; +import com.microblink.blinkid.view.recognition.ScanResultListener; import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaPlugin; import org.json.JSONArray; @@ -29,11 +41,13 @@ public class BlinkIDScanner extends CordovaPlugin { private static final int REQUEST_CODE = 1337; private static final String SCAN_WITH_CAMERA = "scanWithCamera"; + private static final String SCAN_WITH_DIRECT_API = "scanWithDirectApi"; private static final String CANCELLED = "cancelled"; - private static final String RESULT_LIST = "resultList"; private RecognizerBundle mRecognizerBundle; + private RecognizerRunner mRecognizerRunner; + private boolean mFirstSideScanned = false; private CallbackContext mCallbackContext; /** @@ -69,18 +83,11 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo try { if (action.equals(SCAN_WITH_CAMERA)) { - JSONObject jsonOverlaySettings = args.getJSONObject(0); - JSONObject jsonRecognizerCollection = args.getJSONObject(1); - JSONObject jsonLicenses = args.getJSONObject(2); - - setLicense(jsonLicenses); - mRecognizerBundle = RecognizerSerializers.INSTANCE.deserializeRecognizerCollection(jsonRecognizerCollection); - UISettings overlaySettings = OverlaySettingsSerializers.INSTANCE.getOverlaySettings(this.cordova.getContext(), jsonOverlaySettings, mRecognizerBundle); - - // unable to use ActivityRunner because we need to use cordova's activity launcher - Intent intent = new Intent(this.cordova.getContext(), overlaySettings.getTargetActivity()); - overlaySettings.saveToIntent(intent); - this.cordova.startActivityForResult(this, intent, REQUEST_CODE); + //Scan with camera + scanWithCamera(args); + } else if (action.equals(SCAN_WITH_DIRECT_API)) { + //Scan with DirectAPI + scanWithDirectApi(args); } else { return false; } @@ -91,6 +98,156 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo } } + private void scanWithCamera(JSONArray arguments) throws JSONException{ + try { + JSONObject jsonOverlaySettings = arguments.getJSONObject(0); + JSONObject jsonRecognizerCollection = arguments.getJSONObject(1); + JSONObject jsonLicenses = arguments.getJSONObject(2); + + setLicense(jsonLicenses); + setLanguage(jsonOverlaySettings.getString("language"), + jsonOverlaySettings.getString("country")); + mRecognizerBundle = RecognizerSerializers.INSTANCE.deserializeRecognizerCollection(jsonRecognizerCollection); + UISettings overlaySettings = OverlaySettingsSerializers.INSTANCE.getOverlaySettings(this.cordova.getContext(), jsonOverlaySettings, mRecognizerBundle); + + // unable to use ActivityRunner because we need to use cordova's activity launcher + Intent intent = new Intent(this.cordova.getContext(), overlaySettings.getTargetActivity()); + overlaySettings.saveToIntent(intent); + this.cordova.startActivityForResult(this, intent, REQUEST_CODE); + } catch (JSONException e) { + mCallbackContext.error("Could not start scanWithCamera.\nJSON error: " + e); + } + } + + private void scanWithDirectApi(JSONArray arguments) throws JSONException { + //DirectAPI processing + JSONObject jsonRecognizerCollection = arguments.getJSONObject(0); + JSONObject jsonLicense = arguments.getJSONObject(3); + setLicense(jsonLicense); + + ScanResultListener mScanResultListenerBackSide = new ScanResultListener() { + @Override + public void onScanningDone(@NonNull RecognitionSuccessType recognitionSuccessType) { + mFirstSideScanned = false; + handleDirectApiResult(recognitionSuccessType); + } + @Override + public void onUnrecoverableError(@NonNull Throwable throwable) { + handleDirectApiError(throwable.getMessage()); + } + }; + + FirstSideRecognitionCallback mFirstSideRecognitionCallback = new FirstSideRecognitionCallback() { + @Override + public void onFirstSideRecognitionFinished() { + mFirstSideScanned = true; + } + }; + + ScanResultListener mScanResultListenerFrontSide = new ScanResultListener() { + @Override + public void onScanningDone(@NonNull RecognitionSuccessType recognitionSuccessType) { + if (mFirstSideScanned) { + //multiside recognizer used + try { + if (!arguments.getString(2).isEmpty() && arguments.getString(2) != "null") { + processImage(arguments.getString(2), mScanResultListenerBackSide); + } else if (recognitionSuccessType != RecognitionSuccessType.UNSUCCESSFUL) { + handleDirectApiResult(recognitionSuccessType); + } else { + handleDirectApiError("Could not extract the information from the front side and back side is empty!"); + } + } catch (JSONException e) { + throw new RuntimeException(e); + } + } else if (!mFirstSideScanned && recognitionSuccessType != RecognitionSuccessType.UNSUCCESSFUL){ + //singleside recognizer used + handleDirectApiResult(recognitionSuccessType); + } else { + mFirstSideScanned = false; + handleDirectApiError("Could not extract the data with DirectAPI!"); + } + } + @Override + public void onUnrecoverableError(@NonNull Throwable throwable) { + handleDirectApiError(throwable.getMessage()); + } + }; + + setupRecognizerRunner(jsonRecognizerCollection, mFirstSideRecognitionCallback); + + if (!arguments.getString(1).isEmpty()) { + processImage(arguments.getString(1), mScanResultListenerFrontSide); + } else { + handleDirectApiError("The first side image is empty!"); + } + } + + private void setupRecognizerRunner(JSONObject jsonRecognizerCollection, FirstSideRecognitionCallback mFirstSideRecognitionCallback) { + if (mRecognizerRunner != null) { + mRecognizerRunner.resetRecognitionState(true); + } else { + mRecognizerBundle = RecognizerSerializers.INSTANCE.deserializeRecognizerCollection(jsonRecognizerCollection); + try { + mRecognizerRunner = RecognizerRunner.getSingletonInstance(); + } catch (Exception e) { + handleDirectApiError("DirectAPI not supported: " + e.getMessage()); + } + + MetadataCallbacks metadataCallbacks = new MetadataCallbacks(); + metadataCallbacks.setFirstSideRecognitionCallback(mFirstSideRecognitionCallback); + mRecognizerRunner.setMetadataCallbacks(metadataCallbacks); + mRecognizerRunner.initialize(cordova.getContext(), mRecognizerBundle, new DirectApiErrorListener() { + @Override + public void onRecognizerError(@NonNull Throwable throwable) { + handleDirectApiError("Failed to initialize recognizer with DirectAPI: " + throwable.getMessage()); + } + }); + } + } + + private void processImage(String base64Image, ScanResultListener scanResultListener) { + Bitmap image = base64ToBitmap(base64Image); + if (image != null) { + mRecognizerRunner.recognizeBitmap( + base64ToBitmap(base64Image), + Orientation.ORIENTATION_LANDSCAPE_RIGHT, + scanResultListener + ); + } else { + handleDirectApiError("Could not decode the Base64 image!"); + } + } + + private void handleDirectApiResult(RecognitionSuccessType recognitionSuccessType) { + if (recognitionSuccessType != RecognitionSuccessType.UNSUCCESSFUL) { + JSONObject result = new JSONObject(); + try { + result.put(CANCELLED, false); + } catch (JSONException e) { + throw new RuntimeException(e); + } + try { + JSONArray resultList = RecognizerSerializers.INSTANCE.serializeRecognizerResults(mRecognizerBundle.getRecognizers()); + result.put(RESULT_LIST, resultList); + } catch(JSONException e) { + throw new RuntimeException(e); + } + mCallbackContext.success(result); + + } else { + handleDirectApiError("Could not extract the information with DirectAPI!"); + } + } + + private void handleDirectApiError(String errorMessage) { + mCallbackContext.error(errorMessage); + mFirstSideScanned = false; + if (mRecognizerRunner != null) { + mRecognizerRunner.resetRecognitionState(true); + } + } + private void setLicense( JSONObject jsonLicense ) throws JSONException { MicroblinkSDK.setShowTrialLicenseWarning( jsonLicense.optBoolean("showTrialLicenseKeyWarning", true) @@ -106,6 +263,15 @@ private void setLicense( JSONObject jsonLicense ) throws JSONException { MicroblinkSDK.setIntentDataTransferMode(IntentDataTransferMode.PERSISTED_OPTIMISED); } + private Bitmap base64ToBitmap(String base64String) { + byte[] decodedBytes = Base64.decode(base64String, Base64.DEFAULT); + return BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.length); + } + + private void setLanguage(String language, String country) { + LanguageUtils.setLanguageAndCountry(language, country, this.cordova.getContext()); + } + /** * Called when the scanner intent completes. * diff --git a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/overlays/serialization/BlinkIdOverlaySettingsSerialization.java b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/overlays/serialization/BlinkIdOverlaySettingsSerialization.java index de58a15..9d85de6 100644 --- a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/overlays/serialization/BlinkIdOverlaySettingsSerialization.java +++ b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/overlays/serialization/BlinkIdOverlaySettingsSerialization.java @@ -39,6 +39,12 @@ public UISettings createUISettings(Context context, JSONObject jsonUISettings, R boolean showIntroductionDialog = jsonUISettings.optBoolean("showIntroductionDialog", false); settings.setShowIntroductionDialog(showIntroductionDialog); + + boolean showTorchButton = jsonUISettings.optBoolean("showTorchButton", true); + settings.setShowTorchButton(showTorchButton); + + boolean showCancelButton = jsonUISettings.optBoolean("showCancelButton", true); + settings.setShowCancelButton(showCancelButton); long onboardingButtonTooltipDelay = jsonUISettings.optLong("onboardingButtonTooltipDelay", 12000); settings.setShowTooltipTimeIntervalMs(onboardingButtonTooltipDelay); 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 f123114..a59031b 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 @@ -53,6 +53,7 @@ public JSONObject serializeResult(Recognizer recognizer) { jsonResult.put("backVizResult", BlinkIDSerializationUtils.serializeVizResult(result.getBackVizResult())); jsonResult.put("barcodeCameraFrame", SerializationUtils.encodeImageBase64(result.getBarcodeCameraFrame())); jsonResult.put("barcodeResult", BlinkIDSerializationUtils.serializeBarcodeResult(result.getBarcodeResult())); + jsonResult.put("bloodType", BlinkIDSerializationUtils.serializeStringResult(result.getBloodType())); jsonResult.put("classInfo", BlinkIDSerializationUtils.serializeClassInfo(result.getClassInfo())); jsonResult.put("dataMatch", BlinkIDSerializationUtils.serializeDataMatchResult(result.getDataMatch())); jsonResult.put("dateOfBirth", BlinkIDSerializationUtils.serializeDateResult(result.getDateOfBirth())); @@ -96,6 +97,7 @@ public JSONObject serializeResult(Recognizer recognizer) { jsonResult.put("scanningFirstSideDone", result.isScanningFirstSideDone()); jsonResult.put("sex", BlinkIDSerializationUtils.serializeStringResult(result.getSex())); jsonResult.put("signatureImage", SerializationUtils.encodeImageBase64(result.getSignatureImage())); + jsonResult.put("sponsor", BlinkIDSerializationUtils.serializeStringResult(result.getSponsor())); } catch (JSONException e) { // see https://developer.android.com/reference/org/json/JSONException throw new RuntimeException(e); 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 982f6b8..8433638 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 @@ -46,6 +46,7 @@ public JSONObject serializeResult(Recognizer recognizer) { jsonResult.put("age", result.getAge()); jsonResult.put("barcodeCameraFrame", SerializationUtils.encodeImageBase64(result.getBarcodeCameraFrame())); jsonResult.put("barcodeResult", BlinkIDSerializationUtils.serializeBarcodeResult(result.getBarcodeResult())); + jsonResult.put("bloodType", BlinkIDSerializationUtils.serializeStringResult(result.getBloodType())); jsonResult.put("cameraFrame", SerializationUtils.encodeImageBase64(result.getCameraFrame())); jsonResult.put("classInfo", BlinkIDSerializationUtils.serializeClassInfo(result.getClassInfo())); jsonResult.put("dateOfBirth", BlinkIDSerializationUtils.serializeDateResult(result.getDateOfBirth())); @@ -83,6 +84,7 @@ public JSONObject serializeResult(Recognizer recognizer) { jsonResult.put("residentialStatus", BlinkIDSerializationUtils.serializeStringResult(result.getResidentialStatus())); jsonResult.put("sex", BlinkIDSerializationUtils.serializeStringResult(result.getSex())); jsonResult.put("signatureImage", SerializationUtils.encodeImageBase64(result.getSignatureImage())); + jsonResult.put("sponsor", BlinkIDSerializationUtils.serializeStringResult(result.getSponsor())); jsonResult.put("vizResult", BlinkIDSerializationUtils.serializeVizResult(result.getVizResult())); } catch (JSONException e) { // see https://developer.android.com/reference/org/json/JSONException diff --git a/BlinkID/src/ios/sources/CDVBlinkIDScanner.h b/BlinkID/src/ios/sources/CDVBlinkIDScanner.h index 12eff82..9c15ba3 100644 --- a/BlinkID/src/ios/sources/CDVBlinkIDScanner.h +++ b/BlinkID/src/ios/sources/CDVBlinkIDScanner.h @@ -21,6 +21,11 @@ * Starts the scanning process */ - (void)scanWithCamera:(CDVInvokedUrlCommand *)command; + +/** + * Starts the image recognition process via DirectAPI + */ +- (void)scanWithDirectApi:(CDVInvokedUrlCommand *)command; /** * Returns successful recognition */ diff --git a/BlinkID/src/ios/sources/CDVBlinkIDScanner.m b/BlinkID/src/ios/sources/CDVBlinkIDScanner.m index eabdd01..7d3adde 100644 --- a/BlinkID/src/ios/sources/CDVBlinkIDScanner.m +++ b/BlinkID/src/ios/sources/CDVBlinkIDScanner.m @@ -27,7 +27,7 @@ #import -@interface CDVPlugin () +@interface CDVPlugin () @property (nonatomic, retain) CDVInvokedUrlCommand *lastCommand; @@ -37,9 +37,13 @@ @interface CDVBlinkIDScanner () @property (nonatomic, strong) MBRecognizerCollection *recognizerCollection; @property (nonatomic) id scanningViewController; +@property (nonatomic, strong) MBRecognizerRunner *recognizerRunner; @property (class, nonatomic, readonly) NSString *RESULT_LIST; @property (class, nonatomic, readonly) NSString *CANCELLED; +@property (class, nonatomic, readonly) NSString *EMPTY_IMAGE; +@property (class, nonatomic, readonly) NSString *INVALID_IMAGE_FORMAT; +@property (class, nonatomic, readonly) NSString *NO_DATA; @property (class, nonatomic, readonly) int COMPRESSED_IMAGE_QUALITY; @end @@ -65,6 +69,7 @@ - (NSDictionary *)sanitizeDictionary:(NSDictionary *)dictionary { } #pragma mark - Main +//MARK: scanning with camera - (void)scanWithCamera:(CDVInvokedUrlCommand *)command { [self setLastCommand:command]; @@ -74,6 +79,7 @@ - (void)scanWithCamera:(CDVInvokedUrlCommand *)command { NSDictionary *jsonLicenses = [self sanitizeDictionary:[self.lastCommand argumentAtIndex:2]]; [self setLicense:jsonLicenses]; + [self setLanguage:(NSString *)jsonOverlaySettings[@"language"] country:(NSString *)jsonOverlaySettings[@"country"]]; self.recognizerCollection = [[MBRecognizerSerializers sharedInstance] deserializeRecognizerCollection:jsonRecognizerCollection]; @@ -88,6 +94,92 @@ - (void)scanWithCamera:(CDVInvokedUrlCommand *)command { [[self viewController] presentViewController:recognizerRunnerViewController animated:YES completion:nil]; } +//MARK: DirectAPI scanning +- (void)scanWithDirectApi:(CDVInvokedUrlCommand *)command { + [self setLastCommand:command]; + NSDictionary *jsonRecognizerCollection = [self sanitizeDictionary:[self.lastCommand argumentAtIndex:0]]; + NSDictionary *jsonLicenses = [self sanitizeDictionary:[self.lastCommand argumentAtIndex:3]]; + + [self setLicense:jsonLicenses]; + [self setupRecognizerRunner:jsonRecognizerCollection]; + + if ([self.lastCommand argumentAtIndex:1] != nil) { + UIImage * frontImage = [self convertbase64ToImage:[self.lastCommand argumentAtIndex:1]]; + if (!CGSizeEqualToSize(frontImage.size, CGSizeZero)) { + [self processImage:[self convertbase64ToImage:[self.lastCommand argumentAtIndex:1]]]; + } else { + [self handleDirectApiError:CDVBlinkIDScanner.INVALID_IMAGE_FORMAT]; + } + } else { + [self handleDirectApiError:CDVBlinkIDScanner.EMPTY_IMAGE]; + } +} + +- (void)recognizerRunnerDidFinishRecognitionOfFirstSide:(MBRecognizerRunner *)recognizerRunner { + if ([self.lastCommand argumentAtIndex:2] != nil && !CGSizeEqualToSize([self convertbase64ToImage:[self.lastCommand argumentAtIndex:2]].size, CGSizeZero)) { + [self processImage:[self convertbase64ToImage:[self.lastCommand argumentAtIndex:2]]]; + } else { + [self handleJsonResult]; + } +} + +- (void)recognizerRunner:(nonnull MBRecognizerRunner *)recognizerRunner didFinishScanningWithState:(MBRecognizerResultState)state { + dispatch_async(dispatch_get_main_queue(), ^{ + if (state == MBRecognizerResultStateValid || state == MBRecognizerResultStateUncertain) { + [self handleJsonResult]; + } else if (state == MBRecognizerResultStateEmpty) { + [self handleDirectApiError:CDVBlinkIDScanner.NO_DATA]; + } + }); +} + +//setup the recognizer runner +- (void) setupRecognizerRunner:(NSDictionary *)jsonRecognizerCollection { + self.recognizerCollection = [[MBRecognizerSerializers sharedInstance] deserializeRecognizerCollection:jsonRecognizerCollection]; + self.recognizerRunner = [[MBRecognizerRunner alloc] initWithRecognizerCollection:self.recognizerCollection]; + self.recognizerRunner.scanningRecognizerRunnerDelegate = self; + self.recognizerRunner.metadataDelegates.firstSideFinishedRecognizerRunnerDelegate = self; +} + +//convert the image to MBImage and process it +- (void)processImage:(UIImage *)originalImage { + MBImage *image = [MBImage imageWithUIImage:originalImage]; + image.cameraFrame = NO; + image.orientation = MBProcessingOrientationLeft; + dispatch_queue_t _serialQueue = dispatch_queue_create("com.microblink.DirectAPI", DISPATCH_QUEUE_SERIAL); + dispatch_async(_serialQueue, ^{ + [self.recognizerRunner processImage:image]; + }); +} + +//convert image from base64 to UIImage +-(UIImage*)convertbase64ToImage:(NSString *)base64Image { + NSData *imageData = [[NSData alloc] initWithBase64EncodedString:base64Image options:NSDataBase64DecodingIgnoreUnknownCharacters]; + if (imageData) { + UIImage *image = [UIImage imageWithData:imageData]; + return image; + } else { + return [UIImage new]; + } +} + +//handle JSON results +- (void) handleJsonResult { + NSMutableArray *jsonResults = [[NSMutableArray alloc] initWithCapacity:self.recognizerCollection.recognizerList.count]; + for (NSUInteger i = 0; i < self.recognizerCollection.recognizerList.count; ++i) { + [jsonResults addObject:[[self.recognizerCollection.recognizerList objectAtIndex:i] serializeResult]]; + } + + NSDictionary *resultDict; + resultDict = @{ + CDVBlinkIDScanner.CANCELLED: [NSNumber numberWithBool:NO], + CDVBlinkIDScanner.RESULT_LIST: jsonResults + }; + + CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:resultDict]; + [self.commandDelegate sendPluginResult:result callbackId:self.lastCommand.callbackId]; +} + - (void)setLicense:(NSDictionary*) jsonLicense { __weak CDVBlinkIDScanner *weakSelf = self; @@ -112,24 +204,21 @@ - (void)setLicense:(NSDictionary*) jsonLicense { } +- (void)setLanguage:(NSString *)language country:(NSString *)country { + if (language != nil) { + if (country != nil && ![country isEqualToString:@""]) { + MBMicroblinkApp.sharedInstance.language = [[language stringByAppendingString:@"-"] stringByAppendingString:country]; + } else { + MBMicroblinkApp.sharedInstance.language = language; + } + } +} + - (void)overlayViewControllerDidFinishScanning:(MBOverlayViewController *)overlayViewController state:(MBRecognizerResultState)state { if (state != MBRecognizerResultStateEmpty) { [overlayViewController.recognizerRunnerViewController pauseScanning]; // recognizers within self.recognizerCollection now have their results filled - - NSMutableArray *jsonResults = [[NSMutableArray alloc] initWithCapacity:self.recognizerCollection.recognizerList.count]; - for (NSUInteger i = 0; i < self.recognizerCollection.recognizerList.count; ++i) { - [jsonResults addObject:[[self.recognizerCollection.recognizerList objectAtIndex:i] serializeResult]]; - } - - NSDictionary *resultDict; - resultDict = @{ - CDVBlinkIDScanner.CANCELLED: [NSNumber numberWithBool:NO], - CDVBlinkIDScanner.RESULT_LIST: jsonResults - }; - - CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:resultDict]; - [self.commandDelegate sendPluginResult:result callbackId:self.lastCommand.callbackId]; + [self handleJsonResult]; // dismiss recognizer runner view controller dispatch_async(dispatch_get_main_queue(), ^{ @@ -159,10 +248,29 @@ + (NSString *)CANCELLED { return @"cancelled"; } ++ (NSString *)EMPTY_IMAGE { + return @"The first side image is empty!"; +} + ++ (NSString *)INVALID_IMAGE_FORMAT { + return @"Could not decode the Base64 image!"; +} + ++ (NSString *)NO_DATA { + return @"Could not extract the data with DirectAPI!"; +} + + (int)COMPRESSED_IMAGE_QUALITY { return 90; } +- (void) handleDirectApiError:(NSString*)errorString { + self.recognizerCollection = nil; + self.recognizerRunner = nil; + CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errorString]; + [self.commandDelegate sendPluginResult:result callbackId:self.lastCommand.callbackId]; +} + + (NSString *)licenseErrorToString:(MBLicenseError)licenseError { switch(licenseError) { case MBLicenseErrorNetworkRequired: diff --git a/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.h b/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.h index 12fe757..739c24f 100644 --- a/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.h +++ b/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.h @@ -26,6 +26,8 @@ +(NSDictionary * _Nonnull) serializeBarcodeElements:(MBBarcodeElements * _Nonnull)extendedElements; +(NSArray * _Nonnull) serializeBarcodeElementsValues:(MBBarcodeElements * _Nonnull)extendedElements; + (NSDictionary * _Nonnull)serializeAdditionalProcessingInfo:(MBAdditionalProcessingInfo * _Nullable)additionalProcessingInfo; -+ (NSDictionary * _Nonnull)serializeMBDate:(MBDate * _Nonnull)date; - ++ (NSDictionary * _Nonnull)serializeMBDateResult:(MBDateResult * _Nullable) value; ++(NSDictionary * _Nonnull) serializeMBStringResult:(MBStringResult * _Nullable) value; ++(NSNumber * _Nullable)serializeMBSide:(MBSide) value; ++(NSDictionary * _Nonnull) serializeNSDate:(NSDate * _Nullable) value; @end \ No newline at end of file diff --git a/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m b/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m index f26ee68..7500b5a 100644 --- a/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m +++ b/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m @@ -16,12 +16,12 @@ +(NSDictionary *) serializeMrzResult:(MBMrzResult *)mrzResult { @"primaryId" : mrzResult.primaryID, @"secondaryId" : mrzResult.secondaryID, @"issuer" : mrzResult.issuer, - @"dateOfBirth" : [MBBlinkIDSerializationUtils serializeMBDate:mrzResult.dateOfBirth], + @"dateOfBirth" : [MBSerializationUtils serializeMBDate:mrzResult.dateOfBirth], @"documentNumber" : mrzResult.documentNumber, @"nationality" : mrzResult.nationality, @"gender" : mrzResult.gender, @"documentCode" : mrzResult.documentCode, - @"dateOfExpiry" : [MBBlinkIDSerializationUtils serializeMBDate:mrzResult.dateOfExpiry], + @"dateOfExpiry" : [MBSerializationUtils serializeMBDate:mrzResult.dateOfExpiry], @"opt1" : mrzResult.opt1, @"opt2" : mrzResult.opt2, @"alienNumber" : mrzResult.alienNumber, @@ -61,10 +61,10 @@ +(NSDictionary *) serializeDriverLicenseDetailedInfo:(MBDriverLicenseDetailedInf } return @{ - @"restrictions" : [MBSerializationUtils serializeMBStringResult:driverLicenseDetailedInfo.restrictions], - @"endorsements" : [MBSerializationUtils serializeMBStringResult:driverLicenseDetailedInfo.endorsements], - @"vehicleClass" : [MBSerializationUtils serializeMBStringResult:driverLicenseDetailedInfo.vehicleClass], - @"conditions" : [MBSerializationUtils serializeMBStringResult:driverLicenseDetailedInfo.conditions], + @"restrictions" : [MBBlinkIDSerializationUtils serializeMBStringResult:driverLicenseDetailedInfo.restrictions], + @"endorsements" : [MBBlinkIDSerializationUtils serializeMBStringResult:driverLicenseDetailedInfo.endorsements], + @"vehicleClass" : [MBBlinkIDSerializationUtils serializeMBStringResult:driverLicenseDetailedInfo.vehicleClass], + @"conditions" : [MBBlinkIDSerializationUtils serializeMBStringResult:driverLicenseDetailedInfo.conditions], @"vehicleClassesInfo" : vehicleClassesInfo }; } @@ -87,10 +87,10 @@ + (NSDictionary *)serializeBarcodeDriverLicenseDetailedInfo:(MBBarcodeDriverLice +(NSDictionary *) serializeVehicleClassInfo:(MBVehicleClassInfo *)vehicleClassInfo { return @{ - @"vehicleClass" : [MBSerializationUtils serializeMBStringResult:vehicleClassInfo.vehicleClass], - @"licenceType" : [MBSerializationUtils serializeMBStringResult:vehicleClassInfo.licenceType], - @"effectiveDate" : [MBSerializationUtils serializeMBDateResult:vehicleClassInfo.effectiveDate], - @"expiryDate" : [MBSerializationUtils serializeMBDateResult:vehicleClassInfo.expiryDate] + @"vehicleClass" : [MBBlinkIDSerializationUtils serializeMBStringResult:vehicleClassInfo.vehicleClass], + @"licenceType" : [MBBlinkIDSerializationUtils serializeMBStringResult:vehicleClassInfo.licenceType], + @"effectiveDate" : [MBBlinkIDSerializationUtils serializeMBDateResult:vehicleClassInfo.effectiveDate], + @"expiryDate" : [MBBlinkIDSerializationUtils serializeMBDateResult:vehicleClassInfo.expiryDate] }; } @@ -98,8 +98,8 @@ + (NSDictionary *)serializeBarcodeVehicleClassInfo:(MBBarcodeVehicleClassInfo *) return @{ @"vehicleClass" : vehicleClassInfo.vehicleClass, @"licenceType" : vehicleClassInfo.licenceType, - @"effectiveDate" : [MBBlinkIDSerializationUtils serializeMBDate:vehicleClassInfo.effectiveDate], - @"expiryDate" : [MBBlinkIDSerializationUtils serializeMBDate:vehicleClassInfo.expiryDate] + @"effectiveDate" : [MBSerializationUtils serializeMBDate :vehicleClassInfo.effectiveDate], + @"expiryDate" : [MBSerializationUtils serializeMBDate:vehicleClassInfo.expiryDate] }; } @@ -138,31 +138,31 @@ +(NSDictionary *) serializeClassInfo:(MBClassInfo *)classInfo { +(NSDictionary *) serializeVizResult:(MBVizResult *)vizResult { return @{ - @"firstName" : [MBSerializationUtils serializeMBStringResult:vizResult.firstName], - @"lastName" : [MBSerializationUtils serializeMBStringResult:vizResult.lastName], - @"fullName" : [MBSerializationUtils serializeMBStringResult:vizResult.fullName], - @"additionalNameInformation" : [MBSerializationUtils serializeMBStringResult:vizResult.additionalNameInformation], - @"localizedName" : [MBSerializationUtils serializeMBStringResult:vizResult.localizedName], - @"address" : [MBSerializationUtils serializeMBStringResult:vizResult.address], - @"additionalAddressInformation" : [MBSerializationUtils serializeMBStringResult:vizResult.additionalAddressInformation], - @"additionalOptionalAddressInformation" : [MBSerializationUtils serializeMBStringResult:vizResult.additionalOptionalAddressInformation], - @"placeOfBirth" : [MBSerializationUtils serializeMBStringResult:vizResult.placeOfBirth], - @"nationality" : [MBSerializationUtils serializeMBStringResult:vizResult.nationality], - @"race" : [MBSerializationUtils serializeMBStringResult:vizResult.race], - @"religion" : [MBSerializationUtils serializeMBStringResult:vizResult.religion], - @"profession" : [MBSerializationUtils serializeMBStringResult:vizResult.profession], - @"maritalStatus" : [MBSerializationUtils serializeMBStringResult:vizResult.maritalStatus], - @"residentialStatus" : [MBSerializationUtils serializeMBStringResult:vizResult.residentialStatus], - @"employer" : [MBSerializationUtils serializeMBStringResult:vizResult.employer], - @"sex" : [MBSerializationUtils serializeMBStringResult:vizResult.sex], - @"dateOfBirth" : [MBSerializationUtils serializeMBDateResult:vizResult.dateOfBirth], - @"dateOfIssue" : [MBSerializationUtils serializeMBDateResult:vizResult.dateOfIssue], - @"dateOfExpiry" : [MBSerializationUtils serializeMBDateResult:vizResult.dateOfExpiry], - @"documentNumber" : [MBSerializationUtils serializeMBStringResult:vizResult.documentNumber], - @"personalIdNumber" : [MBSerializationUtils serializeMBStringResult:vizResult.personalIdNumber], - @"documentAdditionalNumber" : [MBSerializationUtils serializeMBStringResult:vizResult.documentAdditionalNumber], - @"additionalPersonalIdNumber" : [MBSerializationUtils serializeMBStringResult:vizResult.additionalPersonalIdNumber], - @"issuingAuthority" : [MBSerializationUtils serializeMBStringResult:vizResult.issuingAuthority], + @"firstName" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.firstName], + @"lastName" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.lastName], + @"fullName" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.fullName], + @"additionalNameInformation" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.additionalNameInformation], + @"localizedName" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.localizedName], + @"address" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.address], + @"additionalAddressInformation" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.additionalAddressInformation], + @"additionalOptionalAddressInformation" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.additionalOptionalAddressInformation], + @"placeOfBirth" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.placeOfBirth], + @"nationality" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.nationality], + @"race" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.race], + @"religion" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.religion], + @"profession" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.profession], + @"maritalStatus" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.maritalStatus], + @"residentialStatus" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.residentialStatus], + @"employer" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.employer], + @"sex" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.sex], + @"dateOfBirth" : [MBBlinkIDSerializationUtils serializeMBDateResult:vizResult.dateOfBirth], + @"dateOfIssue" : [MBBlinkIDSerializationUtils serializeMBDateResult:vizResult.dateOfIssue], + @"dateOfExpiry" : [MBBlinkIDSerializationUtils serializeMBDateResult:vizResult.dateOfExpiry], + @"documentNumber" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.documentNumber], + @"personalIdNumber" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.personalIdNumber], + @"documentAdditionalNumber" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.documentAdditionalNumber], + @"additionalPersonalIdNumber" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.additionalPersonalIdNumber], + @"issuingAuthority" : [MBBlinkIDSerializationUtils serializeMBStringResult:vizResult.issuingAuthority], @"driverLicenseDetailedInfo" : [MBBlinkIDSerializationUtils serializeDriverLicenseDetailedInfo:vizResult.driverLicenseDetailedInfo], @"empty" : [NSNumber numberWithBool:vizResult.empty] }; @@ -189,9 +189,9 @@ +(NSDictionary *) serializeBarcodeResult:(MBBarcodeResult *)barcodeResult { @"residentialStatus" : barcodeResult.residentialStatus, @"employer" : barcodeResult.employer, @"sex" : barcodeResult.sex, - @"dateOfBirth" : [MBBlinkIDSerializationUtils serializeMBDate:barcodeResult.dateOfBirth], - @"dateOfIssue" : [MBBlinkIDSerializationUtils serializeMBDate:barcodeResult.dateOfIssue], - @"dateOfExpiry" : [MBBlinkIDSerializationUtils serializeMBDate:barcodeResult.dateOfExpiry], + @"dateOfBirth" : [MBSerializationUtils serializeMBDate:barcodeResult.dateOfBirth], + @"dateOfIssue" : [MBSerializationUtils serializeMBDate:barcodeResult.dateOfIssue], + @"dateOfExpiry" : [MBSerializationUtils serializeMBDate:barcodeResult.dateOfExpiry], @"documentNumber" : barcodeResult.documentNumber, @"personalIdNumber" : barcodeResult.personalIdNumber, @"documentAdditionalNumber" : barcodeResult.documentAdditionalNumber, @@ -293,14 +293,53 @@ +(NSDictionary *)serializeAdditionalProcessingInfo:(MBAdditionalProcessingInfo * }; } -+ (NSDictionary *)serializeMBDate:(MBDate *)date { ++ (NSDictionary *)serializeMBDateResult:(MBDateResult *) value { + NSMutableDictionary *dict = [MBBlinkIDSerializationUtils serializeDay:value.day month:value.month year:value.year].mutableCopy; + [dict setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:value.originalDateStringResult] forKey:@"originalDateStringResult"]; + [dict setValue:[NSNumber numberWithBool:value.isFilledByDomainKnowledge] forKey:@"isFilledByDomainKnowledge"]; + return dict; +} + ++(NSDictionary *) serializeDay:(NSInteger)day month:(NSInteger)month year:(NSInteger)year { return @{ - @"day" : @(date.day), - @"month" : @(date.month), - @"year" : @(date.year), - @"originalDateString" : date.originalDateString, - @"isFilledByDomainKnowledge" : [NSNumber numberWithBool:date.isFilledByDomainKnowledge], + @"day" : [NSNumber numberWithInteger:day], + @"month" : [NSNumber numberWithInteger:month], + @"year" : [NSNumber numberWithInteger:year] }; } ++(NSDictionary *) serializeNSDate:(NSDate*) value { + NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:value]; + return [MBBlinkIDSerializationUtils serializeDay:components.day month:components.month year:components.year]; +} + ++ (NSDictionary *)serializeMBStringResult:(MBStringResult *) value { + NSMutableDictionary *dict = [NSMutableDictionary dictionary]; + [dict setValue:[value valueForAlphabetType:MBAlphabetTypeLatin] forKey:@"latin"]; + [dict setValue:[value valueForAlphabetType:MBAlphabetTypeArabic] forKey:@"arabic"]; + [dict setValue:[value valueForAlphabetType:MBAlphabetTypeCyrillic] forKey:@"cyrillic"]; + [dict setValue:value.description forKey:@"description"]; + + NSMutableDictionary *location = [NSMutableDictionary dictionary]; + [location setValue:[MBSerializationUtils serializeCGRect:[value locationForAlphabetType:MBAlphabetTypeLatin]] forKey:@"latin"]; + [location setValue:[MBSerializationUtils serializeCGRect:[value locationForAlphabetType:MBAlphabetTypeArabic]] forKey:@"arabic"]; + [location setValue:[MBSerializationUtils serializeCGRect:[value locationForAlphabetType:MBAlphabetTypeCyrillic]] forKey:@"cyrillic"]; + [dict setValue:location forKey:@"location"]; + + NSMutableDictionary *side = [NSMutableDictionary dictionary]; + [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; +} + ++(NSNumber *)serializeMBSide:(MBSide) value { + if (value == MBSideNone) { + return nil; + } + return [NSNumber numberWithLong:value - 1]; +} + @end \ No newline at end of file diff --git a/BlinkID/src/ios/sources/MBSerializationUtils.h b/BlinkID/src/ios/sources/MBSerializationUtils.h index 8626853..acfe145 100644 --- a/BlinkID/src/ios/sources/MBSerializationUtils.h +++ b/BlinkID/src/ios/sources/MBSerializationUtils.h @@ -10,10 +10,7 @@ @interface MBSerializationUtils : NSObject -+(NSDictionary * _Nonnull) serializeNSDate:(NSDate * _Nullable) value; -+(NSDictionary * _Nonnull) serializeMBDateResult:(MBDateResult * _Nullable) value; -+(NSDictionary * _Nonnull) serializeMBStringResult:(MBStringResult * _Nullable) value; -+(NSNumber * _Nullable)serializeMBSide:(MBSide) value; ++(NSDictionary * _Nonnull) serializeMBDate:(MBDate * _Nonnull) date; +(NSString * _Nullable) encodeMBImage:(MBImage * _Nullable) image; +(NSDictionary * _Nonnull)serializeCGPoint:(CGPoint) point; +(NSDictionary * _Nonnull) serializeMBQuadrangle:(MBQuadrangle * _Nonnull) quad; diff --git a/BlinkID/src/ios/sources/MBSerializationUtils.m b/BlinkID/src/ios/sources/MBSerializationUtils.m index 765d3b8..68b21fe 100644 --- a/BlinkID/src/ios/sources/MBSerializationUtils.m +++ b/BlinkID/src/ios/sources/MBSerializationUtils.m @@ -9,56 +9,16 @@ @implementation MBSerializationUtils -+(NSDictionary *) serializeDay:(NSInteger)day month:(NSInteger)month year:(NSInteger)year { ++ (NSDictionary *)serializeMBDate:(MBDate *) date { return @{ - @"day" : [NSNumber numberWithInteger:day], - @"month" : [NSNumber numberWithInteger:month], - @"year" : [NSNumber numberWithInteger:year] + @"day" : @(date.day), + @"month" : @(date.month), + @"year" : @(date.year), + @"originalDateString" : date.originalDateString, + @"isFilledByDomainKnowledge" : [NSNumber numberWithBool:date.isFilledByDomainKnowledge], }; } -+(NSDictionary *) serializeNSDate:(NSDate*) value { - NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:value]; - return [MBSerializationUtils serializeDay:components.day month:components.month year:components.year]; -} - -+ (NSDictionary *)serializeMBDateResult:(MBDateResult *) value { - NSMutableDictionary *dict = [MBSerializationUtils serializeDay:value.day month:value.month year:value.year].mutableCopy; - [dict setValue:[MBSerializationUtils serializeMBStringResult:value.originalDateStringResult] forKey:@"originalDateStringResult"]; - [dict setValue:[NSNumber numberWithBool:value.isFilledByDomainKnowledge] forKey:@"isFilledByDomainKnowledge"]; - - return dict; -} - -+ (NSDictionary *)serializeMBStringResult:(MBStringResult *) value { - NSMutableDictionary *dict = [NSMutableDictionary dictionary]; - [dict setValue:[value valueForAlphabetType:MBAlphabetTypeLatin] forKey:@"latin"]; - [dict setValue:[value valueForAlphabetType:MBAlphabetTypeArabic] forKey:@"arabic"]; - [dict setValue:[value valueForAlphabetType:MBAlphabetTypeCyrillic] forKey:@"cyrillic"]; - [dict setValue:value.description forKey:@"description"]; - - NSMutableDictionary *location = [NSMutableDictionary dictionary]; - [location setValue:[MBSerializationUtils serializeCGRect:[value locationForAlphabetType:MBAlphabetTypeLatin]] forKey:@"latin"]; - [location setValue:[MBSerializationUtils serializeCGRect:[value locationForAlphabetType:MBAlphabetTypeArabic]] forKey:@"arabic"]; - [location setValue:[MBSerializationUtils serializeCGRect:[value locationForAlphabetType:MBAlphabetTypeCyrillic]] forKey:@"cyrillic"]; - [dict setValue:location forKey:@"location"]; - - NSMutableDictionary *side = [NSMutableDictionary dictionary]; - [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; -} - -+(NSNumber *)serializeMBSide:(MBSide) value { - if (value == MBSideNone) { - return nil; - } - return [NSNumber numberWithLong:value - 1]; -} - +(NSString *) encodeMBImage:(MBImage * _Nullable) image { const int COMPRESSED_IMAGE_QUALITY = 90; diff --git a/BlinkID/src/ios/sources/Overlays/Serialization/MBBlinkIdOverlaySettingsSerialization.m b/BlinkID/src/ios/sources/Overlays/Serialization/MBBlinkIdOverlaySettingsSerialization.m index 6c24aea..ca88f99 100644 --- a/BlinkID/src/ios/sources/Overlays/Serialization/MBBlinkIdOverlaySettingsSerialization.m +++ b/BlinkID/src/ios/sources/Overlays/Serialization/MBBlinkIdOverlaySettingsSerialization.m @@ -199,6 +199,20 @@ -(MBOverlayViewController *) createOverlayViewController:(NSDictionary *)jsonOve sett.defineSpecificMissingMandatoryFields = [showMandatoryFieldsMissing boolValue]; } } + + { + id showTorchButton = [jsonOverlaySettings valueForKey: @"showTorchButton"]; + if (showTorchButton != nil) { + sett.displayTorchButton = [showTorchButton boolValue]; + } + } + + { + id showCancelButton = [jsonOverlaySettings valueForKey: @"showCancelButton"]; + if (showCancelButton != nil) { + sett.displayCancelButton = [showCancelButton boolValue]; + } + } return [[MBBlinkIdOverlayViewController alloc] initWithSettings:sett recognizerCollection:recognizerCollection delegate:self]; } diff --git a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdMultiSideRecognizerWrapper.m b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdMultiSideRecognizerWrapper.m index 238560e..924bdca 100644 --- a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdMultiSideRecognizerWrapper.m +++ b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdMultiSideRecognizerWrapper.m @@ -154,10 +154,10 @@ @implementation MBBlinkIdMultiSideRecognizer (JsonSerialization) -(NSDictionary *) serializeResult { NSMutableDictionary* jsonResult = (NSMutableDictionary*)[super serializeResult]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.additionalAddressInformation] forKey:@"additionalAddressInformation"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.additionalNameInformation] forKey:@"additionalNameInformation"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.additionalOptionalAddressInformation] forKey:@"additionalOptionalAddressInformation"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.address] forKey:@"address"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.additionalAddressInformation] forKey:@"additionalAddressInformation"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.additionalNameInformation] forKey:@"additionalNameInformation"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.additionalOptionalAddressInformation] forKey:@"additionalOptionalAddressInformation"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.address] forKey:@"address"]; [jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeAdditionalProcessingInfo:self.result.backAdditionalProcessingInfo] forKey:@"backAdditionalProcessingInfo"]; [jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.backCameraFrame] forKey:@"backCameraFrame"]; @@ -166,24 +166,25 @@ -(NSDictionary *) serializeResult { [jsonResult setValue:[MBBlinkIDSerializationUtils serializeVizResult:self.result.backVizResult] forKey:@"backVizResult"]; [jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.barcodeCameraFrame] forKey:@"barcodeCameraFrame"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeBarcodeResult:self.result.barcodeResult] forKey:@"barcodeResult"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.bloodType] forKey:@"bloodType"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeClassInfo:self.result.classInfo] forKey:@"classInfo"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeDataMatchResult:self.result.dataMatchResult] forKey:@"dataMatch"]; - [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"]; - [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils 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:[MBSerializationUtils serializeMBStringResult:self.result.documentAdditionalNumber] forKey:@"documentAdditionalNumber"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBDateResult:self.result.dateOfIssue] forKey:@"dateOfIssue"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.documentAdditionalNumber] forKey:@"documentAdditionalNumber"]; [jsonResult setValue:[NSNumber numberWithInteger:self.result.documentDataMatch] forKey:@"documentDataMatch"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.documentNumber] forKey:@"documentNumber"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.documentOptionalAdditionalNumber] forKey:@"documentOptionalAdditionalNumber"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.documentNumber] forKey:@"documentNumber"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.documentOptionalAdditionalNumber] forKey:@"documentOptionalAdditionalNumber"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeDriverLicenseDetailedInfo:self.result.driverLicenseDetailedInfo] forKey:@"driverLicenseDetailedInfo"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.employer] forKey:@"employer"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.employer] forKey:@"employer"]; [jsonResult setValue:[NSNumber numberWithBool:self.result.expired] forKey:@"expired"]; [jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.faceImage] forKey:@"faceImage"]; [jsonResult setValue:[MBSerializationUtils serializeCGRect:self.result.faceImageLocation] forKey:@"faceImageLocation"]; [jsonResult setValue:[NSNumber numberWithInteger:self.result.faceImageSide] forKey:@"faceImageSide"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.fathersName] forKey:@"fathersName"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.firstName] forKey:@"firstName"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.fathersName] forKey:@"fathersName"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.firstName] forKey:@"firstName"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeAdditionalProcessingInfo:self.result.frontAdditionalProcessingInfo] forKey:@"frontAdditionalProcessingInfo"]; [jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.frontCameraFrame] forKey:@"frontCameraFrame"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeImageAnalysisResult:self.result.frontImageAnalysisResult] forKey:@"frontImageAnalysisResult"]; @@ -191,25 +192,26 @@ -(NSDictionary *) serializeResult { [jsonResult setValue:[MBBlinkIDSerializationUtils serializeVizResult:self.result.frontVizResult] forKey:@"frontVizResult"]; [jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.fullDocumentBackImage] forKey:@"fullDocumentBackImage"]; [jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.fullDocumentFrontImage] forKey:@"fullDocumentFrontImage"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.fullName] forKey:@"fullName"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.issuingAuthority] forKey:@"issuingAuthority"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.lastName] forKey:@"lastName"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.localizedName] forKey:@"localizedName"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.maritalStatus] forKey:@"maritalStatus"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.mothersName] forKey:@"mothersName"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.fullName] forKey:@"fullName"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.issuingAuthority] forKey:@"issuingAuthority"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.lastName] forKey:@"lastName"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.localizedName] forKey:@"localizedName"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.maritalStatus] forKey:@"maritalStatus"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.mothersName] forKey:@"mothersName"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMrzResult:self.result.mrzResult] forKey:@"mrzResult"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.nationality] forKey:@"nationality"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.personalIdNumber] forKey:@"personalIdNumber"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.placeOfBirth] forKey:@"placeOfBirth"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.nationality] forKey:@"nationality"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.personalIdNumber] forKey:@"personalIdNumber"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.placeOfBirth] forKey:@"placeOfBirth"]; [jsonResult setValue:[NSNumber numberWithInteger:self.result.processingStatus] forKey:@"processingStatus"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.profession] forKey:@"profession"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.race] forKey:@"race"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.profession] forKey:@"profession"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.race] forKey:@"race"]; [jsonResult setValue:[NSNumber numberWithInteger:self.result.recognitionMode] forKey:@"recognitionMode"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.religion] forKey:@"religion"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.residentialStatus] forKey:@"residentialStatus"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.religion] forKey:@"religion"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.residentialStatus] forKey:@"residentialStatus"]; [jsonResult setValue:[NSNumber numberWithBool:self.result.scanningFirstSideDone] forKey:@"scanningFirstSideDone"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.sex] forKey:@"sex"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.sex] forKey:@"sex"]; [jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.signatureImage] forKey:@"signatureImage"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.sponsor] forKey:@"sponsor"]; return jsonResult; } diff --git a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdSingleSideRecognizerWrapper.m b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdSingleSideRecognizerWrapper.m index 5620cdf..ab6151b 100644 --- a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdSingleSideRecognizerWrapper.m +++ b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBBlinkIdSingleSideRecognizerWrapper.m @@ -136,51 +136,53 @@ @implementation MBBlinkIdSingleSideRecognizer (JsonSerialization) -(NSDictionary *) serializeResult { NSMutableDictionary* jsonResult = (NSMutableDictionary*)[super serializeResult]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.additionalAddressInformation] forKey:@"additionalAddressInformation"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.additionalNameInformation] forKey:@"additionalNameInformation"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.additionalOptionalAddressInformation] forKey:@"additionalOptionalAddressInformation"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.additionalAddressInformation] forKey:@"additionalAddressInformation"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.additionalNameInformation] forKey:@"additionalNameInformation"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.additionalOptionalAddressInformation] forKey:@"additionalOptionalAddressInformation"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeAdditionalProcessingInfo:self.result.additionalProcessingInfo] forKey:@"additionalProcessingInfo"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.address] forKey:@"address"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.address] forKey:@"address"]; [jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"]; [jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.barcodeCameraFrame] forKey:@"barcodeCameraFrame"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeBarcodeResult:self.result.barcodeResult] forKey:@"barcodeResult"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.bloodType] forKey:@"bloodType"]; [jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.cameraFrame] forKey:@"cameraFrame"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeClassInfo:self.result.classInfo] forKey:@"classInfo"]; - [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"]; - [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils 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:[MBSerializationUtils serializeMBStringResult:self.result.documentAdditionalNumber] forKey:@"documentAdditionalNumber"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.documentNumber] forKey:@"documentNumber"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.documentOptionalAdditionalNumber] forKey:@"documentOptionalAdditionalNumber"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBDateResult:self.result.dateOfIssue] forKey:@"dateOfIssue"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.documentAdditionalNumber] forKey:@"documentAdditionalNumber"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.documentNumber] forKey:@"documentNumber"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.documentOptionalAdditionalNumber] forKey:@"documentOptionalAdditionalNumber"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeDriverLicenseDetailedInfo:self.result.driverLicenseDetailedInfo] forKey:@"driverLicenseDetailedInfo"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.employer] forKey:@"employer"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.employer] forKey:@"employer"]; [jsonResult setValue:[NSNumber numberWithBool:self.result.expired] forKey:@"expired"]; [jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.faceImage] forKey:@"faceImage"]; [jsonResult setValue:[MBSerializationUtils serializeCGRect:self.result.faceImageLocation] forKey:@"faceImageLocation"]; [jsonResult setValue:[NSNumber numberWithInteger:self.result.faceImageSide] forKey:@"faceImageSide"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.fathersName] forKey:@"fathersName"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.firstName] forKey:@"firstName"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.fathersName] forKey:@"fathersName"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.firstName] forKey:@"firstName"]; [jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.fullDocumentImage] forKey:@"fullDocumentImage"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.fullName] forKey:@"fullName"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.fullName] forKey:@"fullName"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeImageAnalysisResult:self.result.imageAnalysisResult] forKey:@"imageAnalysisResult"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.issuingAuthority] forKey:@"issuingAuthority"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.lastName] forKey:@"lastName"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.localizedName] forKey:@"localizedName"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.maritalStatus] forKey:@"maritalStatus"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.mothersName] forKey:@"mothersName"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.issuingAuthority] forKey:@"issuingAuthority"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.lastName] forKey:@"lastName"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.localizedName] forKey:@"localizedName"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.maritalStatus] forKey:@"maritalStatus"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.mothersName] forKey:@"mothersName"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMrzResult:self.result.mrzResult] forKey:@"mrzResult"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.nationality] forKey:@"nationality"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.personalIdNumber] forKey:@"personalIdNumber"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.placeOfBirth] forKey:@"placeOfBirth"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.nationality] forKey:@"nationality"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.personalIdNumber] forKey:@"personalIdNumber"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.placeOfBirth] forKey:@"placeOfBirth"]; [jsonResult setValue:[NSNumber numberWithInteger:self.result.processingStatus] forKey:@"processingStatus"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.profession] forKey:@"profession"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.race] forKey:@"race"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.profession] forKey:@"profession"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.race] forKey:@"race"]; [jsonResult setValue:[NSNumber numberWithInteger:self.result.recognitionMode] forKey:@"recognitionMode"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.religion] forKey:@"religion"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.residentialStatus] forKey:@"residentialStatus"]; - [jsonResult setValue:[MBSerializationUtils serializeMBStringResult:self.result.sex] forKey:@"sex"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.religion] forKey:@"religion"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.residentialStatus] forKey:@"residentialStatus"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.sex] forKey:@"sex"]; [jsonResult setValue:[MBSerializationUtils encodeMBImage:self.result.signatureImage] forKey:@"signatureImage"]; + [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.sponsor] forKey:@"sponsor"]; [jsonResult setValue:[MBBlinkIDSerializationUtils serializeVizResult:self.result.vizResult] forKey:@"vizResult"]; return jsonResult; diff --git a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBIdBarcodeRecognizerWrapper.m b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBIdBarcodeRecognizerWrapper.m index 01ca810..df4aed8 100644 --- a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBIdBarcodeRecognizerWrapper.m +++ b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBIdBarcodeRecognizerWrapper.m @@ -35,9 +35,9 @@ -(NSDictionary *) serializeResult { [jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"]; [jsonResult setValue:[NSNumber numberWithInteger:self.result.barcodeType] forKey:@"barcodeType"]; [jsonResult setValue:self.result.city forKey:@"city"]; - [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBDate:self.result.dateOfBirth] forKey:@"dateOfBirth"]; - [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBDate:self.result.dateOfExpiry] forKey:@"dateOfExpiry"]; - [jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBDate:self.result.dateOfIssue] forKey:@"dateOfIssue"]; + [jsonResult setValue:[MBSerializationUtils serializeMBDate:self.result.dateOfBirth] forKey:@"dateOfBirth"]; + [jsonResult setValue:[MBSerializationUtils serializeMBDate:self.result.dateOfExpiry] forKey:@"dateOfExpiry"]; + [jsonResult setValue:[MBSerializationUtils serializeMBDate: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] forKey:@"documentType"]; diff --git a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBUsdlCombinedRecognizerWrapper.m b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBUsdlCombinedRecognizerWrapper.m index cc03a0c..0d44f7d 100644 --- a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBUsdlCombinedRecognizerWrapper.m +++ b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBUsdlCombinedRecognizerWrapper.m @@ -81,9 +81,9 @@ -(NSDictionary *) serializeResult { [jsonResult setValue:self.result.restrictions forKey:@"restrictions"]; [jsonResult setValue:self.result.endorsements forKey:@"endorsements"]; [jsonResult setValue:self.result.vehicleClass forKey:@"vehicleClass"]; - [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"]; - [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfIssue] forKey:@"dateOfIssue"]; - [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"]; + [jsonResult setValue:[MBSerializationUtils serializeMBDate:self.result.dateOfBirth] forKey:@"dateOfBirth"]; + [jsonResult setValue:[MBSerializationUtils serializeMBDate:self.result.dateOfIssue] forKey:@"dateOfIssue"]; + [jsonResult setValue:[MBSerializationUtils serializeMBDate:self.result.dateOfExpiry] forKey:@"dateOfExpiry"]; [jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"]; [jsonResult setValue:[self.result optionalElements] forKey:@"optionalElements"]; diff --git a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBUsdlRecognizerWrapper.m b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBUsdlRecognizerWrapper.m index dba28a8..d636f59 100644 --- a/BlinkID/src/ios/sources/Recognizers/Wrappers/MBUsdlRecognizerWrapper.m +++ b/BlinkID/src/ios/sources/Recognizers/Wrappers/MBUsdlRecognizerWrapper.m @@ -60,9 +60,9 @@ -(NSDictionary *) serializeResult { [jsonResult setValue:self.result.restrictions forKey:@"restrictions"]; [jsonResult setValue:self.result.endorsements forKey:@"endorsements"]; [jsonResult setValue:self.result.vehicleClass forKey:@"vehicleClass"]; - [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"]; - [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfIssue] forKey:@"dateOfIssue"]; - [jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"]; + [jsonResult setValue:[MBSerializationUtils serializeMBDate:self.result.dateOfBirth] forKey:@"dateOfBirth"]; + [jsonResult setValue:[MBSerializationUtils serializeMBDate:self.result.dateOfIssue] forKey:@"dateOfIssue"]; + [jsonResult setValue:[MBSerializationUtils serializeMBDate:self.result.dateOfExpiry] forKey:@"dateOfExpiry"]; [jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"]; [jsonResult setValue:[self.result optionalElements] forKey:@"optionalElements"]; diff --git a/BlinkID/www/blinkIdScanner.js b/BlinkID/www/blinkIdScanner.js index 5c5a47c..e6ea852 100644 --- a/BlinkID/www/blinkIdScanner.js +++ b/BlinkID/www/blinkIdScanner.js @@ -82,6 +82,73 @@ BlinkID.prototype.scanWithCamera = function (successCallback, errorCallback, ove errorCallback, 'BlinkIDScanner', 'scanWithCamera', [overlaySettings, recognizerCollection, licenses]); }; +/** + * successCallback: callback that will be invoked on successful scan + * errorCallback: callback that will be invoked on error + * recognizerCollection: {RecognizerCollection} containing recognizers to use for scanning + * frontImage: the front image of the document that will be used for processing with DirectAPI in base64 format + * backImage: the back image of the document that will be used for processing with DirectAPI in base64 format. + * This parameter is optional for the BlinkIdSingleSideRecognizer. Pass an empty string for this parameter. + * licenses: object containing: + * - base64 license keys for iOS and Android + * - optioanl parameter 'licensee' when license for multiple apps is used + * - optional flag 'showTrialLicenseKeyWarning' which indicates + * whether warning for trial license key will be shown, in format + * { + * ios: 'base64iOSLicense', + * android: 'base64AndroidLicense', + * licensee: String, + * showTrialLicenseKeyWarning: Boolean + * } + */ + +BlinkID.prototype.scanWithDirectApi = function (successCallback, errorCallback, recognizerCollection, frontImage, backImage, licenses) { + if (errorCallback == null) { + errorCallback = function () { + }; + } + + if (typeof errorCallback != "function") { + console.log("BlinkIDScanner.scanWithDirectApi failure: failure parameter not a function"); + throw new Error("BlinkIDScanner.scanWithDirectApi failure: failure parameter not a function"); + return; + } + + if (typeof successCallback != "function") { + console.log("BlinkIDScanner.scanWithDirectApi failure: success callback parameter must be a function"); + throw new Error("BlinkIDScanner.scanWithDirectApi failure: success callback parameter must be a function"); + return; + } + + // first invalidate old results + for (var i = 0; i < recognizerCollection.recognizerArray[i].length; ++i ) { + recognizerCollection.recognizerArray[i].result = null; + } + + exec( + function internalCallback(scanningResult) { + var cancelled = scanningResult.cancelled; + + if (cancelled) { + successCallback(true); + } else { + var results = scanningResult.resultList; + if (results.length != recognizerCollection.recognizerArray.length) { + console.log("INTERNAL ERROR: native plugin returned wrong number of results!"); + throw new Error("INTERNAL ERROR: native plugin returned wrong number of results!"); + errorCallback(new Error("INTERNAL ERROR: native plugin returned wrong number of results!")); + } else { + for (var i = 0; i < results.length; ++i) { + // native plugin must ensure types match + recognizerCollection.recognizerArray[i].result = recognizerCollection.recognizerArray[i].createResultFromNative(results[i]); + } + successCallback(false); + } + } + }, + errorCallback, 'BlinkIDScanner', 'scanWithDirectApi', [recognizerCollection, frontImage, backImage, licenses]); +}; + // COMMON CLASSES /** @@ -878,6 +945,12 @@ BlinkID.prototype.Region = Object.freeze( Parana: 129, Pernambuco: 130, SantaCatarina: 131, + AndhraPradesh: 132, + Ceara: 133, + Goias: 134, + GuerreroAcapulcoDeJuarez: 135, + Haryana: 136, + Sergipe: 137, } ); @@ -948,6 +1021,11 @@ BlinkID.prototype.Type = Object.freeze( ImmigrantVisa: 59, ConsularVoterId: 60, TwicCard: 61, + ExitEntryPermit: 62, + MainlandTravelPermitTaiwan: 63, + NbiClearance: 64, + ProofOfRegistration: 65, + TemporaryProtectionPermit: 66, } ); @@ -956,44 +1034,44 @@ BlinkID.prototype.Type = Object.freeze( */ BlinkID.prototype.FieldType = Object.freeze ( { - AdditionalAddressInformation: 0, - AdditionalNameInformation: 1, - AdditionalOptionalAddressInformation: 2, - AdditionalPersonalIdNumber: 3, - Address: 4, - ClassEffectiveDate: 5, - ClassExpiryDate: 6, - Conditions: 7, - DateOfBirth: 8, - DateOfExpiry: 9, - DateOfIssue: 10, - DocumentAdditionalNumber: 11, - DocumentOptionalAdditionalNumber: 12, - DocumentNumber: 13, - Employer: 14, - Endorsements: 15, - FathersName: 16, - FirstName: 17, - FullName: 18, - IssuingAuthority: 19, - LastName: 20, - LicenceType: 21, - LocalizedName: 22, - MaritalStatus: 23, - MothersName: 24, - Mrz: 25, - Nationality: 26, - PersonalIdNumber: 27, - PlaceOfBirth: 28, - Profession: 29, - Race: 30, - Religion: 31, - ResidentialStatus: 32, - Restrictions: 33, - Sex: 34, - VehicleClass: 35, - BloodType: 36, - Sponsor: 37, + AdditionalAddressInformation: 0, + AdditionalNameInformation: 1, + AdditionalOptionalAddressInformation: 2, + AdditionalPersonalIdNumber: 3, + Address: 4, + ClassEffectiveDate: 5, + ClassExpiryDate: 6, + Conditions: 7, + DateOfBirth: 8, + DateOfExpiry: 9, + DateOfIssue: 10, + DocumentAdditionalNumber: 11, + DocumentOptionalAdditionalNumber: 12, + DocumentNumber: 13, + Employer: 14, + Endorsements: 15, + FathersName: 16, + FirstName: 17, + FullName: 18, + IssuingAuthority: 19, + LastName: 20, + LicenceType: 21, + LocalizedName: 22, + MaritalStatus: 23, + MothersName: 24, + Mrz: 25, + Nationality: 26, + PersonalIdNumber: 27, + PlaceOfBirth: 28, + Profession: 29, + Race: 30, + Religion: 31, + ResidentialStatus: 32, + Restrictions: 33, + Sex: 34, + VehicleClass: 35, + BloodType: 36, + Sponsor: 37, } ); @@ -2457,11 +2535,20 @@ function BlinkIdOverlaySettings() { */ this.requireDocumentSidesDataMatch = true; - /** - * Language of UI. - */ + /** + * If default overlay contains textual information, text will be localized to this language. Otherwise device langauge will be used + * + * example: "en" + */ this.language = null; + /** + * Used with language variable, it defines the country locale + * + * example: "US" to use "en_US" on Android and en-US on iOS + */ + this.country = null; + /** * Defines whether Document Not Supported dialog will be displayed in UI. * @@ -2522,6 +2609,19 @@ function BlinkIdOverlaySettings() { */ this.onboardingButtonTooltipDelay = 12000; + /** + * Defines whether torch button used for turning the flashlight on and off is shown on the screen during the scanning session. + * + * Default: true + */ + this.showTorchButton = true; + + /** + * Defines whether exit (cancel) button used for cancelling the scan is shown on the screen during the scanning session. + * + * Default: true + */ + this.showCancelButton = true; } BlinkIdOverlaySettings.prototype = new OverlaySettings(); @@ -2576,99 +2676,104 @@ function BlinkIdMultiSideRecognizerResult(nativeResult) { /** * The additional address information of the document owner. */ - this.additionalAddressInformation = nativeResult.additionalAddressInformation; + this.additionalAddressInformation = nativeResult.additionalAddressInformation; /** * The additional name information of the document owner. */ - this.additionalNameInformation = nativeResult.additionalNameInformation; + this.additionalNameInformation = nativeResult.additionalNameInformation; /** * The one more additional address information of the document owner. */ - this.additionalOptionalAddressInformation = nativeResult.additionalOptionalAddressInformation; + this.additionalOptionalAddressInformation = nativeResult.additionalOptionalAddressInformation; /** * The address of the document owner. */ - this.address = nativeResult.address; + this.address = nativeResult.address; /** * The current age of the document owner in years. It is calculated difference * between now and date of birth. Now is current time on the device. * @return current age of the document owner in years or -1 if date of birth is unknown. */ - this.age = nativeResult.age; + this.age = nativeResult.age; /** * Additional info on processing of the back side. */ - this.backAdditionalProcessingInfo = nativeResult.backAdditionalProcessingInfo; + this.backAdditionalProcessingInfo = nativeResult.backAdditionalProcessingInfo; /** * The back raw camera frame. */ - this.backCameraFrame = nativeResult.backCameraFrame; + this.backCameraFrame = nativeResult.backCameraFrame; /** * Defines possible color and moire statuses determined from scanned back image. */ - this.backImageAnalysisResult = nativeResult.backImageAnalysisResult; + this.backImageAnalysisResult = nativeResult.backImageAnalysisResult; /** * Status of the last back side recognition process. */ - this.backProcessingStatus = nativeResult.backProcessingStatus; + this.backProcessingStatus = nativeResult.backProcessingStatus; /** * Defines the data extracted from the back side visual inspection zone. */ - this.backVizResult = nativeResult.backVizResult; + this.backVizResult = nativeResult.backVizResult; /** * The barcode raw camera frame. */ - this.barcodeCameraFrame = nativeResult.barcodeCameraFrame; + this.barcodeCameraFrame = nativeResult.barcodeCameraFrame; /** * Defines the data extracted from the barcode. */ - this.barcodeResult = nativeResult.barcodeResult; + this.barcodeResult = nativeResult.barcodeResult; + + /** + * The blood type of the document owner. + */ + this.bloodType = nativeResult.bloodType; /** * The classification information. */ - this.classInfo = nativeResult.classInfo; + this.classInfo = nativeResult.classInfo; /** * Detailed info on data match. */ - this.dataMatch = nativeResult.dataMatch; + this.dataMatch = nativeResult.dataMatch; /** * The date of birth of the document owner. */ - this.dateOfBirth = nativeResult.dateOfBirth != null ? new Date(nativeResult.dateOfBirth) : null; + 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; + this.dateOfExpiry = nativeResult.dateOfExpiry != null ? new Date(nativeResult.dateOfExpiry) : null; /** * Determines if date of expiry is permanent. */ - this.dateOfExpiryPermanent = nativeResult.dateOfExpiryPermanent; + this.dateOfExpiryPermanent = nativeResult.dateOfExpiryPermanent; /** * The date of issue of the document. */ - this.dateOfIssue = nativeResult.dateOfIssue != null ? new Date(nativeResult.dateOfIssue) : null; + this.dateOfIssue = nativeResult.dateOfIssue != null ? new Date(nativeResult.dateOfIssue) : null; /** * The additional number of the document. */ - this.documentAdditionalNumber = nativeResult.documentAdditionalNumber; + this.documentAdditionalNumber = nativeResult.documentAdditionalNumber; /** * Returns DataMatchStateSuccess if data from scanned parts/sides of the document match, @@ -2676,27 +2781,27 @@ function BlinkIdMultiSideRecognizerResult(nativeResult) { * of the document and values do not match, this method will return DataMatchStateFailed. Result will * be DataMatchStateSuccess only if scanned values for all fields that are compared are the same. */ - this.documentDataMatch = nativeResult.documentDataMatch; + this.documentDataMatch = nativeResult.documentDataMatch; /** * The document number. */ - this.documentNumber = nativeResult.documentNumber; + this.documentNumber = nativeResult.documentNumber; /** * The one more additional number of the document. */ - this.documentOptionalAdditionalNumber = nativeResult.documentOptionalAdditionalNumber; + this.documentOptionalAdditionalNumber = nativeResult.documentOptionalAdditionalNumber; /** * The driver license detailed info. */ - this.driverLicenseDetailedInfo = nativeResult.driverLicenseDetailedInfo; + this.driverLicenseDetailedInfo = nativeResult.driverLicenseDetailedInfo; /** * The employer of the document owner. */ - this.employer = nativeResult.employer; + this.employer = nativeResult.employer; /** * Checks whether the document has expired or not by comparing the current @@ -2707,163 +2812,168 @@ function BlinkIdMultiSideRecognizerResult(nativeResult) { * date of expiry has passed * date of expiry is unknown and it is not permanent */ - this.expired = nativeResult.expired; + this.expired = nativeResult.expired; /** * face image from the document if enabled with returnFaceImage property. */ - this.faceImage = nativeResult.faceImage; + this.faceImage = nativeResult.faceImage; /** * face image location from the document if enabled with returnFaceImage property. */ - this.faceImageLocation = nativeResult.faceImageLocation; + this.faceImageLocation = nativeResult.faceImageLocation; /** * side of document that face image is located on if enabled with returnFaceImage property. */ - this.faceImageSide = nativeResult.faceImageSide; + this.faceImageSide = nativeResult.faceImageSide; /** * The father's name of the document owner. */ - this.fathersName = nativeResult.fathersName; + this.fathersName = nativeResult.fathersName; /** * The first name of the document owner. */ - this.firstName = nativeResult.firstName; + this.firstName = nativeResult.firstName; /** * Additional info on processing of the front side. */ - this.frontAdditionalProcessingInfo = nativeResult.frontAdditionalProcessingInfo; + this.frontAdditionalProcessingInfo = nativeResult.frontAdditionalProcessingInfo; /** * The front raw camera frame. */ - this.frontCameraFrame = nativeResult.frontCameraFrame; + this.frontCameraFrame = nativeResult.frontCameraFrame; /** * Defines possible color and moire statuses determined from scanned front image. */ - this.frontImageAnalysisResult = nativeResult.frontImageAnalysisResult; + this.frontImageAnalysisResult = nativeResult.frontImageAnalysisResult; /** * Status of the last front side recognition process. */ - this.frontProcessingStatus = nativeResult.frontProcessingStatus; + this.frontProcessingStatus = nativeResult.frontProcessingStatus; /** * Defines the data extracted from the front side visual inspection zone. */ - this.frontVizResult = nativeResult.frontVizResult; + this.frontVizResult = nativeResult.frontVizResult; /** * back side image of the document if enabled with returnFullDocumentImage property. */ - this.fullDocumentBackImage = nativeResult.fullDocumentBackImage; + this.fullDocumentBackImage = nativeResult.fullDocumentBackImage; /** * front side image of the document if enabled with returnFullDocumentImage property. */ - this.fullDocumentFrontImage = nativeResult.fullDocumentFrontImage; + this.fullDocumentFrontImage = nativeResult.fullDocumentFrontImage; /** * The full name of the document owner. */ - this.fullName = nativeResult.fullName; + this.fullName = nativeResult.fullName; /** * The issuing authority of the document. */ - this.issuingAuthority = nativeResult.issuingAuthority; + this.issuingAuthority = nativeResult.issuingAuthority; /** * The last name of the document owner. */ - this.lastName = nativeResult.lastName; + this.lastName = nativeResult.lastName; /** * The localized name of the document owner. */ - this.localizedName = nativeResult.localizedName; + this.localizedName = nativeResult.localizedName; /** * The marital status of the document owner. */ - this.maritalStatus = nativeResult.maritalStatus; + this.maritalStatus = nativeResult.maritalStatus; /** * The mother's name of the document owner. */ - this.mothersName = nativeResult.mothersName; + this.mothersName = nativeResult.mothersName; /** * The data extracted from the machine readable zone */ - this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; + this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; /** * The nationality of the documet owner. */ - this.nationality = nativeResult.nationality; + this.nationality = nativeResult.nationality; /** * The personal identification number. */ - this.personalIdNumber = nativeResult.personalIdNumber; + this.personalIdNumber = nativeResult.personalIdNumber; /** * The place of birth of the document owner. */ - this.placeOfBirth = nativeResult.placeOfBirth; + this.placeOfBirth = nativeResult.placeOfBirth; /** * Defines status of the last recognition process. */ - this.processingStatus = nativeResult.processingStatus; + this.processingStatus = nativeResult.processingStatus; /** * The profession of the document owner. */ - this.profession = nativeResult.profession; + this.profession = nativeResult.profession; /** * The race of the document owner. */ - this.race = nativeResult.race; + this.race = nativeResult.race; /** * Recognition mode used to scan current document. */ - this.recognitionMode = nativeResult.recognitionMode; + this.recognitionMode = nativeResult.recognitionMode; /** * The religion of the document owner. */ - this.religion = nativeResult.religion; + this.religion = nativeResult.religion; /** * The residential stauts of the document owner. */ - this.residentialStatus = nativeResult.residentialStatus; + this.residentialStatus = nativeResult.residentialStatus; /** * Returns true if recognizer has finished scanning first side and is now scanning back side, * false if it's still scanning first side. */ - this.scanningFirstSideDone = nativeResult.scanningFirstSideDone; + this.scanningFirstSideDone = nativeResult.scanningFirstSideDone; /** * The sex of the document owner. */ - this.sex = nativeResult.sex; + this.sex = nativeResult.sex; /** * image of the signature if enabled with returnSignatureImage property. */ - this.signatureImage = nativeResult.signatureImage; + this.signatureImage = nativeResult.signatureImage; + + /** + * The sponsor of the document owner. + */ + this.sponsor = nativeResult.sponsor; } @@ -3044,99 +3154,104 @@ function BlinkIdSingleSideRecognizerResult(nativeResult) { /** * The additional address information of the document owner. */ - this.additionalAddressInformation = nativeResult.additionalAddressInformation; + this.additionalAddressInformation = nativeResult.additionalAddressInformation; /** * The additional name information of the document owner. */ - this.additionalNameInformation = nativeResult.additionalNameInformation; + this.additionalNameInformation = nativeResult.additionalNameInformation; /** * The one more additional address information of the document owner. */ - this.additionalOptionalAddressInformation = nativeResult.additionalOptionalAddressInformation; + this.additionalOptionalAddressInformation = nativeResult.additionalOptionalAddressInformation; /** * Additional info on processing. */ - this.additionalProcessingInfo = nativeResult.additionalProcessingInfo; + this.additionalProcessingInfo = nativeResult.additionalProcessingInfo; /** * The address of the document owner. */ - this.address = nativeResult.address; + this.address = nativeResult.address; /** * The current age of the document owner in years. It is calculated difference * between now and date of birth. Now is current time on the device. * @return current age of the document owner in years or -1 if date of birth is unknown. */ - this.age = nativeResult.age; + this.age = nativeResult.age; /** * The barcode raw camera frame. */ - this.barcodeCameraFrame = nativeResult.barcodeCameraFrame; + this.barcodeCameraFrame = nativeResult.barcodeCameraFrame; /** * Defines the data extracted from the barcode. */ - this.barcodeResult = nativeResult.barcodeResult; + this.barcodeResult = nativeResult.barcodeResult; + + /** + * The blood type of the document owner. + */ + this.bloodType = nativeResult.bloodType; /** * The raw camera frame. */ - this.cameraFrame = nativeResult.cameraFrame; + this.cameraFrame = nativeResult.cameraFrame; /** * The classification information. */ - this.classInfo = nativeResult.classInfo; + this.classInfo = nativeResult.classInfo; /** * The date of birth of the document owner. */ - this.dateOfBirth = nativeResult.dateOfBirth != null ? new Date(nativeResult.dateOfBirth) : null; + 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; + this.dateOfExpiry = nativeResult.dateOfExpiry != null ? new Date(nativeResult.dateOfExpiry) : null; /** * Determines if date of expiry is permanent. */ - this.dateOfExpiryPermanent = nativeResult.dateOfExpiryPermanent; + this.dateOfExpiryPermanent = nativeResult.dateOfExpiryPermanent; /** * The date of issue of the document. */ - this.dateOfIssue = nativeResult.dateOfIssue != null ? new Date(nativeResult.dateOfIssue) : null; + this.dateOfIssue = nativeResult.dateOfIssue != null ? new Date(nativeResult.dateOfIssue) : null; /** * The additional number of the document. */ - this.documentAdditionalNumber = nativeResult.documentAdditionalNumber; + this.documentAdditionalNumber = nativeResult.documentAdditionalNumber; /** * The document number. */ - this.documentNumber = nativeResult.documentNumber; + this.documentNumber = nativeResult.documentNumber; /** * The one more additional number of the document. */ - this.documentOptionalAdditionalNumber = nativeResult.documentOptionalAdditionalNumber; + this.documentOptionalAdditionalNumber = nativeResult.documentOptionalAdditionalNumber; /** * The driver license detailed info. */ - this.driverLicenseDetailedInfo = nativeResult.driverLicenseDetailedInfo; + this.driverLicenseDetailedInfo = nativeResult.driverLicenseDetailedInfo; /** * The employer of the document owner. */ - this.employer = nativeResult.employer; + this.employer = nativeResult.employer; /** * Checks whether the document has expired or not by comparing the current @@ -3147,137 +3262,142 @@ function BlinkIdSingleSideRecognizerResult(nativeResult) { * date of expiry has passed * date of expiry is unknown and it is not permanent */ - this.expired = nativeResult.expired; + this.expired = nativeResult.expired; /** * face image from the document if enabled with returnFaceImage property. */ - this.faceImage = nativeResult.faceImage; + this.faceImage = nativeResult.faceImage; /** * face image location from the document if enabled with returnFaceImage property. */ - this.faceImageLocation = nativeResult.faceImageLocation; + this.faceImageLocation = nativeResult.faceImageLocation; /** * side of document that face image is located on if enabled with returnFaceImage property. */ - this.faceImageSide = nativeResult.faceImageSide; + this.faceImageSide = nativeResult.faceImageSide; /** * The father's name of the document owner. */ - this.fathersName = nativeResult.fathersName; + this.fathersName = nativeResult.fathersName; /** * The first name of the document owner. */ - this.firstName = nativeResult.firstName; + this.firstName = nativeResult.firstName; /** * full document image if enabled with returnFullDocumentImage property. */ - this.fullDocumentImage = nativeResult.fullDocumentImage; + this.fullDocumentImage = nativeResult.fullDocumentImage; /** * The full name of the document owner. */ - this.fullName = nativeResult.fullName; + this.fullName = nativeResult.fullName; /** * Defines possible color and moire statuses determined from scanned image. */ - this.imageAnalysisResult = nativeResult.imageAnalysisResult; + this.imageAnalysisResult = nativeResult.imageAnalysisResult; /** * The issuing authority of the document. */ - this.issuingAuthority = nativeResult.issuingAuthority; + this.issuingAuthority = nativeResult.issuingAuthority; /** * The last name of the document owner. */ - this.lastName = nativeResult.lastName; + this.lastName = nativeResult.lastName; /** * The localized name of the document owner. */ - this.localizedName = nativeResult.localizedName; + this.localizedName = nativeResult.localizedName; /** * The marital status of the document owner. */ - this.maritalStatus = nativeResult.maritalStatus; + this.maritalStatus = nativeResult.maritalStatus; /** * The mother's name of the document owner. */ - this.mothersName = nativeResult.mothersName; + this.mothersName = nativeResult.mothersName; /** * The data extracted from the machine readable zone */ - this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; + this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; /** * The nationality of the documet owner. */ - this.nationality = nativeResult.nationality; + this.nationality = nativeResult.nationality; /** * The personal identification number. */ - this.personalIdNumber = nativeResult.personalIdNumber; + this.personalIdNumber = nativeResult.personalIdNumber; /** * The place of birth of the document owner. */ - this.placeOfBirth = nativeResult.placeOfBirth; + this.placeOfBirth = nativeResult.placeOfBirth; /** * Defines status of the last recognition process. */ - this.processingStatus = nativeResult.processingStatus; + this.processingStatus = nativeResult.processingStatus; /** * The profession of the document owner. */ - this.profession = nativeResult.profession; + this.profession = nativeResult.profession; /** * The race of the document owner. */ - this.race = nativeResult.race; + this.race = nativeResult.race; /** * Recognition mode used to scan current document. */ - this.recognitionMode = nativeResult.recognitionMode; + this.recognitionMode = nativeResult.recognitionMode; /** * The religion of the document owner. */ - this.religion = nativeResult.religion; + this.religion = nativeResult.religion; /** * The residential stauts of the document owner. */ - this.residentialStatus = nativeResult.residentialStatus; + this.residentialStatus = nativeResult.residentialStatus; /** * The sex of the document owner. */ - this.sex = nativeResult.sex; + this.sex = nativeResult.sex; /** * image of the signature if enabled with returnSignatureImage property. */ - this.signatureImage = nativeResult.signatureImage; + this.signatureImage = nativeResult.signatureImage; + + /** + * The sponsor of the document owner. + */ + this.sponsor = nativeResult.sponsor; /** * Defines the data extracted from the visual inspection zone */ - this.vizResult = nativeResult.vizResult; + this.vizResult = nativeResult.vizResult; } @@ -3436,22 +3556,22 @@ function DocumentFaceRecognizerResult(nativeResult) { /** * Quadrangle represeting corner points of the document within the input image. */ - this.documentLocation = nativeResult.documentLocation != null ? new Quadrilateral(nativeResult.documentLocation) : null; + this.documentLocation = nativeResult.documentLocation != null ? new Quadrilateral(nativeResult.documentLocation) : null; /** * face image from the document if enabled with returnFaceImage property. */ - this.faceImage = nativeResult.faceImage; + this.faceImage = nativeResult.faceImage; /** * Quadrangle represeting corner points of the face image within the input image. */ - this.faceLocation = nativeResult.faceLocation != null ? new Quadrilateral(nativeResult.faceLocation) : null; + this.faceLocation = nativeResult.faceLocation != null ? new Quadrilateral(nativeResult.faceLocation) : null; /** * full document image if enabled with returnFullDocumentImage property. */ - this.fullDocumentImage = nativeResult.fullDocumentImage; + this.fullDocumentImage = nativeResult.fullDocumentImage; } @@ -3539,73 +3659,73 @@ function IdBarcodeRecognizerResult(nativeResult) { /** * The additional name information of the document owner. */ - this.additionalNameInformation = nativeResult.additionalNameInformation; + this.additionalNameInformation = nativeResult.additionalNameInformation; /** * The address of the document owner. */ - this.address = nativeResult.address; + this.address = nativeResult.address; /** * The current age of the document owner in years. It is calculated difference * between now and date of birth. Now is current time on the device. * @return current age of the document owner in years or -1 if date of birth is unknown. */ - this.age = nativeResult.age; + this.age = nativeResult.age; /** * Type of the barcode scanned * * @return Type of the barcode */ - this.barcodeType = nativeResult.barcodeType; + this.barcodeType = nativeResult.barcodeType; /** * The city address portion of the document owner. */ - this.city = nativeResult.city; + this.city = nativeResult.city; /** * The date of birth of the document owner. */ - this.dateOfBirth = nativeResult.dateOfBirth != null ? new Date(nativeResult.dateOfBirth) : null; + 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; + 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; + this.dateOfIssue = nativeResult.dateOfIssue != null ? new Date(nativeResult.dateOfIssue) : null; /** * The additional number of the document. */ - this.documentAdditionalNumber = nativeResult.documentAdditionalNumber; + this.documentAdditionalNumber = nativeResult.documentAdditionalNumber; /** * The document number. */ - this.documentNumber = nativeResult.documentNumber; + this.documentNumber = nativeResult.documentNumber; /** * The document type deduced from the recognized barcode * * @return Type of the document */ - this.documentType = nativeResult.documentType; + this.documentType = nativeResult.documentType; /** * The employer of the document owner. */ - this.employer = nativeResult.employer; + this.employer = nativeResult.employer; /** * The additional privileges granted to the driver license owner. */ - this.endorsements = nativeResult.endorsements; + this.endorsements = nativeResult.endorsements; /** * Checks whether the document has expired or not by comparing the current @@ -3616,125 +3736,125 @@ function IdBarcodeRecognizerResult(nativeResult) { * date of expiry has passed * date of expiry is unknown and it is not permanent */ - this.expired = nativeResult.expired; + this.expired = nativeResult.expired; /** * Document specific extended elements that contain all barcode fields in their original form. * * Currently this is only filled for AAMVACompliant documents. */ - this.extendedElements = nativeResult.extendedElements; + this.extendedElements = nativeResult.extendedElements; /** * The first name of the document owner. */ - this.firstName = nativeResult.firstName; + this.firstName = nativeResult.firstName; /** * The full name of the document owner. */ - this.fullName = nativeResult.fullName; + this.fullName = nativeResult.fullName; /** * The issuing authority of the document. */ - this.issuingAuthority = nativeResult.issuingAuthority; + this.issuingAuthority = nativeResult.issuingAuthority; /** * The jurisdiction code address portion of the document owner. */ - this.jurisdiction = nativeResult.jurisdiction; + this.jurisdiction = nativeResult.jurisdiction; /** * The last name of the document owner. */ - this.lastName = nativeResult.lastName; + this.lastName = nativeResult.lastName; /** * The marital status of the document owner. */ - this.maritalStatus = nativeResult.maritalStatus; + this.maritalStatus = nativeResult.maritalStatus; /** * The middle name of the document owner. */ - this.middleName = nativeResult.middleName; + this.middleName = nativeResult.middleName; /** * The nationality of the documet owner. */ - this.nationality = nativeResult.nationality; + this.nationality = nativeResult.nationality; /** * The personal identification number. */ - this.personalIdNumber = nativeResult.personalIdNumber; + this.personalIdNumber = nativeResult.personalIdNumber; /** * The place of birth of the document owner. */ - this.placeOfBirth = nativeResult.placeOfBirth; + this.placeOfBirth = nativeResult.placeOfBirth; /** * The postal code address portion of the document owner. */ - this.postalCode = nativeResult.postalCode; + this.postalCode = nativeResult.postalCode; /** * The profession of the document owner. */ - this.profession = nativeResult.profession; + this.profession = nativeResult.profession; /** * The race of the document owner. */ - this.race = nativeResult.race; + this.race = nativeResult.race; /** * Byte array with result of the scan */ - this.rawData = nativeResult.rawData; + this.rawData = nativeResult.rawData; /** * The religion of the document owner. */ - this.religion = nativeResult.religion; + this.religion = nativeResult.religion; /** * The residential stauts of the document owner. */ - this.residentialStatus = nativeResult.residentialStatus; + this.residentialStatus = nativeResult.residentialStatus; /** * The restrictions to driving privileges for the driver license owner. */ - this.restrictions = nativeResult.restrictions; + this.restrictions = nativeResult.restrictions; /** * The sex of the document owner. */ - this.sex = nativeResult.sex; + this.sex = nativeResult.sex; /** * The street address portion of the document owner. */ - this.street = nativeResult.street; + this.street = nativeResult.street; /** * Retrieves string content of scanned data */ - this.stringData = nativeResult.stringData; + this.stringData = nativeResult.stringData; /** * Flag indicating uncertain scanning data * E.g obtained from damaged barcode. */ - this.uncertain = nativeResult.uncertain; + this.uncertain = nativeResult.uncertain; /** * The type of vehicle the driver license owner has privilege to drive. */ - this.vehicleClass = nativeResult.vehicleClass; + this.vehicleClass = nativeResult.vehicleClass; } @@ -3768,33 +3888,33 @@ function MrtdCombinedRecognizerResult(nativeResult) { * of the document and values do not match, this method will return DataMatchStateFailed. Result will * be DataMatchStateSuccess only if scanned values for all fields that are compared are the same. */ - this.documentDataMatch = nativeResult.documentDataMatch; + this.documentDataMatch = nativeResult.documentDataMatch; /** * face image from the document if enabled with returnFaceImage property. */ - this.faceImage = nativeResult.faceImage; + this.faceImage = nativeResult.faceImage; /** * back side image of the document if enabled with returnFullDocumentImage property. */ - this.fullDocumentBackImage = nativeResult.fullDocumentBackImage; + this.fullDocumentBackImage = nativeResult.fullDocumentBackImage; /** * front side image of the document if enabled with returnFullDocumentImage property. */ - this.fullDocumentFrontImage = nativeResult.fullDocumentFrontImage; + this.fullDocumentFrontImage = nativeResult.fullDocumentFrontImage; /** * Returns the Data extracted from the machine readable zone. */ - this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; + this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; /** * Returns true if recognizer has finished scanning first side and is now scanning back side, * false if it's still scanning first side. */ - this.scanningFirstSideDone = nativeResult.scanningFirstSideDone; + this.scanningFirstSideDone = nativeResult.scanningFirstSideDone; } @@ -3904,12 +4024,12 @@ function MrtdRecognizerResult(nativeResult) { /** * full document image if enabled with returnFullDocumentImage property. */ - this.fullDocumentImage = nativeResult.fullDocumentImage; + this.fullDocumentImage = nativeResult.fullDocumentImage; /** * Returns the Data extracted from the machine readable zone. */ - this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; + this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; } @@ -3992,17 +4112,17 @@ function PassportRecognizerResult(nativeResult) { /** * face image from the document if enabled with returnFaceImage property. */ - this.faceImage = nativeResult.faceImage; + this.faceImage = nativeResult.faceImage; /** * full document image if enabled with returnFullDocumentImage property. */ - this.fullDocumentImage = nativeResult.fullDocumentImage; + this.fullDocumentImage = nativeResult.fullDocumentImage; /** * The data extracted from the machine readable zone. */ - this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; + this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; } @@ -4085,17 +4205,17 @@ function VisaRecognizerResult(nativeResult) { /** * face image from the document if enabled with returnFaceImage property. */ - this.faceImage = nativeResult.faceImage; + this.faceImage = nativeResult.faceImage; /** * full document image if enabled with returnFullDocumentImage property. */ - this.fullDocumentImage = nativeResult.fullDocumentImage; + this.fullDocumentImage = nativeResult.fullDocumentImage; /** * The data extracted from the machine readable zone. */ - this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; + this.mrzResult = nativeResult.mrzResult != null ? new MrzResult(nativeResult.mrzResult) : null; } From 8d6f64fed6b640765b146b8df5319c708fa8cafb Mon Sep 17 00:00:00 2001 From: mparadina Date: Wed, 3 Apr 2024 11:20:36 +0200 Subject: [PATCH 02/14] Update SDK version --- BlinkID/package.json | 2 +- BlinkID/plugin.xml | 5 ++--- BlinkID/scripts/initIOSFramework.sh | 2 +- BlinkID/src/android/libBlinkID.gradle | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/BlinkID/package.json b/BlinkID/package.json index f4af209..9f9df56 100644 --- a/BlinkID/package.json +++ b/BlinkID/package.json @@ -1,6 +1,6 @@ { "name": "blinkid-cordova", - "version": "6.5.0", + "version": "6.6.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 5be2c22..9dfb3a1 100644 --- a/BlinkID/plugin.xml +++ b/BlinkID/plugin.xml @@ -2,7 +2,7 @@ + version="6.6.0"> BlinkIdScanner A small and powerful ID card scanning library @@ -153,8 +153,7 @@ - - + $CAMERA_USAGE_DESCRIPTION diff --git a/BlinkID/scripts/initIOSFramework.sh b/BlinkID/scripts/initIOSFramework.sh index 0179cad..29c72f1 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/v6.5.0/BlinkID.xcframework.zip' +LINK='https://github.com/BlinkID/blinkid-ios/releases/download/v6.6.0/BlinkID.xcframework.zip' FILENAME='BlinkID.xcframework.zip' # BlinkID framework will be obtained via wget or curl diff --git a/BlinkID/src/android/libBlinkID.gradle b/BlinkID/src/android/libBlinkID.gradle index ec162ae..c555c87 100644 --- a/BlinkID/src/android/libBlinkID.gradle +++ b/BlinkID/src/android/libBlinkID.gradle @@ -6,7 +6,7 @@ repositories { } dependencies { - implementation('com.microblink:blinkid:6.5.0@aar') { + implementation('com.microblink:blinkid:6.6.1@aar') { transitive = true } } From d9234543da7709bc58f8a5e1023b05d6549bf7e0 Mon Sep 17 00:00:00 2001 From: mparadina Date: Wed, 3 Apr 2024 11:49:51 +0200 Subject: [PATCH 03/14] sample index.js and init script update --- initCordovaSampleApp.sh | 3 + sample_files/www/css/index.css | 18 ++ sample_files/www/index.html | 4 +- sample_files/www/js/index.js | 303 +++++++++++++++++++++++---------- 4 files changed, 239 insertions(+), 89 deletions(-) diff --git a/initCordovaSampleApp.sh b/initCordovaSampleApp.sh index 7351e4a..bd5e774 100755 --- a/initCordovaSampleApp.sh +++ b/initCordovaSampleApp.sh @@ -26,6 +26,9 @@ else echo "Using plugin from NPM" fi +# cordova-plugin-camera plugin needed only for sample application with DirectAPI to get the document images +cordova plugin add https://github.com/jalios/cordova-plugin-camera.git + # add ios and android support to the project cordova platform add android@10 cordova platform add ios diff --git a/sample_files/www/css/index.css b/sample_files/www/css/index.css index 6eca2af..038612e 100755 --- a/sample_files/www/css/index.css +++ b/sample_files/www/css/index.css @@ -92,6 +92,24 @@ h1 { margin-right: 38% } +#directAPIMultiSideButton { + margin-top: 20px; + font-size:18px; + height: 30px; + width: 35%; + margin-left: 32%; + margin-right: 35% +} + +#directAPISingleSideButton { + margin-top: 20px; + font-size:18px; + height: 30px; + width: 35%; + margin-left: 32%; + margin-right: 35% +} + #resultDiv { margin-top: 20px; } diff --git a/sample_files/www/index.html b/sample_files/www/index.html index 1310d27..9f69435 100644 --- a/sample_files/www/index.html +++ b/sample_files/www/index.html @@ -28,7 +28,9 @@

BlinkID

- + + +

Document Image:

diff --git a/sample_files/www/js/index.js b/sample_files/www/js/index.js index 9e47591..2ea3555 100644 --- a/sample_files/www/js/index.js +++ b/sample_files/www/js/index.js @@ -55,30 +55,28 @@ var app = { documentBackImageDiv.style.visibility = "hidden"; faceImageDiv.style.visibility = "hidden"; - // to scan any machine readable travel document (passports, visa's and IDs with - // machine readable zone), use MrtdRecognizer -// var mrtdRecognizer = new cordova.plugins.BlinkID.MrtdRecognizer(); -// mrtdRecognizer.returnFullDocumentImage = true; - // wrap recognizer with SuccessFrameGrabberRecognizer to obtain camera frame from the successful scan -// var mrtdSuccessFrameGrabber = new cordova.plugins.BlinkID.SuccessFrameGrabberRecognizer(mrtdRecognizer); - // BlinkIDMultiSideRecognizer automatically classifies different document types and scans the data from // the supported document var blinkIdMultiSideRecognizer = new cordova.plugins.BlinkID.BlinkIdMultiSideRecognizer(); blinkIdMultiSideRecognizer.returnFullDocumentImage = true; blinkIdMultiSideRecognizer.returnFaceImage = true; + /* Uncomment line 67 if you're using scanWithDirectApi and you are sending cropped images for processing. + The processing will most likely not work if cropped images are being sent with the scanCroppedDocumentImage property being set to false */ + + //blinkIdMultiSideRecognizer.scanCroppedDocumentImage = true; + // there are lots of Recognizer objects in BlinkID - check blinkIdScanner.js for full reference var blinkidOverlaySettings = new cordova.plugins.BlinkID.BlinkIdOverlaySettings(); // create RecognizerCollection from any number of recognizers that should perform recognition - var recognizerCollection = new cordova.plugins.BlinkID.RecognizerCollection([blinkIdMultiSideRecognizer /*, mrtdSuccessFrameGrabber */]); + var recognizerCollection = new cordova.plugins.BlinkID.RecognizerCollection([blinkIdMultiSideRecognizer]); // package name/bundleID com.microblink.sample var licenseKeys = { - android: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUAbGV5SkRjbVZoZEdWa1QyNGlPakUzTURnd09EUTNNelkxTmprc0lrTnlaV0YwWldSR2IzSWlPaUkwT1RabFpEQXpaUzAwT0RBeExUUXpZV1F0WVRrMU5DMDBNemMyWlRObU9UTTVNR1FpZlE9PRIv5OawGAVdpvmuz+999CsJyIAgtV3h96BJo1Fq+xBZnKDoKhL01jBUrxC0E4+EeWoTuEtPPcDte2KHgjOP7Z4y+Mk9ihWDHTjgANWfFwG2Gd7HYJxgwcYQsTvICqS1CBklIILTfbXahwtD4ZKh0ghaxUJf7gU=', - ios: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUBbGV5SkRjbVZoZEdWa1QyNGlPakUzTURnd09EUTFNamM1TnpJc0lrTnlaV0YwWldSR2IzSWlPaUkwT1RabFpEQXpaUzAwT0RBeExUUXpZV1F0WVRrMU5DMDBNemMyWlRObU9UTTVNR1FpZlE9PTYmqMAMVMiFzaNDv15W9/CxDFVRDWRjok+uP0GtswDV4XTVGmhbivKDEb9Gtk2iMzf29qFWF8aUjIES4QSQFJG0xfBXZhluSk7lt4A959aHAZ0+BWgDnqZUPJAF2jZd0Pl2Kt1oDxLtqtf8V/RR+dPYzUV0PEA=' + android: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUAbGV5SkRjbVZoZEdWa1QyNGlPakUzTVRJeE16YzJPVEl5Tmpjc0lrTnlaV0YwWldSR2IzSWlPaUprWkdRd05qWmxaaTAxT0RJekxUUXdNRGd0T1RRNE1DMDFORFU0WWpBeFlUVTJZamdpZlE9PbyzAUXcMwR/Z4tMjDjtuRZzCpHBlMqUGaxDKaBeki4WI/hGXZZ9Ntv+KPCCt3jx2ibipTuGzUV1nbBIunAG6aw5tq+S5aSnQ6xWs5YMtyxeNatDxmvbhtRXYLQ61cICRW0VgY7/Qh/KfyI51kL/I5YiGRnBP1ZJ', + ios: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUBbGV5SkRjbVZoZEdWa1QyNGlPakUzTVRJeE16YzFPRGN3TWpZc0lrTnlaV0YwWldSR2IzSWlPaUprWkdRd05qWmxaaTAxT0RJekxUUXdNRGd0T1RRNE1DMDFORFU0WWpBeFlUVTJZamdpZlE9PYvwosgRYNp1QRJTln5X2YwfBhxia2Zmcp6EaOwdXfDpW992EyNseFmSASo2Yx1zJEEsyGudDGYXE0g16KZtvJx+kIgS66juVst+kf0n38GlYTVZbmLDANY7reEj8J2GHVHY9Kk/OgD2WXDcbpJE9nZmPMgM5Vr5' }; function buildResult(result, key) { @@ -99,6 +97,110 @@ var app = { return "" } + function handleRecognizerResult(blinkIdResult) { + var resultString = + buildResult(blinkIdResult.firstName.description, "First name") + + buildResult(blinkIdResult.lastName.description, "Last name") + + buildResult(blinkIdResult.fullName.description, "Full name") + + buildResult(blinkIdResult.localizedName.description, "Localized name") + + buildResult(blinkIdResult.additionalNameInformation.description, "Additional name info") + + buildResult(blinkIdResult.address.description, "Address") + + buildResult(blinkIdResult.additionalAddressInformation.description, "Additional address info") + + buildResult(blinkIdResult.additionalOptionalAddressInformation.description, "Additional optional address info") + + buildResult(blinkIdResult.documentNumber.description, "Document number") + + buildResult(blinkIdResult.documentAdditionalNumber.description, "Additional document number") + + buildResult(blinkIdResult.sex.description, "Sex") + + buildResult(blinkIdResult.issuingAuthority.description, "Issuing authority") + + buildResult(blinkIdResult.nationality.description, "Nationality") + + buildDateResult(blinkIdResult.dateOfBirth, "Date of birth") + + buildResult(blinkIdResult.age.description, "Age") + + buildDateResult(blinkIdResult.dateOfIssue, "Date of issue") + + buildDateResult(blinkIdResult.dateOfExpiry, "Date of expiry") + + buildResult(blinkIdResult.dateOfExpiryPermanent.description, "Date of expiry permanent") + + buildResult(blinkIdResult.expired.description, "Expired") + + buildResult(blinkIdResult.maritalStatus.description, "Martial status") + + buildResult(blinkIdResult.personalIdNumber.description, "Personal id number") + + buildResult(blinkIdResult.profession.description, "Profession") + + buildResult(blinkIdResult.race.description, "Race") + + buildResult(blinkIdResult.religion.description, "Religion") + + buildResult(blinkIdResult.residentialStatus.description, "Residential status") + + buildResult(blinkIdResult.processingStatus.description, "Processing status") + + buildResult(blinkIdResult.recognitionMode.description, "Recognition mode") + ; + + let dataMatchResult = blinkIdResult.dataMatch; + resultString += + buildResult(dataMatchResult.stateForWholeDocument, "State for the whole document") + + buildResult(dataMatchResult.states[0].state, "Date of birth") + + buildResult(dataMatchResult.states[1].state, "Date of expiry") + + buildResult(dataMatchResult.states[2].state, "Document number"); + + var licenceInfo = blinkIdResult.driverLicenseDetailedInfo; + if (licenceInfo) { + var vehicleClassesInfoString = ''; + if (licenceInfo.vehicleClassesInfo) { + for (let i=0; i Date: Wed, 3 Apr 2024 12:02:03 +0200 Subject: [PATCH 04/14] Update Release notes.md --- Release notes.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Release notes.md b/Release notes.md index 2924634..98370da 100644 --- a/Release notes.md +++ b/Release notes.md @@ -1,3 +1,23 @@ +## 6.6.0 + +- Updated to [Android SDK v6.6.1](https://github.com/BlinkID/blinkid-android/releases/tag/v6.6.1) and [iOS SDK v6.6.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.6.0) +- Updated the SDK with new regions and types, which can be found in the native documentation for [iOS](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.6.0) and [Android](https://github.com/BlinkID/blinkid-android/releases/tag/v6.6.0). +- Added settings `showCancelButton` and `showTorchButton` in `BlinkIdOverlaySettings` with which the ‘Cancel’ and ‘Torch’ buttons in the scanning UI can be shown or hidden. +- Fixed issue with setting the SDK language for Android. + +**Major API update** + - We have introduced the **DirectAPI** method of scanning, which allows the SDK to extract the document information from static images without the need to use the device’s camera and our UI. + - Usage: + - The `scanWithDirectApi` method requires four parameters: + - `RecognizerCollection`, which is a collection of Recognizers used for document scanning. + - `frontImage`, which would represent the front image of the document in the Base64 format string + - `backImage`, which would represent the back image of the document in the Base64 format string + - `license`, the licenses for iOS and Android required to unlock the SDK + - the `backImage` parameter is optional when using the `BlinkIdSingleSideRecognizer`, and can be passed as `null` or an empty string (`””`). + - An example of its usage can be found in the [sample application](https://github.com/BlinkID/blinkid-cordova/blob/master/sample_files/www/js/index.js), both for the Multiside and Singleside scanning. + - More information about the DirectAPI scanning can be found here in the native documentation for [iOS](https://github.com/BlinkID/blinkid-ios?tab=readme-ov-file#direct-api-processing) and [Android](https://github.com/BlinkID/blinkid-android?tab=readme-ov-file#direct-api). + - Keep in mind that we still recommend using our ‘regular’ way of scanning with the camera, as static images can sometimes be in lower-quality which can cause SDK extraction error. It would be best to use the `scanWithDirectApi` method when using the device’s camera is not an option. + ## 6.5.0 - Updated to [Android SDK v6.5.0](https://github.com/BlinkID/blinkid-android/releases/tag/v6.5.0) and [iOS SDK v6.4.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.5.0) - Added `cardOrientation` property to `ImageAnalysisResult` From bf3def50894b6da17184252f73bd31aac0e3548d Mon Sep 17 00:00:00 2001 From: mparadina Date: Wed, 3 Apr 2024 12:18:53 +0200 Subject: [PATCH 05/14] Minor adjustments to sample index.js and init script --- initCordovaSampleApp.sh | 4 +-- sample_files/www/css/index.css | 51 ++++++++++------------------------ sample_files/www/js/index.js | 48 +++++++++++++++++++------------- 3 files changed, 46 insertions(+), 57 deletions(-) diff --git a/initCordovaSampleApp.sh b/initCordovaSampleApp.sh index bd5e774..56f2f44 100755 --- a/initCordovaSampleApp.sh +++ b/initCordovaSampleApp.sh @@ -16,7 +16,7 @@ cordova create $APP_NAME com.microblink.sample $APP_NAME cd $APP_NAME # add the BlinkID plugin -IS_LOCAL_BUILD=false || exit 1 +IS_LOCAL_BUILD=true || exit 1 if [ "$IS_LOCAL_BUILD" = true ]; then # using cordova plugin from NPM cordova plugin add ../BlinkID --variable CAMERA_USAGE_DESCRIPTION="Camera permission is required for automated scanning" @@ -47,5 +47,5 @@ sed -i '' 's#compileSdkVersion cordovaConfig.SDK_VERSION#compileSdkVersion 33#g' sed -i '' 's#targetSdkVersion cordovaConfig.SDK_VERSION#targetSdkVersion 33#g' ./platforms/android/app/build.gradle # how to run -echo "To run iOS demo application open Xcode project $APP_NAME/platforms/ios/$APP_NAME.xcodeproj and set your development team." +echo "To run iOS demo application open Xcode project $APP_NAME/platforms/ios/$APP_NAME.xcodeproj, add the NSPhotoLibraryUsageDescription key to Info.plist if the DirectAPI will be used set your development team." echo "To run Android demo application, position to $APP_NAME folder and type: cordova run android" diff --git a/sample_files/www/css/index.css b/sample_files/www/css/index.css index 038612e..8299c90 100755 --- a/sample_files/www/css/index.css +++ b/sample_files/www/css/index.css @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -* { + * { -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */ } @@ -85,48 +85,27 @@ h1 { display:none; } -#scanButton { - font-size:18px; - width: 24%; - margin-left: 38%; - margin-right: 38% -} - -#directAPIMultiSideButton { - margin-top: 20px; - font-size:18px; - height: 30px; - width: 35%; - margin-left: 32%; - margin-right: 35% -} - +#scanButton, +#directAPIMultiSideButton, #directAPISingleSideButton { - margin-top: 20px; font-size:18px; height: 30px; - width: 35%; - margin-left: 32%; - margin-right: 35% + width: 50%; + margin: 20px auto; + display: block; } #resultDiv { margin-top: 20px; } -@keyframes fade { - from { opacity: 1.0; } - 50% { opacity: 0.4; } - to { opacity: 1.0; } -} - -@-webkit-keyframes fade { - from { opacity: 1.0; } - 50% { opacity: 0.4; } - to { opacity: 1.0; } -} - -.blink { - animation:fade 3000ms infinite; - -webkit-animation:fade 3000ms infinite; +@media screen and (max-width: 768px) { + button { + font-size: 16px; + } + #scanButton, + #directAPIMultiSideButton, + #directAPISingleSideButton { + width: 70%; + } } diff --git a/sample_files/www/js/index.js b/sample_files/www/js/index.js index 2ea3555..ef4af46 100644 --- a/sample_files/www/js/index.js +++ b/sample_files/www/js/index.js @@ -127,13 +127,14 @@ var app = { buildResult(blinkIdResult.processingStatus.description, "Processing status") + buildResult(blinkIdResult.recognitionMode.description, "Recognition mode") ; - - let dataMatchResult = blinkIdResult.dataMatch; - resultString += - buildResult(dataMatchResult.stateForWholeDocument, "State for the whole document") + - buildResult(dataMatchResult.states[0].state, "Date of birth") + - buildResult(dataMatchResult.states[1].state, "Date of expiry") + - buildResult(dataMatchResult.states[2].state, "Document number"); + if (blinkIdResult == blinkIdMultiSideRecognizer.result) { + let dataMatchResult = blinkIdResult.dataMatch; + resultString += + buildResult(dataMatchResult.stateForWholeDocument, "State for the whole document") + + buildResult(dataMatchResult.states[0].state, "Date of birth") + + buildResult(dataMatchResult.states[1].state, "Date of expiry") + + buildResult(dataMatchResult.states[2].state, "Document number"); + } var licenceInfo = blinkIdResult.driverLicenseDetailedInfo; if (licenceInfo) { @@ -156,18 +157,27 @@ var app = { // there are other fields to extract - check blinkIdScanner.js for full reference resultDiv.innerHTML = resultString; - - var resultDocumentFrontImage = blinkIdMultiSideRecognizer.result.fullDocumentFrontImage; - if (resultDocumentFrontImage) { - documentFrontImage.src = "data:image/jpg;base64, " + resultDocumentFrontImage; - documentFrontImageDiv.style.visibility = "visible"; - } - var resultDocumentBackImage = blinkIdMultiSideRecognizer.result.fullDocumentBackImage; - if (resultDocumentBackImage) { - documentBackImage.src = "data:image/jpg;base64, " + resultDocumentBackImage; - documentBackImageDiv.style.visibility = "visible"; + if (blinkIdResult == blinkIdMultiSideRecognizer.result) { + var resultDocumentFrontImage = blinkIdResult.fullDocumentFrontImage; + if (resultDocumentFrontImage) { + documentFrontImage.src = "data:image/jpg;base64, " + resultDocumentFrontImage; + documentFrontImageDiv.style.visibility = "visible"; + } + var resultDocumentBackImage = blinkIdResult.fullDocumentBackImage; + if (resultDocumentBackImage) { + documentBackImage.src = "data:image/jpg;base64, " + resultDocumentBackImage; + documentBackImageDiv.style.visibility = "visible"; + } + } else { + var resultDocumentImage = blinkIdResult.fullDocumentImage; + if (resultDocumentImage) { + documentFrontImage.src = "data:image/jpg;base64, " + resultDocumentImage; + documentFrontImageDiv.style.visibility = "visible"; + } + documentBackImageDiv.style.visibility = "hidden"; + documentBackImage.src = ""; } - var resultFaceImage = blinkIdMultiSideRecognizer.result.faceImage; + var resultFaceImage = blinkIdResult.faceImage; if (resultFaceImage) { faceImage.src = "data:image/jpg;base64, " + resultFaceImage; faceImageDiv.style.visibility = "visible"; @@ -296,7 +306,7 @@ var app = { blinkIdSingleSideRecognizer.returnFullDocumentImage = true; blinkIdSingleSideRecognizer.returnFaceImage = true; - /* Uncomment line 302 if you're using scanWithDirectApi and you are sending cropped images for processing. + /* Uncomment line 312 if you're using scanWithDirectApi and you are sending cropped images for processing. The processing will most likely not work if cropped images are being sent with the scanCroppedDocumentImage property being set to false */ //blinkIdSingleSideRecognizer.scanCroppedDocumentImage = true; From 73e49db94dbd969a4d438104b294bbdbdede6694 Mon Sep 17 00:00:00 2001 From: mparadina Date: Wed, 3 Apr 2024 13:31:27 +0200 Subject: [PATCH 06/14] Additional changes to Release notes.md --- Release notes.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Release notes.md b/Release notes.md index 98370da..b7c285b 100644 --- a/Release notes.md +++ b/Release notes.md @@ -5,18 +5,19 @@ - Added settings `showCancelButton` and `showTorchButton` in `BlinkIdOverlaySettings` with which the ‘Cancel’ and ‘Torch’ buttons in the scanning UI can be shown or hidden. - Fixed issue with setting the SDK language for Android. -**Major API update** - - We have introduced the **DirectAPI** method of scanning, which allows the SDK to extract the document information from static images without the need to use the device’s camera and our UI. - - Usage: - - The `scanWithDirectApi` method requires four parameters: - - `RecognizerCollection`, which is a collection of Recognizers used for document scanning. - - `frontImage`, which would represent the front image of the document in the Base64 format string - - `backImage`, which would represent the back image of the document in the Base64 format string - - `license`, the licenses for iOS and Android required to unlock the SDK - - the `backImage` parameter is optional when using the `BlinkIdSingleSideRecognizer`, and can be passed as `null` or an empty string (`””`). - - An example of its usage can be found in the [sample application](https://github.com/BlinkID/blinkid-cordova/blob/master/sample_files/www/js/index.js), both for the Multiside and Singleside scanning. - - More information about the DirectAPI scanning can be found here in the native documentation for [iOS](https://github.com/BlinkID/blinkid-ios?tab=readme-ov-file#direct-api-processing) and [Android](https://github.com/BlinkID/blinkid-android?tab=readme-ov-file#direct-api). - - Keep in mind that we still recommend using our ‘regular’ way of scanning with the camera, as static images can sometimes be in lower-quality which can cause SDK extraction error. It would be best to use the `scanWithDirectApi` method when using the device’s camera is not an option. +### Major API update + +- We have introduced the **DirectAPI** method of scanning, which allows the SDK to extract the document information from static images without the need to use the device’s camera and our UI. +- Usage: + - The `scanWithDirectApi` method requires four parameters: + - `RecognizerCollection`, which is a collection of Recognizers used for document scanning. + - `frontImage`, which would represent the front image of the document in the Base64 format string + - `backImage`, which would represent the back image of the document in the Base64 format string + - `license`, the licenses for iOS and Android required to unlock the SDK + - the `backImage` parameter is optional when using the `BlinkIdSingleSideRecognizer`, and can be passed as `null` or an empty string (`””`). +- An example of its usage can be found in the [sample application](https://github.com/BlinkID/blinkid-cordova/blob/master/sample_files/www/js/index.js) , both for the Multiside and Singleside scanning. +- More information about the DirectAPI scanning can be found here in the native documentation for [iOS](https://github.com/BlinkID/blinkid-ios?tab=readme-ov-file#direct-api-processing) and [Android](https://github.com/BlinkID/blinkid-android?tab=readme-ov-file#direct-api). +- Keep in mind that we still recommend using our ‘regular’ way of scanning with the camera, as static images can sometimes be in lower-quality which can cause SDK extraction error. It would be best to use the `scanWithDirectApi` method when using the device’s camera is not an option. ## 6.5.0 - Updated to [Android SDK v6.5.0](https://github.com/BlinkID/blinkid-android/releases/tag/v6.5.0) and [iOS SDK v6.4.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.5.0) From b99f6ce42b227ebdda4fb9e26f176fdfd580e167 Mon Sep 17 00:00:00 2001 From: mparadina Date: Thu, 4 Apr 2024 14:15:16 +0200 Subject: [PATCH 07/14] Minor adjustment to Android DirectAPI setup --- .../plugins/cordova/BlinkIDScanner.java | 35 ++++++++++--------- initCordovaSampleApp.sh | 2 +- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/BlinkIDScanner.java b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/BlinkIDScanner.java index 15a98d4..552c977 100644 --- a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/BlinkIDScanner.java +++ b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/BlinkIDScanner.java @@ -185,25 +185,26 @@ public void onUnrecoverableError(@NonNull Throwable throwable) { private void setupRecognizerRunner(JSONObject jsonRecognizerCollection, FirstSideRecognitionCallback mFirstSideRecognitionCallback) { if (mRecognizerRunner != null) { - mRecognizerRunner.resetRecognitionState(true); - } else { - mRecognizerBundle = RecognizerSerializers.INSTANCE.deserializeRecognizerCollection(jsonRecognizerCollection); - try { - mRecognizerRunner = RecognizerRunner.getSingletonInstance(); - } catch (Exception e) { - handleDirectApiError("DirectAPI not supported: " + e.getMessage()); - } + mRecognizerRunner.terminate(); + } + + mRecognizerBundle = RecognizerSerializers.INSTANCE.deserializeRecognizerCollection(jsonRecognizerCollection); - MetadataCallbacks metadataCallbacks = new MetadataCallbacks(); - metadataCallbacks.setFirstSideRecognitionCallback(mFirstSideRecognitionCallback); - mRecognizerRunner.setMetadataCallbacks(metadataCallbacks); - mRecognizerRunner.initialize(cordova.getContext(), mRecognizerBundle, new DirectApiErrorListener() { - @Override - public void onRecognizerError(@NonNull Throwable throwable) { - handleDirectApiError("Failed to initialize recognizer with DirectAPI: " + throwable.getMessage()); - } - }); + try { + mRecognizerRunner = RecognizerRunner.getSingletonInstance(); + } catch (Exception e) { + handleDirectApiError("DirectAPI not supported: " + e.getMessage()); } + + MetadataCallbacks metadataCallbacks = new MetadataCallbacks(); + metadataCallbacks.setFirstSideRecognitionCallback(mFirstSideRecognitionCallback); + mRecognizerRunner.setMetadataCallbacks(metadataCallbacks); + mRecognizerRunner.initialize(cordova.getContext(), mRecognizerBundle, new DirectApiErrorListener() { + @Override + public void onRecognizerError(@NonNull Throwable throwable) { + handleDirectApiError("Failed to initialize recognizer with DirectAPI: " + throwable.getMessage()); + } + }); } private void processImage(String base64Image, ScanResultListener scanResultListener) { diff --git a/initCordovaSampleApp.sh b/initCordovaSampleApp.sh index 56f2f44..18c40af 100755 --- a/initCordovaSampleApp.sh +++ b/initCordovaSampleApp.sh @@ -16,7 +16,7 @@ cordova create $APP_NAME com.microblink.sample $APP_NAME cd $APP_NAME # add the BlinkID plugin -IS_LOCAL_BUILD=true || exit 1 +IS_LOCAL_BUILD=false || exit 1 if [ "$IS_LOCAL_BUILD" = true ]; then # using cordova plugin from NPM cordova plugin add ../BlinkID --variable CAMERA_USAGE_DESCRIPTION="Camera permission is required for automated scanning" From a36b69fe429bedb4744235924d823f2edc1b4a55 Mon Sep 17 00:00:00 2001 From: mparadina Date: Fri, 5 Apr 2024 11:20:51 +0200 Subject: [PATCH 08/14] Minor changes to DirectAPI implementation, Release notes.md --- .../blinkid/plugins/cordova/BlinkIDScanner.java | 10 +++++----- BlinkID/src/ios/sources/CDVBlinkIDScanner.m | 4 ++-- Release notes.md | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/BlinkIDScanner.java b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/BlinkIDScanner.java index 552c977..e97afbd 100644 --- a/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/BlinkIDScanner.java +++ b/BlinkID/src/android/java/com/microblink/blinkid/plugins/cordova/BlinkIDScanner.java @@ -150,12 +150,12 @@ public void onScanningDone(@NonNull RecognitionSuccessType recognitionSuccessTyp if (mFirstSideScanned) { //multiside recognizer used try { - if (!arguments.getString(2).isEmpty() && arguments.getString(2) != "null") { + if (!arguments.getString(2).isEmpty() && !arguments.isNull(2)) { processImage(arguments.getString(2), mScanResultListenerBackSide); } else if (recognitionSuccessType != RecognitionSuccessType.UNSUCCESSFUL) { handleDirectApiResult(recognitionSuccessType); } else { - handleDirectApiError("Could not extract the information from the front side and back side is empty!"); + handleDirectApiError("Could not extract the information from the front side and the back side is empty!"); } } catch (JSONException e) { throw new RuntimeException(e); @@ -165,7 +165,7 @@ public void onScanningDone(@NonNull RecognitionSuccessType recognitionSuccessTyp handleDirectApiResult(recognitionSuccessType); } else { mFirstSideScanned = false; - handleDirectApiError("Could not extract the data with DirectAPI!"); + handleDirectApiError("Could not extract the information with DirectAPI!"); } } @Override @@ -176,10 +176,10 @@ public void onUnrecoverableError(@NonNull Throwable throwable) { setupRecognizerRunner(jsonRecognizerCollection, mFirstSideRecognitionCallback); - if (!arguments.getString(1).isEmpty()) { + if (!arguments.getString(1).isEmpty() && !arguments.isNull(1)) { processImage(arguments.getString(1), mScanResultListenerFrontSide); } else { - handleDirectApiError("The first side image is empty!"); + handleDirectApiError("The provided image for the 'frontImage' parameter is empty!"); } } diff --git a/BlinkID/src/ios/sources/CDVBlinkIDScanner.m b/BlinkID/src/ios/sources/CDVBlinkIDScanner.m index 7d3adde..b19553f 100644 --- a/BlinkID/src/ios/sources/CDVBlinkIDScanner.m +++ b/BlinkID/src/ios/sources/CDVBlinkIDScanner.m @@ -249,7 +249,7 @@ + (NSString *)CANCELLED { } + (NSString *)EMPTY_IMAGE { - return @"The first side image is empty!"; + return @"The provided image for the 'frontImage' parameter is empty!"; } + (NSString *)INVALID_IMAGE_FORMAT { @@ -257,7 +257,7 @@ + (NSString *)INVALID_IMAGE_FORMAT { } + (NSString *)NO_DATA { - return @"Could not extract the data with DirectAPI!"; + return @"Could not extract the information with DirectAPI!"; } + (int)COMPRESSED_IMAGE_QUALITY { diff --git a/Release notes.md b/Release notes.md index b7c285b..4baba9e 100644 --- a/Release notes.md +++ b/Release notes.md @@ -1,7 +1,7 @@ ## 6.6.0 - Updated to [Android SDK v6.6.1](https://github.com/BlinkID/blinkid-android/releases/tag/v6.6.1) and [iOS SDK v6.6.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.6.0) -- Updated the SDK with new regions and types, which can be found in the native documentation for [iOS](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.6.0) and [Android](https://github.com/BlinkID/blinkid-android/releases/tag/v6.6.0). +- Updated the SDK with new regions and types, which can be found in the native documentation for [Android](https://github.com/BlinkID/blinkid-android/releases/tag/v6.6.0) and [iOS](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.6.0) . - Added settings `showCancelButton` and `showTorchButton` in `BlinkIdOverlaySettings` with which the ‘Cancel’ and ‘Torch’ buttons in the scanning UI can be shown or hidden. - Fixed issue with setting the SDK language for Android. @@ -10,14 +10,14 @@ - We have introduced the **DirectAPI** method of scanning, which allows the SDK to extract the document information from static images without the need to use the device’s camera and our UI. - Usage: - The `scanWithDirectApi` method requires four parameters: - - `RecognizerCollection`, which is a collection of Recognizers used for document scanning. + - `recognizerCollection`, which is a collection of Recognizers used for document scanning. - `frontImage`, which would represent the front image of the document in the Base64 format string - `backImage`, which would represent the back image of the document in the Base64 format string - - `license`, the licenses for iOS and Android required to unlock the SDK - - the `backImage` parameter is optional when using the `BlinkIdSingleSideRecognizer`, and can be passed as `null` or an empty string (`””`). + - the `backImage` parameter is optional when using the `BlinkIdSingleSideRecognizer`, and can be passed as `null` or an empty string (`””`). + - `licenses`, the licenses for iOS and Android required to unlock the SDK - An example of its usage can be found in the [sample application](https://github.com/BlinkID/blinkid-cordova/blob/master/sample_files/www/js/index.js) , both for the Multiside and Singleside scanning. -- More information about the DirectAPI scanning can be found here in the native documentation for [iOS](https://github.com/BlinkID/blinkid-ios?tab=readme-ov-file#direct-api-processing) and [Android](https://github.com/BlinkID/blinkid-android?tab=readme-ov-file#direct-api). -- Keep in mind that we still recommend using our ‘regular’ way of scanning with the camera, as static images can sometimes be in lower-quality which can cause SDK extraction error. It would be best to use the `scanWithDirectApi` method when using the device’s camera is not an option. +- More information about the DirectAPI scanning can be found here in the native documentation for [Android](https://github.com/BlinkID/blinkid-android?tab=readme-ov-file#direct-api) and [iOS](https://github.com/BlinkID/blinkid-ios?tab=readme-ov-file#direct-api-processing) . +- We still recommend using our ‘regular’ way of scanning with the camera, as static images can sometimes be in lower-quality which can cause SDK extraction error. It would be best to use the `scanWithDirectApi` method when using the device’s camera is not an option. ## 6.5.0 - Updated to [Android SDK v6.5.0](https://github.com/BlinkID/blinkid-android/releases/tag/v6.5.0) and [iOS SDK v6.4.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.5.0) From 9a7ca87587586c36693799a6d5e641e87173cc98 Mon Sep 17 00:00:00 2001 From: mparadina Date: Fri, 12 Apr 2024 12:53:51 +0200 Subject: [PATCH 09/14] Minor change to DirectAPI parameters comment --- BlinkID/www/blinkIdScanner.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BlinkID/www/blinkIdScanner.js b/BlinkID/www/blinkIdScanner.js index e6ea852..3efad4e 100644 --- a/BlinkID/www/blinkIdScanner.js +++ b/BlinkID/www/blinkIdScanner.js @@ -86,9 +86,9 @@ BlinkID.prototype.scanWithCamera = function (successCallback, errorCallback, ove * successCallback: callback that will be invoked on successful scan * errorCallback: callback that will be invoked on error * recognizerCollection: {RecognizerCollection} containing recognizers to use for scanning - * frontImage: the front image of the document that will be used for processing with DirectAPI in base64 format - * backImage: the back image of the document that will be used for processing with DirectAPI in base64 format. - * This parameter is optional for the BlinkIdSingleSideRecognizer. Pass an empty string for this parameter. + * frontImage: the Base64 format string that represents the front image of the document that will be used for processing with DirectAPI + * backImage: the Base64 format string that represents the back image of the document that will be used for processing with DirectAPI + * - This parameter is optional for the BlinkIdSingleSideRecognizer. Pass 'null' or an empty string "" for this parameter in this case * licenses: object containing: * - base64 license keys for iOS and Android * - optioanl parameter 'licensee' when license for multiple apps is used From 71bf20ba5e5e648f50bb2d51aee5ec7b449abc19 Mon Sep 17 00:00:00 2001 From: mparadina Date: Fri, 3 May 2024 13:41:10 +0200 Subject: [PATCH 10/14] v6.7.0 release --- .../BlinkIDSerializationUtils.java | 18 ++++++- .../ios/sources/MBBlinkIDSerializationUtils.m | 54 +++++++++++++------ BlinkID/www/blinkIdScanner.js | 33 +++++++++--- 3 files changed, 82 insertions(+), 23 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 6fa4859..0aa60af 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 @@ -29,6 +29,7 @@ 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 com.microblink.blinkid.entities.recognizers.blinkid.generic.DocumentNumberAnonymizationSettings; import org.json.JSONArray; import org.json.JSONException; @@ -124,6 +125,7 @@ public static JSONObject serializeImageAnalysisResult(ImageAnalysisResult imageA jsonImageAnalysis.put("barcodeDetectionStatus", SerializationUtils.serializeEnum(imageAnalysisResult.getBarcodeDetectionStatus())); jsonImageAnalysis.put("cardRotation", BlinkIDSerializationUtils.serializeCardRotation(imageAnalysisResult.getCardRotation())); jsonImageAnalysis.put("cardOrientation", SerializationUtils.serializeEnum(imageAnalysisResult.getCardOrientation())); + jsonImageAnalysis.put("realIdDetectionStatus", SerializationUtils.serializeEnum(imageAnalysisResult.getRealIdDetectionStatus())); return jsonImageAnalysis; } @@ -331,6 +333,7 @@ public static ClassAnonymizationSettings[] deserializeClassAnonymizationSettings Country country = Country.NONE; Region region = Region.NONE; Type type = Type.NONE; + DocumentNumberAnonymizationSettings documentNumberAnonymizationSettings = null; try { JSONObject jsonClassAnonymizationSettings = jsonArray.getJSONObject(i); @@ -354,7 +357,13 @@ public static ClassAnonymizationSettings[] deserializeClassAnonymizationSettings } catch ( JSONException e) { type = null; } - ClassAnonymizationSettings classAnonymizationSettings = new ClassAnonymizationSettings(country, region, type, fieldTypes); + try { + JSONObject jsonDocumentNumberAnonymizationSettings = jsonClassAnonymizationSettings.getJSONObject("documentNumberAnonymizationSettings"); + documentNumberAnonymizationSettings = deserializeDocumentNumberAnonymizationSettings(jsonDocumentNumberAnonymizationSettings); + } catch (JSONException exception) { + documentNumberAnonymizationSettings = null; + } + ClassAnonymizationSettings classAnonymizationSettings = new ClassAnonymizationSettings(country, region, type, fieldTypes, documentNumberAnonymizationSettings); classAnonymizationSettingsArray[i] = classAnonymizationSettings; } catch (JSONException e) { throw new RuntimeException(e); @@ -365,4 +374,11 @@ public static ClassAnonymizationSettings[] deserializeClassAnonymizationSettings return new ClassAnonymizationSettings[]{}; } } + private static DocumentNumberAnonymizationSettings deserializeDocumentNumberAnonymizationSettings (JSONObject jsonDocumentNumberAnonymizationSettings) { + try { + return new DocumentNumberAnonymizationSettings(jsonDocumentNumberAnonymizationSettings.getInt("prefixDigitsVisible"),jsonDocumentNumberAnonymizationSettings.getInt("suffixDigitsVisible")); + } catch (JSONException exception){ + return null; + } + } } \ No newline at end of file diff --git a/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m b/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m index 7500b5a..ba23286 100644 --- a/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m +++ b/BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m @@ -215,7 +215,8 @@ +(NSDictionary *) serializeImageAnalysisResult:(MBImageAnalysisResult *)imageAna @"mrzDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.mrzDetectionStatus)], @"barcodeDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.barcodeDetectionStatus)], @"cardRotation" : [NSNumber numberWithInteger:(imageAnalysisResult.cardRotation)], - @"cardOrientation" : [NSNumber numberWithInteger:(imageAnalysisResult.cardOrientation)] + @"cardOrientation" : [NSNumber numberWithInteger:(imageAnalysisResult.cardOrientation)], + @"realIdDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.realIDDetectionStatus)] }; } @@ -249,23 +250,44 @@ +(MBClassAnonymizationSettings *) deserializeMBClassAnonymizationSettings:(NSDic NSNumber *country = [jsonClassAnonymizationSettings valueForKey:@"country"]; NSNumber *region = [jsonClassAnonymizationSettings valueForKey:@"region"]; NSNumber *type = [jsonClassAnonymizationSettings valueForKey:@"type"]; + NSDictionary *jsonDocumentNumberAnonymizationSettings = [jsonClassAnonymizationSettings valueForKey:@"documentNumberAnonymizationSettings"]; - if (![country isEqual:[NSNull null]] && country.integerValue != nil && ![region isEqual:[NSNull null]] && region.integerValue != nil && ![type isEqual:[NSNull null]] && type.integerValue != nil) { - return [[MBClassAnonymizationSettings alloc] initWithCountry:country.integerValue region:region.integerValue type:type.integerValue fields:fields]; - } else if (![country isEqual:[NSNull null]] && country.integerValue != nil && ![type isEqual:[NSNull null]] && type.integerValue != nil){ - return [[MBClassAnonymizationSettings alloc] initWithCountry:country.integerValue type:type.integerValue fields:fields]; - } else if (![country isEqual:[NSNull null]] && country.integerValue != nil && ![region isEqual:[NSNull null]] && region.integerValue != nil ) { - return [[MBClassAnonymizationSettings alloc] initWithCountry:country.integerValue region:region.integerValue fields:fields]; - } else if (![region isEqual:[NSNull null]] && region.integerValue != nil && ![type isEqual:[NSNull null]] && type.integerValue != nil ) { - return [[MBClassAnonymizationSettings alloc] initWithRegion:region.integerValue type:type.integerValue fields:fields]; - } else if (![country isEqual:[NSNull null]] && country.integerValue != nil ) { - return [[MBClassAnonymizationSettings alloc] initWithCountry:country.integerValue fields:fields]; - } else if (![region isEqual:[NSNull null]] && region.integerValue != nil) { - return [[MBClassAnonymizationSettings alloc] initWithRegion:region.integerValue fields:fields]; - } else if (![type isEqual:[NSNull null]] && type.integerValue != nil ) { - return [[MBClassAnonymizationSettings alloc] initWithType:type.integerValue fields:fields]; + if (![jsonDocumentNumberAnonymizationSettings isEqual:[NSNull null]] && jsonDocumentNumberAnonymizationSettings != nil) { + MBDocumentNumberAnonymizationSettings *documentNumberAnonymizationSettings = [[MBDocumentNumberAnonymizationSettings alloc] initWithPrefixDigitsVisible:[[jsonDocumentNumberAnonymizationSettings valueForKey:@"prefixDigitsVisible"] integerValue] suffixDigitsVisible:[[jsonDocumentNumberAnonymizationSettings valueForKey:@"suffixDigitsVisible"] integerValue]]; + + if (![country isEqual:[NSNull null]] && country.integerValue != nil && ![region isEqual:[NSNull null]] && region.integerValue != nil && ![type isEqual:[NSNull null]] && type.integerValue != nil) { + return [[MBClassAnonymizationSettings alloc] initWithCountry:country.integerValue region:region.integerValue type:type.integerValue fields:fields documentNumberAnonymizationSettings:documentNumberAnonymizationSettings]; + } else if (![country isEqual:[NSNull null]] && country.integerValue != nil && ![type isEqual:[NSNull null]] && type.integerValue != nil){ + return [[MBClassAnonymizationSettings alloc] initWithCountry:country.integerValue type:type.integerValue fields:fields documentNumberAnonymizationSettings:documentNumberAnonymizationSettings]; + } else if (![country isEqual:[NSNull null]] && country.integerValue != nil && ![region isEqual:[NSNull null]] && region.integerValue != nil ) { + return [[MBClassAnonymizationSettings alloc] initWithCountry:country.integerValue region:region.integerValue fields:fields documentNumberAnonymizationSettings:documentNumberAnonymizationSettings]; + } else if (![region isEqual:[NSNull null]] && region.integerValue != nil && ![type isEqual:[NSNull null]] && type.integerValue != nil ) { + return [[MBClassAnonymizationSettings alloc] initWithRegion:region.integerValue type:type.integerValue fields:fields documentNumberAnonymizationSettings:documentNumberAnonymizationSettings]; + } else if (![country isEqual:[NSNull null]] && country.integerValue != nil ) { + return [[MBClassAnonymizationSettings alloc] initWithCountry:country.integerValue fields:fields documentNumberAnonymizationSettings:documentNumberAnonymizationSettings]; + } else if (![region isEqual:[NSNull null]] && region.integerValue != nil) { + return [[MBClassAnonymizationSettings alloc] initWithRegion:region.integerValue fields:fields documentNumberAnonymizationSettings:documentNumberAnonymizationSettings]; + } else if (![type isEqual:[NSNull null]] && type.integerValue != nil ) { + return [[MBClassAnonymizationSettings alloc] initWithType:type.integerValue fields:fields documentNumberAnonymizationSettings:documentNumberAnonymizationSettings]; + } + return [[MBClassAnonymizationSettings alloc] initWithFields:fields documentNumberAnonymizationSettings:documentNumberAnonymizationSettings]; + } else { + if (![country isEqual:[NSNull null]] && country.integerValue != nil && ![region isEqual:[NSNull null]] && region.integerValue != nil && ![type isEqual:[NSNull null]] && type.integerValue != nil) { + return [[MBClassAnonymizationSettings alloc] initWithCountry:country.integerValue region:region.integerValue type:type.integerValue fields:fields]; + } else if (![country isEqual:[NSNull null]] && country.integerValue != nil && ![type isEqual:[NSNull null]] && type.integerValue != nil){ + return [[MBClassAnonymizationSettings alloc] initWithCountry:country.integerValue type:type.integerValue fields:fields]; + } else if (![country isEqual:[NSNull null]] && country.integerValue != nil && ![region isEqual:[NSNull null]] && region.integerValue != nil ) { + return [[MBClassAnonymizationSettings alloc] initWithCountry:country.integerValue region:region.integerValue fields:fields]; + } else if (![region isEqual:[NSNull null]] && region.integerValue != nil && ![type isEqual:[NSNull null]] && type.integerValue != nil ) { + return [[MBClassAnonymizationSettings alloc] initWithRegion:region.integerValue type:type.integerValue fields:fields]; + } else if (![country isEqual:[NSNull null]] && country.integerValue != nil ) { + return [[MBClassAnonymizationSettings alloc] initWithCountry:country.integerValue fields:fields]; + } else if (![region isEqual:[NSNull null]] && region.integerValue != nil) { + return [[MBClassAnonymizationSettings alloc] initWithRegion:region.integerValue fields:fields]; + } else if (![type isEqual:[NSNull null]] && type.integerValue != nil ) { + return [[MBClassAnonymizationSettings alloc] initWithType:type.integerValue fields:fields]; + } } - return [[MBClassAnonymizationSettings alloc] initWithFields:fields]; } } diff --git a/BlinkID/www/blinkIdScanner.js b/BlinkID/www/blinkIdScanner.js index 3efad4e..2aaeb7f 100644 --- a/BlinkID/www/blinkIdScanner.js +++ b/BlinkID/www/blinkIdScanner.js @@ -425,7 +425,10 @@ BlinkID.prototype.ProcessingStatus = Object.freeze( AwaitingOtherSide: 14, /** Side not scanned. */ - NotScanned: 15 + NotScanned: 15, + + /** Detection of the barcode failed. */ + BarcodeDetectionFailed: 16 } ); @@ -512,6 +515,8 @@ function ImageAnalysisResult(nativeImageAnalysisResult) { this.cardOrientation = nativeImageAnalysisResult.cardOrientation; /** Document card rotation positions */ this.cardRotation = nativeImageAnalysisResult.cardRotation; + /** RealID detection status determined from the scanned image. */ + this.realIdDetectionStatus = nativeImageAnalysisResult.realIdDetectionStatus; } /** @@ -2341,21 +2346,37 @@ BlinkID.prototype.RecognitionModeFilter = RecognitionModeFilter; /** * ClassAnonymizationSettings is used to anonymize specific documents and fields. - * It can be modified with countries, regions, document types and document fields. - * See Country, Region, Type and FieldType objects to get more information which fields can be anonymized. + * It can be modified with countries, regions, document types, document fields and the partial document number anonymization. + * See Country, Region, Type, FieldType and DocumentNumberAnonymizationSettings objects to get more information which settings can be anonymized. * Setting is taken into account if AnonymizationMode is set to ImageOnly,ResultFieldsOnly or FullResult. */ function ClassAnonymizationSettings() { + /** Documents from the set country will be anonymized */ this.country = null; - + /** Documents from the set region will be anonymized */ this.region = null; - + /** Document type that will be anonymized */ this.type = null; - + /** Document fields that will be anonymized */ this.fields = []; + /** Partial document number anonymization */ + this.documentNumberAnonymizationSettings = null; } BlinkID.prototype.ClassAnonymizationSettings = ClassAnonymizationSettings; + +/** + * DocumentNumberAnonymizationSettings is implemented with ClassAnonymizationSettings class. + * It can partially anonymize the document number from the scanned document. +*/ +function DocumentNumberAnonymizationSettings() { + /** Set how many digits will be visible at the beggining of the document number. */ + this.prefixDigitsVisible = 0; + /** Set how many digits will be visible at the end of the document number. */ + this.suffixDigitsVisible = 0; +} + +BlinkID.prototype.DocumentNumberAnonymizationSettings = DocumentNumberAnonymizationSettings; /** * Result of the data matching algorithm for scanned parts/sides of the document. */ From 13a6da17de1e35d6190d86c1baf13802fa88fef4 Mon Sep 17 00:00:00 2001 From: mparadina Date: Fri, 3 May 2024 13:42:55 +0200 Subject: [PATCH 11/14] SDK version update --- BlinkID/package.json | 2 +- BlinkID/plugin.xml | 2 +- BlinkID/scripts/initIOSFramework.sh | 2 +- BlinkID/src/android/libBlinkID.gradle | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BlinkID/package.json b/BlinkID/package.json index 9f9df56..64e0c80 100644 --- a/BlinkID/package.json +++ b/BlinkID/package.json @@ -1,6 +1,6 @@ { "name": "blinkid-cordova", - "version": "6.6.0", + "version": "6.7.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 9dfb3a1..36d1faf 100644 --- a/BlinkID/plugin.xml +++ b/BlinkID/plugin.xml @@ -2,7 +2,7 @@ + version="6.7.0"> BlinkIdScanner A small and powerful ID card scanning library diff --git a/BlinkID/scripts/initIOSFramework.sh b/BlinkID/scripts/initIOSFramework.sh index 29c72f1..894440e 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/v6.6.0/BlinkID.xcframework.zip' +LINK='https://github.com/BlinkID/blinkid-ios/releases/download/v6.7.0/BlinkID.xcframework.zip' FILENAME='BlinkID.xcframework.zip' # BlinkID framework will be obtained via wget or curl diff --git a/BlinkID/src/android/libBlinkID.gradle b/BlinkID/src/android/libBlinkID.gradle index c555c87..e646964 100644 --- a/BlinkID/src/android/libBlinkID.gradle +++ b/BlinkID/src/android/libBlinkID.gradle @@ -6,7 +6,7 @@ repositories { } dependencies { - implementation('com.microblink:blinkid:6.6.1@aar') { + implementation('com.microblink:blinkid:6.7.0@aar') { transitive = true } } From b3e97ccc0fa2077cc3db4a88160b0c9e9cf4a0e5 Mon Sep 17 00:00:00 2001 From: mparadina Date: Fri, 3 May 2024 13:46:45 +0200 Subject: [PATCH 12/14] sample app index.js and Release notes.md update --- Release notes.md | 14 ++++++++++---- sample_files/www/js/index.js | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Release notes.md b/Release notes.md index 4baba9e..e745f45 100644 --- a/Release notes.md +++ b/Release notes.md @@ -1,8 +1,14 @@ -## 6.6.0 - -- Updated to [Android SDK v6.6.1](https://github.com/BlinkID/blinkid-android/releases/tag/v6.6.1) and [iOS SDK v6.6.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.6.0) -- Updated the SDK with new regions and types, which can be found in the native documentation for [Android](https://github.com/BlinkID/blinkid-android/releases/tag/v6.6.0) and [iOS](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.6.0) . +## 6.7.0 + +- Updated to [Android SDK v6.7.0](https://github.com/BlinkID/blinkid-android/releases/tag/v6.7.0) and [iOS SDK v6.7.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.7.0) +- Updated the SDK with new regions and types, which can be found in the native documentation with version 6.6.0 [Android](https://github.com/BlinkID/blinkid-android/releases/tag/v6.6.0) and [iOS](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.6.0) +- Added Real ID symbol detection on US driver's licenses in the `ImageAnalysisResult` class. +- Added partial anonymization of the Document Number field. + - Anonymization can be added in `ClassAnonymizationSettings` class by additionally adding `DocumentNumberAnonymizationSettings`. +- Added `BarcodeDetectionFailed` to `ProcessingStatus`. + - It is returned when the mandatory barcode is not present on the back of US documents. - Added settings `showCancelButton` and `showTorchButton` in `BlinkIdOverlaySettings` with which the ‘Cancel’ and ‘Torch’ buttons in the scanning UI can be shown or hidden. +- This version of the SDK contains the native iOS `BlinkID.xcframework` with the privacy manifest file (`PrivacyInfo.xcprivacy`). - Fixed issue with setting the SDK language for Android. ### Major API update diff --git a/sample_files/www/js/index.js b/sample_files/www/js/index.js index ef4af46..53f53d0 100644 --- a/sample_files/www/js/index.js +++ b/sample_files/www/js/index.js @@ -75,8 +75,8 @@ var app = { // package name/bundleID com.microblink.sample var licenseKeys = { - android: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUAbGV5SkRjbVZoZEdWa1QyNGlPakUzTVRJeE16YzJPVEl5Tmpjc0lrTnlaV0YwWldSR2IzSWlPaUprWkdRd05qWmxaaTAxT0RJekxUUXdNRGd0T1RRNE1DMDFORFU0WWpBeFlUVTJZamdpZlE9PbyzAUXcMwR/Z4tMjDjtuRZzCpHBlMqUGaxDKaBeki4WI/hGXZZ9Ntv+KPCCt3jx2ibipTuGzUV1nbBIunAG6aw5tq+S5aSnQ6xWs5YMtyxeNatDxmvbhtRXYLQ61cICRW0VgY7/Qh/KfyI51kL/I5YiGRnBP1ZJ', - ios: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUBbGV5SkRjbVZoZEdWa1QyNGlPakUzTVRJeE16YzFPRGN3TWpZc0lrTnlaV0YwWldSR2IzSWlPaUprWkdRd05qWmxaaTAxT0RJekxUUXdNRGd0T1RRNE1DMDFORFU0WWpBeFlUVTJZamdpZlE9PYvwosgRYNp1QRJTln5X2YwfBhxia2Zmcp6EaOwdXfDpW992EyNseFmSASo2Yx1zJEEsyGudDGYXE0g16KZtvJx+kIgS66juVst+kf0n38GlYTVZbmLDANY7reEj8J2GHVHY9Kk/OgD2WXDcbpJE9nZmPMgM5Vr5' + android: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUAbGV5SkRjbVZoZEdWa1QyNGlPakUzTVRNNE5qWXdNVEE1TURnc0lrTnlaV0YwWldSR2IzSWlPaUprWkdRd05qWmxaaTAxT0RJekxUUXdNRGd0T1RRNE1DMDFORFU0WWpBeFlUVTJZamdpZlE9PYrV4CMxsRU+iUM/SeDbRDbjxRQsXIYuDXKzh5n0zmLHgSdRllWR/wE/J2MZ2MkpDdegbPTLRoJV+59G9F1QY8gIW7ua07A6f7wzTGq4laEyCo+f1rOOUBTZfKBIzqUJtR9NZIkb6YMkfLY5cmmNb5vnwIM+9BNI', + ios: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUBbGV5SkRjbVZoZEdWa1QyNGlPakUzTVRRM016STRPRE0zTnpVc0lrTnlaV0YwWldSR2IzSWlPaUprWkdRd05qWmxaaTAxT0RJekxUUXdNRGd0T1RRNE1DMDFORFU0WWpBeFlUVTJZamdpZlE9PT4PFNbaGYbx8lz0VdMw0rwMahZJsnnMY0+blCuN/m+QolwrXwoZIVhisfNF7p9UPmh44A6nnFILPB2z3pyoV0mmbTrZ/6/sfoWf4v2SlJjpwM5pBxCooWZr4IAmv5YT6Ef3x4iC6U1gL8zUB0T53LpWoY9+CElD' }; function buildResult(result, key) { From 34d9bcbc3de883574af111069463f6540b3436e9 Mon Sep 17 00:00:00 2001 From: mparadina Date: Mon, 6 May 2024 13:22:20 +0200 Subject: [PATCH 13/14] Update native iOS framework to v6.7.1 --- BlinkID/plugin.xml | 2 +- BlinkID/scripts/initIOSFramework.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BlinkID/plugin.xml b/BlinkID/plugin.xml index 36d1faf..e24ca63 100644 --- a/BlinkID/plugin.xml +++ b/BlinkID/plugin.xml @@ -153,7 +153,7 @@ - + $CAMERA_USAGE_DESCRIPTION diff --git a/BlinkID/scripts/initIOSFramework.sh b/BlinkID/scripts/initIOSFramework.sh index 894440e..17702b7 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/v6.7.0/BlinkID.xcframework.zip' +LINK='https://github.com/BlinkID/blinkid-ios/releases/download/v6.7.1/BlinkID.xcframework.zip' FILENAME='BlinkID.xcframework.zip' # BlinkID framework will be obtained via wget or curl From 62b779685f102e8f77450f8d90fd4779bef9e625 Mon Sep 17 00:00:00 2001 From: mparadina Date: Mon, 13 May 2024 13:07:32 +0200 Subject: [PATCH 14/14] Raise compileSdkVersion and targetSdkVersion in sample app --- initCordovaSampleApp.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/initCordovaSampleApp.sh b/initCordovaSampleApp.sh index 18c40af..d16668a 100755 --- a/initCordovaSampleApp.sh +++ b/initCordovaSampleApp.sh @@ -43,8 +43,8 @@ cordova prepare sed -i '' 's## #g' config.xml sed -i '' 's#xmlns:cdv="http://cordova.apache.org/ns/1.0"#xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android"#g' config.xml sed -i '' 's#minSdkVersion cordovaConfig.MIN_SDK_VERSION#minSdkVersion 22#g' ./platforms/android/app/build.gradle -sed -i '' 's#compileSdkVersion cordovaConfig.SDK_VERSION#compileSdkVersion 33#g' ./platforms/android/app/build.gradle -sed -i '' 's#targetSdkVersion cordovaConfig.SDK_VERSION#targetSdkVersion 33#g' ./platforms/android/app/build.gradle +sed -i '' 's#compileSdkVersion cordovaConfig.SDK_VERSION#compileSdkVersion 34#g' ./platforms/android/app/build.gradle +sed -i '' 's#targetSdkVersion cordovaConfig.SDK_VERSION#targetSdkVersion 34#g' ./platforms/android/app/build.gradle # how to run echo "To run iOS demo application open Xcode project $APP_NAME/platforms/ios/$APP_NAME.xcodeproj, add the NSPhotoLibraryUsageDescription key to Info.plist if the DirectAPI will be used set your development team."