From b041876fa6b8d0f54ff69cc049e588fdc228cc84 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 13 Oct 2021 18:00:35 +0100 Subject: [PATCH 1/5] matching the other notifications and only alerting the group notifiation once - fixes notification sounds coming through for every message despite only vibrating for the first --- .../im/vector/app/features/notifications/NotificationUtils.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt index 14dfe5c6ee..aecbbe78d2 100755 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt @@ -802,6 +802,7 @@ class NotificationUtils @Inject constructor(private val context: Context, return NotificationCompat.Builder(context, if (noisy) NOISY_NOTIFICATION_CHANNEL_ID else SILENT_NOTIFICATION_CHANNEL_ID) // used in compat < N, after summary is built based on child notifications + .setOnlyAlertOnce(true) .setWhen(lastMessageTimestamp) .setStyle(style) .setContentTitle(stringProvider.getString(R.string.app_name)) From 99de9d4a4ff94b30366b86a0846600f1b0a57cfa Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 13 Oct 2021 18:01:49 +0100 Subject: [PATCH 2/5] adding changelog entry --- changelog.d/3872.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/3872.bugfix diff --git a/changelog.d/3872.bugfix b/changelog.d/3872.bugfix new file mode 100644 index 0000000000..9145771bae --- /dev/null +++ b/changelog.d/3872.bugfix @@ -0,0 +1 @@ +Fixing notification sounds being triggered for every message, now they only trigger for the first, consistent with the vibrations \ No newline at end of file From 64c532e54b3247610e181feff911e99acb8561ad Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 13 Oct 2021 18:42:02 +0100 Subject: [PATCH 3/5] allowing the first notification for each child of the group to vibrate/make a sound - by having the group and child notifications alert once we can safetly always update the group and get consistent alertOnce behaviour --- .../vector/app/features/notifications/NotificationUtils.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt index aecbbe78d2..774f3db2cf 100755 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt @@ -561,7 +561,7 @@ class NotificationUtils @Inject constructor(private val context: Context, // TODO Group should be current user display name .setGroup(stringProvider.getString(R.string.app_name)) // In order to avoid notification making sound twice (due to the summary notification) - .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY) + .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_ALL) .setSmallIcon(smallIcon) // Set primary color (important for Wear 2.0 Notifications). .setColor(accentColor) @@ -644,7 +644,7 @@ class NotificationUtils @Inject constructor(private val context: Context, .setContentTitle(stringProvider.getString(R.string.app_name)) .setContentText(inviteNotifiableEvent.description) .setGroup(stringProvider.getString(R.string.app_name)) - .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY) + .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_ALL) .setSmallIcon(smallIcon) .setColor(accentColor) .apply { @@ -708,7 +708,7 @@ class NotificationUtils @Inject constructor(private val context: Context, .setContentTitle(stringProvider.getString(R.string.app_name)) .setContentText(simpleNotifiableEvent.description) .setGroup(stringProvider.getString(R.string.app_name)) - .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY) + .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_ALL) .setSmallIcon(smallIcon) .setColor(accentColor) .setAutoCancel(true) From 2f0affa27e74144ea1ed9498730a22ae5a005352 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 14 Oct 2021 11:56:48 +0100 Subject: [PATCH 4/5] using correct issue number in change log entry --- changelog.d/{3872.bugfix => 3774.bugfix} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/{3872.bugfix => 3774.bugfix} (100%) diff --git a/changelog.d/3872.bugfix b/changelog.d/3774.bugfix similarity index 100% rename from changelog.d/3872.bugfix rename to changelog.d/3774.bugfix From eb70a81afd4a5f06503fb1692a939b58352b0fc2 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 14 Oct 2021 13:14:36 +0100 Subject: [PATCH 5/5] moving builder call to avoid misaligning the comment --- .../im/vector/app/features/notifications/NotificationUtils.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt index 774f3db2cf..92feb3d038 100755 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt @@ -801,8 +801,8 @@ class NotificationUtils @Inject constructor(private val context: Context, val smallIcon = R.drawable.ic_status_bar return NotificationCompat.Builder(context, if (noisy) NOISY_NOTIFICATION_CHANNEL_ID else SILENT_NOTIFICATION_CHANNEL_ID) - // used in compat < N, after summary is built based on child notifications .setOnlyAlertOnce(true) + // used in compat < N, after summary is built based on child notifications .setWhen(lastMessageTimestamp) .setStyle(style) .setContentTitle(stringProvider.getString(R.string.app_name))