diff --git a/bindings/matrix-sdk-ffi/src/room.rs b/bindings/matrix-sdk-ffi/src/room.rs index c06021203ab..a3f3a07136a 100644 --- a/bindings/matrix-sdk-ffi/src/room.rs +++ b/bindings/matrix-sdk-ffi/src/room.rs @@ -241,7 +241,7 @@ impl Room { let listener: Arc = listener.into(); let timeline_stream = - Arc::new(TaskHandle::new(RUNTIME.spawn(timeline_stream.for_each(move |diff| { + TaskHandle::new(RUNTIME.spawn(timeline_stream.for_each(move |diff| { let listener = listener.clone(); let fut = RUNTIME.spawn_blocking(move || { listener.on_update(Arc::new(TimelineDiff::new(diff))) @@ -252,11 +252,11 @@ impl Room { error!("Timeline listener error: {e}"); } } - })))); + }))); RoomTimelineListenerResult { items: timeline_items.into_iter().map(TimelineItem::from_arc).collect(), - items_stream: timeline_stream, + items_stream: Arc::new(timeline_stream), } }) } diff --git a/bindings/matrix-sdk-ffi/src/room_list.rs b/bindings/matrix-sdk-ffi/src/room_list.rs index 94abd04ffe6..213c49f4942 100644 --- a/bindings/matrix-sdk-ffi/src/room_list.rs +++ b/bindings/matrix-sdk-ffi/src/room_list.rs @@ -1,4 +1,7 @@ -use std::{fmt::Debug, sync::Arc}; +use std::{ + fmt::Debug, + sync::{Arc, RwLock}, +}; use eyeball_im::VectorDiff; use futures_util::{pin_mut, StreamExt}; @@ -203,7 +206,10 @@ impl RoomListItem { } fn full_room(&self) -> Arc { - Arc::new(Room::new(self.inner.inner_room().clone())) + Arc::new(Room::with_timeline( + self.inner.inner_room().clone(), + Arc::new(RwLock::new(Some(RUNTIME.block_on(async { self.inner.timeline().await })))), + )) } fn subscribe(&self, settings: Option) {