From f9e8f1178b532fee8812ff34285ebeccfbf42d31 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Thu, 11 Jan 2024 12:06:33 +0100 Subject: [PATCH] feat(base): Implement `Client::rooms_stream`. This patch implements `Client::rooms_stream`, which forwards the result of the recently added `Store::rooms_stream` method. --- crates/matrix-sdk-base/src/client.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/matrix-sdk-base/src/client.rs b/crates/matrix-sdk-base/src/client.rs index 6a8dbf9c0..0ecf33c45 100644 --- a/crates/matrix-sdk-base/src/client.rs +++ b/crates/matrix-sdk-base/src/client.rs @@ -21,6 +21,8 @@ use std::{ use std::{ops::Deref, sync::Arc}; use eyeball::{SharedObservable, Subscriber}; +use eyeball_im::{Vector, VectorDiff}; +use futures_util::Stream; use matrix_sdk_common::instant::Instant; #[cfg(feature = "e2e-encryption")] use matrix_sdk_crypto::{ @@ -169,6 +171,11 @@ impl BaseClient { self.store.rooms_filtered(filter) } + /// Get a stream of all the rooms, in addition to the existing rooms. + pub fn rooms_stream(&self) -> (Vector, impl Stream>>) { + self.store.rooms_stream() + } + /// Lookup the Room for the given RoomId, or create one, if it didn't exist /// yet in the store pub fn get_or_create_room(&self, room_id: &RoomId, room_state: RoomState) -> Room {