MessageListViewModel
ViewModel responsible for handling all the business logic & state for the list of messages.
Parameters
Controller used to relay the logic and fetch the state.
Properties
Gives us information about the online state of the device.
State handler for the UI, which holds all the information the UI needs to render messages.
Regulates the visibility of deleted messages.
Gives us information if we're currently in the Thread message mode.
Gives us information if we have selected a message.
Whether is the poll option details should be shown or not.
Gives us information if the MessageListViewModel was started for the purpose of showing a thread.
Set of currently active MessageActions. Used to show things like edit, reply, delete and similar actions.
Regulates the message footer visibility.
Holds the current MessageMode that's used for the messages list. MessageMode.Normal by default.
Determines whether we should show system messages or not.
The list of typing users.
Functions
Cast an answer for a poll in a message.
Clears the NewMessageState from our UI state, after the user taps on the "Scroll to bottom" or "New Message" actions in the list or simply scrolls to the bottom.
Removes the delete actions from our messageActions, as well as the overlay, before deleting the selected message.
Dismisses all message actions, when we cancel them in the rest of the UI.
Used to dismiss a specific message action, such as delete, reply, edit or something similar.
Triggered when the user taps the show more options button on the poll message.
Removes the flag actions from our messageActions, as well as the overlay, before flagging the selected message.
Returns a message with the given ID from the currentMessagesState.
Leaves the thread we're in and resets the state of the messageMode and both of the MessageListStates.
Loads newer messages of a channel following the currently newest loaded message. In case of threads this will do nothing.
Loads older messages of a channel following the currently oldest loaded message. Also will load older messages of a thread.
Changes the current messageMode to be Thread with ThreadState and Loads thread data using ChatClient directly. The data is observed by using ThreadState.
Executes one of the actions for the given ephemeral giphy message.
Triggered when the user selects a new message action, in the message overlay.
Resets the MessageListStates, to remove the message overlay, by setting 'selectedMessage' to null.
Removes the shadow ban for the given user inside this channel.
Remove a vote for a poll in a message.
Requests that the list scrolls to the bottom to the newest messages. If the newest messages are loaded will set scroll the list to the bottom. If they are not loaded will request the newest data and once loaded will scroll to the bottom of the list.
Scrolls to message if in list otherwise get the message from backend. Does not work for threads.
Triggered when the user taps the show more reactions button.
Triggered when the user long taps on and selects a message.
Triggered when the user taps on and selects message reactions.
Sets the date separator handler which determines when to add date separators. By default, a date separator will be added if the difference between two messages' dates is greater than 4h.
Sets the value used to filter deleted messages.
Sets the value used to determine if message footer content is shown.
Sets a handler which determines the position of a message inside a group.
Sets whether the system messages should be visible.
Sets the thread date separator handler which determines when to add date separators inside the thread.
Shadow bans the given user inside this channel.
Un-flags a user identified by the provided ID.
Unmutes the given user inside this channel.
Attempts to update the last seen message in the channel or thread. We only update the last seen message the first time the data loads and whenever we see a message that's newer than the current last seen message.
Triggered when the poll information has been changed and need to sync on the poll states.