Package-level declarations
Functions
Link copied to clipboard
fun DefaultMessageComposerFooterContent(messageComposerState: MessageComposerState, onAlsoSendToChannelSelected: (Boolean) -> Unit)
Represents the default content shown at the bottom of the message composer component.
Link copied to clipboard
fun DefaultMessageComposerHeaderContent(messageComposerState: MessageComposerState, onCancelAction: () -> Unit, onLinkPreviewClick: (LinkPreview) -> Unit? = null)
Represents the default content shown at the top of the message composer component.
Link copied to clipboard
fun MessageComposer(viewModel: MessageComposerViewModel, modifier: Modifier = Modifier, onSendMessage: (Message) -> Unit = { viewModel.sendMessage(it) }, onAttachmentsClick: () -> Unit = {}, onCommandsClick: () -> Unit = {}, onValueChange: (String) -> Unit = { viewModel.setMessageInput(it) }, onAttachmentRemoved: (Attachment) -> Unit = { viewModel.removeSelectedAttachment(it) }, onCancelAction: () -> Unit = { viewModel.dismissMessageActions() }, onLinkPreviewClick: (LinkPreview) -> Unit? = null, onMentionSelected: (User) -> Unit = { viewModel.selectMention(it) }, onCommandSelected: (Command) -> Unit = { viewModel.selectCommand(it) }, onAlsoSendToChannelSelected: (Boolean) -> Unit = { viewModel.setAlsoSendToChannel(it) }, recordingActions: AudioRecordingActions = AudioRecordingActions.defaultActions(viewModel), headerContent: @Composable ColumnScope.(MessageComposerState) -> Unit = {
DefaultMessageComposerHeaderContent(
messageComposerState = it,
onCancelAction = onCancelAction,
onLinkPreviewClick = onLinkPreviewClick,
)
}, footerContent: @Composable ColumnScope.(MessageComposerState) -> Unit = {
DefaultMessageComposerFooterContent(
messageComposerState = it,
onAlsoSendToChannelSelected = onAlsoSendToChannelSelected,
)
}, mentionPopupContent: @Composable (List<User>) -> Unit = {
DefaultMentionPopupContent(
mentionSuggestions = it,
onMentionSelected = onMentionSelected,
)
}, commandPopupContent: @Composable (List<Command>) -> Unit = {
DefaultCommandPopupContent(
commandSuggestions = it,
onCommandSelected = onCommandSelected,
)
}, integrations: @Composable RowScope.(MessageComposerState) -> Unit = {
DefaultComposerIntegrations(
messageInputState = it,
onAttachmentsClick = onAttachmentsClick,
onCommandsClick = onCommandsClick,
ownCapabilities = it.ownCapabilities,
)
}, label: @Composable (MessageComposerState) -> Unit = { DefaultComposerLabel(it.ownCapabilities) }, input: @Composable RowScope.(MessageComposerState) -> Unit = {
DefaultComposerInputContent(
messageComposerState = it,
onValueChange = onValueChange,
onAttachmentRemoved = onAttachmentRemoved,
label = label,
)
}, audioRecordingContent: @Composable RowScope.(MessageComposerState) -> Unit = {
DefaultMessageComposerRecordingContent(
messageComposerState = it,
recordingActions = recordingActions,
)
}, trailingContent: @Composable (MessageComposerState) -> Unit = {
DefaultMessageComposerTrailingContent(
messageComposerState = it,
onSendMessage = { input, attachments ->
val message = viewModel.buildNewMessage(input, attachments)
onSendMessage(message)
},
recordingActions = recordingActions,
)
})
Default MessageComposer component that relies on MessageComposerViewModel to handle data and communicate various events.
fun MessageComposer(messageComposerState: MessageComposerState, onSendMessage: (String, List<Attachment>) -> Unit, modifier: Modifier = Modifier, onAttachmentsClick: () -> Unit = {}, onCommandsClick: () -> Unit = {}, onValueChange: (String) -> Unit = {}, onAttachmentRemoved: (Attachment) -> Unit = {}, onCancelAction: () -> Unit = {}, onLinkPreviewClick: (LinkPreview) -> Unit? = null, onMentionSelected: (User) -> Unit = {}, onCommandSelected: (Command) -> Unit = {}, onAlsoSendToChannelSelected: (Boolean) -> Unit = {}, recordingActions: AudioRecordingActions = AudioRecordingActions.None, headerContent: @Composable ColumnScope.(MessageComposerState) -> Unit = {
DefaultMessageComposerHeaderContent(
messageComposerState = it,
onCancelAction = onCancelAction,
onLinkPreviewClick = onLinkPreviewClick,
)
}, footerContent: @Composable ColumnScope.(MessageComposerState) -> Unit = {
DefaultMessageComposerFooterContent(
messageComposerState = it,
onAlsoSendToChannelSelected = onAlsoSendToChannelSelected,
)
}, mentionPopupContent: @Composable (List<User>) -> Unit = {
DefaultMentionPopupContent(
mentionSuggestions = it,
onMentionSelected = onMentionSelected,
)
}, commandPopupContent: @Composable (List<Command>) -> Unit = {
DefaultCommandPopupContent(
commandSuggestions = it,
onCommandSelected = onCommandSelected,
)
}, integrations: @Composable RowScope.(MessageComposerState) -> Unit = {
DefaultComposerIntegrations(
messageInputState = it,
onAttachmentsClick = onAttachmentsClick,
onCommandsClick = onCommandsClick,
ownCapabilities = messageComposerState.ownCapabilities,
)
}, label: @Composable (MessageComposerState) -> Unit = { DefaultComposerLabel(messageComposerState.ownCapabilities) }, input: @Composable RowScope.(MessageComposerState) -> Unit = {
DefaultComposerInputContent(
messageComposerState = messageComposerState,
onValueChange = onValueChange,
onAttachmentRemoved = onAttachmentRemoved,
label = label,
)
}, audioRecordingContent: @Composable RowScope.(MessageComposerState) -> Unit = {
DefaultMessageComposerRecordingContent(
messageComposerState = it,
recordingActions = recordingActions,
)
}, trailingContent: @Composable (MessageComposerState) -> Unit = {
DefaultMessageComposerTrailingContent(
messageComposerState = it,
onSendMessage = onSendMessage,
recordingActions = recordingActions,
)
})
Clean version of the MessageComposer that doesn't rely on ViewModels, so the user can provide a manual way to handle and represent data and various operations.