Repository navigation
feat: played receipts for voice messages and audio files - #4023
Open
isekovanic wants to merge 12 commits into
Open
isekovanic wants to merge 12 commits into
isekovanic wants to merge 12 commits into
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
This branch has not been deployed
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.markTypesand 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
messageIdand tell their pool when playback first advances, after any download and buffering, through an optionalonPlaybackStartedpool callback. Whatever UI controls the player, the message is marked once it actually plays, even if its bubble scrolled away while the audio buffered.ChannelShellgives its audio pool a callback that callschannel.markMessagePlayed(player.messageId).AudioAttachmentonly passes themessageIdtouseAudioPlayer. Composer previews pass none and are never marked.openImageGallerytakes an optionalchannel, whichGalleryand the channel detailsMediaListpass. A gallery opened without one marks nothing.useMarkMessagePlayedis public, for a custom player that does not use the SDK's players.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.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.progress. Gallery tests with a real pool cover marking the shown video, a neighbour only once shown, and nothing without a channel.AudioAttachmenttests go throughChannelShell: a press alone does not mark, the first progress does, and a preview never does.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, and the author saw "Played · ✓✓ time" under the video. Autoplay and "Played by" with a count are covered by the unit tests only.MessageSystem,TypingIndicator,MessageAuthorandThreadsnapshots are updated for the token references and the avatar colour.☑️ Checklist
developbranch