Class MessageListHeaderViewModel
-
- All Implemented Interfaces:
public final class MessageListHeaderViewModel extends ViewModel
ViewModel class for MessageListHeaderView.
-
-
Field Summary
Fields Modifier and Type Field Description private final LiveData<Channel>channelprivate final LiveData<List<User>>typingUsersprivate final LiveData<List<Member>>membersprivate final LiveData<Integer>membersCountprivate final LiveData<ConnectionState>onlineprivate final LiveData<Message>activeThread
-
Constructor Summary
Constructors Constructor Description MessageListHeaderViewModel(String cid, ChatClient chatClient, ClientState clientState, String messageId)
-
Method Summary
Modifier and Type Method Description final LiveData<Channel>getChannel()The current Channel created from ChannelState. final LiveData<List<User>>getTypingUsers()A list of users who are currently typing. final LiveData<List<Member>>getMembers()A list of Channel members. final LiveData<Integer>getMembersCount()Number of Channel members. final LiveData<ConnectionState>getOnline()Current user's online status. final LiveData<Message>getActiveThread()Signals that we are currently in thread mode if the value is non-null. final UnitsetActiveThread(Message message)Sets thread mode. final UnitresetThread()Switches to normal (non-thread) mode. -
-
Constructor Detail
-
MessageListHeaderViewModel
MessageListHeaderViewModel(String cid, ChatClient chatClient, ClientState clientState, String messageId)
- Parameters:
cid- The CID of the current channel.chatClient- An instance of the low level chat client.clientState- Client state of SDK that contains information such as the current user and connection state.messageId- The id of a message we wish to scroll to in messages list.
-
-
Method Detail
-
getChannel
final LiveData<Channel> getChannel()
The current Channel created from ChannelState. It emits new data either when channel data or the list of members in ChannelState updates.
Combining the two is important because members changing online status does not result in channel events being received.
-
getTypingUsers
final LiveData<List<User>> getTypingUsers()
A list of users who are currently typing.
-
getMembers
final LiveData<List<Member>> getMembers()
A list of Channel members.
-
getMembersCount
final LiveData<Integer> getMembersCount()
Number of Channel members.
-
getActiveThread
final LiveData<Message> getActiveThread()
Signals that we are currently in thread mode if the value is non-null. If the value is null we are in normal mode.
-
setActiveThread
final Unit setActiveThread(Message message)
Sets thread mode.
- Parameters:
message- The original message on which the thread is based on.
-
resetThread
final Unit resetThread()
Switches to normal (non-thread) mode.
-
-
-
-