MediaAttachmentFactory

constructor(maximumNumberOfPreviewedItems: Int = 4, skipEnrichUrl: Boolean = false, onContentItemClick: (MediaAttachmentClickData) -> Unit = { onMediaAttachmentContentItemClick( it.mediaGalleryPreviewLauncher, it.message, it.attachmentPosition, it.videoThumbnailsEnabled, it.downloadAttachmentUriGenerator, it.downloadRequestInterceptor, it.streamCdnImageResizing, it.skipEnrichUrl, ) }, canHandle: (attachments: List<Attachment>) -> Boolean = { attachments -> attachments.all { it.isImage() || it.isVideo() } }, itemOverlayContent: @Composable (attachmentType: String?) -> Unit = { attachmentType -> if (attachmentType == AttachmentType.VIDEO) { DefaultItemOverlayContent() } }, previewItemOverlayContent: @Composable (attachmentType: String?) -> Unit = { attachmentType -> if (attachmentType == AttachmentType.VIDEO) { DefaultPreviewItemOverlayContent() } })

Parameters

maximumNumberOfPreviewedItems

The maximum number of thumbnails that can be displayed in a group when previewing Media attachments in the message list. Values between 4 and 8 are optimal.

skipEnrichUrl

Used by the media gallery. If set to true will skip enriching URLs when you update the message by deleting an attachment contained within it. Set to false by default.

onContentItemClick

Lambda called when an item gets clicked.

canHandle

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

itemOverlayContent

Represents the content overlaid above individual items. By default it is used to display a play button over video previews.

previewItemOverlayContent

Represents the content overlaid above individual preview items. By default it is used to display a play button over video previews.


constructor(maximumNumberOfPreviewedItems: Int = 4, skipEnrichUrl: Boolean = false, onContentItemClick: (mediaGalleryPreviewLauncher: ManagedActivityResultLauncher<MediaGalleryPreviewContract.Input, MediaGalleryPreviewResult?>, message: Message, attachmentPosition: Int, videoThumbnailsEnabled: Boolean, downloadAttachmentUriGenerator: DownloadAttachmentUriGenerator, downloadRequestInterceptor: DownloadRequestInterceptor, streamCdnImageResizing: StreamCdnImageResizing, skipEnrichUrl: Boolean) -> Unit, canHandle: (attachments: List<Attachment>) -> Boolean = { attachments -> attachments.all { it.isImage() || it.isVideo() } }, itemOverlayContent: @Composable (attachmentType: String?) -> Unit = { attachmentType -> if (attachmentType == AttachmentType.VIDEO) { DefaultItemOverlayContent() } }, previewItemOverlayContent: @Composable (attachmentType: String?) -> Unit = { attachmentType -> if (attachmentType == AttachmentType.VIDEO) { DefaultPreviewItemOverlayContent() } })

Deprecated

Use the constructor that does not take onContentItemClick parameter.

Replace with

MediaAttachmentFactory(maximumNumberOfPreviewedItems, skipEnrichUrl, onContentItemClick, canHandle, itemOverlayContent, previewItemOverlayContent)

Creates a new instance of MediaAttachmentFactory with the default parameters.