From 2253c71338d8ab5bbccfc615c08bc9e983d78a2c Mon Sep 17 00:00:00 2001 From: "Mr.Jebelli" Date: Mon, 22 Jun 2026 13:56:57 +0330 Subject: [PATCH] use FCM-matching tag so local notif replaces Google's bare push --- lib/services/notification/notification_service.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/services/notification/notification_service.dart b/lib/services/notification/notification_service.dart index 93659e8..e2bdabe 100644 --- a/lib/services/notification/notification_service.dart +++ b/lib/services/notification/notification_service.dart @@ -259,6 +259,12 @@ class NotificationService { // - otherwise → MessagingStyle (compact) final useBigPicture = notifType.contains('1') || bigPicturePath != null; + // Use the same tag the backend put on the FCM notification so this + // local notification REPLACES the bare one Android already drew when + // the push arrived — no duplicate, just the cover image. + final notifTag = + (data.id != null && data.id!.isNotEmpty) ? 'didvan-content-${data.id}' : null; + final AndroidNotificationDetails androidPlatformChannelSpecifics = AndroidNotificationDetails( 'content', @@ -267,6 +273,7 @@ class NotificationService { importance: Importance.max, priority: Priority.high, playSound: true, + tag: notifTag, styleInformation: useBigPicture && bigPicturePath != null ? BigPictureStyleInformation( FilePathAndroidBitmap(bigPicturePath),