Merge branch 'krille/remove-database-destroyer' into 'main'

refactor: Remove databaseDestroyer

See merge request famedly/company/frontend/famedlysdk!1118
This commit is contained in:
Nicolas Werner 2022-08-30 09:26:49 +00:00
commit ea1f340ca9
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)? 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;