MessageListViewModelFactory

class MessageListViewModelFactory @JvmOverloads constructor(context: Context, cid: String, messageId: String? = null, parentMessageId: String? = null, chatClient: ChatClient = ChatClient.instance(), clientState: ClientState = chatClient.clientState, mediaRecorder: StreamMediaRecorder = DefaultStreamMediaRecorder(context.applicationContext), userLookupHandler: UserLookupHandler = DefaultUserLookupHandler(chatClient, cid), fileToUri: (File) -> String = { file -> file.toUri().toString() }, messageLimit: Int = MessageListController.DEFAULT_MESSAGES_LIMIT, enforceUniqueReactions: Boolean = true, maxAttachmentCount: Int = AttachmentConstants.MAX_ATTACHMENTS_COUNT, showSystemMessages: Boolean = true, deletedMessageVisibility: DeletedMessageVisibility = DeletedMessageVisibility.ALWAYS_VISIBLE, messageFooterVisibility: MessageFooterVisibility = MessageFooterVisibility.WithTimeDifference(), dateSeparatorHandler: DateSeparatorHandler = DateSeparatorHandler.getDefaultDateSeparatorHandler(), threadDateSeparatorHandler: DateSeparatorHandler = DateSeparatorHandler.getDefaultThreadDateSeparatorHandler(), messagePositionHandler: MessagePositionHandler = MessagePositionHandler.defaultHandler(), showDateSeparatorInEmptyThread: Boolean = false, showThreadSeparatorInEmptyThread: Boolean = false, threadLoadOlderToNewer: Boolean = false) : ViewModelProvider.Factory

A ViewModel factory for MessageListViewModel, MessageListHeaderViewModel and MessageComposerViewModel.

Parameters

cid

The current channel ID, to load the messages from.

messageId

The message ID to which we want to scroll to when opening the message list.

parentMessageId

The ID of the parent Message if the message we want to scroll to is in a thread. If the message we want to scroll to is not in a thread, you can pass in a null value.

chatClient

The client to use for API calls.

clientState

The current state of the SDK.

mediaRecorder

The media recorder for async voice messages.

messageLimit

The limit of the messages to load in a single page.

enforceUniqueReactions

Flag to enforce unique reactions or enable multiple from the same user.

maxAttachmentCount

The maximum number of attachments that can be sent in a single message.

showSystemMessages

If we should show system message items in the list.

deletedMessageVisibility

The behavior of deleted messages in the list and if they're visible or not.

messageFooterVisibility

The behavior of message footers in the list and their visibility.

dateSeparatorHandler

Handler that determines when the date separators should be visible.

threadDateSeparatorHandler

Handler that determines when the thread date separators should be visible.

messagePositionHandler

Determines the position of the message inside a group.

showDateSeparatorInEmptyThread

Configures if we show a date separator when threads are empty. Adds the separator item when the value is true.

showThreadSeparatorInEmptyThread

Configures if we show a thread separator when threads are empty. Adds the separator item when the value is true.

threadLoadOlderToNewer

Configures if the thread should be loaded from older to newer messages.

See also

Constructors

Link copied to clipboard
constructor(context: Context, cid: String, messageId: String? = null, parentMessageId: String? = null, chatClient: ChatClient = ChatClient.instance(), clientState: ClientState = chatClient.clientState, mediaRecorder: StreamMediaRecorder = DefaultStreamMediaRecorder(context.applicationContext), userLookupHandler: UserLookupHandler = DefaultUserLookupHandler(chatClient, cid), fileToUri: (File) -> String = { file -> file.toUri().toString() }, messageLimit: Int = MessageListController.DEFAULT_MESSAGES_LIMIT, enforceUniqueReactions: Boolean = true, maxAttachmentCount: Int = AttachmentConstants.MAX_ATTACHMENTS_COUNT, showSystemMessages: Boolean = true, deletedMessageVisibility: DeletedMessageVisibility = DeletedMessageVisibility.ALWAYS_VISIBLE, messageFooterVisibility: MessageFooterVisibility = MessageFooterVisibility.WithTimeDifference(), dateSeparatorHandler: DateSeparatorHandler = DateSeparatorHandler.getDefaultDateSeparatorHandler(), threadDateSeparatorHandler: DateSeparatorHandler = DateSeparatorHandler.getDefaultThreadDateSeparatorHandler(), messagePositionHandler: MessagePositionHandler = MessagePositionHandler.defaultHandler(), showDateSeparatorInEmptyThread: Boolean = false, showThreadSeparatorInEmptyThread: Boolean = false, threadLoadOlderToNewer: Boolean = false)

Types

Link copied to clipboard
class Builder constructor(context: Context)

Functions

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

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