BiometricAuthentication
BiometricAuthentication copied to clipboard
Modify the return value type of canAuthenticate()
Modify the return value type of canAuthenticate() to verify that the device and settings are available before authenticating
@JJson I don't think all these steps are required for canAuthenticate()
method.
Just true or false return is fine because anyways user needs to handle all those failure cases.
It would be repetitive handling for authenticateWithBioMetrics()
method.
and handling these failure cases in authenticateWithBioMetrics()
makes better sense than canAuthenticate()
method.
let me know your thoughts. thanks.
I think it is better to distinguish the type of error before authentication (for example, the device is not supported, the settings are not authorized, etc.) and the errors in the authentication process (such as fingerprint errors, face errors, etc.).
In my application, the process is like this: first check if the device supports, whether the permission is enabled, if not, prompt the user to open, and then initiate authentication. So I need to call canAuthenticate() first. If there is an error, the prompt needs to give a specific reason, so I need canAuthenticate() to return the specific error type.