Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use biometricpromt and more consistent callbacks #179

Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
7b2f741
Merge pull request #1 from NiklasMerz/master
greaterking Aug 6, 2019
aa90d42
APP-445
Aug 7, 2019
928bce6
APP-445
Aug 7, 2019
6b30a3b
- using lib for prompt proved to be far better then trying to keep so…
Aug 8, 2019
12ba82f
- using lib for prompt proved to be far better then trying to keep so…
Aug 9, 2019
4099d6b
- testing isAvailable
Aug 10, 2019
f52ba1d
- added to .gitignore
Aug 11, 2019
1efb7f3
Merge remote-tracking branch 'origin/2.0.0-biometricpromt-and-consist…
Aug 11, 2019
714abb1
- error codes are consistent across all platforms
Aug 15, 2019
4e36cc6
- constants reminder
Aug 16, 2019
ddacc62
Merge remote-tracking branch 'origin/2.0.0-biometricpromt-and-consist…
Aug 16, 2019
012d98f
- made description and subtitle optional in android if null is passed…
Aug 17, 2019
cb1104b
- removed res folder since it's not needed
Aug 17, 2019
fafa4df
- testing if draft pr gets updated when not in review mode
Aug 17, 2019
b41944b
- trying to fix cognitive complexity stuff
Aug 17, 2019
8e03551
- fixing too many returns
Aug 17, 2019
2d41eae
License notes
NiklasMerz Aug 17, 2019
ce4be4c
Merge branch 'master' into 2.0.0-biometricpromt-and-consistent-callbacks
NiklasMerz Aug 17, 2019
0796c2b
Fix linting error
NiklasMerz Aug 17, 2019
1f358d5
- updating reademe
Aug 18, 2019
02e0256
https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio/pull/179…
Sep 21, 2019
5e2e4b1
- fixing else if condition
Sep 24, 2019
d8e5ab4
Upgrade android project with https://github.com/exxbrain/android-biom…
exxbrain Oct 10, 2019
e02a01a
Update android-biometric to version 0.3
exxbrain Oct 10, 2019
7861ae3
Fix returning success message
exxbrain Oct 12, 2019
1f38c58
Add a comment why we always return "finger" in Android
exxbrain Oct 12, 2019
b1c4101
Merge pull request #2 from exxbrain/2.0.0-biometricpromt-and-consiste…
greaterking Oct 12, 2019
a4374a2
Fix compilation error
exxbrain Oct 12, 2019
682676e
Merge branch '2.0.0-biometricpromt-and-consistent-callbacks' into gre…
exxbrain Oct 12, 2019
5922172
Fixed some codeclimate errors
exxbrain Oct 12, 2019
bbf24eb
Merge pull request #3 from exxbrain/2.0.0-biometricpromt-and-consiste…
greaterking Oct 12, 2019
52abe99
Revert "2.0.0 biometricpromt and consistent callbacks"
greaterking Oct 12, 2019
2ceac63
Merge pull request #4 from greaterking/revert-3-2.0.0-biometricpromt-…
greaterking Oct 12, 2019
bbeefbb
Revert "Revert "2.0.0 biometricpromt and consistent callbacks""
exxbrain Oct 12, 2019
06a94e1
Merge pull request #5 from exxbrain/2.0.0-biometricpromt-and-consiste…
greaterking Oct 13, 2019
2f36680
Code climate related fixes
exxbrain Oct 13, 2019
b7bfda6
Merge pull request #6 from exxbrain/2.0.0-biometricpromt-and-consiste…
greaterking Oct 13, 2019
533fb2f
Merge branch 'NiklasMerz/master' into 2.0.0-biometricpromt-and-consis…
exxbrain Oct 13, 2019
bdfd9f9
Merge pull request #7 from exxbrain/2.0.0-biometricpromt-and-consiste…
greaterking Oct 13, 2019
177d04a
- remove mention of @anitaa1990 aar lib ..since its no longer being u…
Oct 14, 2019
885ef2c
Update library to use aar file.
Oct 15, 2019
f7d75c9
Merge branch 'greaterking/2.0.0-biometricpromt-and-consistent-callbac…
exxbrain Oct 15, 2019
d262c16
Several fixes according to code review. Upgrade to full clone of andr…
exxbrain Oct 15, 2019
01ce93f
Rotation behaviour fix
exxbrain Oct 16, 2019
cc39ba9
Do not close dialog on fail.
exxbrain Oct 16, 2019
53ec6f0
Some refactoring
Oct 16, 2019
9c0ba00
Fix codeclimate warning
Oct 16, 2019
7e5ff42
Merge pull request #8 from exxbrain/2.0.0-biometricpromt-and-consiste…
greaterking Oct 16, 2019
cee5950
Handle BiometricPrompt.ERROR_USER_CANCELED
Oct 17, 2019
4518ca6
Remove cordova-android version from tests
Oct 17, 2019
96397eb
android-biometric.aar annotation
Oct 17, 2019
9b594c6
Merge pull request #9 from exxbrain/2.0.0-biometricpromt-and-consiste…
greaterking Oct 18, 2019
b2ab181
Add "biometric" type
Oct 18, 2019
6a64907
Merge pull request #10 from exxbrain/2.0.0-biometricpromt-and-consist…
greaterking Oct 18, 2019
5310c2c
- removed all occurrences of "FINGERPRINT" in constants to make them …
Nov 1, 2019
f4a312b
Add __cancelButtonTitle__ for Android
NiklasMerz Nov 12, 2019
ccc8a47
Gitignore Android project
NiklasMerz Nov 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
node_modules/
package-lock.json
/.idea/$CACHE_FILE$
/.idea/.gitignore
/.idea/cordova-plugin-fingerprint-aio.iml
/.idea/misc.xml
/.idea/modules.xml
/.idea/inspectionProfiles/Project_Default.xml
/.idea/vcs.xml
60 changes: 43 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,34 +84,58 @@ Fingerprint.isAvailable(isAvailableSuccess, isAvailableError);
alert("Fingerprint available");
}

function isAvailableError(message) {
// 'message' will be an object with an error code and message
console.log(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", //Android: Used for encryption. iOS: used for dialogue if no `localizedReason` is given.
clientSecret: "o7aoOMYUbyxaD23oFAnJ" //Necessary for Android encrpytion of keys. Use random secret key.
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**

* __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.

## Thanks to the authors of the original fingerprint plugins
### Optional parameters

* __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.

### 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_FINGERPRINT_NOT_ENROLLED** = `-106`;
- **BIOMETRIC_INTERNAL_PLUGIN_ERROR** = `-107`;
- **BIOMETRIC_FINGERPRINT_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:

Expand All @@ -121,7 +145,9 @@ Some code is refactored from their projects and I learned how to make Cordova pl

[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).

38 changes: 7 additions & 31 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -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="2.0.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.0">
<name>FingerprintAllInOne</name>
<description>Cordova plugin to use fingerprint on Android and iOS</description>
<license>MIT</license>
Expand All @@ -11,7 +11,6 @@
<clobbers target="Fingerprint"/>
</js-module>



<!-- ios -->
<platform name="ios">
Expand All @@ -38,37 +37,14 @@
<param name="android-package" value="de.niklasmerz.cordova.fingerprint.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_aio_fingerprint_error.xml" target-dir="res/drawable"/>
<source-file src="res/android/drawable/ic_aio_fingerprint_success.xml" target-dir="res/drawable"/>
<resource-file src="res/android/drawable-hdpi/aio_ic_fp_40px.png" target="res/drawable-hdpi/aio_ic_fp_40px.png"/>
<resource-file src="res/android/drawable-mdpi/aio_ic_fp_40px.png" target="res/drawable-mdpi/aio_ic_fp_40px.png"/>
<resource-file src="res/android/drawable-nodpi/aio_android_robot.png" target="res/drawable-nodpi/aio_android_robot.png"/>
<resource-file src="res/android/drawable-xhdpi/aio_ic_fp_40px.png" target="res/drawable-xhdpi/aio_ic_fp_40px.png"/>
<resource-file src="res/android/drawable-xxhdpi/aio_ic_fp_40px.png" target="res/drawable-xxhdpi/aio_ic_fp_40px.png"/>
<resource-file src="res/android/drawable-xxxhdpi/aio_ic_fp_40px.png" target="res/drawable-xxxhdpi/aio_ic_fp_40px.png"/>
<source-file src="res/android/layout/aio_fingerprint_dialog_container.xml" target-dir="res/layout"/>
<source-file src="res/android/layout/aio_fingerprint_dialog_content.xml" target-dir="res/layout"/>
<source-file src="res/android/values/aio_fpauth-colors.xml" target-dir="res/values"/>
<source-file src="res/android/values/aio_fpauth-strings.xml" target-dir="res/values"/>
<source-file src="res/android/values-es/aio_fpauth-strings.xml" target-dir="res/values-es"/>
<source-file src="res/android/values-de/aio_fpauth-strings.xml" target-dir="res/values-de"/>
<source-file src="res/android/values-fr/aio_fpauth-strings.xml" target-dir="res/values-fr"/>
<source-file src="res/android/values-zh/aio_fpauth-strings.xml" target-dir="res/values-zh"/>
<source-file src="res/android/values-pt/aio_fpauth-strings.xml" target-dir="res/values-pt"/>
<source-file src="res/android/values-it/aio_fpauth-strings.xml" target-dir="res/values-it"/>
<source-file src="res/android/values-el/aio_fpauth-strings.xml" target-dir="res/values-el"/>
<source-file src="res/android/values-zh-rTW/aio_fpauth-strings.xml" target-dir="res/values-zh-rTW"/>
<source-file src="res/android/values-nl/aio_fpauth-strings.xml" target-dir="res/values-nl"/>
<source-file src="res/android/values-da/aio_fpauth-strings.xml" target-dir="res/values-da"/>
<source-file src="res/android/values-sv/aio_fpauth-strings.xml" target-dir="res/values-sv"/>
<source-file src="res/android/values-ru/aio_fpauth-strings.xml" target-dir="res/values-ru"/>

<framework src="src/android/build.gradle" custom="true" type="gradleReference"/>
<resource-file src="src/android/libs/biometric.aar" target="libs/biometric.aar" />
<source-file src="src/android/Fingerprint.java" target-dir="src/de/niklasmerz/cordova/biometric"/>
</platform>

</plugin>
Binary file removed res/android/drawable-hdpi/aio_ic_fp_40px.png
Binary file not shown.
Binary file removed res/android/drawable-mdpi/aio_ic_fp_40px.png
Binary file not shown.
Binary file removed res/android/drawable-nodpi/aio_android_robot.png
Binary file not shown.
Binary file removed res/android/drawable-xhdpi/aio_ic_fp_40px.png
Binary file not shown.
Binary file removed res/android/drawable-xxhdpi/aio_ic_fp_40px.png
Binary file not shown.
Binary file removed res/android/drawable-xxxhdpi/aio_ic_fp_40px.png
Binary file not shown.
28 changes: 0 additions & 28 deletions res/android/drawable/ic_aio_fingerprint_error.xml

This file was deleted.

28 changes: 0 additions & 28 deletions res/android/drawable/ic_aio_fingerprint_success.xml

This file was deleted.

61 changes: 0 additions & 61 deletions res/android/layout/aio_fingerprint_dialog_container.xml

This file was deleted.

58 changes: 0 additions & 58 deletions res/android/layout/aio_fingerprint_dialog_content.xml

This file was deleted.

13 changes: 0 additions & 13 deletions res/android/values-da/aio_fpauth-strings.xml

This file was deleted.

28 changes: 0 additions & 28 deletions res/android/values-de/aio_fpauth-strings.xml

This file was deleted.

13 changes: 0 additions & 13 deletions res/android/values-el/aio_fpauth-strings.xml

This file was deleted.

Loading