class MessagesViewModelFactory(context: Context, channelId: String, messageId: String? = null, parentMessageId: String? = null, autoTranslationEnabled: Boolean = false, chatClient: ChatClient = ChatClient.instance(), clientState: ClientState = chatClient.clientState, mediaRecorder: StreamMediaRecorder = DefaultStreamMediaRecorder(context.applicationContext), userLookupHandler: UserLookupHandler = DefaultUserLookupHandler(chatClient, channelId), fileToUriConverter: (File) -> String = { file -> file.toUri().toString() }, messageLimit: Int = MessageListController.DEFAULT_MESSAGES_LIMIT, clipboardHandler: ClipboardHandler = ClipboardHandlerImpl(
clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager,
autoTranslationEnabled = autoTranslationEnabled,
getCurrentUser = { chatClient.getCurrentUser() },
), 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, isComposerLinkPreviewEnabled: Boolean = false) :
ViewModelProvider.Factory Holds all the dependencies needed to build the ViewModels for the Messages Screen. Currently builds the MessageComposerViewModel, MessageListViewModel and AttachmentsPickerViewModel.
Parameters
The current channel ID, to load the messages from.
The message id to which we want to scroll to when opening the message list.
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.
The client to use for API calls.
The current state of the SDK.
The media recorder for async voice messages.
The number of messages to load in a single page.
Flag to enforce unique reactions or enable multiple from the same user.
The maximum number of attachments that can be sent in a single message.
If we should show system message items in the list.
The behavior of deleted messages in the list and if they're visible or not.
The behavior of message footers in the list and their visibility.
Handler that determines when the date separators should be visible.
threadDateSeparatorHandler
Handler that determines when the thread date separators should be visible.
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
.
Configures if the thread should load older messages to newer messages.