ChannelViewModel

ViewModel preparing and managing data related with the list of messages in a channel since 3.0.0

Constructors

Link copied to clipboard
open fun ChannelViewModel(@NonNull channelUrl: String, @Nullable messageListParams: MessageListParams)
Constructor

Types

Link copied to clipboard
Class that holds message data in a channel.

Functions

Link copied to clipboard
open fun buildMessageList(): List<BaseMessage>
Processes a list of messages to be passed to the view.
Link copied to clipboard
open fun createMessageListParams(): MessageListParams
Creates params for the message list when loading the message list.
Link copied to clipboard
open fun deleteMessage(@NonNull message: BaseMessage, @Nullable handler: OnCompleteHandler)
Deletes a message.
Link copied to clipboard
Returns LiveData that can be observed if huge gaps are detected within the collection this view model managed.
Link copied to clipboard
open fun getMessageById(messageId: Long): BaseMessage
Retrieves message that matches messageId from the message list which this view model manages.
Link copied to clipboard
Returns LiveData that can be observed for the state of loading messages.
Link copied to clipboard
open fun getMessagesByCreatedAt(createdAt: Long): List<BaseMessage>
Retrieves messages created at createdAt from the message list which this view model manages.
Link copied to clipboard
Returns the timestamp that is the starting point when the message list is fetched initially.
Link copied to clipboard
Returns LiveData that can be observed for the status of the result of fetching the message list.
Link copied to clipboard
Returns LiveData that can be observed for members who are typing in the channel associated with this view model.
Link copied to clipboard
open fun hasMessageById(messageId: Long): Boolean
Checks if the message with messageId is in the message list which this view model manages.
Link copied to clipboard
open fun hasNext(): Boolean
Determine whether the data on the next page exists.
Link copied to clipboard
open fun hasPrevious(): Boolean
Determine whether the data on the previous page exists.
Link copied to clipboard
open fun loadInitial(startingPoint: Long): Boolean
Requests the list of BaseMessages for the first time.
Link copied to clipboard
open fun loadNext(): List<BaseMessage>
Requests the list of BaseMessages when the page goes to the next.
Link copied to clipboard
open fun loadPrevious(): List<BaseMessage>
Requests the list of BaseMessages when the page goes to the previous.
Link copied to clipboard
Returns LiveData that can be observed if the channel has been deleted.
Link copied to clipboard
open fun onChannelUpdated(): LiveData<GroupChannel>
Returns LiveData that can be observed if the channel has been updated.
Link copied to clipboard
protected open fun onCleared()
Link copied to clipboard
open fun onFeedbackDeleted(): LiveData<Pair<BaseMessage, SendbirdException>>
Returns LiveData that can be observed for the result of deleting feedback.
Link copied to clipboard
open fun onFeedbackSubmitted(): LiveData<Pair<BaseMessage, SendbirdException>>
Returns LiveData that can be observed for the result of submitting feedback.
Link copied to clipboard
open fun onFeedbackUpdated(): LiveData<Pair<BaseMessage, SendbirdException>>
Returns LiveData that can be observed for the result of updating feedback.
Link copied to clipboard
open fun onMessagesDeleted(): LiveData<List<BaseMessage>>
Returns LiveData that can be observed if the messages has been deleted in the collection this view model managed.
Link copied to clipboard
open fun removeFeedback(@NonNull message: BaseMessage)
Removes feedback for the message.
Link copied to clipboard
open fun setMessageCollectionHandler(@Nullable handler: MessageCollectionHandler)
Registers a handler for the message collection managed by this view model.
Link copied to clipboard
open fun submitFeedback(@NonNull message: BaseMessage, @NonNull rating: FeedbackRating, @Nullable comment: String)
Submits feedback for the message.

Properties

Link copied to clipboard
open val messageListParams: MessageListParams