diff --git a/lib/notifications.dart b/lib/notifications.dart index 5e435537b2..e961b57d17 100644 --- a/lib/notifications.dart +++ b/lib/notifications.dart @@ -78,34 +78,34 @@ class NotificationService { // need to save the value. token.value = value; } -} -void _onForegroundMessage(FirebaseRemoteMessage message) { - assert(debugLog("notif message: ${message.data}")); - _onRemoteMessage(message); -} + static void _onForegroundMessage(FirebaseRemoteMessage message) { + assert(debugLog("notif message: ${message.data}")); + _onRemoteMessage(message); + } -Future _onBackgroundMessage(FirebaseRemoteMessage message) async { - // This callback will run in a separate isolate from the rest of the app. - // See docs: - // https://firebase.flutter.dev/docs/messaging/usage/#background-messages - assert(() { - debugLogEnabled = true; - return true; - }()); - LiveZulipBinding.ensureInitialized(); - NotificationDisplayManager._init(); - - assert(debugLog("notif message in background: ${message.data}")); - _onRemoteMessage(message); -} + static Future _onBackgroundMessage(FirebaseRemoteMessage message) async { + // This callback will run in a separate isolate from the rest of the app. + // See docs: + // https://firebase.flutter.dev/docs/messaging/usage/#background-messages + assert(() { + debugLogEnabled = true; + return true; + }()); + LiveZulipBinding.ensureInitialized(); + NotificationDisplayManager._init(); + + assert(debugLog("notif message in background: ${message.data}")); + _onRemoteMessage(message); + } -void _onRemoteMessage(FirebaseRemoteMessage message) { - final data = FcmMessage.fromJson(message.data); - switch (data) { - case MessageFcmMessage(): NotificationDisplayManager._onMessageFcmMessage(data, message.data); - case RemoveFcmMessage(): break; // TODO handle - case UnexpectedFcmMessage(): break; // TODO(log) + static void _onRemoteMessage(FirebaseRemoteMessage message) { + final data = FcmMessage.fromJson(message.data); + switch (data) { + case MessageFcmMessage(): NotificationDisplayManager._onMessageFcmMessage(data, message.data); + case RemoveFcmMessage(): break; // TODO handle + case UnexpectedFcmMessage(): break; // TODO(log) + } } }