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.
This commit is contained in:
Christian Pauly 2022-08-30 11:00:48 +02:00
parent c89c1cb7cd
commit 0c107cf917
1 changed files with 0 additions and 15 deletions

View File

@ -61,8 +61,6 @@ class Client extends MatrixApi {
final FutureOr<DatabaseApi> Function(Client)? databaseBuilder; final FutureOr<DatabaseApi> Function(Client)? databaseBuilder;
final FutureOr<DatabaseApi> Function(Client)? legacyDatabaseBuilder; final FutureOr<DatabaseApi> Function(Client)? legacyDatabaseBuilder;
final FutureOr<void> Function(Client)? databaseDestroyer;
final FutureOr<void> Function(Client)? legacyDatabaseDestroyer;
DatabaseApi? _database; DatabaseApi? _database;
DatabaseApi? get database => _database; DatabaseApi? get database => _database;
@ -155,9 +153,7 @@ class Client extends MatrixApi {
Client( Client(
this.clientName, { this.clientName, {
this.databaseBuilder, this.databaseBuilder,
this.databaseDestroyer,
this.legacyDatabaseBuilder, this.legacyDatabaseBuilder,
this.legacyDatabaseDestroyer,
Set<KeyVerificationMethod>? verificationMethods, Set<KeyVerificationMethod>? verificationMethods,
http.Client? httpClient, http.Client? httpClient,
Set<String>? importantStateEvents, Set<String>? importantStateEvents,
@ -1480,16 +1476,6 @@ class Client extends MatrixApi {
_rooms = []; _rooms = [];
await encryption?.dispose(); await encryption?.dispose();
encryption = null; 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); onLoginStateChanged.add(LoginState.loggedOut);
} }
@ -2860,7 +2846,6 @@ class Client extends MatrixApi {
} }
await legacyDatabase.clear(); await legacyDatabase.clear();
await legacyDatabaseDestroyer?.call(this);
} }
await legacyDatabase?.close(); await legacyDatabase?.close();
_initLock = false; _initLock = false;