Merge pull request #4249 from vector-im/feature/adm/constant-notification-sounds

Constant triggering of notification sounds
This commit is contained in:
Benoit Marty 2021-10-14 17:06:53 +02:00 committed by GitHub
commit 1f74bc986d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

1
changelog.d/3774.bugfix Normal file
View File

@ -0,0 +1 @@
Fixing notification sounds being triggered for every message, now they only trigger for the first, consistent with the vibrations

View File

@ -561,7 +561,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
// TODO Group should be current user display name // TODO Group should be current user display name
.setGroup(stringProvider.getString(R.string.app_name)) .setGroup(stringProvider.getString(R.string.app_name))
// In order to avoid notification making sound twice (due to the summary notification) // 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) .setSmallIcon(smallIcon)
// Set primary color (important for Wear 2.0 Notifications). // Set primary color (important for Wear 2.0 Notifications).
.setColor(accentColor) .setColor(accentColor)
@ -644,7 +644,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
.setContentTitle(stringProvider.getString(R.string.app_name)) .setContentTitle(stringProvider.getString(R.string.app_name))
.setContentText(inviteNotifiableEvent.description) .setContentText(inviteNotifiableEvent.description)
.setGroup(stringProvider.getString(R.string.app_name)) .setGroup(stringProvider.getString(R.string.app_name))
.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY) .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_ALL)
.setSmallIcon(smallIcon) .setSmallIcon(smallIcon)
.setColor(accentColor) .setColor(accentColor)
.apply { .apply {
@ -708,7 +708,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
.setContentTitle(stringProvider.getString(R.string.app_name)) .setContentTitle(stringProvider.getString(R.string.app_name))
.setContentText(simpleNotifiableEvent.description) .setContentText(simpleNotifiableEvent.description)
.setGroup(stringProvider.getString(R.string.app_name)) .setGroup(stringProvider.getString(R.string.app_name))
.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY) .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_ALL)
.setSmallIcon(smallIcon) .setSmallIcon(smallIcon)
.setColor(accentColor) .setColor(accentColor)
.setAutoCancel(true) .setAutoCancel(true)
@ -801,6 +801,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
val smallIcon = R.drawable.ic_status_bar val smallIcon = R.drawable.ic_status_bar
return NotificationCompat.Builder(context, if (noisy) NOISY_NOTIFICATION_CHANNEL_ID else SILENT_NOTIFICATION_CHANNEL_ID) 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 // used in compat < N, after summary is built based on child notifications
.setWhen(lastMessageTimestamp) .setWhen(lastMessageTimestamp)
.setStyle(style) .setStyle(style)