From ec4413550b48ab1e44c0f912b2e3de3b26525884 Mon Sep 17 00:00:00 2001 From: Bruno Windels <274386+bwindels@users.noreply.github.com> Date: Tue, 8 Nov 2022 07:59:26 +0100 Subject: [PATCH] apply method rename (and catch errors) --- src/domain/SessionLoadViewModel.js | 2 +- src/matrix/storage/idb/StorageFactory.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/domain/SessionLoadViewModel.js b/src/domain/SessionLoadViewModel.js index abc16299..e86d718f 100644 --- a/src/domain/SessionLoadViewModel.js +++ b/src/domain/SessionLoadViewModel.js @@ -154,7 +154,7 @@ export class SessionLoadViewModel extends ViewModel { } async logout() { - await this._client.logout(); + await this._client.startLogout(this.navigation.path.get("session").value); this.navigation.push("session", true); } diff --git a/src/matrix/storage/idb/StorageFactory.ts b/src/matrix/storage/idb/StorageFactory.ts index 44d481eb..722cf0a6 100644 --- a/src/matrix/storage/idb/StorageFactory.ts +++ b/src/matrix/storage/idb/StorageFactory.ts @@ -78,11 +78,15 @@ export class StorageFactory { return new Storage(db, this._idbFactory, this._IDBKeyRange, hasWebkitEarlyCloseTxnBug, this._localStorage, log.logger); } - delete(sessionId: string): Promise { + async delete(sessionId: string): Promise { const databaseName = sessionName(sessionId); - clearKeysFromLocalStorage(this._localStorage, databaseName); - const req = this._idbFactory.deleteDatabase(databaseName); - return reqAsPromise(req); + try { + clearKeysFromLocalStorage(this._localStorage, databaseName); + } catch (e) {} + try { + const req = this._idbFactory.deleteDatabase(databaseName); + await reqAsPromise(req); + } catch (e) {} } async export(sessionId: string, log: ILogItem): Promise {