chore: Set data_message in pusher properties for hedwig

This commit is contained in:
Krille 2023-09-12 11:55:36 +02:00
parent 9fcb5cce19
commit be69672d41
No known key found for this signature in database

View file

@ -20,9 +20,8 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app_badger/flutter_app_badger.dart';
@ -174,7 +173,11 @@ class BackgroundPush {
currentPushers.first.lang == 'en' &&
currentPushers.first.data.url.toString() == gatewayUrl &&
currentPushers.first.data.format ==
AppConfig.pushNotificationsPusherFormat) {
AppConfig.pushNotificationsPusherFormat &&
mapEquals(
currentPushers.single.data.additionalProperties,
{"data_message": pusherDataMessageFormat},
)) {
Logs().i('[Push] Pusher already set');
} else {
Logs().i('Need to set new pusher');
@ -211,6 +214,7 @@ class BackgroundPush {
data: PusherData(
url: Uri.parse(gatewayUrl!),
format: AppConfig.pushNotificationsPusherFormat,
additionalProperties: {"data_message": pusherDataMessageFormat},
),
kind: 'http',
),
@ -222,6 +226,12 @@ class BackgroundPush {
}
}
final pusherDataMessageFormat = Platform.isAndroid
? 'android'
: Platform.isIOS
? 'ios'
: null;
bool _wentToRoomOnStartup = false;
Future<void> setupPush() async {