Skip to content

Commit

Permalink
Merge pull request #218 from BlinkID/release/v6.6.0
Browse files Browse the repository at this point in the history
Release/v6.6.0
  • Loading branch information
mparadina authored May 10, 2024
2 parents 006d9d5 + eb1ef18 commit 37f67d9
Show file tree
Hide file tree
Showing 28 changed files with 1,199 additions and 471 deletions.
2 changes: 1 addition & 1 deletion BlinkID/blinkid-react-native.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Pod::Spec.new do |s|
s.header_dir = "blinkid-react-native"

s.dependency 'React'
s.dependency 'PPBlinkID', '~> 6.5.0'
s.dependency 'PPBlinkID', '~> 6.7.1'

s.frameworks = 'UIKit'
end
67 changes: 67 additions & 0 deletions BlinkID/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,31 @@ const BlinkIDNative = Platform.select({
* licensee: String,
* showTrialLicenseKeyWarning: Boolean
* }
*
* -> 'scanWithDirectApi' takes the following parameters:
* 1. RecognizerCollection recognizerCollection: object containing recognizers to use for scanning
* 2. String frontImage: a Base64 format string that represents the front image of the document that will be used for processing with DirectAPI
* 3. String backImage: a Base64 format string that represents the back image of the document that will be used for processing with DirectAPI
* - backImage parameter is optional with the BlinkIdSingleSide recognizer, as only one side of the document is required. Pass 'null' or an empty string "" for this parameter in this case
* 4. String license: BlinkID base64 license key bound to application ID for Android or iOS. To obtain
* valid license key, please visit http://microblink.com/login or
* contact us at http://help.microblink.com
*
* OR
*
* Object license: containing:
* - mandatory parameter 'licenseKey': base64 license key bound to application ID
* for Android or iOS. To obtain valid license key, please visit
* http://microblink.com/login or contact us at http://help.microblink.com
* - 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
* {
* licenseKey: '<base64iOSLicense or base64AndroidLicense>',
* licensee: String,
* showTrialLicenseKeyWarning: Boolean
* }
*/
class BlinkIDWrapper {
async scanWithCamera(overlaySettings, recognizerCollection, license) {
Expand Down Expand Up @@ -66,6 +91,48 @@ class BlinkIDWrapper {
return [];
}
}

async scanWithDirectApi(recognizerCollection, frontImage, backImage, license) {
try {
var licenseObject = license;
if (typeof license === 'string' || license instanceof String) {
licenseObject = { licenseKey: license };
}

var frontImageObject = frontImage;
if (typeof frontImage === 'string' || frontImage instanceof String) {
frontImageObject = { frontImage: frontImage };
}

var backImageObject = backImage;
if (typeof backImage === 'string' || backImage instanceof String) {
backImageObject = { backImage: backImage };
}

const nativeResults = await BlinkIDNative.scanWithDirectApi(recognizerCollection, frontImageObject, backImageObject, licenseObject);
if (nativeResults.length != recognizerCollection.recognizerArray.length) {
console.log("INTERNAL ERROR: native plugin returned wrong number of results!");
return [];
} else {
let results = [];
for (let i = 0; i < nativeResults.length; ++i) {
// native plugin must ensure types match
// recognizerCollection.recognizerArray[i].result = recognizerCollection.recognizerArray[i].createResultFromNative(nativeResults[i]);

// unlike Cordova, ReactNative does not allow mutation of user-provided recognizers, so we need to
// return results and let user handle them manually.
let result = recognizerCollection.recognizerArray[i].createResultFromNative(nativeResults[i]);
if (result.resultState != RecognizerResultState.empty) {
results.push(result);
}
}
return results;
}
} catch (error) {
console.log(error);
return [];
}
}
}

export var BlinkID = new BlinkIDWrapper();
Expand Down
48 changes: 36 additions & 12 deletions BlinkID/overlays/blinkidOverlays.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,20 @@ export class BlinkIdOverlaySettings extends OverlaySettings {
*/
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.
*
Expand All @@ -102,30 +111,31 @@ export class BlinkIdOverlaySettings extends OverlaySettings {
/**
* Option to configure missing mandatory fields feedback during scanning. If disabled, general message is presented.
*
* Default: true
* Default: true
*/
this.showMandatoryFieldsMissing = true;

/**
* Option to configure back side scanning timeout.
*
* Default: 17000
* Option to configure back side scanning timeout.
*
* Default: 17000
*/
this.backSideScanningTimeoutMilliseconds = 17000;

/**
/**
* Message that is shown while scanning the barcode.
* If null, default value will be used.
*/
this.scanBarcodeText = null;
*/
this.scanBarcodeText = null;

/**
* Instructions for the user to move the document from the edge.
* If null, default value will be used.
* Instructions for the user to move the document from the edge.
* If null, default value will be used.
*/
this.errorDocumentTooCloseToEdge = null;

/**
* String: title of the dialog which is shown when the data on the document is not matching.
* String: title of the dialog which is shown when the data on the document is not matching.
* If null, default value will be used.
*/
this.showOnboardingInfo = true;
Expand All @@ -143,6 +153,20 @@ export class BlinkIdOverlaySettings extends OverlaySettings {
* Default: 12000
*/
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;
}
}

Expand Down
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-react-native",
"version": "6.5.0",
"version": "6.7.0",
"description": "A small and powerful ID card scanning library. Powered by Microblink (www.microblink.com).",
"main": "index.js",
"repository": {
Expand Down
18 changes: 18 additions & 0 deletions BlinkID/recognizers/blinkIdMultiSideRecognizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ export class BlinkIdMultiSideRecognizerResult extends RecognizerResult {
*/
this.barcodeResult = nativeResult.barcodeResult;

/**
* The blood type of the document owner.
*/
this.bloodType = nativeResult.bloodType;

/**
* The classification information.
*/
Expand Down Expand Up @@ -123,6 +128,14 @@ export class BlinkIdMultiSideRecognizerResult extends RecognizerResult {
*/
this.documentAdditionalNumber = nativeResult.documentAdditionalNumber;

/**
* Returns DataMatchStateSuccess if data from scanned parts/sides of the document match,
* DataMatchStateFailed otherwise. For example if date of expiry is scanned from the front and back side
* 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;

/**
* The document number.
*/
Expand Down Expand Up @@ -310,6 +323,11 @@ export class BlinkIdMultiSideRecognizerResult extends RecognizerResult {
*/
this.signatureImage = nativeResult.signatureImage;

/**
* The sponsor of the document owner.
*/
this.sponsor = nativeResult.sponsor;

}
}

Expand Down
10 changes: 10 additions & 0 deletions BlinkID/recognizers/blinkIdSingleSideRecognizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ export class BlinkIdSingleSideRecognizerResult extends RecognizerResult {
*/
this.barcodeResult = nativeResult.barcodeResult;

/**
* The blood type of the document owner.
*/
this.bloodType = nativeResult.bloodType;

/**
* The raw camera frame.
*/
Expand Down Expand Up @@ -259,6 +264,11 @@ export class BlinkIdSingleSideRecognizerResult extends RecognizerResult {
*/
this.signatureImage = nativeResult.signatureImage;

/**
* The sponsor of the document owner.
*/
this.sponsor = nativeResult.sponsor;

/**
* Defines the data extracted from the visual inspection zone
*/
Expand Down
7 changes: 3 additions & 4 deletions BlinkID/src/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ rootProject.allprojects {
apply plugin: 'com.android.library'

android {
compileSdkVersion 33
buildToolsVersion "28.0.3"
compileSdkVersion 34

defaultConfig {
minSdkVersion 21
targetSdkVersion 33
targetSdkVersion 34
}
buildTypes {
release {
Expand All @@ -26,7 +25,7 @@ android {

dependencies {
implementation 'com.facebook.react:react-native:+'
implementation('com.microblink:blinkid:6.5.0@aar') {
implementation('com.microblink:blinkid:6.7.0@aar') {
transitive = true
}
}
Loading

0 comments on commit 37f67d9

Please sign in to comment.