Skip to content

Commit

Permalink
chore!(ffi): rename thumbnail_url to thumbnail_path
Browse files Browse the repository at this point in the history
This is a breaking change because uniffi may use foreign-language named
parameters based on the Rust parameter name.
  • Loading branch information
bnjbvr committed Jan 8, 2025
1 parent 265e980 commit 59ff563
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions bindings/matrix-sdk-ffi/src/timeline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ impl Timeline {
}

fn build_thumbnail_info(
thumbnail_url: Option<String>,
thumbnail_path: Option<String>,
thumbnail_info: Option<ThumbnailInfo>,
) -> Result<Option<Thumbnail>, RoomError> {
match (thumbnail_url, thumbnail_info) {
match (thumbnail_path, thumbnail_info) {
(None, None) => Ok(None),

(Some(thumbnail_url), Some(thumbnail_info)) => {
(Some(thumbnail_path), Some(thumbnail_info)) => {
let thumbnail_data =
fs::read(thumbnail_url).map_err(|_| RoomError::InvalidThumbnailData)?;
fs::read(thumbnail_path).map_err(|_| RoomError::InvalidThumbnailData)?;

let height = thumbnail_info
.height
Expand Down Expand Up @@ -190,7 +190,7 @@ fn build_thumbnail_info(
}

_ => {
warn!("Ignoring thumbnail because either the thumbnail URL or info isn't defined");
warn!("Ignoring thumbnail because either the thumbnail path or info isn't defined");
Ok(None)
}
}
Expand Down Expand Up @@ -326,14 +326,14 @@ impl Timeline {
pub fn send_image(
self: Arc<Self>,
params: UploadParameters,
thumbnail_url: Option<String>,
thumbnail_path: Option<String>,
image_info: ImageInfo,
progress_watcher: Option<Box<dyn ProgressWatcher>>,
) -> Result<Arc<SendAttachmentJoinHandle>, RoomError> {
let attachment_info = AttachmentInfo::Image(
BaseImageInfo::try_from(&image_info).map_err(|_| RoomError::InvalidAttachmentData)?,
);
let thumbnail = build_thumbnail_info(thumbnail_url, image_info.thumbnail_info)?;
let thumbnail = build_thumbnail_info(thumbnail_path, image_info.thumbnail_info)?;
self.send_attachment(
params,
attachment_info,
Expand All @@ -346,14 +346,14 @@ impl Timeline {
pub fn send_video(
self: Arc<Self>,
params: UploadParameters,
thumbnail_url: Option<String>,
thumbnail_path: Option<String>,
video_info: VideoInfo,
progress_watcher: Option<Box<dyn ProgressWatcher>>,
) -> Result<Arc<SendAttachmentJoinHandle>, RoomError> {
let attachment_info = AttachmentInfo::Video(
BaseVideoInfo::try_from(&video_info).map_err(|_| RoomError::InvalidAttachmentData)?,
);
let thumbnail = build_thumbnail_info(thumbnail_url, video_info.thumbnail_info)?;
let thumbnail = build_thumbnail_info(thumbnail_path, video_info.thumbnail_info)?;
self.send_attachment(
params,
attachment_info,
Expand Down

0 comments on commit 59ff563

Please sign in to comment.