feat: Enhance avatar management with detailed logging and error handling

This commit is contained in:
2026-01-24 00:26:23 +05:00
parent b08bea2c14
commit 1367864008
11 changed files with 107 additions and 324 deletions

View File

@@ -735,24 +735,28 @@ fun UnlockScreen(
onUnlocking = { isUnlocking = it },
onError = { error = it },
onSuccess = { decryptedAccount ->
// If biometric is enabled, save password
// If biometric is enabled and password not saved yet, save password
if (biometricAvailable is BiometricAvailability.Available &&
isBiometricEnabled && activity != null) {
scope.launch {
biometricManager.encryptPassword(
activity = activity,
password = password,
onSuccess = { encryptedPassword ->
scope.launch {
biometricPrefs.saveEncryptedPassword(
decryptedAccount.publicKey,
encryptedPassword
)
}
},
onError = { /* Ignore save errors */ },
onCancel = { /* User cancelled */ }
)
// Check if password is already saved
val hasPassword = biometricPrefs.hasEncryptedPassword(decryptedAccount.publicKey)
if (!hasPassword) {
biometricManager.encryptPassword(
activity = activity,
password = password,
onSuccess = { encryptedPassword ->
scope.launch {
biometricPrefs.saveEncryptedPassword(
decryptedAccount.publicKey,
encryptedPassword
)
}
},
onError = { /* Ignore save errors */ },
onCancel = { /* User cancelled */ }
)
}
}
}
onUnlocked(decryptedAccount)