Skip to content

Commit 9c028c9

Browse files
committed
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 <me@frebib.net>
1 parent 9bc2c4a commit 9c028c9

File tree

1 file changed

+4
-1
lines changed
  • libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories

1 file changed

+4
-1
lines changed

libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ class DefaultNotificationCreator @Inject constructor(
136136
// that can be displayed in not disturb mode if white listed (the later will need compat28.x)
137137
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
138138
// ID of the corresponding shortcut, for conversation features under API 30+
139-
.setShortcutId(roomInfo.roomId.value)
139+
// Must match those created in the ShortcutInfoCompat.Builder()
140+
// for the notification to appear as a "Conversation":
141+
// https://developer.android.com/develop/ui/views/notifications/conversations
142+
.setShortcutId("${roomInfo.sessionId.value}-${roomInfo.roomId.value}")
140143
// Auto-bundling is enabled for 4 or more notifications on API 24+ (N+)
141144
// devices and all Wear devices. But we want a custom grouping, so we specify the groupID
142145
.setGroup(roomInfo.sessionId.value)

0 commit comments

Comments
 (0)