diff --git a/crates/matrix-sdk/src/client/mod.rs b/crates/matrix-sdk/src/client/mod.rs index 0fe65251d..b0da7a2af 100644 --- a/crates/matrix-sdk/src/client/mod.rs +++ b/crates/matrix-sdk/src/client/mod.rs @@ -88,6 +88,7 @@ use crate::{ http_client::HttpClient, matrix_auth::MatrixAuth, notification_settings::NotificationSettings, + pinned_events_cache::PinnedEventCache, room_preview::RoomPreview, send_queue::SendQueueData, sync::{RoomUpdate, SyncResponse}, @@ -286,6 +287,9 @@ pub(crate) struct ClientInner { /// It becomes active when [`EventCache::subscribe`] is called. pub(crate) event_cache: OnceCell, + /// A central cache for pinned events. + pub(crate) pinned_event_cache: PinnedEventCache, + /// End-to-end encryption related state. #[cfg(feature = "e2e-encryption")] pub(crate) e2ee: EncryptionData, @@ -341,6 +345,7 @@ impl ClientInner { respect_login_well_known, sync_beat: event_listener::Event::new(), event_cache, + pinned_event_cache: PinnedEventCache::new(), send_queue_data: send_queue, #[cfg(feature = "e2e-encryption")] e2ee: EncryptionData::new(encryption_settings), @@ -2229,6 +2234,11 @@ impl Client { // SAFETY: always initialized in the `Client` ctor. self.inner.event_cache.get().unwrap() } + + /// The [`PinnedEventCache`] instance for this [`Client`]. + pub fn pinned_event_cache(&self) -> &PinnedEventCache { + &self.inner.pinned_event_cache + } } /// A weak reference to the inner client, useful when trying to get a handle diff --git a/crates/matrix-sdk/src/lib.rs b/crates/matrix-sdk/src/lib.rs index ac35f3f73..6f3e78581 100644 --- a/crates/matrix-sdk/src/lib.rs +++ b/crates/matrix-sdk/src/lib.rs @@ -96,5 +96,8 @@ uniffi::setup_scaffolding!(); #[cfg(any(test, feature = "testing"))] pub mod test_utils; +/// Contains the pinned events cache implementation. +pub mod pinned_events_cache; + #[cfg(test)] matrix_sdk_test::init_tracing_for_tests!();