Skip to content

feat: played receipts for voice messages and audio files - #4023

Open
isekovanic wants to merge 12 commits into
developfrom
feat/message-marks
Open

isekovanic wants to merge 12 commits into
developfrom
feat/message-marks

Conversation

@isekovanic

@isekovanic isekovanic commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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-chat release ships markMessagePlayed, channel.config.markTypes and the marks types. 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

  • Marking follows the player, not the component. 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. Whatever UI controls the player, the message is marked once it actually plays, even if its bubble scrolled away while the audio buffered.
  • ChannelShell gives its audio pool a callback that calls channel.markMessagePlayed(player.messageId). AudioAttachment only passes the messageId to useAudioPlayer. Composer previews pass none and are never marked.
  • The gallery store gives its video pool a callback that marks only the shown slide. Autoplay also plays the slides next to it, so those count on their first progress once shown. openImageGallery takes an optional channel, which Gallery and the channel details MediaList pass. A gallery opened without one marks nothing.
  • useMarkMessagePlayed is public, for a custom player that does not use the SDK's players.
  • The client decides whether to send: it skips channel types without the played mark, the user's own messages and messages the user already marked, and queues the mark while offline. A failed mark is ignored.
  • A new MessageMark slot 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 keys messageItemView.mark.{container,text,separator}.
  • The mark shows only once someone played the message and only when channel.config.markTypes includes played. There is no opt-in prop. Turning marks on for the channel type is the switch.
  • Played messages stay in their group. An earlier message in a group shows only the mark, without the delivery status or timestamp, so the time is not read as the time it was played. The last message keeps the full row.
  • The Message and MessageFooter memo comparators and stringifyMessage include the played count, so a mark that arrives while the channel is open re-renders the row.

Design tokens

  • The generated tokens are synced to the latest design-system-tokens build (last synced in June). The token repo has since renamed or removed 55 semantic tokens (chat* → messageBubble*, presence* → avatarPresence*, the avatarPalette* set, ...). Its React Native build now keeps every old name mapped to the current token (GetStream/design-system-tokens#83), so theme.semantics only gains keys and the SDK compiles unchanged. The old names are removed in the next major.
  • Some token values changed in the design. Dark-mode mention text is now blue200 instead of blue400. accentWarning and the avatar default colours changed too, but no SDK component reads them directly.
  • AGENTS.md now 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

  • Avatars without an image use avatarBgDefault and avatarTextDefault instead 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. The avatarPalette* keys stay in theme.semantics through the token adapter, so integrators can still use them.

🎨 UI Changes

iOS
Before After
Android
Before After

🧪 Testing

  • Unit tests cover the footer mark, with no mark before a play or without the played mark 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.
  • Player tests cover telling the pool once on the first progress, reporting again until the pool handles it, nothing while paused, an autoplaying video only once it advances, and Expo's progress. Gallery tests with a real pool cover marking the shown video, a neighbour only once shown, and nothing without a channel. AudioAttachment tests go through ChannelShell: a press alone does not mark, the first progress does, and a preview never does. useMarkMessagePlayed has its own tests.
  • Tested in the SampleApp on the iOS simulator against the stream-chat branch. 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, and the author saw "Played · ✓✓ time" under the video. Autoplay and "Played by" with a count are covered by the unit tests only.
  • With the synced tokens and the avatar change, typecheck and lint are clean and the full unit suite passes. The MessageSystem, TypingIndicator, MessageAuthor and Thread snapshots are updated for the token references and the avatar colour.

☑️ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

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.

This branch has not been deployed

No deployments
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.

1 participant