LinkAttachmentFactory

class LinkAttachmentFactory(linkDescriptionMaxLines: Int, onItemClick: (LinkAttachmentClickData) -> Unit = { onLinkAttachmentContentClick(it.context, it.url) }, val canHandle: (attachments: List<Attachment>) -> Boolean = { links -> links.any { it.hasLink() && !it.isGiphy() } }) : AttachmentFactory

An AttachmentFactory that validates attachments as images and uses LinkAttachmentContent to build the UI for the message.

Has no "preview content", given that this attachment only exists after being sent.

Parameters

linkDescriptionMaxLines
  • The limit of how many lines we show for the link description.

onLinkAttachmentContentClick

Lambda called when an item gets clicked.

canHandle

Lambda that checks if the factory can handle the given attachments.

Constructors

Link copied to clipboard
constructor(linkDescriptionMaxLines: Int, onContentItemClick: (context: Context, previewUrl: String) -> Unit, canHandle: (attachments: List<Attachment>) -> Boolean = { links -> links.any { it.hasLink() && !it.isGiphy() } })

Creates a new instance of LinkAttachmentFactory with the default parameters.

constructor(linkDescriptionMaxLines: Int, onItemClick: (LinkAttachmentClickData) -> Unit = { onLinkAttachmentContentClick(it.context, it.url) }, canHandle: (attachments: List<Attachment>) -> Boolean = { links -> links.any { it.hasLink() && !it.isGiphy() } })

Inherited 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
Link copied to clipboard