Don't send group summary notifications to Android Auto (#3686)

Don't send group notifications to cars
This commit is contained in:
Joris Pelgröm 2023-07-21 03:45:27 +02:00 committed by GitHub
parent 8cc594e945
commit f4eb29cee3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -963,31 +963,23 @@ class MessagingManager @Inject constructor(
if (useCarNotification) {
CarNotificationManager.from(context).apply {
notify(tag, messageId, notificationBuilder)
if (!group.isNullOrBlank()) {
Log.d(TAG, "Show group notification with tag \"$group\" and id \"$groupId\"")
notify(group, groupId, getGroupNotificationBuilder(context, channelId, group, data))
} else if (previousGroup.isNotBlank()) {
val systemManager = context.getSystemService<NotificationManager>() ?: return@apply
Log.d(
TAG,
"Remove group notification with tag \"$previousGroup\" and id \"$previousGroupId\""
)
cancelGroupIfNeeded(systemManager, previousGroup, previousGroupId)
}
}
} else {
notificationManagerCompat.apply {
notify(tag, messageId, notificationBuilder.build())
if (!group.isNullOrBlank()) {
Log.d(TAG, "Show group notification with tag \"$group\" and id \"$groupId\"")
notify(group, groupId, getGroupNotificationBuilder(context, channelId, group, data).build())
} else if (previousGroup.isNotBlank()) {
Log.d(
TAG,
"Remove group notification with tag \"$previousGroup\" and id \"$previousGroupId\""
)
cancelGroupIfNeeded(previousGroup, previousGroupId)
}
}
}
notificationManagerCompat.apply {
if (!group.isNullOrBlank()) {
Log.d(TAG, "Show group notification with tag \"$group\" and id \"$groupId\"")
notify(group, groupId, getGroupNotificationBuilder(context, channelId, group, data).build())
} else if (previousGroup.isNotBlank()) {
Log.d(
TAG,
"Remove group notification with tag \"$previousGroup\" and id \"$previousGroupId\""
)
cancelGroupIfNeeded(previousGroup, previousGroupId)
}
}
}