Skip to content

Commit

Permalink
fix: disable sound and vibration for notification reply [WPB-4741] (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas authored Apr 2, 2024
1 parent 9077058 commit e3ed13b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ class MessageNotificationManager
messagesStyle.addMessage(replyMessage)
}

val notification = setUpNotificationBuilder(context, userId).apply {
val notification = setUpNotificationBuilder(context, userId, true).apply {
setContentIntent(messagePendingIntent(context, conversationId, userIdString))
addAction(getActionReply(context, conversationId, userIdString, false))

Expand All @@ -506,13 +506,19 @@ class MessageNotificationManager

/**
* Create NotificationBuilder and set all the parameters that are common for any MessageNotification
* use [setOnlyAlertOnce] to trigger only once sound and vibrations for notification updates
* @return resulted [NotificationCompat.Builder] so we can set other specific parameters and build it.
*/
private fun setUpNotificationBuilder(context: Context, userId: QualifiedID): NotificationCompat.Builder {
private fun setUpNotificationBuilder(
context: Context,
userId: QualifiedID,
setOnlyAlertOnce: Boolean = false
): NotificationCompat.Builder {
val channelId = NotificationConstants.getMessagesChannelId(userId)

return NotificationCompat.Builder(context, channelId).apply {
setDefaults(NotificationCompat.DEFAULT_ALL)

setOnlyAlertOnce(setOnlyAlertOnce)
priority = NotificationCompat.PRIORITY_MAX
setCategory(NotificationCompat.CATEGORY_MESSAGE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ object NotificationConstants {

private const val MESSAGE_CHANNEL_ID = "com.wire.android.notification_channel"
const val MESSAGE_CHANNEL_NAME = "Messages"

private const val PING_CHANNEL_ID = "com.wire.android.notification_ping_channel"
const val PING_CHANNEL_NAME = "Pings"
private const val MESSAGE_GROUP_KEY_PREFIX = "wire_reloaded_notification_group_"
Expand Down

0 comments on commit e3ed13b

Please sign in to comment.