fix(multi-account): account removal now switches or logs out properly
removeAccountFromStorage was calling loadSavedAccount() which reads from legacy last_account.txt — didn't trigger feed/relay reload. Now calls switchAccount(nextNpub) for proper relay reconnection and feed reload, or logout(deleteKey=true) if no accounts remain. Also cleans up bunker ephemeral keys on removal. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+9
-5
@@ -704,16 +704,20 @@ class AccountManager internal constructor(
|
|||||||
secureStorage.deletePrivateKey(npub)
|
secureStorage.deletePrivateKey(npub)
|
||||||
} catch (_: SecureStorageException) {
|
} catch (_: SecureStorageException) {
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
secureStorage.deletePrivateKey(bunkerEphemeralKeyAlias(npub))
|
||||||
|
} catch (_: SecureStorageException) {
|
||||||
|
}
|
||||||
|
|
||||||
refreshAccountList()
|
refreshAccountList()
|
||||||
|
|
||||||
// If we removed the active account, load the next one or log out
|
// If we removed the active account, switch to next or log out
|
||||||
if (current?.npub == npub) {
|
if (current?.npub == npub) {
|
||||||
val next = accountStorage.currentAccount()
|
val nextNpub = accountStorage.currentAccount()
|
||||||
if (next != null) {
|
if (nextNpub != null) {
|
||||||
loadSavedAccount()
|
switchAccount(nextNpub)
|
||||||
} else {
|
} else {
|
||||||
logout(deleteKey = false)
|
logout(deleteKey = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user