mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-12-11 06:26:03 -05:00
cleanup
This commit is contained in:
parent
8c89ce91cf
commit
9dfb8c3f71
16 changed files with 305 additions and 162 deletions
|
|
@ -168,7 +168,15 @@ class AccountRepository {
|
|||
}
|
||||
|
||||
/// Remove an account and wipe the messages for this account from this device
|
||||
Future<bool> deleteLocalAccount(TypedKey superIdentityRecordKey) async {
|
||||
Future<bool> deleteLocalAccount(TypedKey superIdentityRecordKey,
|
||||
OwnedDHTRecordPointer? accountRecord) async {
|
||||
// Delete the account record locally which causes a deep delete
|
||||
// of all the contacts, invites, chats, and messages in the dht record
|
||||
// pool
|
||||
if (accountRecord != null) {
|
||||
await DHTRecordPool.instance.deleteRecord(accountRecord.recordKey);
|
||||
}
|
||||
|
||||
await logout(superIdentityRecordKey);
|
||||
|
||||
final localAccounts = await _localAccounts.get();
|
||||
|
|
@ -178,8 +186,6 @@ class AccountRepository {
|
|||
await _localAccounts.set(newLocalAccounts);
|
||||
_streamController.add(AccountRepositoryChange.localAccounts);
|
||||
|
||||
// TO DO: wipe messages
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -367,6 +373,11 @@ class AccountRepository {
|
|||
return;
|
||||
}
|
||||
|
||||
if (logoutUser == activeLocalAccount) {
|
||||
await switchToAccount(
|
||||
_localAccounts.value.firstOrNull?.superIdentity.recordKey);
|
||||
}
|
||||
|
||||
final logoutUserLogin = fetchUserLogin(logoutUser);
|
||||
if (logoutUserLogin == null) {
|
||||
// Already logged out
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue