From 3ed5d34f493330453d3cbb966f3ccbabb4a731d8 Mon Sep 17 00:00:00 2001 From: Doug Date: Fri, 15 Nov 2024 17:27:49 +0000 Subject: [PATCH] feat(ffi): Add support for including captions with file uploads. --- bindings/matrix-sdk-ffi/src/timeline/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bindings/matrix-sdk-ffi/src/timeline/mod.rs b/bindings/matrix-sdk-ffi/src/timeline/mod.rs index 99b9032d499..517554daa3f 100644 --- a/bindings/matrix-sdk-ffi/src/timeline/mod.rs +++ b/bindings/matrix-sdk-ffi/src/timeline/mod.rs @@ -418,15 +418,22 @@ impl Timeline { self: Arc, url: String, file_info: FileInfo, + caption: Option, + formatted_caption: Option, progress_watcher: Option>, use_send_queue: bool, ) -> Arc { + let formatted_caption = + formatted_body_from(caption.as_deref(), formatted_caption.map(Into::into)); SendAttachmentJoinHandle::new(RUNTIME.spawn(async move { let base_file_info: BaseFileInfo = BaseFileInfo::try_from(&file_info).map_err(|_| RoomError::InvalidAttachmentData)?; let attachment_info = AttachmentInfo::File(base_file_info); - let attachment_config = AttachmentConfig::new().info(attachment_info); + let attachment_config = AttachmentConfig::new() + .info(attachment_info) + .caption(caption) + .formatted_caption(formatted_caption.map(Into::into)); self.send_attachment( url,