-
Notifications
You must be signed in to change notification settings - Fork 172
Display Touch ID dialog on Android (if supported) #1312
base: master
Are you sure you want to change the base?
Conversation
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.
@kaloudis thanks for the PR. Feedback below...
const isEnrolled = await this._Fingerprint.isEnrolledAsync(); | ||
if (!hasHardware || !isEnrolled) { | ||
const hasFingerprint = await this.checkFingerprintHardwareAndEnrollment(); | ||
if (!hasFingerprint) { |
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.
Nice refactor 👍
src/view/pin-mobile.js
Outdated
@@ -37,6 +37,9 @@ class PinView extends React.Component { | |||
|
|||
render() { | |||
const { store, auth } = this.props; | |||
const unlockText = this.props.auth.checkFingerprintHardwareAndEnrollment() | |||
? 'Unlock with your pin or fingerprint' | |||
: 'Unlock with your pin'; |
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.
May I suggest using the Android's native FingerprintDialog
api:
https://medium.com/exploring-android/exploring-android-p-fingerprint-dialog-fa672ae62c6f
There are react-native modules that seem to offer some type of dialog UI for Android as well:
https://github.com/jariz/react-native-fingerprint-android
https://github.com/hieuvp/react-native-fingerprint-scanner
But those seems to be full fledged replacements for the expo-local-authentication
module that we're using. But if we can offer a native look and feel for auth on each platform it might be worth replacing that one:
https://docs.expo.io/versions/latest/sdk/local-authentication/
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.
It looks like FingerprintDialog
has moved over to BiometricPrompt
https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder
What’s the error? Make sure to use |
-Leverage BiometricPrompt API from Java component -Set up androidx -Update expo-constants and react-native-unimodules -Call BiometricPrompt Java code from react
I've updated the code to use the Otherwise |
.setNegativeButton("Cancel") | ||
.build(); | ||
} | ||
} |
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.
I will likely add an error handler, (and possibly a success handler) to this file after seeing how it behaves as it.
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.
@kaloudis thanks for the changes. Looks like this isn't compatible with the current version of expo?
that's correct |
Please hold: waiting for an update to expo
See this comment