Skip to content

Commit

Permalink
wip try class statics
Browse files Browse the repository at this point in the history
  • Loading branch information
gnprice committed Oct 19, 2023
1 parent cf28e64 commit 064f019
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions lib/notifications.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> _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<void> _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)
}
}
}

Expand Down

0 comments on commit 064f019

Please sign in to comment.