Skip to content

Conversation

@VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Nov 30, 2025

🎯 Goal

Add the operation to mark a channel as unread starting from a given timestamp.

🛠 Implementation details

  • Add new ChatClient/ChannelClient method markUnread which accepts a Date as the timestamp to mark the channel as unread from.
  • Add new ChatClient/ChannelClient method markThreadUnread which accepts only a threadId. Deprecate the old markThreadUnread which accepts a messageId which is currently not supported (it never was, the messageId is currently ignored if threadId is passed).
  • Unify some of the different internal ChatApi methods into a single one (markUnread)

🎨 UI Changes

NA

🧪 Testing

  1. Apply the given patch
  2. Open a channel
  3. Mark a message as unread
  4. The channel should be marked as unread starting from the selected message
    Note: We currently have a UI bug, and the unread separator does not appear on the first markUnread (the channel is still marked). Re-entering the channel (or marking the channel as unread again) will show the separator correctly.
Provide the patch summary here
Subject: [PATCH] Update tests.
---
Index: stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessageListController.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessageListController.kt b/stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessageListController.kt
--- a/stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessageListController.kt	(revision 43c2af02087cdc65ee72da50f5f9cee707ca42fc)
+++ b/stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessageListController.kt	(date 1764517867528)
@@ -1802,7 +1802,7 @@
         cid.cidToTypeAndId().let { (channelType, channelId) ->
             val call = when (val mode = mode.value) {
                 is MessageMode.Normal -> {
-                    chatClient.markUnread(channelType, channelId, messageId = message.id)
+                    chatClient.markUnread(channelType, channelId, timestamp = message.createdAt!!.apply { time -= 1000 })
                 }
 
                 is MessageMode.MessageThread -> {

@github-actions
Copy link
Contributor

github-actions bot commented Nov 30, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.25 MB 0.00 MB 🟢
stream-chat-android-offline 5.48 MB 5.48 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.59 MB 10.59 MB 0.00 MB 🟢
stream-chat-android-compose 12.81 MB 12.81 MB 0.00 MB 🟢

@VelikovPetar VelikovPetar marked this pull request as ready for review November 30, 2025 16:36
@VelikovPetar VelikovPetar requested a review from a team as a code owner November 30, 2025 16:36
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 1, 2025

@VelikovPetar VelikovPetar merged commit 633db4e into develop Dec 1, 2025
13 checks passed
@VelikovPetar VelikovPetar deleted the feature/AND-934_add_mark_channel_unread_by_timestamp branch December 1, 2025 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants