Skip to content

Commit

Permalink
Merge pull request #66 from BlinkID/release/v6.8.0
Browse files Browse the repository at this point in the history
Release/v6.8.0
  • Loading branch information
mparadina authored Jul 15, 2024
2 parents 71276ec + 423e92e commit 9dfe2da
Show file tree
Hide file tree
Showing 29 changed files with 380 additions and 79 deletions.
2 changes: 1 addition & 1 deletion BlinkID/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ android {
}

dependencies {
implementation('com.microblink:blinkid:6.7.0@aar') {
implementation('com.microblink:blinkid:6.8.0@aar') {
transitive = true
}
}
Expand Down
5 changes: 2 additions & 3 deletions BlinkID/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.microblink.flutter">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<activity android:name="com.microblink.activity.DocumentScanActivity" android:noHistory="true" />
<activity android:name="com.microblink.activity.DocumentVerificationActivity" android:noHistory="true" />
<activity android:name="com.microblink.activity.BlinkIdActivity" android:noHistory="true" />
</application>
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import com.microblink.blinkid.flutter.overlays.OverlaySettingsSerialization;
import com.microblink.blinkid.flutter.SerializationUtils;
import com.microblink.blinkid.locale.LanguageUtils;

import com.microblink.blinkid.hardware.camera.VideoResolutionPreset;
import com.microblink.blinkid.uisettings.CameraSettings;

import org.json.JSONObject;

Expand All @@ -19,8 +20,10 @@ public final class BlinkIdOverlaySettingsSerialization implements OverlaySetting
@Override
public UISettings createUISettings(Context context, JSONObject jsonUISettings, RecognizerBundle recognizerBundle) {
BlinkIdUISettings settings = new BlinkIdUISettings(recognizerBundle);

OverlaySerializationUtils.extractCommonUISettings(jsonUISettings, settings);

settings.setAllowHapticFeedback(false);

boolean requireDocumentSidesDataMatch = jsonUISettings.optBoolean("requireDocumentSidesDataMatch", true);
settings.setDocumentDataMatchRequired(requireDocumentSidesDataMatch);

Expand Down Expand Up @@ -51,6 +54,15 @@ public UISettings createUISettings(Context context, JSONObject jsonUISettings, R
long backSideScanningTimeoutMilliseconds = jsonUISettings.optLong("backSideScanningTimeoutMilliseconds", 17000);
settings.setBackSideScanningTimeoutMs(backSideScanningTimeoutMilliseconds);

int videoResolutionPreset = jsonUISettings.optInt("androidCameraResolutionPreset", VideoResolutionPreset.VIDEO_RESOLUTION_DEFAULT.ordinal());

boolean androidLegacyCameraApi = jsonUISettings.optBoolean("enableAndroidLegacyCameraApi", false);

settings.setCameraSettings(new CameraSettings.Builder()
.setVideoResolutionPreset(VideoResolutionPreset.values()[videoResolutionPreset])
.setForceLegacyApi(androidLegacyCameraApi)
.build());

ReticleOverlayStrings.Builder overlasStringsBuilder = new ReticleOverlayStrings.Builder(context);

String firstSideInstructionsText = getStringFromJSONObject(jsonUISettings, "firstSideInstructionsText");
Expand Down Expand Up @@ -105,6 +117,14 @@ public UISettings createUISettings(Context context, JSONObject jsonUISettings, R
if (errorDocumentTooCloseToEdge != null) {
overlasStringsBuilder.setErrorDocumentTooCloseToEdge(errorDocumentTooCloseToEdge);
}
String errorBlurDetected = getStringFromJSONObject(jsonUISettings, "errorBlurDetected");
if (errorBlurDetected != null) {
overlasStringsBuilder.setErrorBlurDetected(errorBlurDetected);
}
String errorGlareDetected = getStringFromJSONObject(jsonUISettings, "errorGlareDetected");
if (errorGlareDetected != null) {
overlasStringsBuilder.setErrorGlareDetected(errorGlareDetected);
}
String language = getStringFromJSONObject(jsonUISettings, "language");
if (language != null) {
String country = getStringFromJSONObject(jsonUISettings, "country");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ public static JSONObject serializeClassInfo(ClassInfo classInfo) throws JSONExce

public static JSONObject serializeImageAnalysisResult(ImageAnalysisResult imageAnalysisResult) throws JSONException {
JSONObject jsonImageAnalysis = new JSONObject();
jsonImageAnalysis.put("blurred", imageAnalysisResult.isBlurred());
jsonImageAnalysis.put("documentImageColorStatus", SerializationUtils.serializeEnum(imageAnalysisResult.getDocumentImageColorStatus()));
jsonImageAnalysis.put("documentImageMoireStatus", SerializationUtils.serializeEnum(imageAnalysisResult.getDocumentImageMoireStatus()));
jsonImageAnalysis.put("faceDetectionStatus", SerializationUtils.serializeEnum(imageAnalysisResult.getFaceDetectionStatus()));
Expand All @@ -226,6 +225,8 @@ public static JSONObject serializeImageAnalysisResult(ImageAnalysisResult imageA
jsonImageAnalysis.put("cardRotation", BlinkIDSerializationUtils.serializeCardRotation(imageAnalysisResult.getCardRotation()));
jsonImageAnalysis.put("cardOrientation", SerializationUtils.serializeEnum(imageAnalysisResult.getCardOrientation()));
jsonImageAnalysis.put("realIdDetectionStatus", SerializationUtils.serializeEnum(imageAnalysisResult.getRealIdDetectionStatus()));
jsonImageAnalysis.put("blurDetected", imageAnalysisResult.isBlurDetected());
jsonImageAnalysis.put("glareDetected", imageAnalysisResult.isGlareDetected());
return jsonImageAnalysis;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ public final class BlinkIdMultiSideRecognizerSerialization implements Recognizer
public Recognizer<?> createRecognizer(JSONObject jsonObject) {
com.microblink.blinkid.entities.recognizers.blinkid.generic.BlinkIdMultiSideRecognizer recognizer = new com.microblink.blinkid.entities.recognizers.blinkid.generic.BlinkIdMultiSideRecognizer();
recognizer.setAdditionalAnonymization(BlinkIDSerializationUtils.deserializeClassAnonymizationSettings(jsonObject.optJSONArray("additionalAnonymization")));
recognizer.setAllowBlurFilter(jsonObject.optBoolean("allowBlurFilter", true));
recognizer.setAllowUncertainFrontSideScan(jsonObject.optBoolean("allowUncertainFrontSideScan", false));
recognizer.setAllowUnparsedMrzResults(jsonObject.optBoolean("allowUnparsedMrzResults", false));
recognizer.setAllowUnverifiedMrzResults(jsonObject.optBoolean("allowUnverifiedMrzResults", true));
recognizer.setAnonymizationMode(com.microblink.blinkid.entities.recognizers.blinkid.generic.AnonymizationMode.values()[jsonObject.optInt("anonymizationMode", 3)]);
recognizer.setBlurStrictnessLevel(com.microblink.blinkid.entities.recognizers.blinkid.generic.imageanalysis.StrictnessLevel.values()[jsonObject.optInt("blurStrictnessLevel", 1)]);
recognizer.setEnableBlurFilter(jsonObject.optBoolean("enableBlurFilter", true));
recognizer.setEnableGlareFilter(jsonObject.optBoolean("enableGlareFilter", true));
recognizer.setFaceImageDpi(jsonObject.optInt("faceImageDpi", 250));
recognizer.setFullDocumentImageDpi(jsonObject.optInt("fullDocumentImageDpi", 250));
recognizer.setFullDocumentImageExtensionFactors(SerializationUtils.deserializeExtensionFactors(jsonObject.optJSONObject("fullDocumentImageExtensionFactors")));
recognizer.setGlareStrictnessLevel(com.microblink.blinkid.entities.recognizers.blinkid.generic.imageanalysis.StrictnessLevel.values()[jsonObject.optInt("glareStrictnessLevel", 1)]);
recognizer.setMaxAllowedMismatchesPerField(jsonObject.optInt("maxAllowedMismatchesPerField", 0));
recognizer.setPaddingEdge((float)jsonObject.optDouble("paddingEdge", 0.0));
recognizer.setRecognitionModeFilter(BlinkIDSerializationUtils.deserializeRecognitionModeFilter(jsonObject.optJSONObject("recognitionModeFilter")));
Expand Down Expand Up @@ -63,6 +66,7 @@ public JSONObject serializeResult(Recognizer<?> recognizer) {
jsonResult.put("documentAdditionalNumber", BlinkIDSerializationUtils.serializeStringResult(result.getDocumentAdditionalNumber()));
jsonResult.put("documentNumber", BlinkIDSerializationUtils.serializeStringResult(result.getDocumentNumber()));
jsonResult.put("documentOptionalAdditionalNumber", BlinkIDSerializationUtils.serializeStringResult(result.getDocumentOptionalAdditionalNumber()));
jsonResult.put("documentSubtype", BlinkIDSerializationUtils.serializeStringResult(result.getDocumentSubtype()));
jsonResult.put("driverLicenseDetailedInfo", BlinkIDSerializationUtils.serializeDriverLicenseDetailedInfo(result.getDriverLicenseDetailedInfo()));
jsonResult.put("employer", BlinkIDSerializationUtils.serializeStringResult(result.getEmployer()));
jsonResult.put("expired", result.isExpired());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ public final class BlinkIdSingleSideRecognizerSerialization implements Recognize
public Recognizer<?> createRecognizer(JSONObject jsonObject) {
com.microblink.blinkid.entities.recognizers.blinkid.generic.BlinkIdSingleSideRecognizer recognizer = new com.microblink.blinkid.entities.recognizers.blinkid.generic.BlinkIdSingleSideRecognizer();
recognizer.setAdditionalAnonymization(BlinkIDSerializationUtils.deserializeClassAnonymizationSettings(jsonObject.optJSONArray("additionalAnonymization")));
recognizer.setAllowBlurFilter(jsonObject.optBoolean("allowBlurFilter", true));
recognizer.setAllowUnparsedMrzResults(jsonObject.optBoolean("allowUnparsedMrzResults", false));
recognizer.setAllowUnverifiedMrzResults(jsonObject.optBoolean("allowUnverifiedMrzResults", true));
recognizer.setAnonymizationMode(com.microblink.blinkid.entities.recognizers.blinkid.generic.AnonymizationMode.values()[jsonObject.optInt("anonymizationMode", 3)]);
recognizer.setBlurStrictnessLevel(com.microblink.blinkid.entities.recognizers.blinkid.generic.imageanalysis.StrictnessLevel.values()[jsonObject.optInt("blurStrictnessLevel", 1)]);
recognizer.setEnableBlurFilter(jsonObject.optBoolean("enableBlurFilter", true));
recognizer.setEnableGlareFilter(jsonObject.optBoolean("enableGlareFilter", true));
recognizer.setFaceImageDpi(jsonObject.optInt("faceImageDpi", 250));
recognizer.setFullDocumentImageDpi(jsonObject.optInt("fullDocumentImageDpi", 250));
recognizer.setFullDocumentImageExtensionFactors(SerializationUtils.deserializeExtensionFactors(jsonObject.optJSONObject("fullDocumentImageExtensionFactors")));
recognizer.setGlareStrictnessLevel(com.microblink.blinkid.entities.recognizers.blinkid.generic.imageanalysis.StrictnessLevel.values()[jsonObject.optInt("glareStrictnessLevel", 1)]);
recognizer.setPaddingEdge((float)jsonObject.optDouble("paddingEdge", 0.0));
recognizer.setRecognitionModeFilter(BlinkIDSerializationUtils.deserializeRecognitionModeFilter(jsonObject.optJSONObject("recognitionModeFilter")));
recognizer.setReturnFaceImage(jsonObject.optBoolean("returnFaceImage", false));
Expand Down Expand Up @@ -56,6 +59,7 @@ public JSONObject serializeResult(Recognizer<?> recognizer) {
jsonResult.put("documentAdditionalNumber", BlinkIDSerializationUtils.serializeStringResult(result.getDocumentAdditionalNumber()));
jsonResult.put("documentNumber", BlinkIDSerializationUtils.serializeStringResult(result.getDocumentNumber()));
jsonResult.put("documentOptionalAdditionalNumber", BlinkIDSerializationUtils.serializeStringResult(result.getDocumentOptionalAdditionalNumber()));
jsonResult.put("documentSubtype", BlinkIDSerializationUtils.serializeStringResult(result.getDocumentSubtype()));
jsonResult.put("driverLicenseDetailedInfo", BlinkIDSerializationUtils.serializeDriverLicenseDetailedInfo(result.getDriverLicenseDetailedInfo()));
jsonResult.put("employer", BlinkIDSerializationUtils.serializeStringResult(result.getEmployer()));
jsonResult.put("expired", result.isExpired());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,17 @@ +(NSDictionary *) serializeBarcodeResult:(MBBarcodeResult *)barcodeResult {

+(NSDictionary *) serializeImageAnalysisResult:(MBImageAnalysisResult *)imageAnalysisResult {
return @{
@"blurred" : [NSNumber numberWithBool:imageAnalysisResult.blurred],
@"documentImageColorStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.documentImageColorStatus)],
@"documentImageMoireStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.documentImageMoireStatus)],
@"faceDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.faceDetectionStatus)],
@"mrzDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.mrzDetectionStatus)],
@"barcodeDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.barcodeDetectionStatus)],
@"cardRotation" : [NSNumber numberWithInteger:(imageAnalysisResult.cardRotation)],
@"cardOrientation" : [NSNumber numberWithInteger:(imageAnalysisResult.cardOrientation)],
@"realIdDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.realIDDetectionStatus)]
@"realIdDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.realIDDetectionStatus)],
@"blurDetected" : [NSNumber numberWithBool:imageAnalysisResult.blurDetected],
@"glareDetected" : [NSNumber numberWithBool:imageAnalysisResult.glareDetected],

};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,27 @@ -(MBOverlayViewController *) createOverlayViewController:(NSDictionary *)jsonOve
sett.displayCancelButton = [showCancelButton boolValue];
}
}

{
id iOSCameraResolutionPreset = [jsonOverlaySettings valueForKey: @"iosCameraResolutionPreset"];
if (iOSCameraResolutionPreset != nil) {
sett.cameraSettings.cameraPreset = [iOSCameraResolutionPreset integerValue];
}
}

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

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

return [[MBBlinkIdOverlayViewController alloc] initWithSettings:sett recognizerCollection:recognizerCollection delegate:self];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ -(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer {
}
}
}
{
id allowBlurFilter = [jsonRecognizer valueForKey:@"allowBlurFilter"];
if (allowBlurFilter != nil) {
recognizer.allowBlurFilter = [(NSNumber *)allowBlurFilter boolValue];
}
}
{
id allowUncertainFrontSideScan = [jsonRecognizer valueForKey:@"allowUncertainFrontSideScan"];
if (allowUncertainFrontSideScan != nil) {
Expand All @@ -57,6 +51,24 @@ -(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer {
recognizer.anonymizationMode = [(NSNumber *)anonymizationMode unsignedIntegerValue];
}
}
{
id blurStrictnessLevel = [jsonRecognizer valueForKey:@"blurStrictnessLevel"];
if (blurStrictnessLevel != nil) {
recognizer.blurStrictnessLevel = [(NSNumber *)blurStrictnessLevel unsignedIntegerValue];
}
}
{
id enableBlurFilter = [jsonRecognizer valueForKey:@"enableBlurFilter"];
if (enableBlurFilter != nil) {
recognizer.enableBlurFilter = [(NSNumber *)enableBlurFilter boolValue];
}
}
{
id enableGlareFilter = [jsonRecognizer valueForKey:@"enableGlareFilter"];
if (enableGlareFilter != nil) {
recognizer.enableGlareFilter = [(NSNumber *)enableGlareFilter boolValue];
}
}
{
id faceImageDpi = [jsonRecognizer valueForKey:@"faceImageDpi"];
if (faceImageDpi != nil) {
Expand All @@ -75,6 +87,12 @@ -(MBRecognizer *) createRecognizer:(NSDictionary*) jsonRecognizer {
recognizer.fullDocumentImageExtensionFactors = [MBCommonSerializationUtils deserializeMBImageExtensionFactors:(NSDictionary*)fullDocumentImageExtensionFactors];
}
}
{
id glareStrictnessLevel = [jsonRecognizer valueForKey:@"glareStrictnessLevel"];
if (glareStrictnessLevel != nil) {
recognizer.glareStrictnessLevel = [(NSNumber *)glareStrictnessLevel unsignedIntegerValue];
}
}
{
id maxAllowedMismatchesPerField = [jsonRecognizer valueForKey:@"maxAllowedMismatchesPerField"];
if (maxAllowedMismatchesPerField != nil) {
Expand Down Expand Up @@ -177,6 +195,7 @@ -(NSDictionary *) serializeResult {
[jsonResult setValue:[NSNumber numberWithInteger:(self.result.documentDataMatch)] forKey:@"documentDataMatch"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.documentNumber] forKey:@"documentNumber"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.documentOptionalAdditionalNumber] forKey:@"documentOptionalAdditionalNumber"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.documentSubtype] forKey:@"documentSubtype"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeDriverLicenseDetailedInfo:self.result.driverLicenseDetailedInfo] forKey:@"driverLicenseDetailedInfo"];
[jsonResult setValue:[MBBlinkIDSerializationUtils serializeMBStringResult:self.result.employer] forKey:@"employer"];
[jsonResult setValue:[NSNumber numberWithBool:self.result.expired] forKey:@"expired"];
Expand Down
Loading

0 comments on commit 9dfe2da

Please sign in to comment.