mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-05-06 09:24:08 +00:00
Fix stream notification grouping
This commit is contained in:
parent
c9ec257a5e
commit
f0c89494dd
@ -88,7 +88,7 @@ class NotificationHelper(val context: Context) {
|
|||||||
|
|
||||||
// Show individual stream notifications, set channel icon only if there is actually
|
// Show individual stream notifications, set channel icon only if there is actually
|
||||||
// one
|
// one
|
||||||
showStreamNotifications(newStreams, data.serviceId, bitmap)
|
showStreamNotifications(newStreams, data.serviceId, data.url, bitmap)
|
||||||
// Show summary notification
|
// Show summary notification
|
||||||
manager.notify(data.pseudoId, summaryBuilder.build())
|
manager.notify(data.pseudoId, summaryBuilder.build())
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ class NotificationHelper(val context: Context) {
|
|||||||
|
|
||||||
override fun onBitmapFailed(e: Exception, errorDrawable: Drawable) {
|
override fun onBitmapFailed(e: Exception, errorDrawable: Drawable) {
|
||||||
// Show individual stream notifications
|
// Show individual stream notifications
|
||||||
showStreamNotifications(newStreams, data.serviceId, null)
|
showStreamNotifications(newStreams, data.serviceId, data.url, null)
|
||||||
// Show summary notification
|
// Show summary notification
|
||||||
manager.notify(data.pseudoId, summaryBuilder.build())
|
manager.notify(data.pseudoId, summaryBuilder.build())
|
||||||
iconLoadingTargets.remove(this) // allow it to be garbage-collected
|
iconLoadingTargets.remove(this) // allow it to be garbage-collected
|
||||||
@ -118,10 +118,11 @@ class NotificationHelper(val context: Context) {
|
|||||||
private fun showStreamNotifications(
|
private fun showStreamNotifications(
|
||||||
newStreams: List<StreamInfoItem>,
|
newStreams: List<StreamInfoItem>,
|
||||||
serviceId: Int,
|
serviceId: Int,
|
||||||
|
channelUrl: String,
|
||||||
channelIcon: Bitmap?
|
channelIcon: Bitmap?
|
||||||
) {
|
) {
|
||||||
for (stream in newStreams) {
|
for (stream in newStreams) {
|
||||||
val notification = createStreamNotification(stream, serviceId, channelIcon)
|
val notification = createStreamNotification(stream, serviceId, channelUrl, channelIcon)
|
||||||
manager.notify(stream.url.hashCode(), notification)
|
manager.notify(stream.url.hashCode(), notification)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,6 +130,7 @@ class NotificationHelper(val context: Context) {
|
|||||||
private fun createStreamNotification(
|
private fun createStreamNotification(
|
||||||
item: StreamInfoItem,
|
item: StreamInfoItem,
|
||||||
serviceId: Int,
|
serviceId: Int,
|
||||||
|
channelUrl: String,
|
||||||
channelIcon: Bitmap?
|
channelIcon: Bitmap?
|
||||||
): Notification {
|
): Notification {
|
||||||
return NotificationCompat.Builder(
|
return NotificationCompat.Builder(
|
||||||
@ -139,7 +141,7 @@ class NotificationHelper(val context: Context) {
|
|||||||
.setLargeIcon(channelIcon)
|
.setLargeIcon(channelIcon)
|
||||||
.setContentTitle(item.name)
|
.setContentTitle(item.name)
|
||||||
.setContentText(item.uploaderName)
|
.setContentText(item.uploaderName)
|
||||||
.setGroup(item.uploaderUrl)
|
.setGroup(channelUrl)
|
||||||
.setColor(ContextCompat.getColor(context, R.color.ic_launcher_background))
|
.setColor(ContextCompat.getColor(context, R.color.ic_launcher_background))
|
||||||
.setColorized(true)
|
.setColorized(true)
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user