downloadAttachment
fun ChatClient.downloadAttachment(context: Context, attachment: Attachment, generateDownloadUri: (Attachment) -> Uri, interceptRequest: DownloadManager.Request.() -> Unit): Call<Unit>
Downloads the selected attachment to the "Download" folder in the public external storage directory.
If a CDN is configured on this ChatClient, the download URL and headers are transformed via CDN.imageRequest (for images) or CDN.fileRequest (for other files) before the download is enqueued. CDN transformations are applied after generateDownloadUri and before interceptRequest, so custom interceptors can override CDN headers.
Return
Executable async Call downloading attachment.
Parameters
context
The context used to access the DownloadManager.
attachment
The attachment to download.
generateDownloadUri
The function that generates the download URI for the attachment.
interceptRequest
The function that intercepts the DownloadManager.Request before it's enqueued.