defaultFactories

fun defaultFactories(getChatClient: () -> ChatClient = { ChatClient.instance() }, linkDescriptionMaxLines: Int = DEFAULT_LINK_DESCRIPTION_MAX_LINES, giphyInfoType: GiphyInfoType = GiphyInfoType.ORIGINAL, giphySizingMode: GiphySizingMode = GiphySizingMode.ADAPTIVE, contentScale: ContentScale = ContentScale.Crop, skipEnrichUrl: Boolean = false, onUploadContentItemClick: (Attachment, List<AttachmentPreviewHandler>) -> Unit = ::onFileUploadContentItemClick, onLinkContentItemClick: (context: Context, previewUrl: String) -> Unit = ::onLinkAttachmentContentClick, onGiphyContentItemClick: (context: Context, Url: String) -> Unit = ::onGiphyAttachmentContentClick, onMediaContentItemClick: (mediaGalleryPreviewLauncher: ManagedActivityResultLauncher<MediaGalleryPreviewContract.Input, MediaGalleryPreviewResult?>, message: Message, attachmentPosition: Int, videoThumbnailsEnabled: Boolean, streamCdnImageResizing: StreamCdnImageResizing, skipEnrichUrl: Boolean) -> Unit = ::onMediaAttachmentContentItemClick, showFileSize: (Attachment) -> Boolean = { true }, onFileContentItemClick: (previewHandlers: List<AttachmentPreviewHandler>, attachment: Attachment) -> Unit = ::onFileAttachmentContentItemClick): List<AttachmentFactory>

Default attachment factories we provide, which can transform image, file and link attachments.

Return

A List of various AttachmentFactory instances that provide different attachments support.

Parameters

getChatClient
  • A lambda that provides the ChatClient instance.

linkDescriptionMaxLines
  • The limit of how long the link attachment descriptions can be.

giphyInfoType

Used to modify the quality and dimensions of the rendered Giphy attachments.

giphySizingMode

Sets the Giphy container sizing strategy. Setting it to automatic makes the container capable of adaptive resizing and ignore StreamDimens.attachmentsContentGiphyWidth and StreamDimens.attachmentsContentGiphyHeight dimensions, however you can still clip maximum dimensions using StreamDimens.attachmentsContentGiphyMaxWidth and StreamDimens.attachmentsContentGiphyMaxHeight. Setting it to fixed size mode will make it respect all given dimensions.

contentScale

Used to determine the way Giphys are scaled inside the Image composable.

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.

onUploadContentItemClick

Lambda called when a uploading attachment content item gets clicked.

onLinkContentItemClick

Lambda called when a link attachment content item gets clicked.

onGiphyContentItemClick

Lambda called when a giphy attachment content item gets clicked.

onMediaContentItemClick

Lambda called when a image or video attachment content item gets clicked.

onFileContentItemClick

Lambda called when a file attachment content item gets clicked.

showFileSize

Lambda called to determine if the file size should be shown for a given attachment.