|
|
|
|
@ -241,7 +241,7 @@ class FirebaseNotificationManger {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await FirebaseMessaging.instance.setAutoInitEnabled(true);
|
|
|
|
|
await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(alert: true, badge: true, sound: true);
|
|
|
|
|
await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(alert: true, badge: false, sound: true);
|
|
|
|
|
|
|
|
|
|
FirebaseMessaging.instance.getInitialMessage().then((initialMessage) {
|
|
|
|
|
if (initialMessage != null) {
|
|
|
|
|
@ -252,9 +252,14 @@ class FirebaseNotificationManger {
|
|
|
|
|
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
if (message.data["notificationType"] != 'NurseConfirmArrive') {
|
|
|
|
|
// Extract title and body from notification field first, fallback to data field
|
|
|
|
|
final String title = message.notification?.title ?? message.data['title'] ?? 'ATOMS';
|
|
|
|
|
final String body = message.notification?.body ?? message.data['body'] ?? 'New notification';
|
|
|
|
|
|
|
|
|
|
// Always show with our grouping logic
|
|
|
|
|
NotificationManger.showNotification(
|
|
|
|
|
title: message.notification?.title ?? "",
|
|
|
|
|
subtext: message.notification?.body ?? "",
|
|
|
|
|
title: title,
|
|
|
|
|
subtext: body,
|
|
|
|
|
hashcode: DateTime.now().millisecondsSinceEpoch.hashCode,
|
|
|
|
|
payload: json.encode(message.data),
|
|
|
|
|
context: context);
|
|
|
|
|
|