use FCM-matching tag so local notif replaces Google's bare push

This commit is contained in:
Mohamad Mahdi Jebeli 2026-06-22 13:56:57 +03:30
parent 6eb00ea786
commit 2253c71338
1 changed files with 7 additions and 0 deletions

View File

@ -259,6 +259,12 @@ class NotificationService {
// - otherwise MessagingStyle (compact) // - otherwise MessagingStyle (compact)
final useBigPicture = notifType.contains('1') || bigPicturePath != null; 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 = final AndroidNotificationDetails androidPlatformChannelSpecifics =
AndroidNotificationDetails( AndroidNotificationDetails(
'content', 'content',
@ -267,6 +273,7 @@ class NotificationService {
importance: Importance.max, importance: Importance.max,
priority: Priority.high, priority: Priority.high,
playSound: true, playSound: true,
tag: notifTag,
styleInformation: useBigPicture && bigPicturePath != null styleInformation: useBigPicture && bigPicturePath != null
? BigPictureStyleInformation( ? BigPictureStyleInformation(
FilePathAndroidBitmap(bigPicturePath), FilePathAndroidBitmap(bigPicturePath),