Skip to main content
CometChatSavedMessages lists the messages the logged-in user has saved, across every conversation. Each row shows where the message came from — the group, or the other person in a one-to-one chat — with the message’s preview and the time it was sent. Swipe a row to unsave it. Tapping a row hands you the message, so you can open its conversation at it.
CometChatSavedMessages showing saved messages with their conversation and time

Where It Fits

The screen is user-level: it needs no user or group.
It fetches the saved messages when it first appears — up to about a hundred, newest save first as the server orders them — and does not fetch again while it stays on screen.

Quick Start

Push it from a NavigationStack, and open the message’s conversation when a row is tapped:
onMessageClick receives the SDK’s BaseMessage. Its receiver is the Group it was sent to, or the User at the other end of a one-to-one chat — the receiver when you sent it, the sender otherwise.The screen uses the system navigation bar with an inline title. With no onBackClick, the back chevron dismisses the screen. Pass one to handle it yourself:

Rows

Each row is 72 pt: the source’s avatar, its name, and a one-line preview — the sender’s name in bold, a glyph for the message’s type, and the text — with the time on the right.The time is when the message was sent: a time today, “Yesterday”, a weekday within the week, then a date. A message with no send time shows none. A deleted message reads “This message was deleted”.

Unsaving

Swipe a row left and tap Unsave. A confirmation asks first; confirming removes the row at once and shows “Message unsaved”. If the server refuses, the row comes back where it was, with no message. There is no long-press menu on this screen; the swipe is the only way to unsave.
Saves and unsaves made elsewhere — in an open chat, or on another device — appear here without a refresh.

Actions and Events

Callback Methods

There are no load, empty or error callbacks: read store.uiState.

SDK Events (Real-Time, Automatic)

The screen loads once, and stays live through its own SDK listener and the Kit’s events: a save or unsave made anywhere in the app appears without a refresh.
There is no pull-to-refresh.

Functionality


States

Hide a state with hideLoadingState, hideEmptyState or hideErrorState.

Custom View Slots

Replace any state. The error view receives no retry action — there is no retry on this screen:
Or for every Saved Messages screen in a subtree. An initialiser argument wins:
Replace the whole row, or one part of it. Each slot receives a SavedMessageItem — the message as a value, its source’s title and avatar, its preview and its send time:
itemView replaces the whole row, and the other four are then not used.The modifier .cometChatSavedMessagesHidden hides states for a subtree.

Advanced Methods

Store Access

SavedMessagesStore loads and holds the rows. Pass your own to read its state — uiState, messages, count — or to show fixed rows in a preview:
A seeded store never fetches. count is there for you to show; the screen’s title never carries it.

Subclassing

CometChatSavedMessages is a View struct. Customise it with its slots, modifiers and style.

Accessibility

  • Each row is one element: the source’s name, then the preview and the time.
  • The swipe action reads “Unsave”.
  • The empty and error art is decorative; their titles are headers.

Style

CometChatSavedMessagesStyle is sparse: set only what you change.

Next Steps

Pinned Messages

The messages pinned in one conversation

Message List

Save and unsave messages from the list’s menu

Pin and Save Messages

Build pinning and saving end to end

Component Styling

Style every component