diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 61393c74..3097c2bb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -97,6 +97,7 @@ build_android_apk: only: - main - tags + - krille/enable-background-push build_android_appbundle: diff --git a/lib/utils/famedlysdk_store.dart b/lib/utils/famedlysdk_store.dart index 0ce242d8..a56d76eb 100644 --- a/lib/utils/famedlysdk_store.dart +++ b/lib/utils/famedlysdk_store.dart @@ -15,7 +15,6 @@ Future getDatabase(Client client) async { } _generateDatabaseLock = true; try { - if (_db != null) return _db; final store = Store(); var password = await store.getItem(SettingKeys.databasePassword); var newPassword = false; @@ -23,7 +22,7 @@ Future getDatabase(Client client) async { newPassword = true; password = randomString(255); } - _db = await constructDb( + final db = await constructDb( logStatements: false, filename: 'moor.sqlite', password: password, @@ -31,13 +30,12 @@ Future getDatabase(Client client) async { if (newPassword) { await store.setItem(SettingKeys.databasePassword, password); } - return _db; + return db; } finally { _generateDatabaseLock = false; } } -Database _db; bool _generateDatabaseLock = false; class Store { diff --git a/lib/utils/firebase_controller.dart b/lib/utils/firebase_controller.dart index 21276a62..4e5c856b 100644 --- a/lib/utils/firebase_controller.dart +++ b/lib/utils/firebase_controller.dart @@ -27,7 +27,7 @@ abstract class FirebaseController { static const String CHANNEL_ID = 'fluffychat_push'; static const String CHANNEL_NAME = 'FluffyChat push channel'; static const String CHANNEL_DESCRIPTION = 'Push notifications for FluffyChat'; - static const String APP_ID = 'chat.fluffy.fluffychat'; + static const String APP_ID = 'chat.fluffy.fluffychat.experimental'; static const String GATEWAY_URL = 'https://janian.de:7023/'; static const String PUSHER_FORMAT = 'event_id_only'; @@ -283,7 +283,8 @@ abstract class FirebaseController { payload: roomId); if (tempClient) { - await client.dispose(); + await client.dispose(closeDatabase: true); + client.database = null; client = null; debugPrint('[Push] Temp client disposed'); }