Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Clear electron data when logging out #10386

Merged
merged 1 commit into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/BasePlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,12 @@ export default abstract class BasePlatform {
logger.error("idbDelete failed in destroyPickleKey", e);
}
}

/**
* Clear app storage, called when logging out to perform data clean up.
*/
public async clearStorage(): Promise<void> {
window.sessionStorage.clear();
window.localStorage.clear();
}
}
1 change: 1 addition & 0 deletions src/Lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ export async function onLoggedOut(): Promise<void> {
stopMatrixClient();
await clearStorage({ deleteEverything: true });
LifecycleCustomisations.onLoggedOutAndStorageCleared?.();
await PlatformPeg.get()?.clearStorage();

// Do this last, so we can make sure all storage has been cleared and all
// customisations got the memo.
Expand Down