mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-18 21:52:30 -04:00
refactor(ffi): also pass the UTD hook to the notification client
This commit is contained in:
@@ -220,7 +220,7 @@ impl From<matrix_sdk::TransmissionProgress> for TransmissionProgress {
|
||||
pub struct Client {
|
||||
pub(crate) inner: AsyncRuntimeDropped<MatrixClient>,
|
||||
delegate: OnceLock<Arc<dyn ClientDelegate>>,
|
||||
utd_hook_manager: OnceLock<Arc<UtdHookManager>>,
|
||||
pub(crate) utd_hook_manager: OnceLock<Arc<UtdHookManager>>,
|
||||
session_verification_controller:
|
||||
Arc<tokio::sync::RwLock<Option<SessionVerificationController>>>,
|
||||
}
|
||||
@@ -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(),
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -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<Client>,
|
||||
pub(crate) client: Arc<Client>,
|
||||
}
|
||||
|
||||
#[matrix_sdk_ffi_macros::export]
|
||||
@@ -108,7 +108,8 @@ impl NotificationClient {
|
||||
pub fn get_room(&self, room_id: String) -> Result<Option<Arc<Room>>, 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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user