From eeb07e5645af2475c9b9ea4c4046ff49ca2350d6 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Fri, 13 Nov 2026 15:06:09 +0000 Subject: [PATCH] Title each grouped Android notification with its chat or run Thread notifications lost their title and collapsed text when the conversation style became a big-text preview, so inside a bundle each one showed only the preview with no hint of which chat or run it came from. --- .../awan/pipelines_app/notify/NotificationPresenter.kt | 9 +++++++++ .../pipelines_app/notify/NotificationProtocolTest.kt | 2 ++ 2 files changed, 11 insertions(+) diff --git a/app/android/app/src/main/kotlin/net/awan/pipelines_app/notify/NotificationPresenter.kt b/app/android/app/src/main/kotlin/net/awan/pipelines_app/notify/NotificationPresenter.kt index 52a37dcc..36268065 100644 --- a/app/android/app/src/main/kotlin/net/awan/pipelines_app/notify/NotificationPresenter.kt +++ b/app/android/app/src/main/kotlin/net/awan/pipelines_app/notify/NotificationPresenter.kt @@ -146,6 +146,8 @@ class NotificationPresenter(private val context: Context) { val ids = entries.map { it.id } val builder = builder(channel) .setSmallIcon(R.drawable.ic_stat_pipelines) + .setContentTitle(threadTitle(latest)) + .setContentText(latest.text) .setNumber(entries.size) .setGroup(NotificationThreads.groupKey(NotificationThreads.namespaceOf(thread))) .setAutoCancel(true) @@ -289,6 +291,13 @@ class NotificationPresenter(private val context: Context) { fun runActionLabel(runClick: String): String? = if (runClick.isEmpty()) null else "Open run" + /** + * A thread notification's title: the chat or run it belongs to, so + * each notification in a bundle says where it came from. + */ + fun threadTitle(entry: ThreadEntry): String = + entry.sender.trim().ifEmpty { kindLabel(entry.kind) } + /** The expanded text for a grouped notification, preferring artifact preview. */ fun threadPreview(entry: ThreadEntry): String = entry.preview.ifEmpty { entry.text } diff --git a/app/android/app/src/test/kotlin/net/awan/pipelines_app/notify/NotificationProtocolTest.kt b/app/android/app/src/test/kotlin/net/awan/pipelines_app/notify/NotificationProtocolTest.kt index 74a8381d..4fd69be4 100644 --- a/app/android/app/src/test/kotlin/net/awan/pipelines_app/notify/NotificationProtocolTest.kt +++ b/app/android/app/src/test/kotlin/net/awan/pipelines_app/notify/NotificationProtocolTest.kt @@ -61,6 +61,8 @@ class NotificationProtocolTest { ) assertEquals("Rendered artifact preview…", NotificationPresenter.threadPreview(entry)) assertEquals("Fallback message", NotificationPresenter.threadPreview(entry.copy(preview = ""))) + assertEquals(entry.sender, NotificationPresenter.threadTitle(entry)) + assertEquals("Chat question", NotificationPresenter.threadTitle(entry.copy(kind = "chat_question", sender = " "))) } private val pushed = """