-
public interface ChannelControllerThe 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
.messages (the livedata for the list of messages)
.channelData (livedata object with the channel name, image, etc.)
.members (livedata object with the members of this channel)
.watchers (the people currently watching this channel)
.typing (who is currently typing)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classChannelController.MessagesState
-
Method Summary
Modifier and Type Method Description abstract Unitclean()abstract ChanneltoChannel()abstract MessagegetMessage(String messageId)abstract StringgetChannelType()abstract StringgetChannelId()abstract LiveData<List<Message>>getMessages()a list of messages sorted by message. abstract LiveData<ChannelController.MessagesState>getMessagesState()Similar to the messages field, but returns the a MessagesState object This sealed class makes it easier to verify that you've implemented all possible error/no result states abstract LiveData<List<Message>>getOldMessages()Old messages loaded from history of conversation abstract LiveData<Integer>getWatcherCount()the number of people currently watching the channel abstract LiveData<List<User>>getWatchers()the list of users currently watching this channel abstract LiveData<TypingEvent>getTyping()who is currently typing (current user is excluded from this) abstract LiveData<List<ChannelUserRead>>getReads()how far every user in this channel has read abstract LiveData<ChannelUserRead>getRead()read status for the current user abstract LiveData<Integer>getUnreadCount()unread count for this channel, calculated based on read state (this works even if you're offline) abstract LiveData<List<Member>>getMembers()the list of members of this channel abstract LiveData<Boolean>getLoading()if we are currently loading abstract LiveData<Boolean>getLoadingOlderMessages()if we are currently loading older messages abstract LiveData<Boolean>getLoadingNewerMessages()if we are currently loading newer messages abstract LiveData<Boolean>getEndOfOlderMessages()set to true if there are no more older messages to load abstract LiveData<Boolean>getEndOfNewerMessages()set to true if there are no more newer messages to load abstract BooleangetRecoveryNeeded()abstract StringgetCid()abstract LiveData<ChannelData>getOfflineChannelData()abstract LiveData<Message>getRepliedMessage()Contains the Message that is selected to be replied to in this channel, or null if no such selection exists. abstract LiveData<Boolean>getHidden()abstract LiveData<Boolean>getMuted()-
-
Method Detail
-
toChannel
abstract Channel toChannel()
-
getMessage
abstract Message getMessage(String messageId)
-
getChannelType
abstract String getChannelType()
-
getChannelId
abstract String getChannelId()
-
getMessages
abstract LiveData<List<Message>> getMessages()
a list of messages sorted by message.createdAt
-
getMessagesState
abstract LiveData<ChannelController.MessagesState> getMessagesState()
Similar to the messages field, but returns the a MessagesState object This sealed class makes it easier to verify that you've implemented all possible error/no result states
-
getOldMessages
abstract LiveData<List<Message>> getOldMessages()
Old messages loaded from history of conversation
-
getWatcherCount
abstract LiveData<Integer> getWatcherCount()
the number of people currently watching the channel
-
getWatchers
abstract LiveData<List<User>> getWatchers()
the list of users currently watching this channel
-
getTyping
abstract LiveData<TypingEvent> getTyping()
who is currently typing (current user is excluded from this)
-
getReads
abstract LiveData<List<ChannelUserRead>> getReads()
how far every user in this channel has read
-
getUnreadCount
abstract LiveData<Integer> getUnreadCount()
unread count for this channel, calculated based on read state (this works even if you're offline)
-
getMembers
abstract LiveData<List<Member>> getMembers()
the list of members of this channel
-
getLoading
abstract LiveData<Boolean> getLoading()
if we are currently loading
-
getLoadingOlderMessages
abstract LiveData<Boolean> getLoadingOlderMessages()
if we are currently loading older messages
-
getLoadingNewerMessages
abstract LiveData<Boolean> getLoadingNewerMessages()
if we are currently loading newer messages
-
getEndOfOlderMessages
abstract LiveData<Boolean> getEndOfOlderMessages()
set to true if there are no more older messages to load
-
getEndOfNewerMessages
abstract LiveData<Boolean> getEndOfNewerMessages()
set to true if there are no more newer messages to load
-
getRecoveryNeeded
abstract Boolean getRecoveryNeeded()
-
getOfflineChannelData
abstract LiveData<ChannelData> getOfflineChannelData()
-
getRepliedMessage
abstract LiveData<Message> getRepliedMessage()
Contains the Message that is selected to be replied to in this channel, or null if no such selection exists.
-
-
-
-