[#1496] Authentication success after previous failure

- Closes #1496
- The onFailed callback now does not reset the helper compose variable anymore
- Toast duration shortened in the auth failed state to improve its UX
- Changelog update
This commit is contained in:
Honza Rychnovský 2024-06-28 16:23:45 +02:00 committed by GitHub
parent 490bc40caf
commit 508552f0fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 8 deletions

View File

@ -12,6 +12,9 @@ directly impact users rather than highlighting other key architectural updates.*
### Added ### Added
- Proper ZEC amount abbreviation has been added across the entire app as described by the design document - Proper ZEC amount abbreviation has been added across the entire app as described by the design document
### Fixed
- The app authentication now correctly handles authentication success after a previous failed state
## [1.1.2 (676)] - 2024-06-24 ## [1.1.2 (676)] - 2024-06-24
### Fixed ### Fixed

View File

@ -341,7 +341,7 @@ private fun MainActivity.ShowSystemAuthentication(
setCheckedProperty(false) setCheckedProperty(false)
}, },
onFailed = { onFailed = {
setCheckedProperty(false) // No action needed
}, },
useCase = protectedUseCase useCase = protectedUseCase
) )

View File

@ -234,7 +234,7 @@ class AuthenticationViewModel(
*/ */
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) { override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
super.onAuthenticationSucceeded(result) super.onAuthenticationSucceeded(result)
Twig.info { "Authentication successful: $result" } Twig.info { "Authentication successful" }
authenticationResult.value = AuthenticationResult.Success authenticationResult.value = AuthenticationResult.Success
} }

View File

@ -140,7 +140,8 @@ private fun WrapDeleteWalletAuth(
Twig.warn { "Authentication result: failed" } Twig.warn { "Authentication result: failed" }
authenticationViewModel.resetAuthenticationResult() authenticationViewModel.resetAuthenticationResult()
onFailed() onFailed()
Toast.makeText(activity, activity.getString(R.string.authentication_toast_failed), Toast.LENGTH_LONG).show() Toast.makeText(activity, activity.getString(R.string.authentication_toast_failed), Toast.LENGTH_SHORT)
.show()
} }
is AuthenticationResult.Error -> { is AuthenticationResult.Error -> {
Twig.error { Twig.error {
@ -212,7 +213,7 @@ private fun WrapAppExportPrivateDataAuth(
Twig.warn { "Authentication result: failed" } Twig.warn { "Authentication result: failed" }
authenticationViewModel.resetAuthenticationResult() authenticationViewModel.resetAuthenticationResult()
onFailed() onFailed()
Toast.makeText(activity, stringResource(id = R.string.authentication_toast_failed), Toast.LENGTH_LONG) Toast.makeText(activity, stringResource(id = R.string.authentication_toast_failed), Toast.LENGTH_SHORT)
.show() .show()
} }
is AuthenticationResult.Error -> { is AuthenticationResult.Error -> {
@ -285,7 +286,7 @@ private fun WrapSeedRecoveryAuth(
Twig.warn { "Authentication result: failed" } Twig.warn { "Authentication result: failed" }
authenticationViewModel.resetAuthenticationResult() authenticationViewModel.resetAuthenticationResult()
onFailed() onFailed()
Toast.makeText(activity, stringResource(id = R.string.authentication_toast_failed), Toast.LENGTH_LONG) Toast.makeText(activity, stringResource(id = R.string.authentication_toast_failed), Toast.LENGTH_SHORT)
.show() .show()
} }
is AuthenticationResult.Error -> { is AuthenticationResult.Error -> {
@ -359,7 +360,7 @@ private fun WrapSendFundsAuth(
Twig.warn { "Authentication result: failed" } Twig.warn { "Authentication result: failed" }
authenticationViewModel.resetAuthenticationResult() authenticationViewModel.resetAuthenticationResult()
onFailed() onFailed()
Toast.makeText(activity, stringResource(id = R.string.authentication_toast_failed), Toast.LENGTH_LONG) Toast.makeText(activity, stringResource(id = R.string.authentication_toast_failed), Toast.LENGTH_SHORT)
.show() .show()
} }
is AuthenticationResult.Error -> { is AuthenticationResult.Error -> {
@ -432,7 +433,7 @@ private fun WrapAppAccessAuth(
AuthenticationResult.Canceled -> { AuthenticationResult.Canceled -> {
Twig.info { "Authentication result: canceled: shutting down" } Twig.info { "Authentication result: canceled: shutting down" }
authenticationViewModel.resetAuthenticationResult() authenticationViewModel.resetAuthenticationResult()
Toast.makeText(activity, stringResource(id = R.string.authentication_toast_canceled), Toast.LENGTH_LONG) Toast.makeText(activity, stringResource(id = R.string.authentication_toast_canceled), Toast.LENGTH_SHORT)
.show() .show()
onCancel() onCancel()
} }

View File

@ -228,12 +228,13 @@ internal fun WrapSendConfirmation(
synchronizer = synchronizer, synchronizer = synchronizer,
) )
} }
sendFundsAuthentication.value = false
}, },
onCancel = { onCancel = {
sendFundsAuthentication.value = false sendFundsAuthentication.value = false
}, },
onFailed = { onFailed = {
sendFundsAuthentication.value = false // No action needed
}, },
useCase = AuthenticationUseCase.SendFunds useCase = AuthenticationUseCase.SendFunds
) )