Repository navigation
feat: played receipts for voice messages and audio files - #4023
Merged
Merged
Conversation
The design keeps a group of voice messages together, so a played message no longer ends its group.
Adds a MessageMark slot before the delivery status. A direct message reads "Played", any other channel "Played by" and the count, shown only once someone played the message and the channel type has the played mark. Earlier messages in a group show only the mark.
Brings the generated tokens up to the latest design-system-tokens build. The old semantic names stay available through the token repo's React Native adapter, so theme.semantics only gains keys.
Avatars without an image use avatarBgDefault and avatarTextDefault instead of a palette colour picked per user or channel, following the current design.
A shared useMarkMessagePlayed hook marks the message whenever its player starts, however playback started, instead of on the play button press.
openImageGallery takes the channel the messages belong to, and the gallery video marks its message played when playback starts, autoplay included.
Audio and video players take an optional messageId and tell their pool when playback first advances, after any download and buffering, through an optional onPlaybackStarted pool callback.
ChannelShell marks a message once its audio player starts, and the gallery once the shown video starts, whatever UI controls the player. Components only pass the messageId. useMarkMessagePlayed is public for players outside the SDK's.
2 tasks done
Players take an optional onPlaybackStarted callback, called as playback advances until it returns true, instead of a messageId. AudioAttachment and the gallery video pass one that marks their message, so the pools, AudioPlayerProvider and ChannelShell no longer take part in marking.
ChatConfigProvider takes an optional handlePlaybackStarted, called as audio, voice recording and video playback advances until it returns true. It gets the attachment, message, player and a markPlayed helper, and defaults to marking the message played. The gallery keeps skipping slides that are not shown, so autoplayed neighbours do not count.
Gallery players were created playing when autoPlayVideo was on, so the slides next to the shown one played off screen, and moving to another slide paused nothing, since autoplay never went through play(). Players now start paused, and a slide plays its video once it is shown, through a store subscription that renders nothing. Moving to another slide pauses the old video before the new index is published. Marking no longer needs to skip slides that are not shown.
Implements the offline database's `getMessageMarks` and `insertMessageMark`, stored like reactions. - A `messageMarks` table holds one row per marker (`messageId`, `userId`, `type`, `createdAt`), deleted with its message. Rows come from each stored message's `mark_groups`, and from `message.mark_added` through `insertMessageMark`. - `mark_groups` and `own_marks` move out of `extraData` into their own `markGroups` and `ownMarks` columns, so a new mark updates them without rewriting the message. - `getMessageMarks` reads a message's marks newest first, joined to the stored users. A mark whose user is not stored lists with the user's ID only. - `SqliteClient.dbVersion` is bumped to 20 for the new table and columns.
oliverlaz
approved these changes
Nov 25, 2026
isekovanic
added a commit
to GetStream/stream-chat-js
that referenced
this pull request
Nov 25, 2026
Ticket: https://linear.app/stream/issue/RN-542 (backend: https://linear.app/stream/issue/CHA-6554) Replaces #2015. The React Native SDK side is GetStream/stream-chat-react-native#4023. ## CLA - [x] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required). - [x] Code changes are tested ## Description of the changes, What, Why and How? Adds message marks. A user who plays another user's voice note or audio file marks the message `played`, and the author sees who played it, as a count on the message and as a list of every member who played it. - `channel.sendMessageMark({ id }, { type })` sends a mark through the offline queue. A mark that fails for lack of a connection is stored as a `send-message-mark` pending task and replayed on reconnect. A mark of the same type that is already queued for the message is not queued again. - `channel.markMessagePlayed(messageId)` sends the `played` mark. It sends nothing when the channel type has no `played` mark or without the `send-message-mark` capability. When the client's message store holds the message, it also sends nothing for the user's own message or a message the user already marked (`own_marks`). For a message the store does not hold, such as a search result, the server ignores those. There is no optimistic update. The message changes when `message.mark_added` arrives, as with read state. - `ChannelConfig` gains `markTypes`, the channel type's `mark_types`. Like `availableCommands` it is server-owned, so the integrator cannot set it, and it is `[]` when marks are off for the channel type. UI SDKs read it to decide whether to show marks. - `message.mark_added` updates the message in the message store, `mark_groups` on the author's copy and `own_marks` on the marker's copy. The offline DB stores the mark through `insertMessageMark`, with the user who made it and the message's mark summaries as the store holds them. - `MessageMarkPaginator` lists the marks on one message, with the user who made each one, newest first, through `queryMessageMarks`. It pages forward with the API's `next` cursor. `messageId` and `filter` say which marks it lists, `paginatorOptions` (such as `pageSize`) work as for the channel, thread and message paginators, and `id` names it, generated when left out as the channel and message paginators do. - `client.messageMarks` keeps the paginators registered with it current: `registerPaginator({ paginator })` registers one and replaces one with the same `id`, `getPaginatorById(id)` finds it again with the pages it loaded, so opening a list again sends no request, and `removePaginator(paginatorOrId)` unregisters it. The app picks the ids, so the client derives no key from the message and the filter. - `message.mark_added` adds the mark to the lists of its message, with the marker from the event's `user`. A mark without one is skipped and shows on the list's next load. - A reconnect flags every list stale, since events may have been missed. A list between `paginator.activate()` and the release it returns reloads at once, and any other reloads when it is next activated. - A hard delete, a channel delete, losing membership, or a truncation that removed the message empties and unregisters the lists it affects. `disconnectUser()` empties and unregisters them all, since the app may still hold them. - With offline support, a mark list opens with the marks the offline database holds while its first page loads, and keeps them when the request fails. Then it pages no further and counts as stale, so a reconnect or the next `activate()` reloads it. `OfflineDBApi` gains `getMessageMarks` and `insertMessageMark`, both required like their reaction counterparts. - Reaction and thread events don't carry marks, so the local marks are kept when those events replace the message. - A thread now registers its channel's server config. A thread opened from the thread list can belong to a channel that was never queried, which left its config empty (no `markTypes`, no `availableCommands`). - The API client is regenerated from the backend commit that added marks. It also picks up the backend changes since the last regeneration (moderation `model` and `provider`, `bypass`, unban query params, `queryUsers` `connection_id`). The server ignores a repeat mark (`created: false`, no event), so a quick play, stop and play before the event arrives sends one extra request and changes nothing. ### Offline page in `BasePaginator` Mark lists showed a bug in how every paginator shows the offline database's first page. The page `preloadFirstPageFromOfflineDb` returned went to `state.items` only, with no interval behind it, so a live item ingested while the first query ran rebuilt the list from empty storage and collapsed it to that one item until the query landed. The channel list had the same collapse once the offline sync was done. - The offline page is stored as the head interval, and the paginator tracks which of its items no live event has touched since (`showsOfflinePage`). The first page from the server, or the next one after a failed query, takes the place of those items as a first page. Items a live event touched stay and merge with it. - `setItemsFromOfflineDb` shows the offline page without a query, for a paginator that defers its first query. `ChannelPaginator` uses it and `showsOfflinePage` for its cold start before the offline sync, in place of its own flags, so both of its offline paths now work the same way. - After a failed cold-start query, pull-to-refresh and scrolling to the end merged the next page into the cached channels and kept channels the server no longer returns. They now replace them. A recovery after a failed cold start updates the list once instead of adding the new channels and removing the dropped ones in two steps. - Every other channel list flow is unchanged. The offline flows are recorded publish by publish in the `ChannelPaginator` tests: cold start before and after the sync, a failed first query followed by recovery, pull-to-refresh or another query, a live channel arriving during the first query, and a list loaded from the server that reconnects or refreshes. Each was compared against the code before this change, and only the cases listed above differ. ## Changelog - Add `channel.sendMessageMark` and `channel.markMessagePlayed`, and handle the `message.mark_added` event. - Add `channel.config.markTypes`. - Add `MessageMarkPaginator` and `client.messageMarks` (`registerPaginator`, `getPaginatorById`, `removePaginator`) to list who marked a message, kept current by `message.mark_added`. - Queue message marks while offline. - Open message mark lists from the offline database. `OfflineDBApi` gains the required `getMessageMarks` and `insertMessageMark`, so a custom offline DB implementation has to add them. - Fix a list showing the offline database's page collapsing to one item when a live item arrived while its first query ran, which affected the channel list once the offline sync was done. - Fix the channel list keeping channels the server no longer returns after a failed cold-start query, on pull-to-refresh or when scrolling to the end. - Fix a thread opened from the thread list missing its channel's server config. ## Testing Besides the unit tests, the paginator and `client.messageMarks` ran against a real app with throwaway users: pages of 2 followed the server's cursors to the last page in order, a live mark from a user the client had never seen joined the list with no request, a list found again by its id after closing came back with no request, a reconnect reloaded the shown list, and a hard delete dropped it. The offline mark lists ran on an Android emulator with the React Native SDK: a list opened in airplane mode came from the stored marks and stopped at its page size without retrying, a mark added on the server while the app was offline appeared at the top after the reconnect reloaded the list, and the list then paged to its end. A live mark landed in the offline database as its row, its user and the message's mark summaries. The channel list still showed its cached channels on an offline cold start, with the same timing as before the `BasePaginator` change.
10.3.0 adds four scheduled-message notification types, which the notification translations have to map, and editedScheduledMessage to the composer state. 10.3.1 lets a bounced message be sent again after it is edited.
SDK Size
|
|
π This PR is included in version 10.3.0 π The release is available on:
Your semantic-release bot π¦π |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket: https://linear.app/stream/issue/RN-542 (backend: https://linear.app/stream/issue/CHA-6554)
Replaces #3962. Depends on GetStream/stream-chat-js#2039. Typecheck fails until a
stream-chatrelease shipsmarkMessagePlayed,channel.config.markTypes, the marks types and the offline DB'sgetMessageMarksandinsertMessageMark. The synced design tokens come from GetStream/design-system-tokens#83.π― Goal
Show the author of a voice note, audio file or video that other users played it, following the "Message Marks" design.
π Implementation details
onPlaybackStartedcallback, called on each progress once playback advances, after any download and buffering, until it returnstrue. The message is marked once it actually plays, even if its bubble scrolled away while the audio buffered. A pool keeps a player's callback when a later caller passes none.AudioAttachmentpasses a callback for its message. Composer previews pass none and are never marked.AnimatedGalleryVideopasses a callback for the video's message.openImageGallerytakes an optionalchannel, whichGalleryand the channel detailsMediaListpass. A gallery opened without one marks nothing.ChatConfigProvider, which takes an optionalhandlePlaybackStarted({ attachment, markPlayed, message, player }). It is called as playback advances until it returnstrue, so returningfalsecan wait for a minimum played time, and it can skip marking or branch onattachment.typeormessage.cid. Without it the message is marked as soon as playback starts. Render the provider aboveOverlayProviderso it also reaches gallery videos. The types areHandlePlaybackStartedandPlaybackStartedParams.useMarkMessagePlayedis public, for a custom player that does not use the SDK's players.Gallery autoplay fix
autoPlayVideoon, every gallery player was created playing, so the slides next to the shown one played off screen, sound included, and moving to another slide paused nothing, because autoplay never went throughplay()and the pool had no active player. The same code is in v9.playedmark, the user's own messages and messages the user already marked, and queues the mark while offline. A failed mark is ignored.MessageMarkslot shows the mark in the footer's status row, before the delivery status and separated from it by a dot. A direct message reads "Played", any other channel "Played by" and the count, capped at 99+. It uses the read colour and the theme tokens, with theme keysmessageItemView.mark.{container,text,separator}.channel.config.markTypesincludesplayed. There is no opt-in prop. Turning marks on for the channel type is the switch.MessageandMessageFootermemo comparators andstringifyMessageinclude the played count, so a mark that arrives while the channel is open re-renders the row.Offline mark lists
MessageMarkPaginatorinstream-chat) opens offline from the stored marks while its first page loads.messageMarkstable holds one row per marker (messageId,userId,type,createdAt), deleted with its message. Rows come from each stored message'smark_groups, which carries the newest markers per type (up to 100), and frommessage.mark_added.mark_groupsandown_marksmove out ofextraDatainto their ownmarkGroupsandownMarkscolumns, asreaction_groupshasreactionGroups, so a new mark updates them without rewriting the message.OfflineDBimplementsgetMessageMarks, the stored marks on a message newest first and joined to the stored users (a mark whose user is not stored lists with the user's ID), andinsertMessageMark, which stores the mark, the user who made it and the two columns.SqliteClient.dbVersiongoes from 19 to 20, so existing installs rebuild their offline database once on update.Design tokens
chat*βmessageBubble*,presence*βavatarPresence*, theavatarPalette*set, ...). Its React Native build now keeps every old name mapped to the current token (GetStream/design-system-tokens#83), sotheme.semanticsonly gains keys and the SDK compiles unchanged. The old names are removed in the next major.blue200instead ofblue400.accentWarningand the avatar default colours changed too, but no SDK component reads them directly.AGENTS.mdnow says where the tokens come from, that the old names are adapters kept in the token repo, and that new code uses the current names.Avatars
avatarBgDefaultandavatarTextDefaultinstead of a colour picked per user or channel from the 5-colour palette, following the current design. Light mode matches what palette 1 looked like. In dark mode the default is the mode-aware brand colour. TheavatarPalette*keys stay intheme.semanticsthrough the token adapter, so integrators can still use them.π¨ UI Changes
iOS
Android
π§ͺ Testing
playedmark type, "Played" in a direct message, the count and 99+ in a channel, a mark that arrives live, and the mark-only row on an earlier message in a group.onPlaybackStartedonce on the first progress, asking again until it returnstrue, nothing while paused, an autoplaying video only once it advances, Expo'sprogress, and the callback on a reused player. Gallery video tests render the gallery with a real pool and cover autoplay playing only the shown video, moving to another slide pausing it and playing the new one, no autoplay withoutautoPlayVideo, marking the shown video, a handler fromChatConfigProviderdeciding, and nothing without a channel.AudioAttachmenttests render it in aChannel: a press alone does not mark, the first progress does, a preview never does, and a configured handler decides.useMarkMessagePlayedhas its own tests.stream-chatbranch. As the author, in a direct message, no mark before a play, then "Played" alone under the earlier voice note and "Played Β· β time" on the last message, both live and after a reload. As the recipient, playing a voice note and playing a video in the gallery each wrote the mark only once playback started, and the author saw "Played Β· ββ time" under the video. Rechecked after moving the override toChatConfigProvider. With autoplay on and a message with two videos, logging each slide's progress showed the off-screen slide playing alongside the shown one before the fix, and only the shown slide playing after it, opening either slide. Moving between slides, a customhandlePlaybackStartedand "Played by" with a count are covered by the unit tests only.mark_groupslives in its column and not inextraDataand reads back, andinsertMessageMarkstores the mark, its user and the columns without touching the rest of the message, stores the user's own mark on another user's message, and skips a message the database never held without aborting the rest of the batch.markGroups, withmark_groupsgone fromextraData. The channel list still showed its cached channels on an offline cold start.MessageSystem,TypingIndicator,MessageAuthorandThreadsnapshots are updated for the token references and the avatar colour.βοΈ Checklist
developbranch