From 451c2379ec3b9ca4430eff872d48d2287871a931 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Fri, 28 May 2021 15:16:04 +0200 Subject: [PATCH] Do not notify again for old events Resending the notification here can trigger other system components or apps that listen to new notifications, such as connected smart watches or automation tools. Fixes https://github.com/vector-im/element-android/issues/1673 --- changelog.d/1673.bugfix | 1 + .../app/features/notifications/NotificationDrawerManager.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/1673.bugfix diff --git a/changelog.d/1673.bugfix b/changelog.d/1673.bugfix new file mode 100644 index 0000000000..b0459f34b8 --- /dev/null +++ b/changelog.d/1673.bugfix @@ -0,0 +1 @@ +Avoid resending notifications that are already shown diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationDrawerManager.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationDrawerManager.kt index 37ed1e654a..fd15455391 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationDrawerManager.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationDrawerManager.kt @@ -457,7 +457,7 @@ class NotificationDrawerManager @Inject constructor(private val context: Context if (eventList.isEmpty() || eventList.all { it.isRedacted }) { notificationUtils.cancelNotificationMessage(null, SUMMARY_NOTIFICATION_ID) - } else { + } else if (hasNewEvent) { // FIXME roomIdToEventMap.size is not correct, this is the number of rooms val nbEvents = roomIdToEventMap.size + simpleEvents.size val sumTitle = stringProvider.getQuantityString(R.plurals.notification_compat_summary_title, nbEvents, nbEvents)