From 78554b3b725f0aaf1554efb4130f983be01440b5 Mon Sep 17 00:00:00 2001 From: M3DZIK Date: Sat, 2 Mar 2024 13:04:45 +0100 Subject: [PATCH] Fix biometric reSetup loop --- .../android/ui/screens/vault/Vault.kt | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/dev/medzik/librepass/android/ui/screens/vault/Vault.kt b/app/src/main/java/dev/medzik/librepass/android/ui/screens/vault/Vault.kt index 972a75a0..6859cb01 100644 --- a/app/src/main/java/dev/medzik/librepass/android/ui/screens/vault/Vault.kt +++ b/app/src/main/java/dev/medzik/librepass/android/ui/screens/vault/Vault.kt @@ -109,10 +109,11 @@ fun VaultScreen( if (checkIfBiometricAvailable(context)) { showBiometricPromptForSetup( context as MainActivity, - KeyStore.initForEncryption( - KeyAlias.BiometricAesKey, - deviceAuthentication = true - ), + cipher = + KeyStore.initForEncryption( + KeyAlias.BiometricAesKey, + deviceAuthentication = true + ), onAuthenticationSucceeded = { cipher -> scope.launch(Dispatchers.IO) { val encryptedData = KeyStore.encrypt(cipher, viewModel.vault.aesKey) @@ -125,17 +126,15 @@ fun VaultScreen( ) ) } - - navController.navigate( - screen = Screen.Vault, - disableBack = true - ) }, onAuthenticationFailed = { - navController.navigate( - screen = Screen.Vault, - disableBack = true - ) + scope.launch(Dispatchers.IO) { + viewModel.credentialRepository.update( + credentials.copy( + biometricReSetup = false + ) + ) + } } ) } else {