feat(base): Implement Client::rooms_stream.

This patch implements `Client::rooms_stream`, which forwards the result
of the recently added `Store::rooms_stream` method.
This commit is contained in:
Ivan Enderlin
2024-01-11 12:06:33 +01:00
parent fd4505b026
commit f9e8f1178b

View File

@@ -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<Room>, impl Stream<Item = Vec<VectorDiff<Room>>>) {
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 {