library / io.getstream.chat.android.livedata.controller / ChannelController

ChannelController

interface ChannelController

The Channel Controller exposes convenient livedata objects to build your chat interface It automatically handles the incoming events and keeps users, messages, reactions, channel information up to date automatically Offline storage is also handled using Room

The most commonly used livedata objects are

Properties

channelData

LiveData object with the channel data

abstract val channelData: LiveData<ChannelData>

channelId

abstract var channelId: String

channelType

abstract var channelType: String

cid

abstract val cid: String

endOfNewerMessages

set to true if there are no more newer messages to load

abstract val endOfNewerMessages: LiveData<Boolean>

endOfOlderMessages

set to true if there are no more older messages to load

abstract val endOfOlderMessages: LiveData<Boolean>

hidden

abstract val hidden: LiveData<Boolean>

loading

if we are currently loading

abstract val loading: LiveData<Boolean>

loadingNewerMessages

if we are currently loading newer messages

abstract val loadingNewerMessages: LiveData<Boolean>

loadingOlderMessages

if we are currently loading older messages

abstract val loadingOlderMessages: LiveData<Boolean>

members

the list of members of this channel

abstract val members: LiveData<List<Member>>

messages

a list of messages sorted by message.createdAt

abstract val messages: LiveData<List<Message>>

muted

abstract val muted: LiveData<Boolean>

read

read status for the current user

abstract val read: LiveData<ChannelUserRead>

reads

how far every user in this channel has read

abstract val reads: LiveData<List<ChannelUserRead>>

recoveryNeeded

abstract var recoveryNeeded: Boolean

typing

who is currently typing (current user is excluded from this)

abstract val typing: LiveData<List<User>>

unreadCount

unread count for this channel, calculated based on read state (this works even if you're offline)

abstract val unreadCount: LiveData<Int>

watcherCount

the number of people currently watching the channel

abstract val watcherCount: LiveData<Int>

watchers

the list of users currently watching this channel

abstract val watchers: LiveData<List<User>>

Functions

clean

abstract fun clean(): Unit

getMessage

abstract fun getMessage(messageId: String): Message?

toChannel

abstract fun toChannel(): Channel

upsertMessage

abstract fun upsertMessage(message: Message): Unit

Inheritors

ChannelControllerImpl

class ChannelControllerImpl : ChannelController