Skip to content

Commit

Permalink
Merge pull request #123 from BlinkID/release/5.4.0
Browse files Browse the repository at this point in the history
Release/5.4.0
  • Loading branch information
i1E authored Apr 29, 2020
2 parents c778b27 + 44e27e3 commit c6ab832
Show file tree
Hide file tree
Showing 25 changed files with 421 additions and 40 deletions.
2 changes: 1 addition & 1 deletion BlinkID/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blinkid-cordova",
"version": "5.3.0",
"version": "5.4.0",
"description": "A small and powerful ID card scanning library",
"cordova": {
"id": "blinkid-cordova",
Expand Down
2 changes: 1 addition & 1 deletion BlinkID/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="blinkid-cordova"
version="5.3.0">
version="5.4.0">

<name>BlinkIdScanner</name>
<description>A small and powerful ID card scanning library</description>
Expand Down
2 changes: 1 addition & 1 deletion BlinkID/scripts/initIOSFramework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
HERE="$(dirname "$(test -L "$0" && readlink "$0" || echo "$0")")"
pushd "${HERE}/../src/ios/" > /dev/null

LINK='https://github.com/BlinkID/blinkid-ios/releases/download/v5.3.0/blinkid-ios_v5.3.0.zip'
LINK='https://github.com/BlinkID/blinkid-ios/releases/download/v5.4.0/blinkid-ios_v5.4.0.zip'
FILENAME='blinkid-ios.zip'

# check if Microblink framework and bundle already exist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ public UISettings createUISettings(Context context, JSONObject jsonUISettings, R
if (retryButtonText != null) {
overlasStringsBuilder.setRetryButtonText(retryButtonText);
}
String scanBarcodeText = getStringFromJSONObject(jsonUISettings, "scanBarcodeText");
if (scanBarcodeText != null) {
overlasStringsBuilder.setBackSideBarcodeInstructions(scanBarcodeText);
}
String errorDocumentTooCloseToEdge = getStringFromJSONObject(jsonUISettings, "errorDocumentTooCloseToEdge");
if (errorDocumentTooCloseToEdge != null) {
overlasStringsBuilder.setErrorDocumentTooCloseToEdge(errorDocumentTooCloseToEdge);
}

settings.setStrings(overlasStringsBuilder.build());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.microblink.entities.recognizers.blinkid.mrtd.MrzResult;
import com.microblink.entities.recognizers.blinkid.imageoptions.extension.ImageExtensionFactors;
import com.microblink.entities.recognizers.blinkid.generic.DriverLicenseDetailedInfo;
import com.microblink.entities.recognizers.blinkid.generic.classinfo.ClassInfo;

import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -56,4 +57,13 @@ public static ImageExtensionFactors deserializeExtensionFactors(JSONObject jsonE
return new ImageExtensionFactors(up, down, left, right);
}
}

public static JSONObject serializeClassInfo(ClassInfo classInfo) throws JSONException {
JSONObject jsonClassInfo = new JSONObject();
jsonClassInfo.put("country", SerializationUtils.serializeEnum(classInfo.getCountry()));
jsonClassInfo.put("region", SerializationUtils.serializeEnum(classInfo.getRegion()));
jsonClassInfo.put("type", SerializationUtils.serializeEnum(classInfo.getType()));
return jsonClassInfo;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ public Recognizer<?> createRecognizer(JSONObject jsonRecognizer) {
recognizer.setFaceImageDpi(jsonRecognizer.optInt("faceImageDpi", 250));
recognizer.setFullDocumentImageDpi(jsonRecognizer.optInt("fullDocumentImageDpi", 250));
recognizer.setFullDocumentImageExtensionFactors(BlinkIDSerializationUtils.deserializeExtensionFactors(jsonRecognizer.optJSONObject("fullDocumentImageExtensionFactors")));
recognizer.setPaddingEdge((float)jsonRecognizer.optDouble("paddingEdge", 0.0));
recognizer.setReturnFaceImage(jsonRecognizer.optBoolean("returnFaceImage", false));
recognizer.setReturnFullDocumentImage(jsonRecognizer.optBoolean("returnFullDocumentImage", false));
recognizer.setSignResult(jsonRecognizer.optBoolean("signResult", false));
recognizer.setSkipUnsupportedBack(jsonRecognizer.optBoolean("skipUnsupportedBack", false));
return recognizer;
}

Expand All @@ -32,6 +34,8 @@ public JSONObject serializeResult(Recognizer<?> recognizer) {
jsonResult.put("additionalAddressInformation", result.getAdditionalAddressInformation());
jsonResult.put("additionalNameInformation", result.getAdditionalNameInformation());
jsonResult.put("address", result.getAddress());
jsonResult.put("age", result.getAge());
jsonResult.put("classInfo", BlinkIDSerializationUtils.serializeClassInfo(result.getClassInfo()));
jsonResult.put("conditions", result.getConditions());
jsonResult.put("dateOfBirth", SerializationUtils.serializeDate(result.getDateOfBirth()));
jsonResult.put("dateOfExpiry", SerializationUtils.serializeDate(result.getDateOfExpiry()));
Expand All @@ -40,7 +44,9 @@ public JSONObject serializeResult(Recognizer<?> recognizer) {
jsonResult.put("digitalSignature", SerializationUtils.encodeByteArrayToBase64(result.getDigitalSignature()));
jsonResult.put("digitalSignatureVersion", (int)result.getDigitalSignatureVersion());
jsonResult.put("documentAdditionalNumber", result.getDocumentAdditionalNumber());
jsonResult.put("documentBackImageColorStatus", SerializationUtils.serializeEnum(result.getDocumentBackImageColorStatus()));
jsonResult.put("documentDataMatch", SerializationUtils.serializeEnum(result.getDocumentDataMatch()));
jsonResult.put("documentFrontImageColorStatus", SerializationUtils.serializeEnum(result.getDocumentFrontImageColorStatus()));
jsonResult.put("documentNumber", result.getDocumentNumber());
jsonResult.put("driverLicenseDetailedInfo", BlinkIDSerializationUtils.serializeDriverLicenseDetailedInfo(result.getDriverLicenseDetailedInfo()));
jsonResult.put("employer", result.getEmployer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public Recognizer<?> createRecognizer(JSONObject jsonRecognizer) {
recognizer.setFaceImageDpi(jsonRecognizer.optInt("faceImageDpi", 250));
recognizer.setFullDocumentImageDpi(jsonRecognizer.optInt("fullDocumentImageDpi", 250));
recognizer.setFullDocumentImageExtensionFactors(BlinkIDSerializationUtils.deserializeExtensionFactors(jsonRecognizer.optJSONObject("fullDocumentImageExtensionFactors")));
recognizer.setPaddingEdge((float)jsonRecognizer.optDouble("paddingEdge", 0.0));
recognizer.setReturnFaceImage(jsonRecognizer.optBoolean("returnFaceImage", false));
recognizer.setReturnFullDocumentImage(jsonRecognizer.optBoolean("returnFullDocumentImage", false));
return recognizer;
Expand All @@ -31,12 +32,15 @@ public JSONObject serializeResult(Recognizer<?> recognizer) {
jsonResult.put("additionalAddressInformation", result.getAdditionalAddressInformation());
jsonResult.put("additionalNameInformation", result.getAdditionalNameInformation());
jsonResult.put("address", result.getAddress());
jsonResult.put("age", result.getAge());
jsonResult.put("classInfo", BlinkIDSerializationUtils.serializeClassInfo(result.getClassInfo()));
jsonResult.put("conditions", result.getConditions());
jsonResult.put("dateOfBirth", SerializationUtils.serializeDate(result.getDateOfBirth()));
jsonResult.put("dateOfExpiry", SerializationUtils.serializeDate(result.getDateOfExpiry()));
jsonResult.put("dateOfExpiryPermanent", result.isDateOfExpiryPermanent());
jsonResult.put("dateOfIssue", SerializationUtils.serializeDate(result.getDateOfIssue()));
jsonResult.put("documentAdditionalNumber", result.getDocumentAdditionalNumber());
jsonResult.put("documentImageColorStatus", SerializationUtils.serializeEnum(result.getDocumentImageColorStatus()));
jsonResult.put("documentNumber", result.getDocumentNumber());
jsonResult.put("driverLicenseDetailedInfo", BlinkIDSerializationUtils.serializeDriverLicenseDetailedInfo(result.getDriverLicenseDetailedInfo()));
jsonResult.put("employer", result.getEmployer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public JSONObject serializeResult(Recognizer<?> recognizer) {
jsonResult.put("additionalAddressInformation", result.getAdditionalAddressInformation());
jsonResult.put("additionalNameInformation", result.getAdditionalNameInformation());
jsonResult.put("address", result.getAddress());
jsonResult.put("age", result.getAge());
jsonResult.put("barcodeType", SerializationUtils.serializeEnum(result.getBarcodeType()));
jsonResult.put("dateOfBirth", SerializationUtils.serializeDate(result.getDateOfBirth()));
jsonResult.put("dateOfExpiry", SerializationUtils.serializeDate(result.getDateOfExpiry()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public JSONObject serializeResult(Recognizer<?> recognizer) {
jsonResult.put("address", result.getAddress());
jsonResult.put("documentNumber", result.getDocumentNumber());
jsonResult.put("sex", result.getSex());
jsonResult.put("age", result.getAge());
jsonResult.put("restrictions", result.getRestrictions());
jsonResult.put("endorsements", result.getEndorsements());
jsonResult.put("vehicleClass", result.getVehicleClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public JSONObject serializeResult(Recognizer<?> recognizer) {
jsonResult.put("address", result.getAddress());
jsonResult.put("documentNumber", result.getDocumentNumber());
jsonResult.put("sex", result.getSex());
jsonResult.put("age", result.getAge());
jsonResult.put("restrictions", result.getRestrictions());
jsonResult.put("endorsements", result.getEndorsements());
jsonResult.put("vehicleClass", result.getVehicleClass());
Expand Down
2 changes: 1 addition & 1 deletion BlinkID/src/android/libBlinkID.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repositories {
}

dependencies {
implementation('com.microblink:blinkid:5.3.0@aar') {
implementation('com.microblink:blinkid:5.4.0@aar') {
transitive = true
}
}
Expand Down
1 change: 1 addition & 0 deletions BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
+(NSDictionary * _Nonnull) serializeMrzResult:(MBMrzResult * _Nonnull)mrzResult;
+(MBImageExtensionFactors) deserializeMBImageExtensionFactors:(NSDictionary * _Nullable)jsonExtensionFactors;
+(NSDictionary * _Nonnull) serializeDriverLicenseDetailedInfo:(MBDriverLicenseDetailedInfo * _Nonnull)driverLicenseDetailedInfo;
+(NSDictionary * _Nonnull) serializeClassInfo:(MBClassInfo * _Nonnull)classInfo;

@end
11 changes: 10 additions & 1 deletion BlinkID/src/ios/sources/MBBlinkIDSerializationUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ +(NSDictionary *) serializeMrzResult:(MBMrzResult *)mrzResult {
@"sanitizedNationality" : mrzResult.sanitizedNationality,
@"sanitizedIssuer" : mrzResult.sanitizedIssuer,
@"sanitizedDocumentCode" : mrzResult.sanitizedDocumentCode,
@"sanitizedDocumentNumber" : mrzResult.sanitizedDocumentNumber
@"sanitizedDocumentNumber" : mrzResult.sanitizedDocumentNumber,
@"age" : [NSNumber numberWithInteger:mrzResult.age]
};
}

Expand All @@ -60,4 +61,12 @@ +(NSDictionary *) serializeDriverLicenseDetailedInfo:(MBDriverLicenseDetailedInf
};
}

+(NSDictionary *) serializeClassInfo:(MBClassInfo *)classInfo {
return @{
@"country" : [NSNumber numberWithInteger:(classInfo.country + 1)],
@"region" : [NSNumber numberWithInteger:(classInfo.region + 1)],
@"type" : [NSNumber numberWithInteger:(classInfo.type + 1)],
};
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@

-(MBOverlayViewController *) createOverlayViewController:(NSDictionary *)jsonOverlaySettings recognizerCollection:(MBRecognizerCollection*)recognizerCollection delegate:(id<MBOverlayViewControllerDelegate>)delegate;

-(MBOverlayViewController *) createDocumentCaptureOverlayViewControllerWithCollection:(MBRecognizerCollection*)recognizerCollection delegate:(id<MBOverlayViewControllerDelegate>)delegate;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@ -(MBOverlayViewController *) createOverlayViewController:(NSDictionary *)jsonOve
return [[self.overlayCreators valueForKey:[jsonOverlaySettings valueForKey:@"overlaySettingsType"]] createOverlayViewController:jsonOverlaySettings recognizerCollection:recognizerCollection delegate:delegate];
}

-(MBOverlayViewController *) createDocumentCaptureOverlayViewControllerWithCollection:(MBRecognizerCollection*)recognizerCollection delegate:(id<MBOverlayViewControllerDelegate>)delegate {
return [[self.overlayCreators valueForKey:@"DocumentCaptureOverlaySettings"] createOverlayViewController:nil recognizerCollection:recognizerCollection delegate:delegate];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@

#import <MicroBlink/MicroBlink.h>

@protocol MBOverlayViewControllerDelegate
@protocol MBOverlayViewControllerDelegate<NSObject>
@required

- (void)overlayViewControllerDidFinishScanning:(MBOverlayViewController *)overlayViewController state:(MBRecognizerResultState)state;
- (void)overlayDidTapClose:(MBOverlayViewController *)overlayViewController;

@optional
- (void)overlayViewControllerDidFinishScanning:(MBOverlayViewController *)overlayViewController highResImage:(MBImage *)highResImage state:(MBRecognizerResultState)state;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,20 @@ -(MBOverlayViewController *) createOverlayViewController:(NSDictionary *)jsonOve
sett.backSideScanningTimeout = [backSideScanningTimeoutMilliseconds doubleValue] / 1000.0;
}
}

{
id scanBarcodeText = [jsonOverlaySettings valueForKey:@"scanBarcodeText"];
if (scanBarcodeText != nil) {
sett.scanBarcodeText = (NSString *)scanBarcodeText;
}
}

{
id errorDocumentTooCloseToEdge = [jsonOverlaySettings valueForKey:@"errorDocumentTooCloseToEdge"];
if (errorDocumentTooCloseToEdge != nil) {
sett.errorDocumentTooCloseToEdge = (NSString *)errorDocumentTooCloseToEdge;
}
}

return [[MBBlinkIdOverlayViewController alloc] initWithSettings:sett recognizerCollection:recognizerCollection delegate:self];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ -(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer {
recognizer.fullDocumentImageExtensionFactors = [MBBlinkIDSerializationUtils deserializeMBImageExtensionFactors:(NSDictionary*)fullDocumentImageExtensionFactors];
}
}
{
id paddingEdge = [jsonRecognizer valueForKey:@"paddingEdge"];
if (paddingEdge != nil) {
recognizer.paddingEdge = [(NSNumber *)paddingEdge floatValue];
}
}
{
id returnFaceImage = [jsonRecognizer valueForKey:@"returnFaceImage"];
if (returnFaceImage != nil) {
Expand All @@ -70,6 +76,12 @@ -(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer {
recognizer.signResult = [(NSNumber *)signResult boolValue];
}
}
{
id skipUnsupportedBack = [jsonRecognizer valueForKey:@"skipUnsupportedBack"];
if (skipUnsupportedBack != nil) {
recognizer.skipUnsupportedBack = [(NSNumber *)skipUnsupportedBack boolValue];
}
}

return recognizer;
}
Expand All @@ -86,6 +98,8 @@ -(NSDictionary *) serializeResult {
[jsonResult setValue:self.result.additionalAddressInformation forKey:@"additionalAddressInformation"];
[jsonResult setValue:self.result.additionalNameInformation forKey:@"additionalNameInformation"];
[jsonResult setValue:self.result.address forKey:@"address"];
[jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeClassInfo:self.result.classInfo] forKey:@"classInfo"];
[jsonResult setValue:self.result.conditions forKey:@"conditions"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"];
Expand All @@ -94,7 +108,9 @@ -(NSDictionary *) serializeResult {
[jsonResult setValue:[self.result.digitalSignature base64EncodedStringWithOptions:0] forKey:@"digitalSignature"];
[jsonResult setValue:[NSNumber numberWithUnsignedInteger:self.result.digitalSignatureVersion] forKey:@"digitalSignatureVersion"];
[jsonResult setValue:self.result.documentAdditionalNumber forKey:@"documentAdditionalNumber"];
[jsonResult setValue:[NSNumber numberWithInteger:(self.result.documentBackImageColorStatus + 1)] forKey:@"documentBackImageColorStatus"];
[jsonResult setValue:[NSNumber numberWithInteger:(self.result.documentDataMatch + 1)] forKey:@"documentDataMatch"];
[jsonResult setValue:[NSNumber numberWithInteger:(self.result.documentFrontImageColorStatus + 1)] forKey:@"documentFrontImageColorStatus"];
[jsonResult setValue:self.result.documentNumber forKey:@"documentNumber"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeDriverLicenseDetailedInfo:self.result.driverLicenseDetailedInfo] forKey:@"driverLicenseDetailedInfo"];
[jsonResult setValue:self.result.employer forKey:@"employer"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ -(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer {
recognizer.fullDocumentImageExtensionFactors = [MBBlinkIDSerializationUtils deserializeMBImageExtensionFactors:(NSDictionary*)fullDocumentImageExtensionFactors];
}
}
{
id paddingEdge = [jsonRecognizer valueForKey:@"paddingEdge"];
if (paddingEdge != nil) {
recognizer.paddingEdge = [(NSNumber *)paddingEdge floatValue];
}
}
{
id returnFaceImage = [jsonRecognizer valueForKey:@"returnFaceImage"];
if (returnFaceImage != nil) {
Expand Down Expand Up @@ -80,12 +86,15 @@ -(NSDictionary *) serializeResult {
[jsonResult setValue:self.result.additionalAddressInformation forKey:@"additionalAddressInformation"];
[jsonResult setValue:self.result.additionalNameInformation forKey:@"additionalNameInformation"];
[jsonResult setValue:self.result.address forKey:@"address"];
[jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeClassInfo:self.result.classInfo] forKey:@"classInfo"];
[jsonResult setValue:self.result.conditions forKey:@"conditions"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"];
[jsonResult setValue:[MBSerializationUtils 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:self.result.documentAdditionalNumber forKey:@"documentAdditionalNumber"];
[jsonResult setValue:[NSNumber numberWithInteger:(self.result.documentImageColorStatus + 1)] forKey:@"documentImageColorStatus"];
[jsonResult setValue:self.result.documentNumber forKey:@"documentNumber"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeDriverLicenseDetailedInfo:self.result.driverLicenseDetailedInfo] forKey:@"driverLicenseDetailedInfo"];
[jsonResult setValue:self.result.employer forKey:@"employer"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ -(NSDictionary *) serializeResult {
[jsonResult setValue:self.result.additionalAddressInformation forKey:@"additionalAddressInformation"];
[jsonResult setValue:self.result.additionalNameInformation forKey:@"additionalNameInformation"];
[jsonResult setValue:self.result.address forKey:@"address"];
[jsonResult setValue:[NSNumber numberWithInteger:self.result.age] forKey:@"age"];
[jsonResult setValue:[NSNumber numberWithInteger:(self.result.barcodeType + 1)] forKey:@"barcodeType"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfBirth] forKey:@"dateOfBirth"];
[jsonResult setValue:[MBSerializationUtils serializeMBDateResult:self.result.dateOfExpiry] forKey:@"dateOfExpiry"];
Expand Down
Loading

0 comments on commit c6ab832

Please sign in to comment.