From af932ea6beb044d2acb54a6a9c8ec1131da9de68 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Wed, 20 Aug 2025 22:20:30 +0100 Subject: [PATCH] Set shortcut ID on received notifications This is the missing piece for Android to treat a notification as a "conversation". Note that this requires shortcuts to have already been created prior to receiving the notification. Signed-off-by: Joe Groocock --- .../push/impl/notifications/factories/NotificationCreator.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt index d462ebb5f6..864aa8b005 100755 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt @@ -136,7 +136,10 @@ class DefaultNotificationCreator @Inject constructor( // that can be displayed in not disturb mode if white listed (the later will need compat28.x) .setCategory(NotificationCompat.CATEGORY_MESSAGE) // ID of the corresponding shortcut, for conversation features under API 30+ - .setShortcutId(roomInfo.roomId.value) + // Must match those created in the ShortcutInfoCompat.Builder() + // for the notification to appear as a "Conversation": + // https://developer.android.com/develop/ui/views/notifications/conversations + .setShortcutId("${roomInfo.sessionId.value}-${roomInfo.roomId.value}") // Auto-bundling is enabled for 4 or more notifications on API 24+ (N+) // devices and all Wear devices. But we want a custom grouping, so we specify the groupID .setGroup(roomInfo.sessionId.value)