ChannelViewModel

class ChannelViewModel(repository: ChannelScreenResourceRepository, savedStateHandle: SavedStateHandle) : ViewModel, SendbirdViewModelContract

ViewModel class for ChannelScreen.

Since

1.0.0-beta.1

Constructors

Link copied to clipboard
constructor(repository: ChannelScreenResourceRepository, savedStateHandle: SavedStateHandle)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The StateFlow for the deleteMessage request.

Link copied to clipboard

The flag to check if there is a next page. Refer to ChannelScreenResourceRepository.hasNext.

Link copied to clipboard

The flag to check if there is a previous page. Refer to ChannelScreenResourceRepository.hasPrevious.

Link copied to clipboard
var initialized: StateFlow<Boolean>
Link copied to clipboard

The StateFlow for the loadNext request.

Link copied to clipboard

The StateFlow for the loadPrevious request.

Link copied to clipboard
val messagesEventState: StateFlow<MessagesEvent>

The StateFlow of the MessagesEvent.

Link copied to clipboard

The StateFlow for the resendMessage request.

Link copied to clipboard

The StateFlow for the sendFileMessage request.

Link copied to clipboard

The StateFlow for the sendUserMessage request.

Link copied to clipboard
open override val uiState: StateFlow<SendbirdScreenUiState>

The StateFlow of the SendbirdScreenUiState.

Link copied to clipboard

The StateFlow for the updateUserMessage request.

Functions

Link copied to clipboard

Deletes a message with a given message. Deleting is only allowed for a message with ChatBaseMessage type.

Link copied to clipboard
fun loadInitial(startingPoint: Long = Long.MAX_VALUE)

Loads the initial messages.

Link copied to clipboard
fun loadNext()

Loads the messages to the latest direction to fetch newer messages.

Link copied to clipboard

Loads the messages to the previous direction to fetch older messages.

Link copied to clipboard

Notifies that the deleteMessage event has been processed to reset deleteMessageEventState to SendbirdEventState.Idle state.

Link copied to clipboard

Notifies that the loadNext event has been processed to reset loadNextEventState to SendbirdEventState.Idle state.

Link copied to clipboard

Notifies that the loadPrevious event has been processed to reset loadPreviousEventState to SendbirdEventState.Idle state.

Link copied to clipboard

Notifies that the resendMessage event has been processed to reset resendMessageEventState to SendbirdEventState.Idle state.

Link copied to clipboard

Notifies that the sendFileMessage event has been processed to reset sendFileMessageEventState to SendbirdEventState.Idle state.

Link copied to clipboard

Notifies that the sendUserMessage event has been processed to reset sendUserMessageEventState to SendbirdEventState.Idle state.

Link copied to clipboard

Notifies that the updateUserMessage event has been processed to reset updateUserMessageEventState to SendbirdEventState.Idle state.

Link copied to clipboard
protected open override fun onCleared()
Link copied to clipboard
open override fun prepare()

The preparation process required for the screen. This contains the Chat SDK's connection by SendbirdChat.connect and getting the channel object ready if necessary.

Link copied to clipboard

Resends a message with a given message. Resending is only allowed for a message with ChatBaseMessage type.

Link copied to clipboard

Sends a file message with a given file.

Link copied to clipboard
fun sendUserMessage(message: String)

Sends a user message with a given message.

Link copied to clipboard
fun setTyping(isTyping: Boolean)

Sets the typing status.

Link copied to clipboard
fun updateUserMessage(messageId: Long, message: String)

Updates a message with a given messageId and message.