mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 06:39:25 +01:00
feat: Enable background push
This commit is contained in:
parent
dbbab93350
commit
1791ae85a7
@ -97,6 +97,7 @@ build_android_apk:
|
||||
only:
|
||||
- main
|
||||
- tags
|
||||
- krille/enable-background-push
|
||||
|
||||
|
||||
build_android_appbundle:
|
||||
|
@ -15,7 +15,6 @@ Future<Database> 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<Database> 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<Database> 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 {
|
||||
|
@ -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');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user