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 Aug 30, 2023
1 parent 2b46325 commit 253b664
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/data/hive/hive_collection_tom_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class HiveCollectionToMDatabase {

Future<void> clear() async {
Logs().w('Delete database and storage key...');
const FlutterSecureStorage()
await const FlutterSecureStorage()
.delete(key: FlutterHiveCollectionsDatabase.cipherStorageKey);
await tomConfigurationsBox.clear();
await Hive.deleteFromDisk();
Expand Down
6 changes: 2 additions & 4 deletions lib/widgets/matrix.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
late String currentClientSecret;
RequestTokenResponse? currentThreepidCreds;

final hiveCollectionToMDatabase = getIt.get<HiveCollectionToMDatabase>();

void setActiveClient(Client? cl) {
final i = widget.clients.indexWhere((c) => c == cl);
if (i != -1) {
Expand Down Expand Up @@ -191,7 +189,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {

Future<void> logout() async {
await client.logout();
await hiveCollectionToMDatabase.clear();
getIt.get<HiveCollectionToMDatabase>().clear();
}

Client? getClientByName(String name) =>
Expand Down Expand Up @@ -365,7 +363,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
if (state == LoginState.loggedIn) {
navigatorContext?.go('/rooms');
} else {
hiveCollectionToMDatabase.clear();
getIt.get<HiveCollectionToMDatabase>().clear();
}
}
});
Expand Down

0 comments on commit 253b664

Please sign in to comment.