-
Notifications
You must be signed in to change notification settings - Fork 305
1. fix error.code; 2. Fix the android cancel button; 3. Add the method of authenticateDevice to enable device password #133
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
Open
orzhtml
wants to merge
10
commits into
hieuvp:master
Choose a base branch
from
orzhtml:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
94185b7
1、安卓新增参数 cancelButton
orzhtml 986f031
1、ios 优化错误信息,更全面
orzhtml 47a2683
修改 README.md
orzhtml 4f2b28f
修改 README.md
orzhtml 63facfc
修改 README.md
orzhtml 2ab5397
格式化代码
orzhtml 7b0eefc
Merge branch 'master' of https://github.com/hieuvp/react-native-finge…
orzhtml 944d7e3
Merge branch 'master' of https://github.com/hieuvp/react-native-finge…
orzhtml d1e6744
Merge branch 'master' of https://github.com/hieuvp/react-native-finge…
orzhtml 200af38
Merge branch 'hieuvp-master'
orzhtml File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -84,7 +84,7 @@ public AuthCallback(final Promise promise) { | |||||||||||||||||
| @Override | ||||||||||||||||||
| public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) { | ||||||||||||||||||
| super.onAuthenticationError(errorCode, errString); | ||||||||||||||||||
| this.promise.reject(biometricPromptErrName(errorCode), TYPE_BIOMETRICS); | ||||||||||||||||||
| this.promise.reject(biometricPromptErrName(errorCode), biometricPromptErrName(errorCode)); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| @Override | ||||||||||||||||||
|
|
@@ -115,7 +115,7 @@ public BiometricPrompt getBiometricPrompt(final Promise promise) { | |||||||||||||||||
| return biometricPrompt; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| private void biometricAuthenticate(final String description, final Promise promise) { | ||||||||||||||||||
| private void biometricAuthenticate(final String description, final String cancelButton, final Promise promise) { | ||||||||||||||||||
| UiThreadUtil.runOnUiThread( | ||||||||||||||||||
| new Runnable() { | ||||||||||||||||||
| @Override | ||||||||||||||||||
|
|
@@ -125,7 +125,7 @@ public void run() { | |||||||||||||||||
| PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder() | ||||||||||||||||||
| .setDeviceCredentialAllowed(false) | ||||||||||||||||||
| .setConfirmationRequired(false) | ||||||||||||||||||
| .setNegativeButtonText("Cancel") | ||||||||||||||||||
| .setNegativeButtonText(cancelButton) | ||||||||||||||||||
| .setTitle(description) | ||||||||||||||||||
| .build(); | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -146,7 +146,7 @@ private String biometricPromptErrName(int errCode) { | |||||||||||||||||
| case BiometricPrompt.ERROR_LOCKOUT: | ||||||||||||||||||
| return "DeviceLocked"; | ||||||||||||||||||
| case BiometricPrompt.ERROR_LOCKOUT_PERMANENT: | ||||||||||||||||||
| return "DeviceLocked"; | ||||||||||||||||||
| return "DeviceLockedPermanent"; | ||||||||||||||||||
| case BiometricPrompt.ERROR_NEGATIVE_BUTTON: | ||||||||||||||||||
| return "UserCancel"; | ||||||||||||||||||
| case BiometricPrompt.ERROR_NO_BIOMETRICS: | ||||||||||||||||||
|
|
@@ -188,19 +188,18 @@ private String getSensorError() { | |||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| @ReactMethod | ||||||||||||||||||
| public void authenticate(String description, final Promise promise) { | ||||||||||||||||||
| public void authenticate(String description, String cancelButton, final Promise promise) { | ||||||||||||||||||
| if (requiresLegacyAuthentication()) { | ||||||||||||||||||
| legacyAuthenticate(promise); | ||||||||||||||||||
| } | ||||||||||||||||||
| else { | ||||||||||||||||||
| final String errorName = getSensorError(); | ||||||||||||||||||
| if (errorName != null) { | ||||||||||||||||||
| promise.reject(errorName, TYPE_BIOMETRICS); | ||||||||||||||||||
| ReactNativeFingerprintScannerModule.this.release(); | ||||||||||||||||||
| promise.reject(errorName, errorName); | ||||||||||||||||||
| return; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| biometricAuthenticate(description, promise); | ||||||||||||||||||
| biometricAuthenticate(description, cancelButton, promise); | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -234,13 +233,12 @@ public void isSensorAvailable(final Promise promise) { | |||||||||||||||||
| // current API | ||||||||||||||||||
| String errorName = getSensorError(); | ||||||||||||||||||
| if (errorName != null) { | ||||||||||||||||||
| promise.reject(errorName, TYPE_BIOMETRICS); | ||||||||||||||||||
| promise.reject(errorName, errorName); | ||||||||||||||||||
| } else { | ||||||||||||||||||
| promise.resolve(TYPE_BIOMETRICS); | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| // for Samsung/MeiZu compat, Android v16-23 | ||||||||||||||||||
| private FingerprintIdentify getFingerprintIdentify() { | ||||||||||||||||||
| if (mFingerprintIdentify != null) { | ||||||||||||||||||
|
|
@@ -287,13 +285,17 @@ private void legacyAuthenticate(final Promise promise) { | |||||||||||||||||
| @Override | ||||||||||||||||||
| public void onSucceed() { | ||||||||||||||||||
| promise.resolve(true); | ||||||||||||||||||
| ReactNativeFingerprintScannerModule.this.release(); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| @Override | ||||||||||||||||||
| public void onNotMatch(int availableTimes) { | ||||||||||||||||||
| mReactContext.getJSModule(RCTDeviceEventEmitter.class) | ||||||||||||||||||
| .emit("FINGERPRINT_SCANNER_AUTHENTICATION", "AuthenticationNotMatch"); | ||||||||||||||||||
| if( availableTimes <= 0 ){ | ||||||||||||||||||
| mReactContext.getJSModule(RCTDeviceEventEmitter.class) | ||||||||||||||||||
| .emit("FINGERPRINT_SCANNER_AUTHENTICATION", "AuthenticationLockout"); | ||||||||||||||||||
| }else{ | ||||||||||||||||||
|
||||||||||||||||||
| if( availableTimes <= 0 ){ | |
| mReactContext.getJSModule(RCTDeviceEventEmitter.class) | |
| .emit("FINGERPRINT_SCANNER_AUTHENTICATION", "AuthenticationLockout"); | |
| }else{ | |
| if (availableTimes <= 0) { | |
| mReactContext.getJSModule(RCTDeviceEventEmitter.class) | |
| .emit("FINGERPRINT_SCANNER_AUTHENTICATION", "AuthenticationLockout"); | |
| } else { |
I think general whitespace style (the majority at least) is like this in the file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the android implementation using a different signature than iOS before? It is inconvenient to have separate APIs for the platforms, but maybe that is unavoidable