Skip to content

Commit

Permalink
Merge pull request #34 from BlinkID/release/v6.5.0
Browse files Browse the repository at this point in the history
Release/v6.5.0
  • Loading branch information
mparadina authored Feb 21, 2024
2 parents e16b41e + 762b847 commit f47c4e9
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 11 deletions.
2 changes: 1 addition & 1 deletion BlinkID/MicroblinkBlinkidCapacitor.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '13.0'
s.dependency 'Capacitor'
s.swift_version = '5.5'
s.dependency 'PPBlinkID', '~> 6.4.0'
s.dependency 'PPBlinkID', '~> 6.5.0'
end
2 changes: 1 addition & 1 deletion BlinkID/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':capacitor-android')

implementation('com.microblink:blinkid:6.4.0@aar') {
implementation('com.microblink:blinkid:6.5.0@aar') {
transitive = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.microblink.blinkid.uisettings.UISettings;
import com.microblink.blinkid.capacitor.overlays.OverlaySettingsSerializers;
import com.microblink.blinkid.capacitor.recognizers.RecognizerSerializers;
import com.microblink.blinkid.locale.LanguageUtils;
import com.getcapacitor.annotation.ActivityCallback;
import com.getcapacitor.annotation.CapacitorPlugin;
import com.getcapacitor.JSObject;
Expand Down Expand Up @@ -40,6 +41,7 @@ public void scanWithCamera(PluginCall call) {
JSObject jsLicenses = call.getObject("license");

setLicense(jsLicenses);
setLanguage(jsOverlaySettings);

recognizerBundle = RecognizerSerializers.INSTANCE.deserializeRecognizerCollection(jsRecognizerCollection);
UISettings uiSettings = OverlaySettingsSerializers.INSTANCE.getOverlaySettings(getContext(), jsOverlaySettings, recognizerBundle);
Expand Down Expand Up @@ -86,6 +88,14 @@ private void setLicense(JSObject jsonLicense) {
MicroblinkSDK.setIntentDataTransferMode(IntentDataTransferMode.PERSISTED_OPTIMISED);
}

private void setLanguage(JSONObject jsonOverlaySettings) {
try {
LanguageUtils.setLanguageAndCountry(jsonOverlaySettings.getString("language"),
jsonOverlaySettings.getString("country"),
getContext());
} catch (Exception e) {}
}

private void startActivityForResult(PluginCall call, String callbackMethod, UISettings settings) {
Activity activity = getActivity();
Intent intent = new Intent(activity, settings.getTargetActivity());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static JSONObject serializeDate(@Nullable Date dateResult) throws JSONExc
}

public static int serializeEnum(Enum e) {
return e.ordinal() + 1;
return e.ordinal();
}

public static JSONArray serializeStringArray(String[] strings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public UISettings createUISettings(Context context, JSONObject jsonUISettings, R
String country = getStringFromJSONObject(jsonUISettings, "country");
if (country != null) {
LanguageUtils.setLanguageAndCountry(language, country, context);
} else {
LanguageUtils.setLanguageAndCountry(language, "", context);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public static JSONObject serializeImageAnalysisResult(ImageAnalysisResult imageA
jsonImageAnalysis.put("mrzDetectionStatus", SerializationUtils.serializeEnum(imageAnalysisResult.getMrzDetectionStatus()));
jsonImageAnalysis.put("barcodeDetectionStatus", SerializationUtils.serializeEnum(imageAnalysisResult.getBarcodeDetectionStatus()));
jsonImageAnalysis.put("cardRotation", BlinkIDSerializationUtils.serializeCardRotation(imageAnalysisResult.getCardRotation()));
jsonImageAnalysis.put("cardOrientation", SerializationUtils.serializeEnum(imageAnalysisResult.getCardOrientation()));
return jsonImageAnalysis;
}

Expand Down
19 changes: 18 additions & 1 deletion BlinkID/ios/Plugin/BlinkIDPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public class BlinkIDCapacitorPlugin: CAPPlugin {
}

setLicenseKey(license: jsonLicense)

setLanguage(jsonOverlaySettings?["language"] ?? "en",
jsonOverlaySettings?["country"] ?? "")

recognizerCollection = MBRecognizerSerializers.sharedInstance()?.deserializeRecognizerCollection(jsonRecognizerCollection)

DispatchQueue.main.async {
Expand Down Expand Up @@ -81,6 +83,21 @@ public class BlinkIDCapacitorPlugin: CAPPlugin {
MBMicroblinkSDK.shared().setLicenseKey(iOSLicense) { (licenseError) in
}
}

private func setLanguage(_ language: Any, _ country: Any) {
if let language = language as? String {
if let country = country as? String{
if !(country.isEmpty) {
MBMicroblinkApp.shared().language = "\(language)-\(country)"
} else {
MBMicroblinkApp.shared().language = language
}
} else {
MBMicroblinkApp.shared().language = language
}
}
}


private func sanitizeDictionary(_ dictionary: [String : Any]) -> [String : Any]? {
var mutableDictionary = dictionary
Expand Down
3 changes: 2 additions & 1 deletion BlinkID/ios/Plugin/MBBlinkIDSerializationUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ +(NSDictionary *) serializeImageAnalysisResult:(MBImageAnalysisResult *)imageAna
@"faceDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.faceDetectionStatus)],
@"mrzDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.mrzDetectionStatus)],
@"barcodeDetectionStatus" : [NSNumber numberWithInteger:(imageAnalysisResult.barcodeDetectionStatus)],
@"cardRotation" : [NSNumber numberWithInteger:(imageAnalysisResult.cardRotation)]
@"cardRotation" : [NSNumber numberWithInteger:(imageAnalysisResult.cardRotation)],
@"cardOrientation" : [NSNumber numberWithInteger:(imageAnalysisResult.cardOrientation)]
};
}

Expand Down
2 changes: 1 addition & 1 deletion BlinkID/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ end
target 'Plugin' do
capacitor_pods

pod 'PPBlinkID', '~> 6.4.0'
pod 'PPBlinkID', '~> 6.5.0'
end

target 'PluginTests' do
Expand Down
4 changes: 2 additions & 2 deletions BlinkID/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion BlinkID/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microblink/blinkid-capacitor",
"version": "6.4.0",
"version": "6.5.0",
"description": "A small and powerful ID card Capacitor plugin for BlinkID SDK",
"main": "dist/plugin.js",
"module": "dist/esm/index.js",
Expand Down
28 changes: 28 additions & 0 deletions BlinkID/src/overlays/blinkidOverlays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,20 @@ export class BlinkIdOverlaySettings extends OverlaySettings {
*/
onboardingButtonTooltipDelay: number;

/**
* Option to configure the language of the UI
*
* Default: The language set on the device. If the language is not supported, the English language will be used.
*/
language: string;

/**
* Option to set the country locale, used with the language variable
*
* Default: The country locale set on the device
*/
country: string;

constructor() {
super('BlinkIdOverlaySettings');
/**
Expand Down Expand Up @@ -249,6 +263,20 @@ export class BlinkIdOverlaySettings extends OverlaySettings {
* Default: 12000
*/
this.onboardingButtonTooltipDelay = 12000;

/**
* (optional) if default overlay contains textual information, text will be localized to this language. Otherwise device langauge will be used
*
* example: "en"
*/
this.language = null;

/**
* (optional) to be 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;
}
}

Expand Down
13 changes: 13 additions & 0 deletions BlinkID/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,16 @@ export const enum CardRotation {
None = 4
}

/// Defines possible card orientations
export const enum CardOrientation {
/** Horizontal card orientation */
Horizontal = 0,
/** Vertical card orientation */
Vertical = 1,
/** Detection was not performed */
NotAvailable = 2
}

/**
* Define level of anonymization performed on recognizer result.
*/
Expand Down Expand Up @@ -436,6 +446,8 @@ export class ImageAnalysisResult {
barcodeDetectionStatus: ImageAnalysisDetectionStatus;
/** Document card rotation status determined from the scanned image. */
cardRotation: CardRotation;
/** Orientation determined from the scanned image. */
cardOrientation: CardOrientation;

constructor(nativeImageAnalysisResult: any) {
this.blurred = nativeImageAnalysisResult.blurred;
Expand All @@ -445,6 +457,7 @@ export class ImageAnalysisResult {
this.mrzDetectionStatus = nativeImageAnalysisResult.mrzDetectionStatus;
this.barcodeDetectionStatus = nativeImageAnalysisResult.barcodeDetectionStatus;
this.cardRotation = nativeImageAnalysisResult.cardRotation;
this.cardOrientation = nativeImageAnalysisResult.cardOrientation;
}
}

Expand Down
5 changes: 5 additions & 0 deletions Release notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 6.5.0
- We have updated the plugin to [Android SDK v6.5.0](https://github.com/BlinkID/blinkid-android/releases/tag/v6.5.0) and [iOS SDK v6.5.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.5.0)
- Added `cardOrientation` property to `ImageAnalysisResult`
- Fixed issue with the SDK localization

## 6.4.0
- We have updated the plugin to [Android SDK v6.4.0](https://github.com/BlinkID/blinkid-android/releases/tag/v6.4.0) and [iOS SDK v6.4.0](https://github.com/BlinkID/blinkid-ios/releases/tag/v6.4.0)

Expand Down
4 changes: 2 additions & 2 deletions sample_files/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class HomePage {

// com.microblink.sample
const licenseKeys: BlinkID.License = {
ios: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUBbGV5SkRjbVZoZEdWa1QyNGlPakUzTURNd056Y3hORFkzT1RJc0lrTnlaV0YwWldSR2IzSWlPaUkwT1RabFpEQXpaUzAwT0RBeExUUXpZV1F0WVRrMU5DMDBNemMyWlRObU9UTTVNR1FpZlE9PYPwAuE88FDjP95RyiGUewj+e6SGUoHitmTt0i2T87nVbH79ynAtPdmuQV49+U4ulln6j4ku3momxVE2igI9howeOZwxK5IbpMVG3ooDibChEXUccclpCCv08w3gEUwsP7hGOIBbA4HP45vru2nkan74SUYXWVU=',
android: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUAbGV5SkRjbVZoZEdWa1QyNGlPakUzTURNd056Y3lNRE0xTWpnc0lrTnlaV0YwWldSR2IzSWlPaUkwT1RabFpEQXpaUzAwT0RBeExUUXpZV1F0WVRrMU5DMDBNemMyWlRObU9UTTVNR1FpZlE9PY6A6Eq56GBOfiH4PZYVCf1vcY3/GuHCOkdOhF5rUKHodDOB3Q01339g0q22TM/fWv5f06CvIiAamEhg1m8xAYWSQt2VVSsVJaAncz+bGexcASnuhlHA+LTLnSZGIxSgnNKBJbizQypDRsyFKKpBq7K2SfVi+gM=',
ios: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUBbGV5SkRjbVZoZEdWa1QyNGlPakUzTURnd09EUTFNamM1TnpJc0lrTnlaV0YwWldSR2IzSWlPaUkwT1RabFpEQXpaUzAwT0RBeExUUXpZV1F0WVRrMU5DMDBNemMyWlRObU9UTTVNR1FpZlE9PTYmqMAMVMiFzaNDv15W9/CxDFVRDWRjok+uP0GtswDV4XTVGmhbivKDEb9Gtk2iMzf29qFWF8aUjIES4QSQFJG0xfBXZhluSk7lt4A959aHAZ0+BWgDnqZUPJAF2jZd0Pl2Kt1oDxLtqtf8V/RR+dPYzUV0PEA=',
android: 'sRwCABVjb20ubWljcm9ibGluay5zYW1wbGUAbGV5SkRjbVZoZEdWa1QyNGlPakUzTURnd09EUTNNelkxTmprc0lrTnlaV0YwWldSR2IzSWlPaUkwT1RabFpEQXpaUzAwT0RBeExUUXpZV1F0WVRrMU5DMDBNemMyWlRObU9UTTVNR1FpZlE9PRIv5OawGAVdpvmuz+999CsJyIAgtV3h96BJo1Fq+xBZnKDoKhL01jBUrxC0E4+EeWoTuEtPPcDte2KHgjOP7Z4y+Mk9ihWDHTjgANWfFwG2Gd7HYJxgwcYQsTvICqS1CBklIILTfbXahwtD4ZKh0ghaxUJf7gU=',
showTrialLicenseWarning: true
};

Expand Down

0 comments on commit f47c4e9

Please sign in to comment.