Skip to content

Commit

Permalink
Initial plugin release with iOS SDK v1.2.0 and Android SDK v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
i1E committed Jan 21, 2016
0 parents commit e5fd207
Show file tree
Hide file tree
Showing 96 changed files with 8,444 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Mac
.DS_Store

# demo app
BlinkIdDemo

# res
resources/signing
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "BlinkID/src/android/blinkid-android"]
path = BlinkID/src/android/blinkid-android
url = [email protected]:BlinkID/blinkid-android.git
92 changes: 92 additions & 0 deletions BlinkID/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?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="com.microblink.BlinkIdScanner"
version="1.0.0">

<name>BlinkIdScanner</name>
<description>A small and powerful ID card scanning library</description>
<license>MIT</license>
<keywords>ID</keywords>
<author>MicroBlink Team [email protected]</author>

<engines>
<engine name="cordova" version=">=3.0.0" />
<engine name="cordova-android" version=">=4.0.0" />
</engines>

<js-module src="www/blinkIdScanner.js" name="BlinkIdScanner">
<clobbers target="cordova.plugins.blinkIdScanner" />
</js-module>

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

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

<config-file target="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="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>


<source-file src="src/android/java/com/phonegap/plugins/blinkid/BlinkIdScanner.java" target-dir="src/com/phonegap/plugins/blinkid" />
<source-file src="src/android/java/com/phonegap/plugins/blinkid/FakeR.java" target-dir="src/com/phonegap/plugins/blinkid" />

<source-file src="src/android/blinkid-android/BlinkIDDemo/BlinkIDDemo/src/main/res/raw/beep.mp3" target-dir="res/raw" />

<framework src="src/android/libRecognizer.gradle" custom="true" type="gradleReference" />
<resource-file src="src/android/blinkid-android/LibRecognizer.aar" target="aar/LibRecognizer.aar" />

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

<platform name="ios">
<source-file src="src/ios/sources/CDVblinkIdScanner.m" />
<header-file src="src/ios/sources/CDVblinkIdScanner.h" />

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

<framework src="CoreVideo.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" />

<resource-file src="src/ios/MicroBlink.bundle" />
<config-file target="config.xml" parent="/*">
<feature name="blinkIdScanner">
<param name="ios-package" value="CDVblinkIdScanner" />
</feature>
</config-file>
</platform>

</plugin>
42 changes: 42 additions & 0 deletions BlinkID/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, '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;
};
1 change: 1 addition & 0 deletions BlinkID/src/android/blinkid-android
Submodule blinkid-android added at 46a79e
Loading

0 comments on commit e5fd207

Please sign in to comment.