ChannelsViewModel

class ChannelsViewModel(repository: ChannelsScreenResourceRepository, savedStateHandle: SavedStateHandle) : ViewModel, SendbirdViewModelContract

The ViewModel class for ChannelsScreen.

Since

1.0.0-beta.1

Constructors

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

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val channelsEventState: StateFlow<ChannelsEvent>

The StateFlow of the list of UikitGroupChannel.

Link copied to clipboard

The StateFlow of the SimpleSendbirdEventState for the leaveChannel request.

Link copied to clipboard

The StateFlow of the SimpleSendbirdEventState for the loadMore request.

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

The StateFlow of the SendbirdScreenUiState.

Functions

Link copied to clipboard

Requests to leave the channel. The result will be notified by leaveChannelEventState.

Link copied to clipboard
fun loadMore()

Requests to load more channels. This should be called when the user scrolls to the end of the list.

Link copied to clipboard

Notifies that the leaveChannel event has been processed to reset leaveChannelEventState to SendbirdEventState.Idle state.

Link copied to clipboard

Notifies that the loadMore event has been processed to reset loadMoreEventState 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
fun setMyPushTriggerOption(url: String, option: GroupChannel.PushTriggerOption)

Requests to set the push trigger option for the current user for a specific channel.