-
public final class MessageInputViewModel extends ViewModel
ViewModel class for com.getstream.sdk.chat.view.messageinput.MessageInputView. Responsible for sending and updating chat messages. Can be bound to the view using MessageInputViewModel.bindView function.
-
-
Field Summary
Fields Modifier and Type Field Description private final LiveData<Integer>maxMessageLengthprivate final LiveData<List<Command>>commandsprivate final LiveData<List<Member>>membersprivate final MutableLiveData<Message>editMessage
-
Constructor Summary
Constructors Constructor Description MessageInputViewModel(String cid, ChatDomain chatDomain)
-
Method Summary
Modifier and Type Method Description final UnitsetActiveThread(Message parentMessage)Sets and informs about new active thread final LiveData<Message>getActiveThread()final UnitresetThread()Resets currently active thread final UnitsendMessage(String messageText, Function1<Message, Unit> messageTransformer)final UnitsendMessageWithAttachments(String messageText, List<File> attachmentFiles, Function1<Message, Unit> messageTransformer)final UniteditMessage(Message message)Edit message final Unitkeystroke()keystroke - First of the typing.start and typing.stop events based on the users keystrokes. final UnitstopTyping()stopTyping - Sets last typing to null and sends the typing. final LiveData<Integer>getMaxMessageLength()final LiveData<List<Command>>getCommands()final LiveData<List<Member>>getMembers()final MutableLiveData<Message>getEditMessage()-
Methods inherited from class androidx.lifecycle.ViewModel
equals, hashCode, toString -
Methods inherited from class com.getstream.sdk.chat.viewmodel.MessageInputViewModel
clear, getTag, onCleared, setTagIfAbsent -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
MessageInputViewModel
MessageInputViewModel(String cid, ChatDomain chatDomain)
- Parameters:
cid- the full channel id, i.e.chatDomain- entry point for all livedata & offline operations
-
-
Method Detail
-
setActiveThread
final Unit setActiveThread(Message parentMessage)
Sets and informs about new active thread
-
getActiveThread
final LiveData<Message> getActiveThread()
-
resetThread
final Unit resetThread()
Resets currently active thread
-
sendMessage
final Unit sendMessage(String messageText, Function1<Message, Unit> messageTransformer)
-
sendMessageWithAttachments
final Unit sendMessageWithAttachments(String messageText, List<File> attachmentFiles, Function1<Message, Unit> messageTransformer)
-
editMessage
final Unit editMessage(Message message)
Edit message
- Parameters:
message- the Message sent
-
keystroke
@Synchronized() final Unit keystroke()
keystroke - First of the typing.start and typing.stop events based on the users keystrokes. Call this on every keystroke
-
stopTyping
final Unit stopTyping()
stopTyping - Sets last typing to null and sends the typing.stop event
-
getMaxMessageLength
final LiveData<Integer> getMaxMessageLength()
-
getCommands
final LiveData<List<Command>> getCommands()
-
getMembers
final LiveData<List<Member>> getMembers()
-
getEditMessage
final MutableLiveData<Message> getEditMessage()
-
-
-
-