Skip to content

Commit

Permalink
feat(ffi): Add support for including captions with file uploads.
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave authored and poljar committed Nov 15, 2024
1 parent 232391c commit 3ed5d34
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bindings/matrix-sdk-ffi/src/timeline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,22 @@ impl Timeline {
self: Arc<Self>,
url: String,
file_info: FileInfo,
caption: Option<String>,
formatted_caption: Option<FormattedBody>,
progress_watcher: Option<Box<dyn ProgressWatcher>>,
use_send_queue: bool,
) -> Arc<SendAttachmentJoinHandle> {
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,
Expand Down

0 comments on commit 3ed5d34

Please sign in to comment.