From 0c107cf9178497edaf55bed608603cce5f1d9d2a Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Tue, 30 Aug 2022 11:00:48 +0200 Subject: [PATCH] refactor: Remove databaseDestroyer The need for a database destroyer is gone since we have switched from sqflite/moor to Hive. Removing it is the first step to a major refactoring to make the database not nullable anymore. --- lib/src/client.dart | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/lib/src/client.dart b/lib/src/client.dart index 42ba9441..d05ca23b 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -61,8 +61,6 @@ class Client extends MatrixApi { final FutureOr Function(Client)? databaseBuilder; final FutureOr Function(Client)? legacyDatabaseBuilder; - final FutureOr Function(Client)? databaseDestroyer; - final FutureOr Function(Client)? legacyDatabaseDestroyer; DatabaseApi? _database; DatabaseApi? get database => _database; @@ -155,9 +153,7 @@ class Client extends MatrixApi { Client( this.clientName, { this.databaseBuilder, - this.databaseDestroyer, this.legacyDatabaseBuilder, - this.legacyDatabaseDestroyer, Set? verificationMethods, http.Client? httpClient, Set? importantStateEvents, @@ -1480,16 +1476,6 @@ class Client extends MatrixApi { _rooms = []; await encryption?.dispose(); encryption = null; - final databaseDestroyer = this.databaseDestroyer; - if (databaseDestroyer != null) { - try { - await database?.close(); - } catch (e, s) { - Logs().e('Unable to close database', e, s); - } - await databaseDestroyer(this); - _database = null; - } onLoginStateChanged.add(LoginState.loggedOut); } @@ -2860,7 +2846,6 @@ class Client extends MatrixApi { } await legacyDatabase.clear(); - await legacyDatabaseDestroyer?.call(this); } await legacyDatabase?.close(); _initLock = false;