MessageComposerViewModel
ViewModel responsible for handling the composing and sending of messages.
It relays all its core actions to a shared data source, as a central place for all the Composer logic. Additionally, all the core data that can be reused across our SDKs is available through shared data sources, while implementation-specific data is stored in respective in the ViewModel.
Parameters
The controller used to relay all the actions and fetch all the state.
Properties
Functions
Stores the selected attachments from the attachment picker. These will be shown in the UI, within the composer component. We upload and send these attachments once the user taps on the send button.
Function which connects MessageComposerView to MessageComposerViewModel. As a result the view renders the state delivered by the ViewModel, and the ViewModel intercepts the user's actions automatically.
Function which connects MessageComposerView to MessageComposerViewModel. As a result the view renders the state delivered by the ViewModel, and the ViewModel intercepts the user's actions automatically. The main difference with bindView is that listeners in this function do not override the default behaviour.
Builds a new Message to send to our API. Based on the internal state, we use the current action's message and apply the given changes.
Removes all staged attachments.
Dismisses all message actions from the UI and clears the input based on the internal state.
Dismisses the suggestions popup above the message composer.
Updates the UI state when leaving the thread, to switch back to the MessageMode.Normal message mode, by calling setMessageMode.
Handles the selected messageAction.
Removes a selected attachment from the list, when the user taps on the cancel/delete button.
Switches the message composer to the command input mode.
Autocompletes the current text input with the mention from the selected user.
Sends a given message using our Stream API. Based on the internal state, we either edit an existing message, or we send a new message, using our API.
Called when the "Also send as a direct message" checkbox is checked or unchecked.
Called when the input changes and the internal state needs to be updated.
Called when the message mode changes and the internal state needs to be updated.
Toggles the visibility of the command suggestion list popup.