AttachmentFactory

open class AttachmentFactory(val canHandle: (attachments: List<Attachment>) -> Boolean, val previewContent: @Composable (modifier: Modifier, attachments: List<Attachment>, onAttachmentRemoved: (Attachment) -> Unit) -> Unit? = null, val content: @Composable (modifier: Modifier, attachmentState: AttachmentState) -> Unit, val textFormatter: (attachments: Attachment) -> String = { it.title ?: it.name ?: it.fallback ?: "" })

Holds the information required to build an attachment message.

Parameters

canHandle

Checks the message and returns if the factory can consume it or not.

previewContent

Composable function that allows users to define the content the AttachmentFactory will build, using any given AttachmentState, when the message is displayed in the message input preview, before sending.

content

Composable function that allows users to define the content the AttachmentFactory will build using any given AttachmentState, when the message is displayed in the message list.

textFormatter

The formatter used to get a string representation for the given attachment.

Constructors

Link copied to clipboard
constructor(canHandle: (attachments: List<Attachment>) -> Boolean, previewContent: @Composable (modifier: Modifier, attachments: List<Attachment>, onAttachmentRemoved: (Attachment) -> Unit) -> Unit? = null, content: @Composable (modifier: Modifier, attachmentState: AttachmentState) -> Unit, textFormatter: (attachments: Attachment) -> String = { it.title ?: it.name ?: it.fallback ?: "" })

Properties

Link copied to clipboard
val canHandle: (attachments: List<Attachment>) -> Boolean
Link copied to clipboard
val content: @Composable (modifier: Modifier, attachmentState: AttachmentState) -> Unit
Link copied to clipboard
val previewContent: @Composable (modifier: Modifier, attachments: List<Attachment>, onAttachmentRemoved: (Attachment) -> Unit) -> Unit? = null
Link copied to clipboard
val textFormatter: (attachments: Attachment) -> String