MessagesScreen

fun MessagesScreen(viewModelFactory: MessagesViewModelFactory, showHeader: Boolean = true, reactionSorting: ReactionSorting = ReactionSortingByFirstReactionAt, onBackPressed: () -> Unit = {}, onHeaderTitleClick: (channel: Channel) -> Unit = {}, onChannelAvatarClick: () -> Unit = {}, onComposerLinkPreviewClick: (LinkPreview) -> Unit? = null, onMessageLinkClick: (Message, String) -> Unit? = null, onUserAvatarClick: (User) -> Unit = {}, onUserMentionClick: (User) -> Unit = {}, skipPushNotification: Boolean = false, skipEnrichUrl: Boolean = false, showAnonymousAvatar: Boolean = false, threadMessagesStart: ThreadMessagesStart = ThreadMessagesStart.BOTTOM, topBarContent: @Composable (BackAction) -> Unit = { DefaultTopBarContent( viewModelFactory = viewModelFactory, backAction = it, onHeaderTitleClick = onHeaderTitleClick, onChannelAvatarClick = onChannelAvatarClick, ) }, bottomBarContent: @Composable () -> Unit = { DefaultBottomBarContent( viewModelFactory = viewModelFactory, onComposerLinkPreviewClick = onComposerLinkPreviewClick, skipPushNotification = skipPushNotification, skipEnrichUrl = skipEnrichUrl, ) })

Default root Messages screen component, that provides the necessary ViewModels and connects all the data handling operations, as well as some basic actions, like back pressed handling.

Because this screen can be shown only if there is an active/selected Channel, the user must provide a viewModelFactory that contains the channel ID, in order to load up all the data. Otherwise, we can't show the UI.

Parameters

viewModelFactory

The factory used to build ViewModels and power the behavior. You can customize the behavior of the list through its parameters. For default behavior, simply create an instance and pass in just the channel ID and the context.

showHeader

If we're showing the header or not.

reactionSorting

The sorting type for reactions. Default is ReactionSortingByFirstReactionAt.

onBackPressed

Handler for when the user taps on the Back button and/or the system back button.

onHeaderTitleClick

Handler for when the user taps on the header section.

onChannelAvatarClick

Handler called when the user taps on the channel avatar.

onUserAvatarClick

Handler when users avatar is clicked.

skipPushNotification

If new messages should skip triggering a push notification when sent. False by default.

skipEnrichUrl

If new messages being sent, or existing ones being updated should skip enriching the URL. If URL is not enriched, it will not be displayed as a link attachment. False by default.

showAnonymousAvatar

If the user avatar should be shown on comments for polls with anonymous voting visibility.

threadMessagesStart

Thread messages start at the bottom or top of the screen.

topBarContent

custom top bar content to be displayed on top of the messages list.

bottomBarContent

custom bottom bar content to be displayed at the bottom of the messages list. Default: ThreadMessagesStart.BOTTOM.