feat(sdk): Remove SlidingSyncList::room_list_filtered_stream.

This patch removes `SlidingSyncList::room_list_filtered_stream.
Of course, the only place where it was used,
`RoomList::entries_with_dynamic_adapters` now use `.filter` from
`VectorSubscriberExt`. It's basically less code.
This commit is contained in:
Ivan Enderlin
2023-09-21 10:14:23 +02:00
parent 1a15802201
commit 3d8bdba268
2 changed files with 2 additions and 16 deletions

View File

@@ -143,7 +143,8 @@ impl RoomList {
loop {
let filter_fn = filter_fn_cell.take().await;
let (values, stream) = list
.room_list_filtered_stream(filter_fn)
.room_list_stream()
.filter(filter_fn)
.dynamic_limit_with_initial_value(page_size, limit_stream.clone());
// Clearing the stream before chaining with the real stream.

View File

@@ -14,7 +14,6 @@ use std::{
use eyeball::{Observable, Subscriber};
use eyeball_im::{ObservableVector, ObservableVectorTransaction, VectorDiff};
use eyeball_im_util::vector::{VectorObserverExt, VectorSubscriberExt};
use futures_core::Stream;
use imbl::Vector;
use ruma::{api::client::sync::sync_events::v4, assign, OwnedRoomId, TransactionId};
@@ -158,20 +157,6 @@ impl SlidingSyncList {
(values, subscriber.into_batched_stream())
}
/// Get a stream of room list, but filtered.
///
/// It's similar to [`Self::room_list_stream`] but the room list is filtered
/// by `filter`.
pub fn room_list_filtered_stream<F>(
&self,
filter: F,
) -> (Vector<RoomListEntry>, impl Stream<Item = Vec<VectorDiff<RoomListEntry>>>)
where
F: Fn(&RoomListEntry) -> bool,
{
self.inner.room_list.read().unwrap().subscribe().batched().filter(filter)
}
/// Get the maximum number of rooms. See [`Self::maximum_number_of_rooms`]
/// to learn more.
pub fn maximum_number_of_rooms(&self) -> Option<u32> {