From 58748bec3a65e7b121b0ea23d617da6bcae6cb47 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Wed, 2 Jul 2025 16:10:06 +0200 Subject: [PATCH] chore(ffi): tweak alias names in the FFI layer It doesn't make sense to name a thing "Matrix" when it comes from the core SDK crate. Also adjust a now slightly-incorrect doc comment for `get_notification`. --- bindings/matrix-sdk-ffi/src/notification.rs | 16 +++++++++++----- crates/matrix-sdk-ui/src/notification_client.rs | 4 +--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bindings/matrix-sdk-ffi/src/notification.rs b/bindings/matrix-sdk-ffi/src/notification.rs index b0105a719..2b2b4d855 100644 --- a/bindings/matrix-sdk-ffi/src/notification.rs +++ b/bindings/matrix-sdk-ffi/src/notification.rs @@ -1,7 +1,7 @@ use std::{collections::HashMap, sync::Arc}; use matrix_sdk_ui::notification_client::{ - NotificationClient as MatrixNotificationClient, NotificationItem as MatrixNotificationItem, + NotificationClient as SdkNotificationClient, NotificationItem as SdkNotificationItem, NotificationStatus as SdkNotificationStatus, }; use ruma::{EventId, OwnedEventId, OwnedRoomId, RoomId}; @@ -55,7 +55,7 @@ pub struct NotificationItem { } impl NotificationItem { - fn from_inner(item: MatrixNotificationItem) -> Self { + fn from_inner(item: SdkNotificationItem) -> Self { let event = match item.event { matrix_sdk_ui::notification_client::NotificationEvent::Timeline(event) => { NotificationEvent::Timeline { event: Arc::new(TimelineEvent(event)) } @@ -103,7 +103,7 @@ pub enum NotificationStatus { #[derive(uniffi::Object)] pub struct NotificationClient { - pub(crate) inner: MatrixNotificationClient, + pub(crate) inner: SdkNotificationClient, /// A reference to the FFI client. /// @@ -127,8 +127,14 @@ impl NotificationClient { Ok(room) } - /// See also documentation of - /// `MatrixNotificationClient::get_notification`. + /// Fetches the content of a notification. + /// + /// This will first try to get the notification using a short-lived sliding + /// sync, and if the sliding-sync can't find the event, then it'll use a + /// `/context` query to find the event with associated member information. + /// + /// An error result means that we couldn't resolve the notification; in that + /// case, a dummy notification may be displayed instead. pub async fn get_notification( &self, room_id: String, diff --git a/crates/matrix-sdk-ui/src/notification_client.rs b/crates/matrix-sdk-ui/src/notification_client.rs index 7b687b2cb..005fff533 100644 --- a/crates/matrix-sdk-ui/src/notification_client.rs +++ b/crates/matrix-sdk-ui/src/notification_client.rs @@ -143,9 +143,7 @@ impl NotificationClient { /// `/context` query to find the event with associated member information. /// /// An error result means that we couldn't resolve the notification; in that - /// case, a dummy notification may be displayed instead. A `None` result - /// means the notification has been filtered out by the user's push - /// rules. + /// case, a dummy notification may be displayed instead. #[instrument(skip(self))] pub async fn get_notification( &self,