Skip to content

Commit

Permalink
Merge pull request #4 from blinkinput/release/v4.2.0
Browse files Browse the repository at this point in the history
Release/v4.2.0
  • Loading branch information
juraskrlec authored May 27, 2020
2 parents 6dfce89 + 07ce2a2 commit fdc1e2b
Show file tree
Hide file tree
Showing 101 changed files with 5,827 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .gitignore/.gitignore → .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.DS_Store

# blinkid-ios containing framework and bundle
BlinkID/src/ios/blinkid-ios
BlinkInput/src/ios/blinkinput-ios

# demo app
BlinkIdDemo
BlinkInputDemo

# res
resources/signing

BlinkIdDevDemo
BlinkInputDevDemo
61 changes: 61 additions & 0 deletions BlinkInput/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "blinkinput-cordova",
"version": "4.3.0",
"description": "A small and powerful scanning library",
"cordova": {
"id": "blinkinput-cordova",
"platforms": [
"android",
"ios"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/BlinkInput/blinkinput-cordova.git"
},
"keywords": [
"scan",
"id",
"scanner",
"identity",
"ID",
"passport",
"sdk",
"ocr",
"USDL",
"PDF417",
"MRZ",
"MRTD",
"barcode",
"DL",
"card",
"document",
"microblink",
"blinkinput",
"ionic",
"phonegap",
"ecosystem:cordova",
"cordova-android",
"cordova-ios"
],
"engines": [
{
"name": "cordova",
"version": ">=7.0.0"
},
{
"name": "cordova-android",
"version": ">=8.0.0"
},
{
"name": "cordova-ios",
"version": ">=4.4.0"
}
],
"author": "Microblink",
"license": "MIT",
"bugs": {
"url": "https://github.com/BlinkInput/blinkinput-cordova/issues"
},
"homepage": "https://github.com/BlinkInput/blinkinput-cordova#readme"
}
183 changes: 183 additions & 0 deletions BlinkInput/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="blinkinput-cordova"
version="4.3.0">

<name>BlinkInputScanner</name>
<description>A small and powerful OCR library</description>
<license>MIT</license>
<keywords>ID</keywords>
<author>Microblink Team [email protected]</author>

<engines>
<engine name="cordova" version=">=7.0.0" />
<engine name="cordova-android" version=">=8.0.0" />
</engines>

<js-module src="www/blinkInputScanner.js" name="BlinkInputScanner">
<clobbers target="cordova.plugins.BlinkInput" />
</js-module>

<!-- android -->
<platform name="android">

<config-file target="res/xml/config.xml" parent="/*">
<feature name="BlinkInputScanner">
<param name="android-package" value="com.phonegap.plugins.microblink.MicroblinkScanner" />
</feature>
</config-file>

<config-file target="app/src/main/AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />

<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true" />
</config-file>

<config-file target="app/src/main/AndroidManifest.xml" parent="/manifest/application">
<activity
android:name="com.microblink.activity.ScanCard"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation|screenSize"
android:screenOrientation="portrait" >
</activity>
</config-file>


<!-- ANDROID SOURCE FILES BEGIN -->
<source-file src="src/android/java/com/phonegap/plugins/microblink/SerializationUtils.java" target-dir="src/com/phonegap/plugins/microblink" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/MicroblinkScanner.java" target-dir="src/com/phonegap/plugins/microblink" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/FakeR.java" target-dir="src/com/phonegap/plugins/microblink" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/parsers/ParserSerialization.java" target-dir="src/com/phonegap/plugins/microblink/parsers" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/parsers/ParserSerializers.java" target-dir="src/com/phonegap/plugins/microblink/parsers" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/parsers/serialization/IbanParserSerialization.java" target-dir="src/com/phonegap/plugins/microblink/parsers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/parsers/serialization/VinParserSerialization.java" target-dir="src/com/phonegap/plugins/microblink/parsers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/parsers/serialization/EmailParserSerialization.java" target-dir="src/com/phonegap/plugins/microblink/parsers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/parsers/serialization/AmountParserSerialization.java" target-dir="src/com/phonegap/plugins/microblink/parsers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/parsers/serialization/RegexParserSerialization.java" target-dir="src/com/phonegap/plugins/microblink/parsers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/parsers/serialization/DateParserSerialization.java" target-dir="src/com/phonegap/plugins/microblink/parsers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/parsers/serialization/LicensePlatesParserSerialization.java" target-dir="src/com/phonegap/plugins/microblink/parsers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/parsers/serialization/TopUpParserSerialization.java" target-dir="src/com/phonegap/plugins/microblink/parsers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/parsers/serialization/RawParserSerialization.java" target-dir="src/com/phonegap/plugins/microblink/parsers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/overlays/OverlaySettingsSerialization.java" target-dir="src/com/phonegap/plugins/microblink/overlays" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/overlays/OverlaySettingsSerializers.java" target-dir="src/com/phonegap/plugins/microblink/overlays" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/overlays/serialization/BarcodeOverlaySettingsSerialization.java" target-dir="src/com/phonegap/plugins/microblink/overlays/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/RecognizerSerializers.java" target-dir="src/com/phonegap/plugins/microblink/recognizers" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/RecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SuccessFrameGrabberRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/Pdf417RecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/DocumentCaptureRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/SimNumberRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<source-file src="src/android/java/com/phonegap/plugins/microblink/recognizers/serialization/BarcodeRecognizerSerialization.java" target-dir="src/com/phonegap/plugins/microblink/recognizers/serialization" />
<!-- ANDROID SOURCE FILES END -->

<!-- resources -->
<resource-file src="src/android/res/raw/beep.mp3" target="res/raw/beep.mp3" />

<framework src="src/android/libBlinkInput.gradle" custom="true" type="gradleReference" />

<!--hook type="after_prepare" src="scripts/fix-largeheap.js" /-->
</platform>

<platform name="ios">
<!-- IOS SOURCE FILES BEGIN -->
<source-file src="src/ios/sources/MBBlinkInputSerializationUtils.m" />
<source-file src="src/ios/sources/MBCommonSerializationUtils.m" />
<source-file src="src/ios/sources/CDVMicroblinkScanner.m" />
<source-file src="src/ios/sources/MBSerializationUtils.m" />
<header-file src="src/ios/sources/MBBlinkInputSerializationUtils.h" />
<header-file src="src/ios/sources/MBCommonSerializationUtils.h" />
<header-file src="src/ios/sources/CDVMicroblinkScanner.h" />
<header-file src="src/ios/sources/MBSerializationUtils.h" />
<header-file src="src/ios/sources/Parsers/MBParserWrapper.h" />
<source-file src="src/ios/sources/Parsers/MBParserSerializers.m" />
<source-file src="src/ios/sources/Parsers/MBParserWrapper.m" />
<header-file src="src/ios/sources/Parsers/MBParserSerializers.h" />
<source-file src="src/ios/sources/Parsers/Wrappers/MBVinParserWrapper.m" />
<source-file src="src/ios/sources/Parsers/Wrappers/MBLicensePlatesParserWrapper.m" />
<header-file src="src/ios/sources/Parsers/Wrappers/MBDateParserWrapper.h" />
<header-file src="src/ios/sources/Parsers/Wrappers/MBRawParserWrapper.h" />
<header-file src="src/ios/sources/Parsers/Wrappers/MBTopUpParserWrapper.h" />
<source-file src="src/ios/sources/Parsers/Wrappers/MBAmountParserWrapper.m" />
<header-file src="src/ios/sources/Parsers/Wrappers/MBIbanParserWrapper.h" />
<source-file src="src/ios/sources/Parsers/Wrappers/MBEmailParserWrapper.m" />
<source-file src="src/ios/sources/Parsers/Wrappers/MBRegexParserWrapper.m" />
<source-file src="src/ios/sources/Parsers/Wrappers/MBRawParserWrapper.m" />
<source-file src="src/ios/sources/Parsers/Wrappers/MBDateParserWrapper.m" />
<header-file src="src/ios/sources/Parsers/Wrappers/MBLicensePlatesParserWrapper.h" />
<header-file src="src/ios/sources/Parsers/Wrappers/MBVinParserWrapper.h" />
<source-file src="src/ios/sources/Parsers/Wrappers/MBTopUpParserWrapper.m" />
<header-file src="src/ios/sources/Parsers/Wrappers/MBEmailParserWrapper.h" />
<source-file src="src/ios/sources/Parsers/Wrappers/MBIbanParserWrapper.m" />
<header-file src="src/ios/sources/Parsers/Wrappers/MBAmountParserWrapper.h" />
<header-file src="src/ios/sources/Parsers/Wrappers/MBRegexParserWrapper.h" />
<header-file src="src/ios/sources/Overlays/MBOverlayVCCreator.h" />
<source-file src="src/ios/sources/Overlays/MBOverlaySettingsSerializers.m" />
<header-file src="src/ios/sources/Overlays/MBOverlayViewControllerDelegate.h" />
<header-file src="src/ios/sources/Overlays/MBOverlaySettingsSerializers.h" />
<header-file src="src/ios/sources/Overlays/Serialization/MBFieldByFieldOverlaySettingsSerialization.h" />
<header-file src="src/ios/sources/Overlays/Serialization/MBBarcodeOverlaySettingsSerialization.h" />
<header-file src="src/ios/sources/Overlays/Serialization/MBDocumentCaptureOverlaySettingsSerialization.h" />
<source-file src="src/ios/sources/Overlays/Serialization/MBFieldByFieldOverlaySettingsSerialization.m" />
<source-file src="src/ios/sources/Overlays/Serialization/MBDocumentCaptureOverlaySettingsSerialization.m" />
<source-file src="src/ios/sources/Overlays/Serialization/MBBarcodeOverlaySettingsSerialization.m" />
<source-file src="src/ios/sources/Processors/MBProcessorWrapper.m" />
<header-file src="src/ios/sources/Processors/MBProcessorSerializers.h" />
<header-file src="src/ios/sources/Processors/MBProcessorWrapper.h" />
<header-file src="src/ios/sources/Processors/Wrappers/MBParserGroupProcessorWrapper.h" />
<source-file src="src/ios/sources/Processors/Wrappers/MBParserGroupProcessorWrapper.m" />
<header-file src="src/ios/sources/Recognizers/MBRecognizerWrapper.h" />
<header-file src="src/ios/sources/Recognizers/MBRecognizerSerializers.h" />
<source-file src="src/ios/sources/Recognizers/MBRecognizerWrapper.m" />
<source-file src="src/ios/sources/Recognizers/MBRecognizerSerializers.m" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBSimNumberRecognizerWrapper.m" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBDocumentCaptureRecognizerWrapper.m" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBPdf417RecognizerWrapper.h" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBBarcodeRecognizerWrapper.h" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBSuccessFrameGrabberRecognizerWrapper.h" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBDocumentCaptureRecognizerWrapper.h" />
<header-file src="src/ios/sources/Recognizers/Wrappers/MBSimNumberRecognizerWrapper.h" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBPdf417RecognizerWrapper.m" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBSuccessFrameGrabberRecognizerWrapper.m" />
<source-file src="src/ios/sources/Recognizers/Wrappers/MBBarcodeRecognizerWrapper.m" />
<!-- IOS SOURCE FILES END -->

<framework src="libc++.dylib" />
<framework src="libz.dylib" />
<framework src="libiconv.dylib" />

<framework src="CoreVideo.framework" />
<framework src="CoreText.framework" />
<framework src="CoreMedia.framework" />
<framework src="QuartzCore.framework" />
<framework src="AudioToolbox.framework" />
<framework src="OpenGLES.framework" />
<framework src="Accelerate.framework" />
<framework src="src/ios/Microblink.framework" custom="true" embed="true"/>

<preference name="CAMERA_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist" parent="NSCameraUsageDescription">
<string>$CAMERA_USAGE_DESCRIPTION</string>
</config-file>

<resource-file src="src/ios/Microblink.bundle" />
<config-file target="config.xml" parent="/*">
<feature name="BlinkInputScanner">
<param name="ios-package" value="CDVMicroblinkScanner" />
</feature>
</config-file>

<hook type="before_plugin_install" src="scripts/initIOSFramework.sh"/>
</platform>

</plugin>
42 changes: 42 additions & 0 deletions BlinkInput/scripts/fix-largeheap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env node

module.exports = function(ctx) {
// make sure android platform is part of build
if (ctx.opts.platforms.indexOf('android') < 0) {
return;
}
var fs = ctx.requireCordovaModule('fs'),
path = ctx.requireCordovaModule('path'),
deferral = ctx.requireCordovaModule('q').defer();

var platformRoot = path.join(ctx.opts.projectRoot, 'platforms/android');
var androidManifest = path.join(platformRoot, 'app/src/main/AndroidManifest.xml');

console.log("BlinkID after_prepare hook: ");
fs.stat(androidManifest, function(err, stats) {
if (err) {
deferral.reject('Operation failed');
console.log("Failed to append largeHeap to AndroidManifest.xml application node");
} else {
fs.readFile(androidManifest, 'utf8', function(err, data) {
var lines = data.split('\n');
var searchingFor = '<application android:hardwareAccelerated="true"';
var newManifest = [];
var largeHeap = 'android:largeHeap="true"';
lines.forEach(function(line) {
if(line.trim().indexOf(searchingFor) != -1 && line.trim().indexOf(largeHeap) == -1) {
newManifest.push(line.replace(/\>$/, ' ') + largeHeap + ">");
} else {
newManifest.push(line);
}
});

fs.writeFileSync(androidManifest, newManifest.join('\n'));
console.log("Append largeHeap to AndroidManifest.xml application node: success");
deferral.resolve();
});
}
});

return deferral.promise;
};
38 changes: 38 additions & 0 deletions BlinkInput/scripts/initIOSFramework.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# enter into ios project folder
HERE="$(dirname "$(test -L "$0" && readlink "$0" || echo "$0")")"
pushd "${HERE}/../src/ios/" > /dev/null

LINK='https://github.com/BlinkInput/blinkinput-ios/releases/download/v4.3.0/blinkinput-ios_v4.3.0.zip'
FILENAME='blinkinput-ios.zip'

# check if Microblink framework and bundle already exist
wget --version > /dev/null 2>&1 || { echo "ERROR: couldn't download Microblink framework, install wget" && exit 1; }
wget -O "${FILENAME}" "${LINK}" -nv --show-progress || ( echo "ERROR: couldn't download Microblink framework, Something went wrong while downloading framework from ${LINK}" && exit 1 )

echo "Unzipping ${FILENAME}"
unzip -v > /dev/null 2>&1 || { echo "ERROR: couldn't unzip Microblink framework, install unzip" && exit 1; }
unzip -o "${FILENAME}" > /dev/null 2>&1 && echo "Unzipped ${FILENAME}"

if [ -d 'Microblink.bundle' ] ; then
rm -rf Microblink.bundle && echo "Removing Microblink.bundle"
fi

if [ -d 'Microblink.framework' ] ; then
rm -rf Microblink.framework && echo "Removing Microblink.framework"
fi

cd blinkinput-ios || exit 1

mv -f Microblink.framework ../Microblink.framework
mv -f Microblink.bundle ../Microblink.bundle

cd ..

echo "Removing unnecessary files"

rm -rfv blinkinput-ios >/dev/null 2>&1
rm "${FILENAME}" >/dev/null 2>&1

popd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.phonegap.plugins.microblink;

import android.app.Activity;
import android.content.Context;

/**
* R replacement for PhoneGap Build.
*
* ([^.\w])R\.(\w+)\.(\w+)
* $1fakeR("$2", "$3")
*
* @author Maciej Nux Jaros
*/
public class FakeR {
private Context context;
private String packageName;

public FakeR(Activity activity) {
context = activity.getApplicationContext();
packageName = context.getPackageName();
}

public FakeR(Context context) {
this.context = context;
packageName = context.getPackageName();
}

public int getId(String group, String key) {
return context.getResources().getIdentifier(key, group, packageName);
}

public static int getId(Context context, String group, String key) {
return context.getResources().getIdentifier(key, group, context.getPackageName());
}
}
Loading

0 comments on commit fdc1e2b

Please sign in to comment.