Skip to content

Commit

Permalink
fixup! fix: clean tom db on logout
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian KOUNE committed Sep 6, 2023
1 parent c76d20d commit 1b8c7fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/data/hive/hive_collection_tom_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class HiveCollectionToMDatabase {
await const FlutterSecureStorage()
.delete(key: FlutterHiveCollectionsDatabase.cipherStorageKey);
await tomConfigurationsBox.clear();
await _collection.deleteFromDisk();
await Hive.deleteFromDisk();
}
}
5 changes: 3 additions & 2 deletions lib/widgets/matrix.dart
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {

navigatorContext?.go('/rooms');
} else {
setUpToMServicesInLogin(c);
if (state == LoginState.loggedIn) {
await setUpToMServicesInLogin(c);
navigatorContext?.go('/rooms');
} else {
await getIt.get<HiveCollectionToMDatabase>().clear();
Expand Down Expand Up @@ -488,7 +488,8 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
}
}

void setUpToMServicesInLogin(Client client) {
Future<void> setUpToMServicesInLogin(Client client) async {
await HiveCollectionToMDatabase.databaseBuilder();
final tomServer = loginHomeserverSummary?.tomServer;
if (tomServer != null) {
_setUpToMServer(tomServer);
Expand Down

0 comments on commit 1b8c7fe

Please sign in to comment.