Skip to content

Commit

Permalink
ffi: fix bindings not using Arc wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartinesp committed Sep 20, 2024
1 parent 363d3a4 commit 5d43630
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bindings/matrix-sdk-ffi/src/ruma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ impl From<RumaPollKind> for PollKind {
#[uniffi::export]
pub fn content_without_relation_from_message(
message: MessageContent,
) -> Result<RoomMessageEventContentWithoutRelation, ClientError> {
) -> Result<Arc<RoomMessageEventContentWithoutRelation>, ClientError> {
let msg_type = message.msg_type.try_into()?;
Ok(RoomMessageEventContentWithoutRelation::new(msg_type))
Ok(Arc::new(RoomMessageEventContentWithoutRelation::new(msg_type)))
}
10 changes: 5 additions & 5 deletions bindings/matrix-sdk-ffi/src/timeline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ impl Timeline {
pub async fn load_reply_details(
&self,
event_id_str: String,
) -> Result<InReplyToDetails, ClientError> {
) -> Result<Arc<InReplyToDetails>, ClientError> {
let event_id = EventId::parse(&event_id_str)?;

let replied_to: Result<RepliedToEvent, Error> =
Expand All @@ -627,19 +627,19 @@ impl Timeline {
};

match replied_to {
Ok(replied_to) => Ok(InReplyToDetails::new(
Ok(replied_to) => Ok(Arc::new(InReplyToDetails::new(
event_id_str,
RepliedToEventDetails::Ready {
content: replied_to.content().into(),
sender: replied_to.sender().to_string(),
sender_profile: replied_to.sender_profile().into(),
},
)),
))),

Err(e) => Ok(InReplyToDetails::new(
Err(e) => Ok(Arc::new(InReplyToDetails::new(
event_id_str,
RepliedToEventDetails::Error { message: e.to_string() },
)),
))),
}
}

Expand Down

0 comments on commit 5d43630

Please sign in to comment.