improvements

ui_ux_rollout_merge_notification_settings
Sikander Saleem 1 month ago
parent 5744e6afbf
commit 14a32d101e

@ -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);

@ -56,6 +56,7 @@ class NotificationManger {
visibility: NotificationVisibility.public,
enableVibration: true,
groupKey: groupId ?? 'com.hmg.atoms',
setAsGroupSummary: false,
);
static DarwinNotificationDetails iosNotificationDetails(String? threadId) => DarwinNotificationDetails(categoryIdentifier: "atoms", threadIdentifier: threadId);
@ -92,7 +93,8 @@ class NotificationManger {
icon: "@drawable/ic_stat_name",
groupKey: groupId,
setAsGroupSummary: true,
// THIS IS THE KEY
onlyAlertOnce: true,
autoCancel: true,
styleInformation: InboxStyleInformation(
[],
contentTitle: 'ATOMS',

Loading…
Cancel
Save