签约流程,指纹登录
diff --git a/plugins/android.json b/plugins/android.json
index c516159..638fa31 100644
--- a/plugins/android.json
+++ b/plugins/android.json
@@ -7,9 +7,6 @@
"files": {}
},
"installed_plugins": {
- "cordova-plugin-fingerprint-aio": {
- "PACKAGE_NAME": "com.supwisdom.dlapp"
- },
"cordova-plugin-touch-id": {
"PACKAGE_NAME": "com.supwisdom.dlapp"
},
@@ -57,6 +54,9 @@
},
"cordova-plugin-file": {
"PACKAGE_NAME": "com.supwisdom.dlapp"
+ },
+ "cordova-plugin-fingerprint-aio": {
+ "PACKAGE_NAME": "com.dalicitycard.app"
}
},
"dependent_plugins": {
diff --git a/plugins/browser.json b/plugins/browser.json
index fc76262..34b89f7 100644
--- a/plugins/browser.json
+++ b/plugins/browser.json
@@ -7,9 +7,6 @@
"files": {}
},
"installed_plugins": {
- "cordova-plugin-fingerprint-aio": {
- "PACKAGE_NAME": "com.supwisdom.dlapp"
- },
"cordova-plugin-touch-id": {
"PACKAGE_NAME": "com.supwisdom.dlapp"
},
@@ -56,6 +53,9 @@
},
"cordova-plugin-file": {
"PACKAGE_NAME": "com.supwisdom.dlapp"
+ },
+ "cordova-plugin-fingerprint-aio": {
+ "PACKAGE_NAME": "com.dalicitycard.app"
}
},
"dependent_plugins": {
diff --git a/plugins/cordova-plugin-fingerprint-aio/.travis.yml b/plugins/cordova-plugin-fingerprint-aio/.travis.yml
index a4628bf..3593189 100644
--- a/plugins/cordova-plugin-fingerprint-aio/.travis.yml
+++ b/plugins/cordova-plugin-fingerprint-aio/.travis.yml
@@ -1,43 +1,101 @@
+# This Travis configuration file is built after a Cordova Paramedic
+# specific template with minimal modifications and adaptations:
+# https://github.com/apache/cordova-paramedic/blob/master/.travis.yml
+
sudo: false
addons:
jwt:
secure: f0G7Z/0N1ACi5pFg32P4kr8tVd5EOADDne5a8/MtabGTjeH0/QZl+4xKIgemXle6BJn949Gqpx4+XkmaKmDHHfIsV+9GmLwqGpGSyQMMoeBI0Lfxzh8aecYDxfJKBYmdmpJcyG3yKa42nxQFEMIljf0NJEmNN8AAglsaSh5VQq2dlv1aXaoJz18dpgRVE1cJ4rvUJN+fOrZYjRsqw9ev+11J7cwRONsBB/Yx+56tsverD2uC4Xutj58CEaw7WRk4BLMqehkGO0/ez2Ofc9dBDfc4ZHqHxZMfqjYO5r95VFclyIgto9ToW2kazuK+NZMgaX5wEBp+ktVQGHQw+rRunANplJt14AXpu7Elpfp04Hb4qjBQTYCXellNJ1TgLJLhP6a3P4nTUBrZ9I5mjSGI8ckvUEb1066KyGJmMIPs64z6BJgDHd91PP+cDq6MqUm+n+m24l6Ou/iLDmxaEs6peEctx5A6hACnNwyyB5MEeqZVbksFkNoYw9pxbTj1bBtBbg5QRHC7+Bd8mrN12VOi2wA2N8dFgO3Np+sfZriq/CXfCPrDNYPX8IwF9HEkm2J+PLW1MD8Kx2XwALCqKjU6md0hKui5LdhNWlpAiNK/eBLtJEF2egaMkQw1JPQYxHIyAAi4yUSYYVd64hb9rgUSTNiywRddmKovBChiwiTsmFc=
env:
global:
- - SAUCE_USERNAME=NiklasMerz
- - TRAVIS_NODE_VERSION="lts/*"
+ - SAUCE_USERNAME=NiklasMerz
+ - TRAVIS_NODE_VERSION=8
+ - ANDROID_API_LEVEL=28
+ - ANDROID_BUILD_TOOLS_VERSION=28.0.3
+
+language: node_js
+node_js: 8
+
+# yaml anchor/alias: https://medium.com/@tommyvn/travis-yml-dry-with-anchors-8b6a3ac1b027
+
+_ios: &_ios
+ os: osx
+ osx_image: xcode10.2
+
+_android: &_android
+ language: android
+ os: linux
+ jdk: oraclejdk8
+ android:
+ components:
+ - tools
+ - build-tools-$ANDROID_BUILD_TOOLS_VERSION
+ - android-$ANDROID_API_LEVEL
+ licenses:
+ - 'android-sdk-preview-license-.+'
+ - 'android-sdk-license-.+'
+ - 'google-gdk-license-.+'
+
matrix:
include:
- - env: PLATFORM=android-7.0
- os: linux
- language: android
- jdk: oraclejdk8
- android:
- components:
- - tools
- - build-tools-26.0.2
- - env: PLATFORM=ios-10.0
- os: osx
- osx_image: xcode9.2
- language: node_js
- node_js: 'lts/*'
+ # local tests, without saucelabs
+ - env: PLATFORM=local/ios-10.0
+ <<: *_ios
+
+ # many tests with saucelabs
+
+ - env: PLATFORM=ios-11.3
+ <<: *_ios
+ - env: PLATFORM=ios-12.0
+ <<: *_ios
+
+ - env: PLATFORM=android-8.1
+ <<: *_android
+ - env: PLATFORM=android-9.0
+ <<: *_android
+
before_install:
-- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm
- && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm
- install $TRAVIS_NODE_VERSION
-- node --version
-- if [[ "$PLATFORM" =~ android ]]; then gradle --version; fi
-- if [[ "$PLATFORM" =~ ios ]]; then npm install -g ios-deploy; fi
-- if [[ "$PLATFORM" =~ android ]]; then echo y | android update sdk -u --filter android-25,android-26;
- fi
-- git clone https://github.com/apache/cordova-paramedic /tmp/paramedic && pushd /tmp/paramedic
- && npm install && popd
-- npm install -g cordova@7.0.1
+ # manually install Node for `language: android`
+ - if [[ "$PLATFORM" =~ android ]]; then nvm install $TRAVIS_NODE_VERSION; fi
+ - node --version
+ - if [[ "$PLATFORM" =~ android ]]; then gradle --version; fi
+ - if [[ "$PLATFORM" =~ ios ]]; then npm install -g ios-deploy; fi
+ - npm install -g cordova
+ # install paramedic if not running on paramedic repo
+ - if ! [[ "$TRAVIS_REPO_SLUG" =~ cordova-paramedic ]]; then npm install -g github:apache/cordova-paramedic; fi
+
install:
-- npm install
+ - npm install
+
+before_script:
+ - |
+ if [[ "$TRAVIS_REPO_SLUG" =~ cordova-paramedic ]]; then
+ # when used in the cordova-paramedic repo
+ TEST_COMMAND="npm run eslint"
+ PARAMEDIC_PLUGIN_TO_TEST="./spec/testable-plugin/"
+ PARAMEDIC_COMMAND="node main.js"
+ else
+ # when used in any other (plugin) repo
+ TEST_COMMAND="npm test"
+ PARAMEDIC_PLUGIN_TO_TEST=$(pwd)
+ PARAMEDIC_COMMAND="cordova-paramedic"
+ fi
+ - PARAMEDIC_BUILDNAME=travis-$TRAVIS_REPO_SLUG-$TRAVIS_JOB_NUMBER
+ - |
+ echo "Variables now are set to:"
+ echo "TEST_COMMAND=$TEST_COMMAND"
+ echo "ADDITIONAL_TESTS=$ADDITIONAL_TESTS"
+ echo "PARAMEDIC_COMMAND=$PARAMEDIC_COMMAND"
+ echo "PLATFORM=$PLATFORM"
+ echo "PARAMEDIC_PLUGIN_TO_TEST=$PARAMEDIC_PLUGIN_TO_TEST"
+ echo "PARAMEDIC_BUILDNAME=$PARAMEDIC_BUILDNAME"
script:
-- node /tmp/paramedic/main.js --config pr/$PLATFORM --plugin $(pwd) --shouldUseSauce
- --buildName travis-plugin-fingerprint-aio-$TRAVIS_JOB_NUMBER
+ - $TEST_COMMAND
+ - if [[ "$ADDITIONAL_TESTS_DIR" != "" ]]; then
+ cd $ADDITIONAL_TESTS_DIR && npm install && npm test;
+ else
+ $PARAMEDIC_COMMAND --config ./pr/$PLATFORM --plugin $PARAMEDIC_PLUGIN_TO_TEST --buildName $PARAMEDIC_BUILDNAME;
+ fi
notifications:
email: false
slack:
diff --git a/plugins/cordova-plugin-fingerprint-aio/README.md b/plugins/cordova-plugin-fingerprint-aio/README.md
index 7e3fa3d..bb16d1f 100644
--- a/plugins/cordova-plugin-fingerprint-aio/README.md
+++ b/plugins/cordova-plugin-fingerprint-aio/README.md
@@ -25,13 +25,11 @@
* Android - Minimum SDK 23
* iOS - **XCode 9.2 or higher** required
- * _Please set `<preference name="UseSwiftLanguageVersion" value="3.2" />` in your config.xml_
+ * _Please set `<preference name="UseSwiftLanguageVersion" value="4.0" />` in your config.xml_
## How to use
----
-
**[Tutorial about using this plugin with Ionic](https://www.youtube.com/watch?v=tQDChMJ6er8)** thanks to Paul Halliday
[Examples](https://github.com/NiklasMerz/fingerprint-aio-demo)
@@ -84,33 +82,59 @@
alert("Fingerprint available");
}
- function isAvailableError(message) {
- alert(message);
+ function isAvailableError(error) {
+ // 'error' will be an object with an error code and message
+ alert(error.message);
}
```
### Show authentication dialogue
```javascript
Fingerprint.show({
- clientId: "Fingerprint-Demo",
- clientSecret: "password" //Only necessary for Android
+ description: "Some biometric description"
}, successCallback, errorCallback);
function successCallback(){
- alert("Authentication successfull");
+ alert("Authentication successful");
}
- function errorCallback(err){
- alert("Authentication invalid " + err);
+ function errorCallback(error){
+ alert("Authentication invalid " + error.message);
}
```
-**Optional parameters**
+### Optional parameters
-* __disableBackup__: If `true` remove backup option on authentication dialogue for Android. Default: `false`.
-* __localizedFallbackTitle__ (iOS only): Title of fallback button.
-* __localizedReason__ (iOS only): Description in authentication dialogue.
+* __title__: Title in authentication dialogue. Default: `"<APP_NAME> Biometric Sign On"`
+* __subtitle__: Subtitle in authentication dialogue. Default: `null`
+* __description__: Description in authentication dialogue. Defaults:
+ * iOS: `"Authenticate"` (iOS' [evaluatePolicy()](https://developer.apple.com/documentation/localauthentication/lacontext/1514176-evaluatepolicy?language=objc) requires this field)
+ * Android: `null`
+* __fallbackButtonTitle__: Title of fallback button. Defaults:
+ * When **disableBackup** is true
+ * `"Cancel"`
+ * When **disableBackup** is false
+ * iOS: `"Use PIN"`
+ * Android: `"Use Backup"` (Because backup could be anything pin/pattern/password ..haven't figured out a reliable way to determine lock type yet [source](https://stackoverflow.com/questions/7768879/check-whether-lock-was-enabled-or-not/18720287))
+* __disableBackup__: If `true` remove backup option on authentication dialogue. Default: `false`. This is useful if you want to implement your own fallback.
+* __cancelButtonTitle__: For cancel button on Android
-## Thanks to the authors of the original fingerprint plugins
+### Constants
+- **BIOMETRIC_UNKNOWN_ERROR** = `-100`;
+- **BIOMETRIC_UNAVAILABLE** = `-101`;
+- **BIOMETRIC_AUTHENTICATION_FAILED** = `-102`;
+- **BIOMETRIC_SDK_NOT_SUPPORTED** = `-103`;
+- **BIOMETRIC_HARDWARE_NOT_SUPPORTED** = `-104`;
+- **BIOMETRIC_PERMISSION_NOT_GRANTED** = `-105`;
+- **BIOMETRIC_NOT_ENROLLED** = `-106`;
+- **BIOMETRIC_INTERNAL_PLUGIN_ERROR** = `-107`;
+- **BIOMETRIC_DISMISSED** = `-108`;
+- **BIOMETRIC_PIN_OR_PATTERN_DISMISSED** = `-109`;
+- **BIOMETRIC_SCREEN_GUARD_UNSECURED** = `-110`;
+- **BIOMETRIC_LOCKED_OUT** = `-111`;
+- **BIOMETRIC_LOCKED_OUT_PERMANENT** = `-112`;
+***
+
+Thanks to the authors of the original fingerprint plugins
Some code is refactored from their projects and I learned how to make Cordova plugins from their great plugins:
@@ -120,7 +144,9 @@
[iOS](https://github.com/EddyVerbruggen/cordova-plugin-touch-id)
+Starting with version 3.0.0 the iOS and Android parts are written from scratch.
+
## License
-* Project and iOS source: [MIT](https://opensource.org/licenses/MIT)
-* Android source: [MIT](https://opensource.org/licenses/MIT) and [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
+The project is MIT licensed: [MIT](https://opensource.org/licenses/MIT).
+
diff --git a/plugins/cordova-plugin-fingerprint-aio/package.json b/plugins/cordova-plugin-fingerprint-aio/package.json
index a79ee09..5ad47d9 100644
--- a/plugins/cordova-plugin-fingerprint-aio/package.json
+++ b/plugins/cordova-plugin-fingerprint-aio/package.json
@@ -1,8 +1,8 @@
{
"_from": "cordova-plugin-fingerprint-aio",
- "_id": "cordova-plugin-fingerprint-aio@1.7.0",
+ "_id": "cordova-plugin-fingerprint-aio@3.0.1",
"_inBundle": false,
- "_integrity": "sha512-pV+JUeEhZUP85nXs9KMpHRClZppVHnpZA5h+8ReKBi4AV4vnzAcpUDBgFN7g3Ra83zmREYI/MqrlZlXn16pg3g==",
+ "_integrity": "sha512-Sgbv8Ykk74Ov1foEZg77owIqmHZoGktsv41rmW8KAAMf2JE93AawvQdUCYYROnk+ozG3D9ItELa5yhYU8i7Zhw==",
"_location": "/cordova-plugin-fingerprint-aio",
"_phantomChildren": {},
"_requested": {
@@ -19,8 +19,8 @@
"#USER",
"/"
],
- "_resolved": "https://registry.npmjs.org/cordova-plugin-fingerprint-aio/-/cordova-plugin-fingerprint-aio-1.7.0.tgz",
- "_shasum": "7f998587106aa47df3cb9666396b9021b6b419f7",
+ "_resolved": "https://registry.npmjs.org/cordova-plugin-fingerprint-aio/-/cordova-plugin-fingerprint-aio-3.0.1.tgz",
+ "_shasum": "030a732773e7690d74a1aadbab66c8a8b294ea42",
"_spec": "cordova-plugin-fingerprint-aio",
"_where": "/Users/shuwei/works2/cordova/dlapp",
"author": {
@@ -45,9 +45,16 @@
"devDependencies": {
"cordova-paramedic": "git+https://github.com/apache/cordova-paramedic.git",
"cordova-plugin-xml": "^0.1.2",
- "eslint": "^5.7.0",
+ "eslint": "^6.5.1",
"jasmine": "^3.2.0"
},
+ "engines": {
+ "cordovaDependencies": {
+ ">=3.0.0": {
+ "cordova-android": ">=8.0.0"
+ }
+ }
+ },
"homepage": "https://github.com/niklasmerz/cordova-plugin-fingerprint-aio#readme",
"keywords": [
"cordova",
@@ -67,8 +74,19 @@
"url": "git+https://github.com/niklasmerz/cordova-plugin-fingerprint-aio.git"
},
"scripts": {
+ "eslint": "npx eslint www",
"plugin-version": "cordova-plugin-xml setVersion",
- "test": "./node_modules/cordova-paramedic/main.js --plugin . --args=--buildFlag='-UseModernBuildSystem=0' --platform"
+ "test": "npm run eslint",
+ "test-android": "npx cordova-paramedic --platform android --plugin $(pwd)",
+ "test-appveyor": "npm run test-browser",
+ "test-browser": "npx cordova-paramedic --platform browser --plugin $(pwd)",
+ "test-ios": "npx cordova-paramedic --platform ios --plugin $(pwd) --verbose",
+ "test-local": "npm run test-browser && npm run test-android && npm run test-ios",
+ "test-saucelabs": "npm run test-saucelabs-ios && npm run test-saucelabs-android",
+ "test-saucelabs-android": "npx cordova-paramedic --config ./pr/android-7.0 --plugin $(pwd) --shouldUseSauce",
+ "test-saucelabs-ios": "npx cordova-paramedic --config ./pr/ios-10.0 --plugin $(pwd) --shouldUseSauce",
+ "test-travis": "npm run test-ios",
+ "test-windows": "npx cordova-paramedic --platform windows --plugin $(pwd)"
},
- "version": "1.7.0"
+ "version": "3.0.1"
}
diff --git a/plugins/cordova-plugin-fingerprint-aio/plugin.xml b/plugins/cordova-plugin-fingerprint-aio/plugin.xml
index d79cb98..e3d9aef 100644
--- a/plugins/cordova-plugin-fingerprint-aio/plugin.xml
+++ b/plugins/cordova-plugin-fingerprint-aio/plugin.xml
@@ -1,5 +1,5 @@
<?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="cordova-plugin-fingerprint-aio" version="1.7.0">
+<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-fingerprint-aio" version="3.0.1">
<name>FingerprintAllInOne</name>
<description>Cordova plugin to use fingerprint on Android and iOS</description>
<license>MIT</license>
@@ -11,7 +11,6 @@
<clobbers target="Fingerprint"/>
</js-module>
-
<!-- ios -->
<platform name="ios">
@@ -21,7 +20,7 @@
<param name="ios-package" value="Fingerprint"/>
</feature>
</config-file>
- <header-file src="src/ios/Bridging-Header.h" />
+ <header-file src="src/ios/Bridging-Header.h"/>
<source-file src="src/ios/Fingerprint.swift"/>
<!-- Usage description of Face ID for iOS 11+ -->
@@ -35,38 +34,33 @@
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="Fingerprint">
- <param name="android-package" value="de.niklasmerz.cordova.fingerprint.Fingerprint"/>
+ <param name="android-package" value="de.niklasmerz.cordova.biometric.Fingerprint"/>
</feature>
</config-file>
+
<config-file target="AndroidManifest.xml" parent="/*">
+ <uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
</config-file>
- <source-file src="src/android/Fingerprint.java" target-dir="src/de/niklasmerz/cordova/fingerprint"/>
- <source-file src="src/android/FingerprintAuthenticationDialogFragment.java" target-dir="src/de/niklasmerz/cordova/fingerprint"/>
- <source-file src="src/android/FingerprintUiHelper.java" target-dir="src/de/niklasmerz/cordova/fingerprint"/>
- <source-file src="res/android/drawable/ic_fingerprint_error.xml" target-dir="res/drawable"/>
- <source-file src="res/android/drawable/ic_fingerprint_success.xml" target-dir="res/drawable"/>
- <resource-file src="res/android/drawable-hdpi/ic_fp_40px.png" target="res/drawable-hdpi/ic_fp_40px.png"/>
- <resource-file src="res/android/drawable-mdpi/ic_fp_40px.png" target="res/drawable-mdpi/ic_fp_40px.png"/>
- <resource-file src="res/android/drawable-nodpi/android_robot.png" target="res/drawable-nodpi/android_robot.png"/>
- <resource-file src="res/android/drawable-xhdpi/ic_fp_40px.png" target="res/drawable-xhdpi/ic_fp_40px.png"/>
- <resource-file src="res/android/drawable-xxhdpi/ic_fp_40px.png" target="res/drawable-xxhdpi/ic_fp_40px.png"/>
- <resource-file src="res/android/drawable-xxxhdpi/ic_fp_40px.png" target="res/drawable-xxxhdpi/ic_fp_40px.png"/>
- <source-file src="res/android/layout/fingerprint_dialog_container.xml" target-dir="res/layout"/>
- <source-file src="res/android/layout/fingerprint_dialog_content.xml" target-dir="res/layout"/>
- <source-file src="res/android/values/fpauth-colors.xml" target-dir="res/values"/>
- <source-file src="res/android/values/fpauth-strings.xml" target-dir="res/values"/>
- <source-file src="res/android/values-es/fpauth-strings.xml" target-dir="res/values-es"/>
- <source-file src="res/android/values-de/fpauth-strings.xml" target-dir="res/values-de"/>
- <source-file src="res/android/values-fr/fpauth-strings.xml" target-dir="res/values-fr"/>
- <source-file src="res/android/values-zh/fpauth-strings.xml" target-dir="res/values-zh"/>
- <source-file src="res/android/values-pt/fpauth-strings.xml" target-dir="res/values-pt"/>
- <source-file src="res/android/values-it/fpauth-strings.xml" target-dir="res/values-it"/>
- <source-file src="res/android/values-el/fpauth-strings.xml" target-dir="res/values-el"/>
- <source-file src="res/android/values-zh-rTW/fpauth-strings.xml" target-dir="res/values-zh-rTW"/>
- <source-file src="res/android/values-nl/fpauth-strings.xml" target-dir="res/values-nl"/>
- <source-file src="res/android/values-da/fpauth-strings.xml" target-dir="res/values-da"/>
+ <config-file target="AndroidManifest.xml" parent="/manifest/application">
+ <activity
+ android:name="de.niklasmerz.cordova.biometric.BiometricActivity"
+ android:theme="@style/TransparentTheme"
+ android:exported="true" />
+ </config-file>
+
+ <framework src="src/android/build.gradle" custom="true" type="gradleReference"/>
+ <resource-file src="src/android/res/biometric_activity.xml" target="res/layout/biometric_activity.xml" />
+ <resource-file src="src/android/res/styles.xml" target="res/values/biometric-styles.xml" />
+ <source-file src="src/android/PromptInfo.java" target-dir="src/de/niklasmerz/cordova/biometric"/>
+ <source-file src="src/android/BiometricActivity.java" target-dir="src/de/niklasmerz/cordova/biometric"/>
+ <source-file src="src/android/Fingerprint.java" target-dir="src/de/niklasmerz/cordova/biometric"/>
+ <source-file src="src/android/PluginError.java" target-dir="src/de/niklasmerz/cordova/biometric"/>
</platform>
+ <engines>
+ <engine name="cordova-android" version=">=8.0.0" />
+ </engines>
+
</plugin>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-hdpi/ic_fp_40px.png b/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-hdpi/ic_fp_40px.png
deleted file mode 100644
index 48ebd8a..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-hdpi/ic_fp_40px.png
+++ /dev/null
Binary files differ
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-mdpi/ic_fp_40px.png b/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-mdpi/ic_fp_40px.png
deleted file mode 100644
index 122f442..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-mdpi/ic_fp_40px.png
+++ /dev/null
Binary files differ
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-nodpi/android_robot.png b/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-nodpi/android_robot.png
deleted file mode 100644
index 40bf934..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-nodpi/android_robot.png
+++ /dev/null
Binary files differ
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-xhdpi/ic_fp_40px.png b/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-xhdpi/ic_fp_40px.png
deleted file mode 100644
index e1c9590..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-xhdpi/ic_fp_40px.png
+++ /dev/null
Binary files differ
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-xxhdpi/ic_fp_40px.png b/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-xxhdpi/ic_fp_40px.png
deleted file mode 100644
index f7e8724..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-xxhdpi/ic_fp_40px.png
+++ /dev/null
Binary files differ
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-xxxhdpi/ic_fp_40px.png b/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-xxxhdpi/ic_fp_40px.png
deleted file mode 100644
index 0fb8545..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable-xxxhdpi/ic_fp_40px.png
+++ /dev/null
Binary files differ
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable/ic_fingerprint_error.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/drawable/ic_fingerprint_error.xml
deleted file mode 100644
index be46116..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable/ic_fingerprint_error.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="40.0dp"
- android:height="40.0dp"
- android:viewportWidth="40.0"
- android:viewportHeight="40.0">
- <path
- android:pathData="M20.0,0.0C8.96,0.0 0.0,8.95 0.0,20.0s8.96,20.0 20.0,20.0c11.04,0.0 20.0,-8.95 20.0,-20.0S31.04,0.0 20.0,0.0z"
- android:fillColor="#F4511E"/>
- <path
- android:pathData="M21.33,29.33l-2.67,0.0l0.0,-2.67l2.67,0.0L21.33,29.33zM21.33,22.67l-2.67,0.0l0.0,-12.0l2.67,0.0L21.33,22.67z"
- android:fillColor="#FFFFFF"/>
-</vector>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable/ic_fingerprint_success.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/drawable/ic_fingerprint_success.xml
deleted file mode 100644
index 261f3e7..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/drawable/ic_fingerprint_success.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="40.0dp"
- android:height="40.0dp"
- android:viewportWidth="40.0"
- android:viewportHeight="40.0">
- <path
- android:pathData="M20.0,20.0m-20.0,0.0a20.0,20.0 0.0,1.0 1.0,40.0 0.0a20.0,20.0 0.0,1.0 1.0,-40.0 0.0"
- android:fillColor="#009688"/>
- <path
- android:pathData="M11.2,21.41l1.63,-1.619999 4.17,4.169998 10.59,-10.589999 1.619999,1.63 -12.209999,12.209999z"
- android:fillColor="#FFFFFF"/>
-</vector>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/layout/fingerprint_dialog_container.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/layout/fingerprint_dialog_container.xml
deleted file mode 100644
index 0c6face..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/layout/fingerprint_dialog_container.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
-
- <include layout="@layout/fingerprint_dialog_content" />
-
- </FrameLayout>
-
- <LinearLayout
- android:id="@+id/buttonPanel"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:paddingStart="12dp"
- android:paddingEnd="12dp"
- android:paddingTop="4dp"
- android:paddingBottom="4dp"
- android:gravity="bottom"
- style="?android:attr/buttonBarStyle">
-
- <Space
- android:id="@+id/spacer"
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_weight="1"
- android:visibility="invisible" />
- <Button
- android:id="@+id/cancel_button"
- style="?android:attr/buttonBarNegativeButtonStyle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
-
- <Button
- android:id="@+id/second_dialog_button"
- style="?android:attr/buttonBarPositiveButtonStyle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
- </LinearLayout>
-
-</LinearLayout>
\ No newline at end of file
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/layout/fingerprint_dialog_content.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/layout/fingerprint_dialog_content.xml
deleted file mode 100644
index 3929eba..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/layout/fingerprint_dialog_content.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/fingerprint_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingBottom="8dp"
- android:paddingStart="24dp"
- android:paddingEnd="24dp"
- android:paddingTop="16dp">
-
- <TextView
- android:id="@+id/fingerprint_description"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentStart="true"
- android:layout_alignParentTop="true"
- android:text="@string/fingerprint_description"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
- android:textColor="?android:attr/textColorSecondary"/>
-
-
- <ImageView
- android:id="@+id/fingerprint_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentStart="true"
- android:layout_below="@+id/fingerprint_description"
- android:layout_marginTop="20dp"
- android:src="@drawable/ic_fp_40px" />
-
- <TextView
- android:id="@+id/fingerprint_status"
- style="@android:style/TextAppearance.Material.Body1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignBottom="@+id/fingerprint_icon"
- android:layout_alignTop="@+id/fingerprint_icon"
- android:layout_marginStart="16dp"
- android:layout_toEndOf="@+id/fingerprint_icon"
- android:gravity="center_vertical"
- android:text="@string/fingerprint_hint"
- android:textColor="@color/hint_color" />
-</RelativeLayout>
\ No newline at end of file
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/values-da/fpauth-strings.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/values-da/fpauth-strings.xml
deleted file mode 100644
index 346666f..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/values-da/fpauth-strings.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="fingerprint_cancel">Annuller</string>
- <string name="fingerprint_use_backup">Brug backup</string>
- <string name="fingerprint_auth_dialog_title">Fingeraftryk Login</string>
- <string name="fingerprint_ok">Ok</string>
- <string name="fingerprint_description">Bekræft fingeraftryk for at fortsætte</string>
- <string name="fingerprint_hint">Rør sensor</string>
- <string name="fingerprint_not_recognized">Fingeraftryk ikke genkendt. Prøv igen.</string>
- <string name="fingerprint_success">Fingeraftryk godkendt</string>
- <string name="new_fingerprint_enrolled_description">Et nyt fingeraftryk blev tilføjet til denne enhed så din adgangskode er krævet.</string>
- <string name="secure_lock_screen_required">Sikring af skærmlås krævet!</string>
-</resources>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/values-de/fpauth-strings.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/values-de/fpauth-strings.xml
deleted file mode 100644
index d5b6bd2..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/values-de/fpauth-strings.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<resources>
- <string name="fingerprint_cancel">Abbrechen</string>
- <string name="fingerprint_use_backup">Passwort</string>
- <string name="fingerprint_auth_dialog_title">Authentifizierung</string>
- <string name="fingerprint_ok">OK</string>
- <string name="fingerprint_description">Fingerabdruck bestätigen</string>
- <string name="fingerprint_hint">Fingerabdrucksensor</string>
- <string name="fingerprint_not_recognized">Fingerabdruck nicht erkannt. Versuchen Sie es erneut</string>
- <string name="fingerprint_success">Authentifiziert</string>
- <string name="new_fingerprint_enrolled_description">Ein neuer Fingerabdruck wurde gespeichert. Bitte geben Sie ihr Passwort ein.</string>
- <string name="secure_lock_screen_required">Passwortgeschützter Sperrbildschirm benötigt</string>
-</resources>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/values-el/fpauth-strings.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/values-el/fpauth-strings.xml
deleted file mode 100644
index 1dcfcdb..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/values-el/fpauth-strings.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="fingerprint_cancel">Ακύρωση</string>
- <string name="fingerprint_use_backup">Χρήση αρχείου</string>
- <string name="fingerprint_auth_dialog_title">Ελεγχος αποτυπώματος</string>
- <string name="fingerprint_ok">Ok</string>
- <string name="fingerprint_description">Επιβεβαίωση αποτυπώματος</string>
- <string name="fingerprint_hint">Αιθηστήρας αφής</string>
- <string name="fingerprint_not_recognized">Σφάλμα. Προσπαθήστε ξανά</string>
- <string name="fingerprint_success">Σωστό αποτύπωμα</string>
- <string name="new_fingerprint_enrolled_description">Νεο αποτύπωμα προστέθηκε , απαιτείται ο κωδικός σας.</string>
- <string name="secure_lock_screen_required">Απαιτείται κλειδωμα οθόνης</string>
-</resources>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/values-es/fpauth-strings.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/values-es/fpauth-strings.xml
deleted file mode 100644
index 25bdbb2..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/values-es/fpauth-strings.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<resources>
- <string name="fingerprint_cancel">Cancelar</string>
- <string name="fingerprint_use_backup">El Respaldo</string>
- <string name="fingerprint_auth_dialog_title">Autenticación de Huellas Digitales</string>
- <string name="fingerprint_ok">De Acuerdo</string>
- <string name="fingerprint_description">Confirmar la huella digital para continuar</string>
- <string name="fingerprint_hint">Sensor tactil</string>
- <string name="fingerprint_not_recognized">No se reconoce la huella digital. Inténtalo de nuevo.</string>
- <string name="fingerprint_success">Reconocido de huella dactilar</string>
- <string name="new_fingerprint_enrolled_description">Una nueva huella digital fue agregada a este dispositivo, por lo que se requiere la contraseña.</string>
- <string name="secure_lock_screen_required">¡Requiere pantalla de bloqueo seguro!</string>
-</resources>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/values-fr/fpauth-strings.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/values-fr/fpauth-strings.xml
deleted file mode 100644
index 4b9d3eb..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/values-fr/fpauth-strings.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<resources>
- <string name="fingerprint_cancel">Annuler</string>
- <string name="fingerprint_use_backup">Utiliser la sauvegarde</string>
- <string name="fingerprint_auth_dialog_title">Authentification par empreinte digitale</string>
- <string name="fingerprint_ok">Ok</string>
- <string name="fingerprint_description">Confirmer l\'empreinte pour continuer</string>
- <string name="fingerprint_hint">Toucher le capteur</string>
- <string name="fingerprint_not_recognized">Empreinte non reconnue. Essayer à nouveau.</string>
- <string name="fingerprint_success">Empreinte reconnue</string>
- <string name="new_fingerprint_enrolled_description">Une nouvelle empreinte digitale a été ajoutée à ce dispositif, de sorte que votre mot de passe est nécessaire.</string>
- <string name="secure_lock_screen_required">Écran de verrouillage sécurisé nécessaire!</string>
-</resources>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/values-it/fpauth-strings.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/values-it/fpauth-strings.xml
deleted file mode 100644
index a226ff8..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/values-it/fpauth-strings.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="fingerprint_cancel">Cancella</string>
- <string name="fingerprint_use_backup">Usa backup</string>
- <string name="fingerprint_auth_dialog_title">Autenticazione impronta digitale</string>
- <string name="fingerprint_ok">Ok</string>
- <string name="fingerprint_description">Conferma l\'impronta digitale per continuare</string>
- <string name="fingerprint_hint">Sensore Touch</string>
- <string name="fingerprint_not_recognized">Impronta digitale non riconosciuta. Riprova.</string>
- <string name="fingerprint_success">Impronta digitale riconosciuta</string>
- <string name="new_fingerprint_enrolled_description">Una nuova impronta è stata aggiunta a questo dispositivo, quindi è necessaria la tua password</string>
- <string name="secure_lock_screen_required">Blocco schermo richiesto!</string>
-</resources>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/values-nl/fpauth-strings.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/values-nl/fpauth-strings.xml
deleted file mode 100644
index e44731c..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/values-nl/fpauth-strings.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
- <string name="fingerprint_cancel">Annuleer</string>
- <string name="fingerprint_use_backup">Back-up gebruiken</string>
- <string name="fingerprint_auth_dialog_title">Authenticatie met vingerafdruk</string>
- <string name="fingerprint_ok">OK</string>
- <string name="fingerprint_description">Vingerafdruk bevestigen om verder te gaan</string>
- <string name="fingerprint_hint">Aanraaksensor</string>
- <string name="fingerprint_not_recognized">Vingerafdruk niet herkend.Opnieuw proberen.</string>
- <string name="fingerprint_success">Vingerafdruk herkend</string>
- <string name="new_fingerprint_enrolled_description">Er werd een nieuwe vingerafdruk aan dit apparaat toegevoegd, waardoor uw wachtwoord is vereist.</string>
- <string name="secure_lock_screen_required">Beveiligd vergrendelingsscherm vereist!</string>
-</resources>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/values-pt/fpauth-strings.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/values-pt/fpauth-strings.xml
deleted file mode 100644
index 7c3e581..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/values-pt/fpauth-strings.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="fingerprint_cancel">Cancelar</string>
- <string name="fingerprint_use_backup">Use o backup</string>
- <string name="fingerprint_auth_dialog_title">Autenticação de impressão digital</string>
- <string name="fingerprint_ok">Ok</string>
- <string name="fingerprint_description">Confirme a impressão digital para continuar</string>
- <string name="fingerprint_hint">Sensor de toque</string>
- <string name="fingerprint_not_recognized">impressão digital não reconhecida. Tente novamente.</string>
- <string name="fingerprint_success">impressão digital reconhecida</string>
- <string name="new_fingerprint_enrolled_description">Uma nova impressão digital foi adicionada a este dispositivo, é necessário o seu código</string>
- <string name="secure_lock_screen_required">É necessário um ecrã de bloqueio seguro!</string>
-</resources>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/values-zh-rTW/fpauth-strings.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/values-zh-rTW/fpauth-strings.xml
deleted file mode 100644
index c8345a3..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/values-zh-rTW/fpauth-strings.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="fingerprint_cancel">取消</string>
- <string name="fingerprint_use_backup">使用手勢密碼</string>
- <string name="fingerprint_auth_dialog_title">指紋識別</string>
- <string name="fingerprint_ok">確認</string><string name="fingerprint_description">指紋識別</string>
- <string name="fingerprint_hint">請觸摸指紋識別傳感器</string>
- <string name="fingerprint_not_recognized">指紋無法識別,請再試一次</string>
- <string name="fingerprint_success">指紋識別成功</string>
- <string name="new_fingerprint_enrolled_description">添加一個新的指紋,需要設置密碼</string>
- <string name="secure_lock_screen_required">需要安全鎖屏</string>
-</resources>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/values-zh/fpauth-strings.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/values-zh/fpauth-strings.xml
deleted file mode 100644
index 54d38b7..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/values-zh/fpauth-strings.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="fingerprint_cancel">取消</string>
- <string name="fingerprint_use_backup">使用手势密码</string>
- <string name="fingerprint_auth_dialog_title">指纹识别</string>
- <string name="fingerprint_ok">确认</string><string name="fingerprint_description">指纹识别</string>
- <string name="fingerprint_hint">请触摸指纹识传感器</string>
- <string name="fingerprint_not_recognized">指纹无法识别,请再试一次</string>
- <string name="fingerprint_success">指纹识别成功</string>
- <string name="new_fingerprint_enrolled_description">添加一个新的指纹,需要设置密码</string>
- <string name="secure_lock_screen_required">需要安全锁屏</string>
-</resources>
\ No newline at end of file
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/values/fpauth-colors.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/values/fpauth-colors.xml
deleted file mode 100644
index a24f3c8..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/values/fpauth-colors.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<resources>
- <color name="warning_color">#f4511e</color>
- <color name="hint_color">#42000000</color>
- <color name="success_color">#009688</color>
-</resources>
diff --git a/plugins/cordova-plugin-fingerprint-aio/res/android/values/fpauth-strings.xml b/plugins/cordova-plugin-fingerprint-aio/res/android/values/fpauth-strings.xml
deleted file mode 100644
index 00cc755..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/res/android/values/fpauth-strings.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<resources>
- <string name="fingerprint_cancel">Cancel</string>
- <string name="fingerprint_use_backup">Use backup</string>
- <string name="fingerprint_auth_dialog_title">Fingerprint Authentication</string>
- <string name="fingerprint_ok">Ok</string>
- <string name="fingerprint_description">Confirm fingerprint to continue</string>
- <string name="fingerprint_hint">Touch sensor</string>
- <string name="fingerprint_not_recognized">Fingerprint not recognized. Try again.</string>
- <string name="fingerprint_success">Fingerprint recognized</string>
- <string name="new_fingerprint_enrolled_description">A new fingerprint was added to this device, so your password is required.</string>
- <string name="secure_lock_screen_required">Secure lock screen required!</string>
-</resources>
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/6.0-20191016123526+0000/fileChanges/last-build.bin b/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/6.0-20191016123526+0000/fileChanges/last-build.bin
new file mode 100644
index 0000000..f76dd23
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/6.0-20191016123526+0000/fileChanges/last-build.bin
Binary files differ
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/6.0-20191016123526+0000/fileHashes/fileHashes.lock b/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/6.0-20191016123526+0000/fileHashes/fileHashes.lock
new file mode 100644
index 0000000..106dd85
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/6.0-20191016123526+0000/fileHashes/fileHashes.lock
Binary files differ
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/6.0-20191016123526+0000/gc.properties b/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/6.0-20191016123526+0000/gc.properties
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/6.0-20191016123526+0000/gc.properties
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
new file mode 100644
index 0000000..2c45a25
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary files differ
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/buildOutputCleanup/cache.properties b/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/buildOutputCleanup/cache.properties
new file mode 100644
index 0000000..34f1943
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/buildOutputCleanup/cache.properties
@@ -0,0 +1,2 @@
+#Sat Nov 16 11:08:08 CET 2019
+gradle.version=6.0-20191016123526+0000
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/vcs-1/gc.properties b/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/vcs-1/gc.properties
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/.gradle/vcs-1/gc.properties
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/.project b/plugins/cordova-plugin-fingerprint-aio/src/android/.project
new file mode 100644
index 0000000..3964dd3
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>android</name>
+ <comment>Project android created by Buildship.</comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.buildship.core.gradleprojectbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/.settings/org.eclipse.buildship.core.prefs b/plugins/cordova-plugin-fingerprint-aio/src/android/.settings/org.eclipse.buildship.core.prefs
new file mode 100644
index 0000000..39c6821
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/.settings/org.eclipse.buildship.core.prefs
@@ -0,0 +1,13 @@
+arguments=
+auto.sync=false
+build.scans.enabled=false
+connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.0-20191016123526+0000))
+connection.project.dir=
+eclipse.preferences.version=1
+gradle.user.home=
+java.home=
+jvm.arguments=
+offline.mode=false
+override.workspace.settings=true
+show.console.view=true
+show.executions.view=true
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/BiometricActivity.java b/plugins/cordova-plugin-fingerprint-aio/src/android/BiometricActivity.java
new file mode 100644
index 0000000..0d6d20e
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/BiometricActivity.java
@@ -0,0 +1,159 @@
+package de.niklasmerz.cordova.biometric;
+
+import android.app.Activity;
+import android.app.KeyguardManager;
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.v4.content.ContextCompat;
+import android.support.v7.app.AppCompatActivity;
+
+import com.exxbrain.android.biometric.BiometricPrompt;
+
+import java.util.concurrent.Executor;
+
+public class BiometricActivity extends AppCompatActivity {
+
+ private static final int REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS = 2;
+ private PromptInfo mPromptInfo;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setTitle(null);
+ int layout = getResources()
+ .getIdentifier("biometric_activity", "layout", getPackageName());
+ setContentView(layout);
+
+ if (savedInstanceState != null) {
+ return;
+ }
+
+ mPromptInfo = new PromptInfo.Builder(getIntent().getExtras()).build();
+ authenticate();
+
+ }
+
+ private void authenticate() {
+ final Handler handler = new Handler(Looper.getMainLooper());
+ Executor executor = handler::post;
+
+ BiometricPrompt biometricPrompt =
+ new BiometricPrompt(this, executor, mAuthenticationCallback);
+
+ BiometricPrompt.PromptInfo.Builder promptInfoBuilder = new BiometricPrompt.PromptInfo.Builder()
+ .setTitle(mPromptInfo.getTitle())
+ .setSubtitle(mPromptInfo.getSubtitle())
+ .setDescription(mPromptInfo.getDescription());
+
+ if (mPromptInfo.isDeviceCredentialAllowed()
+ && Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) { // TODO: remove after fix https://issuetracker.google.com/issues/142740104
+ promptInfoBuilder.setDeviceCredentialAllowed(true);
+ } else {
+ promptInfoBuilder.setNegativeButtonText(mPromptInfo.getCancelButtonTitle());
+ }
+
+ biometricPrompt.authenticate(promptInfoBuilder.build());
+ }
+
+ private BiometricPrompt.AuthenticationCallback mAuthenticationCallback =
+ new BiometricPrompt.AuthenticationCallback() {
+
+ @Override
+ public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
+ super.onAuthenticationError(errorCode, errString);
+ onError(errorCode, errString);
+ }
+
+ @Override
+ public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) {
+ super.onAuthenticationSucceeded(result);
+ finishWithSuccess();
+ }
+
+ @Override
+ public void onAuthenticationFailed() {
+ super.onAuthenticationFailed();
+ }
+ };
+
+
+ // TODO: remove after fix https://issuetracker.google.com/issues/142740104
+ private void showAuthenticationScreen() {
+ KeyguardManager keyguardManager = ContextCompat
+ .getSystemService(this, KeyguardManager.class);
+ if (keyguardManager == null
+ || android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
+ return;
+ }
+ if (keyguardManager.isKeyguardSecure()) {
+ Intent intent = keyguardManager
+ .createConfirmDeviceCredentialIntent(mPromptInfo.getTitle(), mPromptInfo.getDescription());
+ this.startActivityForResult(intent, REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS);
+ } else {
+ // Show a message that the user hasn't set up a lock screen.
+ finishWithError(PluginError.BIOMETRIC_SCREEN_GUARD_UNSECURED);
+ }
+ }
+
+ // TODO: remove after fix https://issuetracker.google.com/issues/142740104
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS) {
+ if (resultCode == Activity.RESULT_OK) {
+ finishWithSuccess();
+ } else {
+ finishWithError(PluginError.BIOMETRIC_PIN_OR_PATTERN_DISMISSED);
+ }
+ }
+ }
+
+ private void onError(int errorCode, @NonNull CharSequence errString) {
+
+ switch (errorCode)
+ {
+ case BiometricPrompt.ERROR_USER_CANCELED:
+ case BiometricPrompt.ERROR_CANCELED:
+ finishWithError(PluginError.BIOMETRIC_DISMISSED);
+ return;
+ case BiometricPrompt.ERROR_NEGATIVE_BUTTON:
+ // TODO: remove after fix https://issuetracker.google.com/issues/142740104
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P && mPromptInfo.isDeviceCredentialAllowed()) {
+ showAuthenticationScreen();
+ return;
+ }
+ finishWithError(PluginError.BIOMETRIC_DISMISSED);
+ break;
+ case BiometricPrompt.ERROR_LOCKOUT:
+ finishWithError(PluginError.BIOMETRIC_LOCKED_OUT.getValue(), errString.toString());
+ break;
+ case BiometricPrompt.ERROR_LOCKOUT_PERMANENT:
+ finishWithError(PluginError.BIOMETRIC_LOCKED_OUT_PERMANENT.getValue(), errString.toString());
+ break;
+ default:
+ finishWithError(errorCode, errString.toString());
+ }
+ }
+
+ private void finishWithSuccess() {
+ setResult(RESULT_OK);
+ finish();
+ }
+
+ private void finishWithError(PluginError error) {
+ finishWithError(error.getValue(), error.getMessage());
+ }
+
+ private void finishWithError(int code, String message) {
+ Intent data = new Intent();
+ data.putExtra("code", code);
+ data.putExtra("message", message);
+ setResult(RESULT_CANCELED, data);
+ finish();
+ }
+}
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/Fingerprint.java b/plugins/cordova-plugin-fingerprint-aio/src/android/Fingerprint.java
index 32fd67c..5bfe78e 100644
--- a/plugins/cordova-plugin-fingerprint-aio/src/android/Fingerprint.java
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/Fingerprint.java
@@ -1,436 +1,132 @@
-/*
- * Copyright (C) https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth
- * Modifications copyright (C) 2016 Niklas Merz
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
+package de.niklasmerz.cordova.biometric;
-package de.niklasmerz.cordova.fingerprint;
-
-import org.apache.cordova.CordovaWebView;
-import org.apache.cordova.CallbackContext;
-import org.apache.cordova.CordovaPlugin;
-import org.apache.cordova.CordovaInterface;
-
-import android.annotation.TargetApi;
-import android.app.FragmentTransaction;
-import android.app.KeyguardManager;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.hardware.fingerprint.FingerprintManager;
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Build;
import android.os.Bundle;
-import android.security.keystore.KeyGenParameterSpec;
-import android.security.keystore.KeyPermanentlyInvalidatedException;
-import android.security.keystore.KeyProperties;
-import android.util.Base64;
-import android.util.DisplayMetrics;
import android.util.Log;
+import com.exxbrain.android.biometric.BiometricManager;
+
+import org.apache.cordova.CallbackContext;
+import org.apache.cordova.CordovaInterface;
+import org.apache.cordova.CordovaPlugin;
+import org.apache.cordova.CordovaWebView;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
-import java.io.IOException;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.CertificateException;
-import java.util.Locale;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.Cipher;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.KeyGenerator;
-import javax.crypto.NoSuchPaddingException;
-import javax.crypto.SecretKey;
-
-@TargetApi(23)
public class Fingerprint extends CordovaPlugin {
- public static final String TAG = "Fingerprint";
- public static String packageName;
+ private static final String TAG = "Fingerprint";
+ private CallbackContext mCallbackContext = null;
- private static final String DIALOG_FRAGMENT_TAG = "FpAuthDialog";
- private static final String ANDROID_KEY_STORE = "AndroidKeyStore";
-
- KeyguardManager mKeyguardManager;
- FingerprintAuthenticationDialogFragment mFragment;
- public static KeyStore mKeyStore;
- public static KeyGenerator mKeyGenerator;
- public static Cipher mCipher;
- private FingerprintManager mFingerPrintManager;
-
- public static CallbackContext mCallbackContext;
- public static PluginResult mPluginResult;
-
- /**
- * Alias for our key in the Android Key Store
- */
- private static String mClientId;
- /**
- * Used to encrypt token
- */
- private static String mClientSecret;
-
- /**
- * Options
- */
- private static boolean mDisableBackup = false;
-
- /**
- * Constructor.
- */
- public Fingerprint() {
- }
-
- /**
- * Sets the context of the Command. This can then be used to do things like
- * get file paths associated with the Activity.
- *
- * @param cordova The context of the main Activity.
- * @param webView The CordovaWebView Cordova is running in.
- */
+ private static final int REQUEST_CODE_BIOMETRIC = 1;
+ private PromptInfo.Builder mPromptInfoBuilder;
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
Log.v(TAG, "Init Fingerprint");
- packageName = cordova.getActivity().getApplicationContext().getPackageName();
- mPluginResult = new PluginResult(PluginResult.Status.NO_RESULT);
-
- if (android.os.Build.VERSION.SDK_INT < 23) {
- return;
- }
-
- mKeyguardManager = cordova.getActivity().getSystemService(KeyguardManager.class);
- mFingerPrintManager = cordova.getActivity().getApplicationContext()
- .getSystemService(FingerprintManager.class);
-
- try {
- mKeyGenerator = KeyGenerator.getInstance(
- KeyProperties.KEY_ALGORITHM_AES, ANDROID_KEY_STORE);
- mKeyStore = KeyStore.getInstance(ANDROID_KEY_STORE);
-
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException("Failed to get an instance of KeyGenerator", e);
- } catch (NoSuchProviderException e) {
- throw new RuntimeException("Failed to get an instance of KeyGenerator", e);
- } catch (KeyStoreException e) {
- throw new RuntimeException("Failed to get an instance of KeyStore", e);
- }
-
- try {
- mCipher = Cipher.getInstance(KeyProperties.KEY_ALGORITHM_AES + "/"
- + KeyProperties.BLOCK_MODE_CBC + "/"
- + KeyProperties.ENCRYPTION_PADDING_PKCS7);
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException("Failed to get an instance of Cipher", e);
- } catch (NoSuchPaddingException e) {
- throw new RuntimeException("Failed to get an instance of Cipher", e);
- }
+ mPromptInfoBuilder = new PromptInfo.Builder(cordova.getActivity());
}
- /**
- * Executes the request and returns PluginResult.
- *
- * @param action The action to execute.
- * @param args JSONArry of arguments for the plugin.
- * @param callbackContext The callback id used when calling back into JavaScript.
- * @return A PluginResult object with a status and message.
- */
- public boolean execute(final String action,
- JSONArray args,
- CallbackContext callbackContext) throws JSONException {
- mCallbackContext = callbackContext;
- Log.v(TAG, "Fingerprint action: " + action);
- if (android.os.Build.VERSION.SDK_INT < 23) {
- Log.e(TAG, "minimum SDK version 23 required");
- mPluginResult = new PluginResult(PluginResult.Status.ERROR);
- mCallbackContext.error("minimum SDK version 23 required");
- mCallbackContext.sendPluginResult(mPluginResult);
- return true;
- }
+ public boolean execute(final String action, JSONArray args, CallbackContext callbackContext) {
- final JSONObject arg_object = args.getJSONObject(0);
+ this.mCallbackContext = callbackContext;
+ Log.v(TAG, "Fingerprint action: " + action);
if (action.equals("authenticate")) {
- if (!arg_object.has("clientId") || !arg_object.has("clientSecret")) {
- mPluginResult = new PluginResult(PluginResult.Status.ERROR);
- mCallbackContext.error("Missing required parameters");
- mCallbackContext.sendPluginResult(mPluginResult);
- return true;
- }
- mClientId = arg_object.getString("clientId");
- mClientSecret = arg_object.getString("clientSecret");
- if (arg_object.has("disableBackup")) {
- mDisableBackup = arg_object.getBoolean("disableBackup");
- }
- // Set language
- Resources res = cordova.getActivity().getResources();
- // Change locale settings in the app.
- DisplayMetrics dm = res.getDisplayMetrics();
- Configuration conf = res.getConfiguration();
- //Do not change locale
- res.updateConfiguration(conf, dm);
-
- if (isFingerprintAuthAvailable()) {
- SecretKey key = getSecretKey();
- boolean isCipherInit = true;
- if (key == null) {
- if (createKey()) {
- key = getSecretKey();
- }
- }
- if (key != null && !initCipher()) {
- isCipherInit = false;
- }
- if (key != null) {
- cordova.getActivity().runOnUiThread(new Runnable() {
- public void run() {
- // Set up the crypto object for later. The object will be authenticated by use
- // of the fingerprint.
- mFragment = new FingerprintAuthenticationDialogFragment();
- Bundle bundle = new Bundle();
- bundle.putBoolean("disableBackup", mDisableBackup);
- mFragment.setArguments(bundle);
-
- if (initCipher()) {
- mFragment.setCancelable(false);
- // Show the fingerprint dialog. The user has the option to use the fingerprint with
- // crypto, or you can fall back to using a server-side verified password.
- mFragment.setCryptoObject(new FingerprintManager.CryptoObject(mCipher));
- FragmentTransaction transaction = cordova.getActivity().getFragmentManager().beginTransaction();
- transaction.add(mFragment, DIALOG_FRAGMENT_TAG);
- transaction.commitAllowingStateLoss();
- } else {
- if (!mDisableBackup) {
- // This happens if the lock screen has been disabled or or a fingerprint got
- // enrolled. Thus show the dialog to authenticate with their password
- mFragment.setCryptoObject(new FingerprintManager
- .CryptoObject(mCipher));
- mFragment.setStage(FingerprintAuthenticationDialogFragment
- .Stage.NEW_FINGERPRINT_ENROLLED);
- FragmentTransaction transaction = cordova.getActivity().getFragmentManager().beginTransaction();
- transaction.add(mFragment, DIALOG_FRAGMENT_TAG);
- transaction.commitAllowingStateLoss();
- } else {
- mCallbackContext.error("Failed to init Cipher and backup disabled.");
- mPluginResult = new PluginResult(PluginResult.Status.ERROR);
- mCallbackContext.sendPluginResult(mPluginResult);
- }
- }
- }
- });
- mPluginResult.setKeepCallback(true);
- } else {
- mCallbackContext.sendPluginResult(mPluginResult);
- }
-
- } else {
- mPluginResult = new PluginResult(PluginResult.Status.ERROR);
- mCallbackContext.error("Fingerprint authentication not available");
- mCallbackContext.sendPluginResult(mPluginResult);
- }
+ executeAuthenticate(args);
return true;
- } else if (action.equals("isAvailable")) {
- if(isFingerprintAuthAvailable() && mFingerPrintManager.isHardwareDetected() && mFingerPrintManager.hasEnrolledFingerprints()){
- mPluginResult = new PluginResult(PluginResult.Status.OK, "finger");
- mCallbackContext.success("finger");
- }else{
- mPluginResult = new PluginResult(PluginResult.Status.ERROR);
- if (mFingerPrintManager.isHardwareDetected() && !mFingerPrintManager.hasEnrolledFingerprints()) {
- mCallbackContext.error("Fingerprint authentication not ready");
- } else {
- mCallbackContext.error("Fingerprint authentication not available");
- }
- }
- mCallbackContext.sendPluginResult(mPluginResult);
+ } else if (action.equals("isAvailable")){
+ executeIsAvailable();
return true;
}
+
return false;
}
- private boolean isFingerprintAuthAvailable() {
- return mFingerPrintManager.isHardwareDetected()
- && mFingerPrintManager.hasEnrolledFingerprints();
- }
-
- /**
- * Initialize the {@link Cipher} instance with the created key in the {@link #createKey()}
- * method.
- *
- * @return {@code true} if initialization is successful, {@code false} if the lock screen has
- * been disabled or reset after the key was generated, or if a fingerprint got enrolled after
- * the key was generated.
- */
- private static boolean initCipher() {
- boolean initCipher = false;
- String errorMessage = "";
- String initCipherExceptionErrorPrefix = "Failed to init Cipher: ";
- try {
- SecretKey key = getSecretKey();
- mCipher.init(Cipher.ENCRYPT_MODE, key);
- initCipher = true;
- } catch (InvalidKeyException e) {
- errorMessage = initCipherExceptionErrorPrefix + "InvalidKeyException: " + e.toString();
-
- }
- if (!initCipher) {
- Log.e(TAG, errorMessage);
- createKey();
- }
- return initCipher;
- }
-
- private static SecretKey getSecretKey() {
- String errorMessage = "";
- String getSecretKeyExceptionErrorPrefix = "Failed to get SecretKey from KeyStore: ";
- SecretKey key = null;
- try {
- mKeyStore.load(null);
- key = (SecretKey) mKeyStore.getKey(mClientId, null);
- } catch (KeyStoreException e) {
- errorMessage = getSecretKeyExceptionErrorPrefix
- + "KeyStoreException: " + e.toString();;
- } catch (CertificateException e) {
- errorMessage = getSecretKeyExceptionErrorPrefix
- + "CertificateException: " + e.toString();;
- } catch (UnrecoverableKeyException e) {
- errorMessage = getSecretKeyExceptionErrorPrefix
- + "UnrecoverableKeyException: " + e.toString();;
- } catch (IOException e) {
- errorMessage = getSecretKeyExceptionErrorPrefix
- + "IOException: " + e.toString();;
- } catch (NoSuchAlgorithmException e) {
- errorMessage = getSecretKeyExceptionErrorPrefix
- + "NoSuchAlgorithmException: " + e.toString();;
- }
- if (key == null) {
- Log.e(TAG, errorMessage);
- }
- return key;
- }
-
- /**
- * Creates a symmetric key in the Android Key Store which can only be used after the user has
- * authenticated with fingerprint.
- */
- public static boolean createKey() {
- String errorMessage = "";
- String createKeyExceptionErrorPrefix = "Failed to create key: ";
- boolean isKeyCreated = false;
- // The enrolling flow for fingerprint. This is where you ask the user to set up fingerprint
- // for your flow. Use of keys is necessary if you need to know if the set of
- // enrolled fingerprints has changed.
- try {
- mKeyStore.load(null);
- // Set the alias of the entry in Android KeyStore where the key will appear
- // and the constrains (purposes) in the constructor of the Builder
- mKeyGenerator.init(new KeyGenParameterSpec.Builder(mClientId,
- KeyProperties.PURPOSE_ENCRYPT |
- KeyProperties.PURPOSE_DECRYPT)
- .setBlockModes(KeyProperties.BLOCK_MODE_CBC)
- // Require the user to authenticate with a fingerprint to authorize every use
- // of the key
- .setUserAuthenticationRequired(true)
- .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7)
- .build());
- mKeyGenerator.generateKey();
- isKeyCreated = true;
- } catch (NoSuchAlgorithmException e) {
- errorMessage = createKeyExceptionErrorPrefix
- + "NoSuchAlgorithmException: " + e.toString();;
- } catch (InvalidAlgorithmParameterException e) {
- errorMessage = createKeyExceptionErrorPrefix
- + "InvalidAlgorithmParameterException: " + e.toString();;
- } catch (CertificateException e) {
- errorMessage = createKeyExceptionErrorPrefix
- + "CertificateException: " + e.toString();;
- } catch (IOException e) {
- errorMessage = createKeyExceptionErrorPrefix
- + "IOException: " + e.toString();;
- }
- if (!isKeyCreated) {
- Log.e(TAG, errorMessage);
- setPluginResultError(errorMessage);
- }
- return isKeyCreated;
- }
-
- public static void onAuthenticated(boolean withFingerprint) {
- JSONObject resultJson = new JSONObject();
- String errorMessage = "";
- boolean createdResultJson = false;
- try {
-
- if (withFingerprint) {
- // If the user has authenticated with fingerprint, verify that using cryptography and
- // then return the encrypted token
- byte[] encrypted = tryEncrypt();
- resultJson.put("withFingerprint", Base64.encodeToString(encrypted, 0 /* flags */));
- } else {
- // Authentication happened with backup password.
- resultJson.put("withPassword", true);
-
- // if failed to init cipher because of InvalidKeyException, create new key
- if (!initCipher()) {
- createKey();
- }
- }
- createdResultJson = true;
- } catch (BadPaddingException e) {
- errorMessage = "Failed to encrypt the data with the generated key:" +
- " BadPaddingException: " + e.getMessage();
- Log.e(TAG, errorMessage);
- } catch (IllegalBlockSizeException e) {
- errorMessage = "Failed to encrypt the data with the generated key: " +
- "IllegalBlockSizeException: " + e.getMessage();
- Log.e(TAG, errorMessage);
- } catch (JSONException e) {
- errorMessage = "Failed to set resultJson key value pair: " + e.getMessage();
- Log.e(TAG, errorMessage);
- }
-
- if (createdResultJson) {
- mCallbackContext.success(resultJson);
- mPluginResult = new PluginResult(PluginResult.Status.OK);
+ private void executeIsAvailable() {
+ PluginError error = canAuthenticate();
+ if (error != null) {
+ sendError(error);
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P){
+ sendSuccess("biometric");
} else {
- mCallbackContext.error(errorMessage);
- mPluginResult = new PluginResult(PluginResult.Status.ERROR);
+ sendSuccess("finger");
}
- mCallbackContext.sendPluginResult(mPluginResult);
}
- public static void onCancelled() {
- mCallbackContext.error("Cancelled");
+ private void executeAuthenticate(JSONArray args) {
+ PluginError error = canAuthenticate();
+ if (error != null) {
+ sendError(error);
+ return;
+ }
+ cordova.getActivity().runOnUiThread(() -> {
+ mPromptInfoBuilder.parseArgs(args);
+ Intent intent = new Intent(cordova.getActivity().getApplicationContext(), BiometricActivity.class);
+ intent.putExtras(mPromptInfoBuilder.build().getBundle());
+ this.cordova.startActivityForResult(this, intent, REQUEST_CODE_BIOMETRIC);
+ });
+ PluginResult pluginResult = new PluginResult(PluginResult.Status.NO_RESULT);
+ pluginResult.setKeepCallback(true);
+ this.mCallbackContext.sendPluginResult(pluginResult);
}
- /**
- * Tries to encrypt some data with the generated key in {@link #createKey} which is
- * only works if the user has just authenticated via fingerprint.
- */
- private static byte[] tryEncrypt() throws BadPaddingException, IllegalBlockSizeException {
- return mCipher.doFinal(mClientSecret.getBytes());
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ super.onActivityResult(requestCode, resultCode, intent);
+ if (requestCode != REQUEST_CODE_BIOMETRIC) {
+ return;
+ }
+ if (resultCode == Activity.RESULT_OK) {
+ sendSuccess("biometric_success");
+ } else if (intent != null) {
+ Bundle extras = intent.getExtras();
+ sendError(extras.getInt("code"), extras.getString("message"));
+ } else {
+ sendError(PluginError.BIOMETRIC_DISMISSED);
+ }
}
- public static boolean setPluginResultError(String errorMessage) {
- mCallbackContext.error(errorMessage);
- mPluginResult = new PluginResult(PluginResult.Status.ERROR);
- return false;
+ private PluginError canAuthenticate() {
+ int error = BiometricManager.from(cordova.getContext()).canAuthenticate();
+ switch (error) {
+ case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
+ case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE:
+ return PluginError.BIOMETRIC_HARDWARE_NOT_SUPPORTED;
+ case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
+ return PluginError.BIOMETRIC_NOT_ENROLLED;
+ default:
+ return null;
+ }
}
-}
\ No newline at end of file
+
+ private void sendError(int code, String message) {
+ JSONObject resultJson = new JSONObject();
+ try {
+ resultJson.put("code", code);
+ resultJson.put("message", message);
+
+ PluginResult result = new PluginResult(PluginResult.Status.ERROR, resultJson);
+ result.setKeepCallback(true);
+ cordova.getActivity().runOnUiThread(() ->
+ Fingerprint.this.mCallbackContext.sendPluginResult(result));
+ } catch (JSONException e) {
+ Log.e(TAG, e.getMessage(), e);
+ }
+ }
+
+ private void sendError(PluginError error) {
+ sendError(error.getValue(), error.getMessage());
+ }
+
+ private void sendSuccess(String message) {
+ Log.e(TAG, message);
+ cordova.getActivity().runOnUiThread(() ->
+ this.mCallbackContext.success(message));
+ }
+}
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/FingerprintAuthenticationDialogFragment.java b/plugins/cordova-plugin-fingerprint-aio/src/android/FingerprintAuthenticationDialogFragment.java
deleted file mode 100644
index 54fb28d..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/src/android/FingerprintAuthenticationDialogFragment.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * Modifications copyright (C) 2016 Niklas Merz
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package de.niklasmerz.cordova.fingerprint;
-
-import android.app.DialogFragment;
-import android.app.KeyguardManager;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.hardware.fingerprint.FingerprintManager;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.Button;
-import android.widget.ImageView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-/**
- * A dialog which uses fingerprint APIs to authenticate the user, and falls back to password
- * authentication if fingerprint is not available.
- */
-public class FingerprintAuthenticationDialogFragment extends DialogFragment
- implements FingerprintUiHelper.Callback {
-
- private static final String TAG = "FingerprintAuthDialog";
- private static final int REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS = 1;
-
- private Button mCancelButton;
- private Button mSecondDialogButton;
- private View mFingerprintContent;
-
- private Stage mStage = Stage.FINGERPRINT;
-
- private KeyguardManager mKeyguardManager;
- private FingerprintManager.CryptoObject mCryptoObject;
- private FingerprintUiHelper mFingerprintUiHelper;
- FingerprintUiHelper.FingerprintUiHelperBuilder mFingerprintUiHelperBuilder;
-
- boolean disableBackup;
-
- public FingerprintAuthenticationDialogFragment() {
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- // Do not create a new Fragment when the Activity is re-created such as orientation changes.
- setRetainInstance(true);
- setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Material_Light_Dialog);
-
- mKeyguardManager = (KeyguardManager) getContext().getSystemService(Context.KEYGUARD_SERVICE);
- mFingerprintUiHelperBuilder = new FingerprintUiHelper.FingerprintUiHelperBuilder(
- getContext(), getContext().getSystemService(FingerprintManager.class));
-
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- Bundle args = getArguments();
- disableBackup = args.getBoolean("disableBackup");
- Log.d(TAG, "disableBackup: " + disableBackup);
-
- int fingerprint_auth_dialog_title_id = getResources()
- .getIdentifier("fingerprint_auth_dialog_title", "string",
- Fingerprint.packageName);
- getDialog().setTitle(getString(fingerprint_auth_dialog_title_id));
- int fingerprint_dialog_container_id = getResources()
- .getIdentifier("fingerprint_dialog_container", "layout",
- Fingerprint.packageName);
- View v = inflater.inflate(fingerprint_dialog_container_id, container, false);
- int cancel_button_id = getResources()
- .getIdentifier("cancel_button", "id", Fingerprint.packageName);
- mCancelButton = (Button) v.findViewById(cancel_button_id);
- mCancelButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- Fingerprint.onCancelled();
- dismissAllowingStateLoss();
- }
- });
-
- int second_dialog_button_id = getResources()
- .getIdentifier("second_dialog_button", "id", Fingerprint.packageName);
- mSecondDialogButton = (Button) v.findViewById(second_dialog_button_id);
- if (disableBackup) {
- mSecondDialogButton.setVisibility(View.GONE);
- }
- mSecondDialogButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- goToBackup();
- }
- });
- int fingerprint_container_id = getResources()
- .getIdentifier("fingerprint_container", "id", Fingerprint.packageName);
- mFingerprintContent = v.findViewById(fingerprint_container_id);
-
- int new_fingerprint_enrolled_description_id = getResources()
- .getIdentifier("new_fingerprint_enrolled_description", "id",
- Fingerprint.packageName);
-
- int fingerprint_icon_id = getResources()
- .getIdentifier("fingerprint_icon", "id", Fingerprint.packageName);
- int fingerprint_status_id = getResources()
- .getIdentifier("fingerprint_status", "id", Fingerprint.packageName);
- mFingerprintUiHelper = mFingerprintUiHelperBuilder.build(
- (ImageView) v.findViewById(fingerprint_icon_id),
- (TextView) v.findViewById(fingerprint_status_id), this);
- updateStage();
-
- // If fingerprint authentication is not available, switch immediately to the backup
- // (password) screen.
- if (!mFingerprintUiHelper.isFingerprintAuthAvailable()) {
- goToBackup();
- }
- return v;
- }
-
-
- @Override
- public void onResume() {
- super.onResume();
- if (mStage == Stage.FINGERPRINT) {
- mFingerprintUiHelper.startListening(mCryptoObject);
- }
- }
-
- public void setStage(Stage stage) {
- mStage = stage;
- }
-
- @Override
- public void onPause() {
- super.onPause();
- mFingerprintUiHelper.stopListening();
- }
-
- /**
- * Sets the crypto object to be passed in when authenticating with fingerprint.
- */
- public void setCryptoObject(FingerprintManager.CryptoObject cryptoObject) {
- mCryptoObject = cryptoObject;
- }
-
- /**
- * Switches to backup (password) screen. This either can happen when fingerprint is not
- * available or the user chooses to use the password authentication method by pressing the
- * button. This can also happen when the user had too many fingerprint attempts.
- */
- private void goToBackup() {
- if(disableBackup)
- {
- Fingerprint.onCancelled();
- dismissAllowingStateLoss();
- }
- else{
- mStage = Stage.BACKUP;
- updateStage();
- }
- }
-
- private void updateStage() {
- int cancel_id = getResources()
- .getIdentifier("fingerprint_cancel", "string", Fingerprint.packageName);
- switch (mStage) {
- case FINGERPRINT:
- mCancelButton.setText(cancel_id);
- int use_backup_id = getResources()
- .getIdentifier("fingerprint_use_backup", "string", Fingerprint.packageName);
- mSecondDialogButton.setText(use_backup_id);
- mFingerprintContent.setVisibility(View.VISIBLE);
- break;
- case NEW_FINGERPRINT_ENROLLED:
- // Intentional fall through
- case BACKUP:
- if (mStage == Stage.NEW_FINGERPRINT_ENROLLED) {
-
- }
- if (!mKeyguardManager.isKeyguardSecure()) {
- // Show a message that the user hasn't set up a lock screen.
- int secure_lock_screen_required_id = getResources()
- .getIdentifier("secure_lock_screen_required", "string",
- Fingerprint.packageName);
- Toast.makeText(getContext(),
- getString(secure_lock_screen_required_id),
- Toast.LENGTH_LONG).show();
- return;
- }
- showAuthenticationScreen();
- break;
- }
- }
-
- private void showAuthenticationScreen() {
- // Create the Confirm Credentials screen. You can customize the title and description. Or
- // we will provide a generic one for you if you leave it null
- Intent intent = mKeyguardManager.createConfirmDeviceCredentialIntent(null, null);
- if (intent != null) {
- startActivityForResult(intent, REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS);
- }
- }
-
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS) {
- // Challenge completed, proceed with using cipher
- if (resultCode == getActivity().RESULT_OK) {
- Fingerprint.onAuthenticated(false /* used backup */);
- } else {
- // The user canceled or didn’t complete the lock screen
- // operation. Go to error/cancellation flow.
- Fingerprint.onCancelled();
- }
- dismissAllowingStateLoss();
- }
- }
-
- @Override
- public void onAuthenticated() {
- // Callback from FingerprintUiHelper. Let the activity know that authentication was
- // successful.
- Fingerprint.onAuthenticated(true /* withFingerprint */);
- dismissAllowingStateLoss();
- }
-
- @Override
- public void onError() {
- if(this.getActivity() != null)
- goToBackup();
- }
-
- @Override
- public void onCancel(DialogInterface dialog) {
- super.onCancel(dialog);
- Fingerprint.onCancelled();
- }
-
- /**
- * Enumeration to indicate which authentication method the user is trying to authenticate with.
- */
- public enum Stage {
- FINGERPRINT,
- NEW_FINGERPRINT_ENROLLED,
- BACKUP
- }
-}
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/FingerprintUiHelper.java b/plugins/cordova-plugin-fingerprint-aio/src/android/FingerprintUiHelper.java
deleted file mode 100644
index e1402c5..0000000
--- a/plugins/cordova-plugin-fingerprint-aio/src/android/FingerprintUiHelper.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- * Modifications copyright (C) 2016 Niklas Merz
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package de.niklasmerz.cordova.fingerprint;
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.hardware.fingerprint.FingerprintManager;
-import android.os.CancellationSignal;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-
-/**
- * Small helper class to manage text/icon around fingerprint authentication UI.
- */
-@TargetApi(23)
-public class FingerprintUiHelper extends FingerprintManager.AuthenticationCallback {
-
- static final long ERROR_TIMEOUT_MILLIS = 1600;
- static final long SUCCESS_DELAY_MILLIS = 1300;
-
- private final Context mContext;
- private final FingerprintManager mFingerprintManager;
- private final ImageView mIcon;
- private final TextView mErrorTextView;
- private final Callback mCallback;
- private CancellationSignal mCancellationSignal;
-
- boolean mSelfCancelled;
-
- /**
- * Builder class for {@link FingerprintUiHelper} in which injected fields from Dagger
- * holds its fields and takes other arguments in the {@link #build} method.
- */
- public static class FingerprintUiHelperBuilder {
- private final FingerprintManager mFingerPrintManager;
- private final Context mContext;
-
- public FingerprintUiHelperBuilder(Context context, FingerprintManager fingerprintManager) {
- mFingerPrintManager = fingerprintManager;
- mContext = context;
- }
-
- public FingerprintUiHelper build(ImageView icon, TextView errorTextView, Callback callback) {
- return new FingerprintUiHelper(mContext, mFingerPrintManager, icon, errorTextView,
- callback);
- }
- }
-
- /**
- * Constructor for {@link FingerprintUiHelper}. This method is expected to be called from
- * only the {@link FingerprintUiHelperBuilder} class.
- */
- private FingerprintUiHelper(Context context, FingerprintManager fingerprintManager,
- ImageView icon, TextView errorTextView, Callback callback) {
- mFingerprintManager = fingerprintManager;
- mIcon = icon;
- mErrorTextView = errorTextView;
- mCallback = callback;
- mContext = context;
- }
-
- public boolean isFingerprintAuthAvailable() {
- return mFingerprintManager.isHardwareDetected()
- && mFingerprintManager.hasEnrolledFingerprints();
- }
-
- public void startListening(FingerprintManager.CryptoObject cryptoObject) {
- if (!isFingerprintAuthAvailable()) {
- return;
- }
- mCancellationSignal = new CancellationSignal();
- mSelfCancelled = false;
- mFingerprintManager
- .authenticate(cryptoObject, mCancellationSignal, 0 /* flags */, this, null);
-
- int ic_fp_40px_id = mContext.getResources()
- .getIdentifier("ic_fp_40px", "drawable", Fingerprint.packageName);
- mIcon.setImageResource(ic_fp_40px_id);
- }
-
- public void stopListening() {
- if (mCancellationSignal != null) {
- mSelfCancelled = true;
- mCancellationSignal.cancel();
- mCancellationSignal = null;
- }
- }
-
- @Override
- public void onAuthenticationError(int errMsgId, CharSequence errString) {
- if (!mSelfCancelled) {
- showError(errString);
- mIcon.postDelayed(new Runnable() {
- @Override
- public void run() {
- mCallback.onError();
- }
- }, ERROR_TIMEOUT_MILLIS);
- }
- }
-
- @Override
- public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
- showError(helpString);
- }
-
- @Override
- public void onAuthenticationFailed() {
- int fingerprint_not_recognized_id = mContext.getResources()
- .getIdentifier("fingerprint_not_recognized", "string", Fingerprint.packageName);
- showError(mIcon.getResources().getString(
- fingerprint_not_recognized_id));
- }
-
- @Override
- public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) {
- mErrorTextView.removeCallbacks(mResetErrorTextRunnable);
- int ic_fingerprint_success_id = mContext.getResources()
- .getIdentifier("ic_fingerprint_success", "drawable", Fingerprint.packageName);
- mIcon.setImageResource(ic_fingerprint_success_id);
- int success_color_id = mContext.getResources()
- .getIdentifier("success_color", "color", Fingerprint.packageName);
- mErrorTextView.setTextColor(
- mErrorTextView.getResources().getColor(success_color_id, null));
- int fingerprint_success_id = mContext.getResources()
- .getIdentifier("fingerprint_success", "string", Fingerprint.packageName);
- mErrorTextView.setText(
- mErrorTextView.getResources().getString(fingerprint_success_id));
- mIcon.postDelayed(new Runnable() {
- @Override
- public void run() {
- mCallback.onAuthenticated();
- }
- }, SUCCESS_DELAY_MILLIS);
- }
-
- private void showError(CharSequence error) {
- int ic_fingerprint_error_id = mContext.getResources()
- .getIdentifier("ic_fingerprint_error", "drawable", Fingerprint.packageName);
- mIcon.setImageResource(ic_fingerprint_error_id);
- mErrorTextView.setText(error);
- int warning_color_id = mContext.getResources()
- .getIdentifier("warning_color", "color", Fingerprint.packageName);
- mErrorTextView.setTextColor(
- mErrorTextView.getResources().getColor(warning_color_id, null));
- mErrorTextView.removeCallbacks(mResetErrorTextRunnable);
- mErrorTextView.postDelayed(mResetErrorTextRunnable, ERROR_TIMEOUT_MILLIS);
- }
-
- Runnable mResetErrorTextRunnable = new Runnable() {
- @Override
- public void run() {
- int hint_color_id = mContext.getResources()
- .getIdentifier("hint_color", "color", Fingerprint.packageName);
- mErrorTextView.setTextColor(
- mErrorTextView.getResources().getColor(hint_color_id, null));
- int fingerprint_hint_id = mContext.getResources()
- .getIdentifier("fingerprint_hint", "string", Fingerprint.packageName);
- mErrorTextView.setText(
- mErrorTextView.getResources().getString(fingerprint_hint_id));
- int ic_fp_40px_id = mContext.getResources()
- .getIdentifier("ic_fp_40px", "drawable", Fingerprint.packageName);
- mIcon.setImageResource(ic_fp_40px_id);
- }
- };
-
- public interface Callback {
-
- void onAuthenticated();
-
- void onError();
- }
-}
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/PluginError.java b/plugins/cordova-plugin-fingerprint-aio/src/android/PluginError.java
new file mode 100644
index 0000000..1a4a5db
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/PluginError.java
@@ -0,0 +1,35 @@
+package de.niklasmerz.cordova.biometric;
+
+public enum PluginError {
+
+ BIOMETRIC_AUTHENTICATION_FAILED(-102, "Authentication failed"),
+ BIOMETRIC_HARDWARE_NOT_SUPPORTED(-104),
+ BIOMETRIC_NOT_ENROLLED(-106),
+ BIOMETRIC_DISMISSED(-108),
+ BIOMETRIC_PIN_OR_PATTERN_DISMISSED(-109),
+ BIOMETRIC_SCREEN_GUARD_UNSECURED(-110,
+ "Go to 'Settings -> Security -> Screenlock' to set up a lock screen"),
+ BIOMETRIC_LOCKED_OUT(-111),
+ BIOMETRIC_LOCKED_OUT_PERMANENT(-112);
+
+ private int value;
+ private String message;
+
+ PluginError(int value) {
+ this.value = value;
+ this.message = this.name();
+ }
+
+ PluginError(int value, String message) {
+ this.value = value;
+ this.message = message;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+}
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/PromptInfo.java b/plugins/cordova-plugin-fingerprint-aio/src/android/PromptInfo.java
new file mode 100644
index 0000000..31ed0dd
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/PromptInfo.java
@@ -0,0 +1,136 @@
+package de.niklasmerz.cordova.biometric;
+
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.util.Log;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+class PromptInfo {
+
+ private static final String DISABLE_BACKUP = "disableBackup";
+ private static final String TITLE = "title";
+ private static final String SUBTITLE = "subtitle";
+ private static final String DESCRIPTION = "description";
+ private static final String FALLBACK_BUTTON_TITLE = "fallbackButtonTitle";
+ private static final String CANCEL_BUTTON_TITLE = "cancelButtonTitle";
+
+ private Bundle bundle = new Bundle();
+
+ Bundle getBundle() {
+ return bundle;
+ }
+
+ String getTitle() {
+ return bundle.getString(TITLE);
+ }
+
+ String getSubtitle() {
+ return bundle.getString(SUBTITLE);
+ }
+
+ String getDescription() {
+ return bundle.getString(DESCRIPTION);
+ }
+
+ boolean isDeviceCredentialAllowed() {
+ return !bundle.getBoolean(DISABLE_BACKUP);
+ }
+
+ String getFallbackButtonTitle() {
+ return bundle.getString(FALLBACK_BUTTON_TITLE);
+ }
+
+ String getCancelButtonTitle() {
+ return bundle.getString(CANCEL_BUTTON_TITLE);
+ }
+
+ public static final class Builder {
+ private static final String TAG = "PromptInfo.Builder";
+ private Bundle bundle;
+ private boolean disableBackup = false;
+ private String title;
+ private String subtitle = null;
+ private String description = null;
+ private String fallbackButtonTitle = "Use backup";
+ private String cancelButtonTitle = "Cancel";
+
+ Builder(Context context) {
+ PackageManager packageManager = context.getPackageManager();
+ try {
+ ApplicationInfo app = packageManager
+ .getApplicationInfo(context.getPackageName(), 0);
+ title = packageManager.getApplicationLabel(app) + " Biometric Sign On";
+ } catch (PackageManager.NameNotFoundException e) {
+ title = "Biometric Sign On";
+ }
+ }
+
+ Builder(Bundle bundle) {
+ this.bundle = bundle;
+ }
+
+ public PromptInfo build() {
+ PromptInfo promptInfo = new PromptInfo();
+
+ if (this.bundle != null) {
+ promptInfo.bundle = bundle;
+ return promptInfo;
+ }
+
+ Bundle bundle = new Bundle();
+ bundle.putString(SUBTITLE, this.subtitle);
+ bundle.putString(TITLE, this.title);
+ bundle.putString(DESCRIPTION, this.description);
+ bundle.putString(FALLBACK_BUTTON_TITLE, this.fallbackButtonTitle);
+ bundle.putString(CANCEL_BUTTON_TITLE, this.cancelButtonTitle);
+ bundle.putBoolean(DISABLE_BACKUP, this.disableBackup);
+ promptInfo.bundle = bundle;
+
+ return promptInfo;
+ }
+
+ void parseArgs(JSONArray args) {
+ JSONObject argsObject;
+ try {
+ argsObject = args.getJSONObject(0);
+ } catch (JSONException e) {
+ Log.e(TAG, "Can't parse args. Defaults will be used.", e);
+ return;
+ }
+ disableBackup = getBooleanArg(argsObject, DISABLE_BACKUP, disableBackup);
+ title = getStringArg(argsObject, TITLE, title);
+ subtitle = getStringArg(argsObject, SUBTITLE, subtitle);
+ description = getStringArg(argsObject, DESCRIPTION, description);
+ fallbackButtonTitle = getStringArg(argsObject, FALLBACK_BUTTON_TITLE, "Use Backup");
+ cancelButtonTitle = getStringArg(argsObject, CANCEL_BUTTON_TITLE, "Cancel");
+ }
+
+ private Boolean getBooleanArg(JSONObject argsObject, String name, Boolean defaultValue) {
+ if (argsObject.has(name)){
+ try {
+ return argsObject.getBoolean(name);
+ } catch (JSONException e) {
+ Log.e(TAG, "Can't parse '" + name + "'. Default will be used.", e);
+ }
+ }
+ return defaultValue;
+ }
+
+ private String getStringArg(JSONObject argsObject, String name, String defaultValue) {
+ if (argsObject.optString(name) != null
+ && !argsObject.optString(name).isEmpty()){
+ try {
+ return argsObject.getString(name);
+ } catch (JSONException e) {
+ Log.e(TAG, "Can't parse '" + name + "'. Default will be used.", e);
+ }
+ }
+ return defaultValue;
+ }
+ }
+}
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/build.gradle b/plugins/cordova-plugin-fingerprint-aio/src/android/build.gradle
new file mode 100644
index 0000000..aad4f13
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/build.gradle
@@ -0,0 +1,30 @@
+allprojects {
+ repositories {
+ maven { url 'https://jitpack.io' }
+ }
+}
+
+dependencies {
+
+ /**
+ * The android-biometric.aar file has been taken from com.github.exxbrain:android-biometric library.
+ * Android biometric library is a clone of androidx.biometric library adapted for non-androidx apps.
+ * This project could be found at https://github.com/exxbrain/android-biometric.
+ * It has Apache License 2.0.
+ *
+ * TODO: Temporary solution. Should be removed after moving cordova-android to androidx. Then use androidx.biometric.
+ */
+ implementation 'com.github.exxbrain:android-biometric:0.4'
+
+ implementation 'com.android.support:design:28.0.0'
+ implementation 'com.android.support:appcompat-v7:28.0.0'
+ implementation 'com.android.support:support-v4:28.0.0'
+ implementation 'com.android.support:support-annotations:28.0.0'
+}
+
+android {
+ packagingOptions {
+ exclude 'META-INF/NOTICE'
+ exclude 'META-INF/LICENSE'
+ }
+}
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/res/biometric_activity.xml b/plugins/cordova-plugin-fingerprint-aio/src/android/res/biometric_activity.xml
new file mode 100644
index 0000000..5708761
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/res/biometric_activity.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent" android:layout_height="match_parent">
+
+</FrameLayout>
\ No newline at end of file
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/android/res/styles.xml b/plugins/cordova-plugin-fingerprint-aio/src/android/res/styles.xml
new file mode 100644
index 0000000..06d9cbb
--- /dev/null
+++ b/plugins/cordova-plugin-fingerprint-aio/src/android/res/styles.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+ <style name="TransparentTheme" parent="Theme.AppCompat">
+ <item name="android:windowIsTranslucent">true</item>
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:windowContentOverlay">@null</item>
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:windowIsFloating">true</item>
+ <item name="android:backgroundDimEnabled">false</item>
+ </style>
+</resources>
\ No newline at end of file
diff --git a/plugins/cordova-plugin-fingerprint-aio/src/ios/Fingerprint.swift b/plugins/cordova-plugin-fingerprint-aio/src/ios/Fingerprint.swift
index 547aeb2..1f01be4 100644
--- a/plugins/cordova-plugin-fingerprint-aio/src/ios/Fingerprint.swift
+++ b/plugins/cordova-plugin-fingerprint-aio/src/ios/Fingerprint.swift
@@ -1,23 +1,47 @@
import Foundation
import LocalAuthentication
+
@objc(Fingerprint) class Fingerprint : CDVPlugin {
+ enum PluginError:Int {
+ case BIOMETRIC_UNKNOWN_ERROR = -100
+ case BIOMETRIC_UNAVAILABLE = -101
+ case BIOMETRIC_AUTHENTICATION_FAILED = -102
+ case BIOMETRIC_PERMISSION_NOT_GRANTED = -105
+ case BIOMETRIC_NOT_ENROLLED = -106
+ case BIOMETRIC_DISMISSED = -108
+ case BIOMETRIC_SCREEN_GUARD_UNSECURED = -110
+ case BIOMETRIC_LOCKED_OUT = -111
+ }
+
+ struct ErrorCodes {
+ var code: Int
+ }
+
+
@objc(isAvailable:)
func isAvailable(_ command: CDVInvokedUrlCommand){
let authenticationContext = LAContext();
var biometryType = "finger";
+ var errorResponse: [AnyHashable: Any] = [
+ "code": 0,
+ "message": "Not Available"
+ ];
var error:NSError?;
let policy:LAPolicy = .deviceOwnerAuthenticationWithBiometrics;
-
+ var pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: "Not available");
let available = authenticationContext.canEvaluatePolicy(policy, error: &error);
+ var results: [String : Any]
+
if(error != nil){
biometryType = "none";
+ errorResponse["code"] = error?.code;
+ errorResponse["message"] = error?.localizedDescription;
}
- var pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: "Not available");
- if available == true {
+ if (available == true) {
if #available(iOS 11.0, *) {
switch(authenticationContext.biometryType) {
case .none:
@@ -30,6 +54,22 @@
}
pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: biometryType);
+ }else{
+ var code: Int;
+ switch(error!._code) {
+ case Int(kLAErrorBiometryNotAvailable):
+ code = PluginError.BIOMETRIC_UNAVAILABLE.rawValue;
+ break;
+ case Int(kLAErrorBiometryNotEnrolled):
+ code = PluginError.BIOMETRIC_NOT_ENROLLED.rawValue;
+ break;
+
+ default:
+ code = PluginError.BIOMETRIC_UNKNOWN_ERROR.rawValue;
+ break;
+ }
+ results = ["code": code, "message": error!.localizedDescription];
+ pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: results);
}
commandDelegate.send(pluginResult, callbackId:command.callbackId);
@@ -39,7 +79,10 @@
@objc(authenticate:)
func authenticate(_ command: CDVInvokedUrlCommand){
let authenticationContext = LAContext();
- var pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: "Something went wrong");
+ var errorResponse: [AnyHashable: Any] = [
+ "message": "Something went wrong"
+ ];
+ var pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: errorResponse);
var reason = "Authentication";
var policy:LAPolicy = .deviceOwnerAuthentication;
let data = command.arguments[0] as AnyObject?;
@@ -49,17 +92,17 @@
authenticationContext.localizedFallbackTitle = "";
policy = .deviceOwnerAuthenticationWithBiometrics;
} else {
- if let localizedFallbackTitle = data?["localizedFallbackTitle"] as! String? {
- authenticationContext.localizedFallbackTitle = localizedFallbackTitle;
+ if let fallbackButtonTitle = data?["fallbackButtonTitle"] as! String? {
+ authenticationContext.localizedFallbackTitle = fallbackButtonTitle;
+ }else{
+ authenticationContext.localizedFallbackTitle = "Use Pin";
}
}
}
// Localized reason
- if let localizedReason = data?["localizedReason"] as! String? {
- reason = localizedReason;
- }else if let clientId = data?["clientId"] as! String? {
- reason = clientId;
+ if let description = data?["description"] as! String? {
+ reason = description;
}
authenticationContext.evaluatePolicy(
@@ -69,17 +112,32 @@
if( success ) {
pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "Success");
}else {
- // Check if there is an error
- if error != nil {
- pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: "Error: \(String(describing: error?.localizedDescription))")
+ if (error != nil) {
+
+ var errorCodes = [Int: ErrorCodes]()
+ var errorResult: [String : Any] = ["code": PluginError.BIOMETRIC_UNKNOWN_ERROR.rawValue, "message": error?.localizedDescription ?? ""];
+
+ errorCodes[1] = ErrorCodes(code: PluginError.BIOMETRIC_AUTHENTICATION_FAILED.rawValue)
+ errorCodes[2] = ErrorCodes(code: PluginError.BIOMETRIC_DISMISSED.rawValue)
+ errorCodes[5] = ErrorCodes(code: PluginError.BIOMETRIC_SCREEN_GUARD_UNSECURED.rawValue)
+ errorCodes[6] = ErrorCodes(code: PluginError.BIOMETRIC_UNAVAILABLE.rawValue)
+ errorCodes[7] = ErrorCodes(code: PluginError.BIOMETRIC_NOT_ENROLLED.rawValue)
+ errorCodes[8] = ErrorCodes(code: PluginError.BIOMETRIC_LOCKED_OUT.rawValue)
+
+ let errorCode = abs(error!._code)
+ if let e = errorCodes[errorCode] {
+ errorResult = ["code": e.code, "message": error!.localizedDescription];
+ }
+
+ pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: errorResult);
}
}
self.commandDelegate.send(pluginResult, callbackId:command.callbackId);
- });
+ }
+ );
}
override func pluginInitialize() {
super.pluginInitialize()
}
-}
-
+}
\ No newline at end of file
diff --git a/plugins/cordova-plugin-fingerprint-aio/www/Fingerprint.js b/plugins/cordova-plugin-fingerprint-aio/www/Fingerprint.js
index 7332656..e01debe 100644
--- a/plugins/cordova-plugin-fingerprint-aio/www/Fingerprint.js
+++ b/plugins/cordova-plugin-fingerprint-aio/www/Fingerprint.js
@@ -1,7 +1,27 @@
/*global cordova */
-function Fingerprint() {
-}
+var Fingerprint = function() {
+};
+
+// Plugin Errors
+Fingerprint.prototype.BIOMETRIC_UNKNOWN_ERROR = -100;
+Fingerprint.prototype.BIOMETRIC_UNAVAILABLE = -101;
+Fingerprint.prototype.BIOMETRIC_AUTHENTICATION_FAILED = -102;
+Fingerprint.prototype.BIOMETRIC_SDK_NOT_SUPPORTED = -103;
+Fingerprint.prototype.BIOMETRIC_HARDWARE_NOT_SUPPORTED = -104;
+Fingerprint.prototype.BIOMETRIC_PERMISSION_NOT_GRANTED = -105;
+Fingerprint.prototype.BIOMETRIC_NOT_ENROLLED = -106;
+Fingerprint.prototype.BIOMETRIC_INTERNAL_PLUGIN_ERROR = -107;
+Fingerprint.prototype.BIOMETRIC_DISMISSED = -108;
+Fingerprint.prototype.BIOMETRIC_PIN_OR_PATTERN_DISMISSED = -109;
+Fingerprint.prototype.BIOMETRIC_SCREEN_GUARD_UNSECURED = -110;
+Fingerprint.prototype.BIOMETRIC_LOCKED_OUT = -111;
+Fingerprint.prototype.BIOMETRIC_LOCKED_OUT_PERMANENT = -112;
+
+// Biometric types
+Fingerprint.prototype.BIOMETRIC_TYPE_FINGERPRINT = "finger";
+Fingerprint.prototype.BIOMETRIC_TYPE_FACE = "face";
+Fingerprint.prototype.BIOMETRIC_TYPE_COMMON = "biometric";
Fingerprint.prototype.show = function (params, successCallback, errorCallback) {
cordova.exec(
diff --git a/plugins/fetch.json b/plugins/fetch.json
index 8734bac..99f7154 100644
--- a/plugins/fetch.json
+++ b/plugins/fetch.json
@@ -1,14 +1,4 @@
{
- "cordova-plugin-fingerprint-aio": {
- "source": {
- "type": "registry",
- "id": "cordova-plugin-fingerprint-aio"
- },
- "is_top_level": true,
- "variables": {
- "FACEID_USAGE_DESCRIPTION": "认证中..."
- }
- },
"cordova-plugin-touch-id": {
"source": {
"type": "registry",
@@ -153,5 +143,13 @@
},
"is_top_level": true,
"variables": {}
+ },
+ "cordova-plugin-fingerprint-aio": {
+ "source": {
+ "type": "registry",
+ "id": "cordova-plugin-fingerprint-aio"
+ },
+ "is_top_level": true,
+ "variables": {}
}
}
\ No newline at end of file
diff --git a/plugins/ios.json b/plugins/ios.json
index 22f9574..523315b 100644
--- a/plugins/ios.json
+++ b/plugins/ios.json
@@ -10,10 +10,6 @@
"cordova-plugin-advanced-http": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
},
- "cordova-plugin-fingerprint-aio": {
- "FACEID_USAGE_DESCRIPTION": "认证中...",
- "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
- },
"cordova-plugin-statusbar": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
},
@@ -58,6 +54,10 @@
},
"cordova-plugin-file": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
+ },
+ "cordova-plugin-fingerprint-aio": {
+ "FACEID_USAGE_DESCRIPTION": " ",
+ "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}
},
"dependent_plugins": {