From 1b8c7fea15aa8ebd01ffb0e242f297de05b1292a Mon Sep 17 00:00:00 2001 From: Julian KOUNE Date: Wed, 6 Sep 2023 15:24:10 +0200 Subject: [PATCH] fixup! fix: clean tom db on logout --- lib/data/hive/hive_collection_tom_database.dart | 1 + lib/widgets/matrix.dart | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/data/hive/hive_collection_tom_database.dart b/lib/data/hive/hive_collection_tom_database.dart index c66504e431..fd304a4cd4 100644 --- a/lib/data/hive/hive_collection_tom_database.dart +++ b/lib/data/hive/hive_collection_tom_database.dart @@ -124,6 +124,7 @@ class HiveCollectionToMDatabase { await const FlutterSecureStorage() .delete(key: FlutterHiveCollectionsDatabase.cipherStorageKey); await tomConfigurationsBox.clear(); + await _collection.deleteFromDisk(); await Hive.deleteFromDisk(); } } diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index cce66c54d6..4347bddb0a 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -355,8 +355,8 @@ class MatrixState extends State with WidgetsBindingObserver { navigatorContext?.go('/rooms'); } else { - setUpToMServicesInLogin(c); if (state == LoginState.loggedIn) { + await setUpToMServicesInLogin(c); navigatorContext?.go('/rooms'); } else { await getIt.get().clear(); @@ -488,7 +488,8 @@ class MatrixState extends State with WidgetsBindingObserver { } } - void setUpToMServicesInLogin(Client client) { + Future setUpToMServicesInLogin(Client client) async { + await HiveCollectionToMDatabase.databaseBuilder(); final tomServer = loginHomeserverSummary?.tomServer; if (tomServer != null) { _setUpToMServer(tomServer);