From cd76cec0894d5ae6545aef9dabafc9e99413edb3 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Wed, 21 May 2025 15:13:11 +0200 Subject: [PATCH] refactor(ffi): also pass the UTD hook to the notification client --- bindings/matrix-sdk-ffi/src/client.rs | 4 ++-- bindings/matrix-sdk-ffi/src/notification.rs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bindings/matrix-sdk-ffi/src/client.rs b/bindings/matrix-sdk-ffi/src/client.rs index ec3c75c38..fd9d23233 100644 --- a/bindings/matrix-sdk-ffi/src/client.rs +++ b/bindings/matrix-sdk-ffi/src/client.rs @@ -220,7 +220,7 @@ impl From for TransmissionProgress { pub struct Client { pub(crate) inner: AsyncRuntimeDropped, delegate: OnceLock>, - utd_hook_manager: OnceLock>, + pub(crate) utd_hook_manager: OnceLock>, session_verification_controller: Arc>>, } @@ -1141,7 +1141,7 @@ impl Client { Ok(Arc::new(NotificationClient { inner: MatrixNotificationClient::new((*self.inner).clone(), process_setup.into()) .await?, - _client: self.clone(), + client: self.clone(), })) } diff --git a/bindings/matrix-sdk-ffi/src/notification.rs b/bindings/matrix-sdk-ffi/src/notification.rs index 0f9b78f64..6060f70d3 100644 --- a/bindings/matrix-sdk-ffi/src/notification.rs +++ b/bindings/matrix-sdk-ffi/src/notification.rs @@ -96,7 +96,7 @@ pub struct NotificationClient { /// Note: we do this to make it so that the FFI `NotificationClient` keeps /// the FFI `Client` and thus the SDK `Client` alive. Otherwise, we /// would need to repeat the hack done in the FFI `Client::drop` method. - pub(crate) _client: Arc, + pub(crate) client: Arc, } #[matrix_sdk_ffi_macros::export] @@ -108,7 +108,8 @@ impl NotificationClient { pub fn get_room(&self, room_id: String) -> Result>, ClientError> { let room_id = RoomId::parse(room_id)?; let sdk_room = self.inner.get_room(&room_id); - let room = sdk_room.map(|room| Arc::new(Room::new(room, None))); + let room = sdk_room + .map(|room| Arc::new(Room::new(room, self.client.utd_hook_manager.get().cloned()))); Ok(room) }