Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Display Touch ID dialog on Android (if supported) #1312

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kaloudis
Copy link

@kaloudis kaloudis commented Sep 27, 2019

Please hold: waiting for an update to expo

See this comment

@CLAassistant
Copy link

CLAassistant commented Sep 27, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@tanx tanx left a 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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactor 👍

@@ -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';
Copy link
Contributor

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/

Copy link
Author

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

@tanx
Copy link
Contributor

tanx commented Sep 27, 2019

Please hold: I still need to test on Android. Currently having issues on gomobile init

What’s the error? Make sure to use go@1.13 and upgrade to the newest gomobile and falafel versions.

-Leverage BiometricPrompt API from Java component
-Set up androidx
-Update expo-constants and react-native-unimodules
-Call BiometricPrompt Java code from react
@kaloudis
Copy link
Author

I've updated the code to use theBiometricPrompt api, but it is based on androidx and Expo needs to put out a release with this PR: expo/expo#5521

Otherwise error: package android.support.annotation does not exist gets returned from mobile/node_modules/expo-constants/android/src/main/java/expo/modules/constants/ConstantsService.java

.setNegativeButton("Cancel")
.build();
}
}
Copy link
Author

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.

Copy link
Contributor

@tanx tanx left a 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?

@kaloudis
Copy link
Author

@kaloudis thanks for the changes. Looks like this isn't compatible with the current version of expo?

that's correct

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants