From 253b664a910e494c8739b4d4a83056e1d58ec80b Mon Sep 17 00:00:00 2001 From: Julian KOUNE Date: Wed, 30 Aug 2023 15:40:01 +0200 Subject: [PATCH] fixup! fix: clean tom db on logout --- lib/data/hive/hive_collection_tom_database.dart | 2 +- lib/widgets/matrix.dart | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/data/hive/hive_collection_tom_database.dart b/lib/data/hive/hive_collection_tom_database.dart index cc4ded36cd..c66504e431 100644 --- a/lib/data/hive/hive_collection_tom_database.dart +++ b/lib/data/hive/hive_collection_tom_database.dart @@ -121,7 +121,7 @@ class HiveCollectionToMDatabase { Future clear() async { Logs().w('Delete database and storage key...'); - const FlutterSecureStorage() + await const FlutterSecureStorage() .delete(key: FlutterHiveCollectionsDatabase.cipherStorageKey); await tomConfigurationsBox.clear(); await Hive.deleteFromDisk(); diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index f13b00b509..505ecf9adc 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -107,8 +107,6 @@ class MatrixState extends State with WidgetsBindingObserver { late String currentClientSecret; RequestTokenResponse? currentThreepidCreds; - final hiveCollectionToMDatabase = getIt.get(); - void setActiveClient(Client? cl) { final i = widget.clients.indexWhere((c) => c == cl); if (i != -1) { @@ -191,7 +189,7 @@ class MatrixState extends State with WidgetsBindingObserver { Future logout() async { await client.logout(); - await hiveCollectionToMDatabase.clear(); + getIt.get().clear(); } Client? getClientByName(String name) => @@ -365,7 +363,7 @@ class MatrixState extends State with WidgetsBindingObserver { if (state == LoginState.loggedIn) { navigatorContext?.go('/rooms'); } else { - hiveCollectionToMDatabase.clear(); + getIt.get().clear(); } } });