From f0c89494dd597a65bfb1d7846c940f0f02e7d085 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Thu, 27 Feb 2025 09:09:08 +0530 Subject: [PATCH] Fix stream notification grouping --- .../local/feed/notifications/NotificationHelper.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationHelper.kt b/app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationHelper.kt index 8ea89368d..646596884 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationHelper.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/notifications/NotificationHelper.kt @@ -88,7 +88,7 @@ class NotificationHelper(val context: Context) { // Show individual stream notifications, set channel icon only if there is actually // one - showStreamNotifications(newStreams, data.serviceId, bitmap) + showStreamNotifications(newStreams, data.serviceId, data.url, bitmap) // Show summary notification manager.notify(data.pseudoId, summaryBuilder.build()) @@ -97,7 +97,7 @@ class NotificationHelper(val context: Context) { override fun onBitmapFailed(e: Exception, errorDrawable: Drawable) { // Show individual stream notifications - showStreamNotifications(newStreams, data.serviceId, null) + showStreamNotifications(newStreams, data.serviceId, data.url, null) // Show summary notification manager.notify(data.pseudoId, summaryBuilder.build()) iconLoadingTargets.remove(this) // allow it to be garbage-collected @@ -118,10 +118,11 @@ class NotificationHelper(val context: Context) { private fun showStreamNotifications( newStreams: List, serviceId: Int, + channelUrl: String, channelIcon: Bitmap? ) { for (stream in newStreams) { - val notification = createStreamNotification(stream, serviceId, channelIcon) + val notification = createStreamNotification(stream, serviceId, channelUrl, channelIcon) manager.notify(stream.url.hashCode(), notification) } } @@ -129,6 +130,7 @@ class NotificationHelper(val context: Context) { private fun createStreamNotification( item: StreamInfoItem, serviceId: Int, + channelUrl: String, channelIcon: Bitmap? ): Notification { return NotificationCompat.Builder( @@ -139,7 +141,7 @@ class NotificationHelper(val context: Context) { .setLargeIcon(channelIcon) .setContentTitle(item.name) .setContentText(item.uploaderName) - .setGroup(item.uploaderUrl) + .setGroup(channelUrl) .setColor(ContextCompat.getColor(context, R.color.ic_launcher_background)) .setColorized(true) .setAutoCancel(true)