OpenChannelViewModel

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

Constructors

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

Functions

Link copied to clipboard
Tries to connect Sendbird Server and retrieve a channel instance.
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
open fun enterChannel(@NonNull channel: OpenChannel, @NonNull handler: OnCompleteHandler)
Try enter this channel.
Link copied to clipboard
open fun getMessageList(): LiveData<List<BaseMessage>>
Returns LiveData that can be observed for the list of messages.
Link copied to clipboard
Returns LiveData that can be observed for the state of loading messages.
Link copied to clipboard
Returns LiveData that can be observed if the current user is muted or not.
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
open fun hasNext(): Boolean
Returns false as the message list for OpenChannel do not support to load for the next by default.
Link copied to clipboard
open fun hasPrevious(): Boolean
Determine whether the data on the previous page exists.
Link copied to clipboard
open fun loadInitial()
Requests the list of BaseMessages for the first time.
Link copied to clipboard
open fun loadNext(): List<BaseMessage>
Returns the empty list as the message list for OpenChannel do not support to load for the next by default.
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<OpenChannel>
Returns LiveData that can be observed if the channel has been updated.
Link copied to clipboard
protected open fun onCleared()
Link copied to clipboard
Returns LiveData that can be observed if the messages has been deleted.
Link copied to clipboard
open fun resendMessage(@NonNull message: BaseMessage, @Nullable handler: OnCompleteHandler)
Resends a message to the channel.
Link copied to clipboard
open fun sendFileMessage(@NonNull params: FileMessageCreateParams, @NonNull fileInfo: FileInfo, @Nullable handler: OnFilteringMessageHandler)
Sends a file message to the channel.
Link copied to clipboard
open fun sendUserMessage(@NonNull params: UserMessageCreateParams, @Nullable handler: OnFilteringMessageHandler)
Sends a text message to the channel.
Link copied to clipboard
open fun updateUserMessage(messageId: Long, @NonNull params: UserMessageUpdateParams, @Nullable handler: OnCompleteHandler)
Updates a text message with messageId.

Properties

Link copied to clipboard
open val channel: OpenChannel
Link copied to clipboard