Skip to content

Commit

Permalink
Set group alert behavior based on alert_once notification parameter (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dshokouhi committed Oct 7, 2021
1 parent 8dac382 commit 73e198a
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ class MessagingService : FirebaseMessagingService() {

handleLargeIcon(notificationBuilder, data)

handleGroup(notificationBuilder, group)
handleGroup(notificationBuilder, group, data[ALERT_ONCE].toBoolean())

handleTimeout(notificationBuilder, data)

Expand Down Expand Up @@ -749,6 +749,8 @@ class MessagingService : FirebaseMessagingService() {
.setGroup(group)
.setGroupSummary(true)

if (data[ALERT_ONCE].toBoolean())
groupNotificationBuilder.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN)
handleColor(groupNotificationBuilder, data)
return groupNotificationBuilder
}
Expand Down Expand Up @@ -878,10 +880,13 @@ class MessagingService : FirebaseMessagingService() {

private fun handleGroup(
builder: NotificationCompat.Builder,
group: String?
group: String?,
alertOnce: Boolean?
) {
if (!group.isNullOrBlank()) {
builder.setGroup(group)
if (alertOnce == true)
builder.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN)
}
}

Expand Down

0 comments on commit 73e198a

Please sign in to comment.