BiometricAuthentication icon indicating copy to clipboard operation
BiometricAuthentication copied to clipboard

Modify the return value type of canAuthenticate()

Open JJson opened this issue 6 years ago • 3 comments

Modify the return value type of canAuthenticate() to verify that the device and settings are available before authenticating

JJson avatar Dec 13 '18 10:12 JJson

@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.

rushisangani avatar Dec 14 '18 06:12 rushisangani

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.

JJson avatar Dec 14 '18 07:12 JJson

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Apr 28 '22 09:04 sonarqubecloud[bot]