ChannelViewModelFactory

class ChannelViewModelFactory(chatClient: ChatClient = ChatClient.instance(), querySort: QuerySorter<Channel> = QuerySortByField.descByName("last_updated"), filters: FilterObject? = null, channelLimit: Int = ChannelListViewModel.DEFAULT_CHANNEL_LIMIT, memberLimit: Int = ChannelListViewModel.DEFAULT_MEMBER_LIMIT, messageLimit: Int = ChannelListViewModel.DEFAULT_MESSAGE_LIMIT, chatEventHandlerFactory: ChatEventHandlerFactory = ChatEventHandlerFactory(chatClient.clientState)) : ViewModelProvider.Factory

Builds the factory that contains all the dependencies required for the Channels Screen. It currently provides the ChannelListViewModel using those dependencies.

Parameters

chatClient

The client used to fetch data.

querySort

The sorting order for channels.

filters

The base filters used to filter out channels.

channelLimit

How many channels we fetch per page.

memberLimit

How many members are fetched for each channel item when loading channels.

messageLimit

How many messages are fetched for each channel item when loading channels.

chatEventHandlerFactory

The instance of ChatEventHandlerFactory used to create ChatEventHandler.

Constructors

Link copied to clipboard
constructor(chatClient: ChatClient = ChatClient.instance(), querySort: QuerySorter<Channel> = QuerySortByField.descByName("last_updated"), filters: FilterObject? = null, channelLimit: Int = ChannelListViewModel.DEFAULT_CHANNEL_LIMIT, memberLimit: Int = ChannelListViewModel.DEFAULT_MEMBER_LIMIT, messageLimit: Int = ChannelListViewModel.DEFAULT_MESSAGE_LIMIT, chatEventHandlerFactory: ChatEventHandlerFactory = ChatEventHandlerFactory(chatClient.clientState))

Functions

Link copied to clipboard
open override fun <T : ViewModel> create(modelClass: Class<T>): T

Create a new instance of ChannelListViewModel class.

Inherited functions

Link copied to clipboard
open fun <T : ViewModel> create(modelClass: Class<T>, extras: CreationExtras): T
open fun <T : ViewModel> create(modelClass: KClass<T>, extras: CreationExtras): T