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:
parent
c89c1cb7cd
commit
0c107cf917
|
|
@ -61,8 +61,6 @@ class Client extends MatrixApi {
|
|||
|
||||
final FutureOr<DatabaseApi> Function(Client)? databaseBuilder;
|
||||
final FutureOr<DatabaseApi> Function(Client)? legacyDatabaseBuilder;
|
||||
final FutureOr<void> Function(Client)? databaseDestroyer;
|
||||
final FutureOr<void> 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<KeyVerificationMethod>? verificationMethods,
|
||||
http.Client? httpClient,
|
||||
Set<String>? 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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue