feat: Enhance avatar management with detailed logging and error handling
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user