Skip to content

Commit 1d83d42

Browse files
committed
chore(ui): Remove Timeline::subscribe.
This patch removes `Timeline::subscribe`. There is `Timeline::subscribe_batched`, which is the only useful API. `subscribe` was only used by our tests, and `matrix-sdk-ffi` uses `subscribe_batched` only.
1 parent 4684cfb commit 1d83d42

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

crates/matrix-sdk-ui/src/timeline/controller/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ use eyeball_im_util::vector::VectorObserverExt;
2020
use futures_core::Stream;
2121
use imbl::Vector;
2222
#[cfg(test)]
23-
use matrix_sdk::crypto::OlmMachine;
23+
use matrix_sdk::{crypto::OlmMachine, SendOutsideWasm};
2424
use matrix_sdk::{
2525
deserialized_responses::{SyncTimelineEvent, TimelineEventKind as SdkTimelineEventKind},
2626
event_cache::{paginator::Paginator, RoomEventCache},
2727
send_queue::{
2828
LocalEcho, LocalEchoContent, RoomSendQueueUpdate, SendHandle, SendReactionHandle,
2929
},
30-
Result, Room, SendOutsideWasm,
30+
Result, Room,
3131
};
3232
use ruma::{
3333
api::client::receipt::create_receipt::v3::ReceiptType as SendReceiptType,
@@ -477,6 +477,7 @@ impl<P: RoomDataProvider> TimelineController<P> {
477477
self.state.read().await.items.clone_items()
478478
}
479479

480+
#[cfg(test)]
480481
pub(super) async fn subscribe(
481482
&self,
482483
) -> (

crates/matrix-sdk-ui/src/timeline/mod.rs

+2-15
Original file line numberDiff line numberDiff line change
@@ -266,23 +266,10 @@ impl Timeline {
266266
}
267267
}
268268

269-
/// Get the current timeline items, and a stream of changes.
270-
///
271-
/// You can poll this stream to receive updates. See
272-
/// [`futures_util::StreamExt`] for a high-level API on top of [`Stream`].
273-
pub async fn subscribe(
274-
&self,
275-
) -> (Vector<Arc<TimelineItem>>, impl Stream<Item = VectorDiff<Arc<TimelineItem>>>) {
276-
let (items, stream) = self.controller.subscribe().await;
277-
let stream = TimelineStream::new(stream, self.drop_handle.clone());
278-
(items, stream)
279-
}
280-
281269
/// Get the current timeline items, and a batched stream of changes.
282270
///
283-
/// In contrast to [`subscribe`](Self::subscribe), this stream can yield
284-
/// multiple diffs at once. The batching is done such that no arbitrary
285-
/// delays are added.
271+
/// This stream can yield multiple diffs at once. The batching is done such
272+
/// that no arbitrary delays are added.
286273
pub async fn subscribe_batched(
287274
&self,
288275
) -> (Vector<Arc<TimelineItem>>, impl Stream<Item = Vec<VectorDiff<Arc<TimelineItem>>>>) {

0 commit comments

Comments
 (0)