ChannelState

interface ChannelState

State container with reactive data of a channel.

Properties

Link copied to clipboard
abstract val channelConfig: StateFlow<Config>

Channel config data

Link copied to clipboard
abstract val channelData: StateFlow<ChannelData>

StateFlow object with the channel data.

Link copied to clipboard
abstract val channelId: String

Id of this channel.

Link copied to clipboard
abstract val channelType: String

Type of this channel.

Link copied to clipboard
abstract val cid: String

CID of this channel. It's 'channelType:channelId'.

Link copied to clipboard
abstract val endOfNewerMessages: StateFlow<Boolean>

If there are no more newer messages to load.

Link copied to clipboard
abstract val endOfOlderMessages: StateFlow<Boolean>

If there are no more older messages to load.

Link copied to clipboard
abstract val hidden: StateFlow<Boolean>

If the channel is currently hidden.

Link copied to clipboard
abstract val insideSearch: StateFlow<Boolean>
Link copied to clipboard
abstract val lastSentMessageDate: StateFlow<Date?>

The date of the last message sent by the current user.

Link copied to clipboard
abstract val loading: StateFlow<Boolean>

If we are currently loading.

Link copied to clipboard
abstract val loadingNewerMessages: StateFlow<Boolean>

If we are currently loading newer messages.

Link copied to clipboard
abstract val loadingOlderMessages: StateFlow<Boolean>

If we are currently loading older messages.

Link copied to clipboard
abstract val members: StateFlow<List<Member>>

The list of members of this channel.

Link copied to clipboard
abstract val membersCount: StateFlow<Int>

Number of all members of this channel.

Link copied to clipboard
abstract val messages: StateFlow<List<Message>>

The message collection of this channel.

Link copied to clipboard
abstract val messagesState: StateFlow<MessagesState>

Strong typed state of message collection of this channel. See MessagesState for more details.

Link copied to clipboard
abstract val muted: StateFlow<Boolean>

If the channel is currently muted.

Link copied to clipboard
abstract val oldMessages: StateFlow<List<Message>>

The collection of messages from previous pages of data.

Link copied to clipboard
abstract val pinnedMessages: StateFlow<List<Message>>

The pinned message collection of this channel.

Link copied to clipboard
abstract val quotedMessagesMap: StateFlow<Map<String, List<String>>>

A map containing all the ids that quoted a message. Using the id of a message you can get the IDs of the messages that quoted it. This can be used to reflected changes of the original message to the messages that quoted it.

Link copied to clipboard
abstract val read: StateFlow<ChannelUserRead?>

Read status for the current user.

Link copied to clipboard
abstract val reads: StateFlow<List<ChannelUserRead>>

How far every user in this channel has read.

Link copied to clipboard
abstract val recoveryNeeded: Boolean

If we need to recover state when connection established again.

Link copied to clipboard
abstract val repliedMessage: StateFlow<Message?>

A replied message state in this channel. By default is null. There is a value if you're replying some message.

Link copied to clipboard
abstract val typing: StateFlow<TypingEvent>

Who is currently typing. Current user is excluded from this.

Link copied to clipboard
abstract val unreadCount: StateFlow<Int>

Unread count for this channel, calculated based on read state. This works even if you're offline.

Link copied to clipboard
abstract val watcherCount: StateFlow<Int>

The number of people currently watching the channel.

Link copied to clipboard
abstract val watchers: StateFlow<List<User>>

The list of users currently watching this channel.

Functions

Link copied to clipboard
abstract fun getMessageById(id: String): Message?

Gets message using the ID. This is a more performatic way to request one message than request the whole list of messages

Link copied to clipboard
abstract fun toChannel(): Channel

Function that builds a channel based on data from StateFlows.