Skip to content

feat: scheduled messages - #4033

Draft
isekovanic wants to merge 24 commits into
developfrom
feat/scheduled-messages
Draft

isekovanic wants to merge 24 commits into
developfrom
feat/scheduled-messages

Conversation

@isekovanic

Copy link
Copy Markdown
Contributor

Summary

Scheduled messages in the React Native SDK, following the iOS Figma frames.

  • Composer: schedule a message from the send button's long press, with preset times or a custom time through the native date and time pickers; edit a scheduled message in its own composer.
  • Banner: the channel and thread show how many messages are scheduled, failed ones first, and open the list.
  • List: a channel's or thread's scheduled messages, and an app-wide list in the SampleApp, with search, a loading skeleton, and rows for messages still being scheduled (uploading, sending).
  • Actions: edit, reschedule, send now, delete and copy, by status; locked while a request is in flight or the server is sending the message.
  • Channel details: a scheduled messages row.
  • Offline support
    • Scheduled messages are stored in SQLite: a scheduledMessages table linked to their message rows (marked by scheduledAt), kept out of the channel's normal messages. DB version 21.
    • getChannels returns each channel's stored scheduled messages, so a channel restored offline has its list.
    • A row whose request is queued offline stays actionable; a queued send now offers Delete only.

Notes

  • Depends on the stream-chat-js follow-ups (GetStream/stream-chat-js, branch feat/scheduled-messages-followups-and-offline), which are not released yet; stream-chat is still ^10.3.1 here. Draft until that release lands and the dependency is bumped.

Test plan

  • yarn lint, yarn test in package.
  • Android emulator (and iOS simulator for the UI): scheduling, editing, rescheduling, send now, delete, failed messages, threads; offline cold start, queued actions and their replay on reconnect.

Ticket: https://linear.app/stream/issue/RN-552

…ttachment picker is open

The attachment picker sheet is lifted by `bottomInset`, but the composer rose by
`attachmentPickerBottomSheetHeight - bottomInset`, so any non-zero inset made the
picker cover the composer. It now rises by the picker height plus the inset.
Utilities, hooks and wiring the scheduled messages UI builds on, with no UI yet:
- schedule time presets, bounds and defaults, failure and error copy, deleted
  quote checks
- hooks over the LLC's scheduled message views (`useScheduledMessages`,
  `useChannelScheduledMessages`, `useChannelWideScheduledMessagesView`), the
  per-channel limit and the edited scheduled message
- `Chat` registers `client.scheduledMessagePaginators`
- translations for the LLC's scheduled message notifications
- the scheduled messages theme keys
A long press on send opens the quick times. Custom time opens a date and time sheet on top of them.
A banner above the composer sums up the scheduled messages of the channel, or of the thread
in a thread, and opens them through onScheduledMessagesBannerPress. The list makes room for it
and keeps it above a closing message overlay.

With a fixed composer the list no longer re-renders when the keyboard changes the composer's
height.
Editing a scheduled message opens it in a composer of its own, so the channel's draft is left
alone. The provider's editScheduledMessage fills that composer in before putting it in use, and
ScheduledMessageEditComposer shows it while the edit lasts. Saving updates the message in place;
a failed message asks for a new time and is scheduled again as a new message.

Save stays disabled while the quoted message is deleted, where the notice offers to remove the
quote, or while a command is typed, which a toast explains.
…eduling a failed message

Scheduling a failed message again ends the edit, which unmounted the composer and the sheet inside
it, so the sheet vanished instead of sliding closed. ScheduledMessageEditComposer now hosts the
sheet next to the composer, with the preview and time copied when it opens. Errors still show in
the sheet. Without that host the button keeps rendering its own sheet.
ScheduledMessageList lists any scheduled messages view, a channel's, a thread's or one across
channels, with search, actions and the reschedule sheet, and needs no Channel.
ChannelScheduledMessages renders it inside the app's Channel and edits messages in place under
the list. A list across channels edits through ScheduledMessageEditComposer, which can now start
an edit itself and report its end.

Rescheduling goes through messageOperations.rescheduleScheduledMessage, so a failed message comes
back with all of its content. The shared location block reason is gone, as messages with a
location can be scheduled now.
…read no theme

The scheduled message components wrapped static styles in a useStyles hook with no dependencies.
They are module level now; a hook stays only where styles read the theme.
Every scheduled messages component now uses the semantics, primitives and
component tokens its Figma frame binds: colors, spacing, radii, icon sizes,
line heights and the banner's elevation shadow. The list paints the app
background itself, as the other SDK lists do.

Adds ExclamationCircleOutline, drawn from the Figma SVG, for the failed
banner, the list's load error, the sheet's error notice and the deleted
quote notice. The calendar and the time pill take their sizes from the iOS
date picker the frames show, which has no Stream tokens.
Adds a Scheduled Messages row after Pinned Messages. It has no built-in
modal, since editing a scheduled message needs the app's own Channel, so
the row shows only once the app routes it through getNavigationItems, and
only where the user can schedule messages.

useCanScheduleMessages follows channel.scheduledMessagesEnabled and
re-renders when the user's capabilities or the scheduled messages config
change, so the row appears and disappears with them.
Adds a channel's and a thread's scheduled messages screen, reached from
the banner and from the channel details row, and a Scheduled tab that
lists every scheduled message across channels.

Editing from the tab queries the message's channel when it isn't loaded,
so the composer has its config, then mounts a Channel for the edit. The
tab bar slides out while editing, so the composer and the attachment
picker sit at the bottom of the window.
…s on Android

Editing starts from an action sheet, which on Android is a separate Dialog
window. The edit composer mounts and focuses its input while that window can
still hold focus, and Android opens no keyboard for an unfocused window.

useFocusMessageInput focuses the input when an edit starts and, on Android,
focuses it again once the app window gets focus back. It is internal and not
exported from the package.
…hadow

With the floating composer, the attach button was an outline with no fill, so
the message list showed through it. It now gets the elevation-1 surface and the
elevation-3 shadow, as in the floating style's Figma frames and like the input
next to it. The regular composer is unchanged.
The scheduled messages list used the generic list skeleton, which can't draw
its rows. ScheduledMessageListLoadingSkeleton follows the Figma loading frame:
the send time, then the avatar, title and message, six rows in all. The
scheduledMessageListSkeleton theme key now names those parts.
…d time pickers

The custom time sheet now follows the Figma Date and Time rows. Pressing Date
opens the system date picker and, once a date is confirmed, the time picker.
Pressing Time opens the time picker alone. The JS calendar and time picker are
removed, together with their theme keys and exports.

The pickers come from a new optional native handler, pickDateTime, which the
native and Expo packages register. It resolves with the selected moment, or
with null when the picker is cancelled, and accepts an AbortSignal that closes
an open picker. The sheet aborts it on unmount.

On Android, the Material date and time pickers use self-contained Material 3
themes in the Stream neutrals, so they render correctly in AppCompat apps and
never modify the app theme. Apps can override the colours by redefining the
resources. The time picker follows the system 12 or 24 hour setting.

On iOS, UIDatePicker is presented in a card above the topmost view controller,
including React Native modals. Only one picker is shown at a time, and every
call resolves exactly once, also when its host is dismissed or the bridge
reloads.
Expo 58.0.25 depends on expo-modules-core 58.1.0, which requires React Native
0.88.1. On 0.88.0 the iOS app fails at launch because RCTStatusBarAppearance is
missing, so the example now uses the version Expo SDK 58 expects.
…nslation keys

Scheduled message times were formatted in code with fixed Day.js templates, so
an app could translate the surrounding sentences but not the format of the time
itself. They now resolve through timestamp.ScheduledMessageTime,
timestamp.ScheduledMessageDate and timestamp.ScheduledMessageWeekday with
getDateString, as the other timestamps in the SDK do, and default to the 24 hour
format of the design.

useScheduledTimeFormatter is replaced by plain formatting functions in
utils/scheduledTimeLabels that take the translation functions from the context.
…e the picker is open

The composer subtracts the attachment picker space from its measured height while the picker
is open. Only the docked wrapper pads itself for the picker. The floating composer is lifted
by a spacer outside the measured view, so the subtraction stored a negative height, and the
banner, suggestions, toasts and list padding anchored to it dropped behind the composer until
the composer resized again.
…ding or sending

A message whose schedule request is still in flight is listed at once by the client. Its row
reads "Uploading…" while an attachment uploads and "Sending…" after, and like a message the
server is sending it offers no actions and a tap shows the still sending notice.
…he composer by testID

A scheduled message the server marks sending reads "Sending…" and a tap shows the still sending
notice instead of its actions. The composer's measured view gets a testID, so its height test
no longer matches the layout handler's source.
Implements the scheduled message methods of OfflineDBApi. A scheduled message's
content goes in the messages table under its ID, marked by a new scheduledAt
column, and its scheduling in a new scheduledMessages table linked to it by a
foreign key. One whose channel is not stored is skipped. Channel and thread
reads, the read by ID and truncation leave scheduled messages out, and the
message mapper drops the column. The response's slim channel is stored too, for
the channel names of a list across channels. DB version 20 -> 21.
…queued offline

A scheduled message is locked while the client's own request for it is in
flight (requestState inFlight) or while the server is sending it. Once its
request waits in the offline queue (requestState queued) it can be acted on
again: one still being scheduled offers the actions of one that waits, and one
whose send now is queued offers delete, to take it back before it goes. The
"Sending..." label still shows for both.
…nels

getChannels attaches each channel's stored scheduled messages as scheduled_messages, so a channel
restored from the offline DB fills its scheduled list as a channel query would.
@isekovanic
isekovanic requested a review from oliverlaz December 1, 2026 08:57
…etadata

stream-chat keeps pending and requestState under localMetadata on LocalScheduledMessage.

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.

2 participants