diff --git a/changelog.d/3774.bugfix b/changelog.d/3774.bugfix new file mode 100644 index 0000000000..9145771bae --- /dev/null +++ b/changelog.d/3774.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 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..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 @@ -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) @@ -801,6 +801,7 @@ 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) + .setOnlyAlertOnce(true) // used in compat < N, after summary is built based on child notifications .setWhen(lastMessageTimestamp) .setStyle(style)