From 9f02dcd412c3f9eeec5ce0ca5ea2af83ee5c1aab Mon Sep 17 00:00:00 2001 From: Mauro <34335419+Velin92@users.noreply.github.com> Date: Tue, 2 Dec 2025 10:31:53 +0100 Subject: [PATCH] ffi(bindings): added `is_space` to the NotificationRoomInfo (#5907) Exposes the `is_space` flag to FFI in the `NotificationRoomInfo`, so that a client can tell through a notification if the room that generated it, is a space or not. --- bindings/matrix-sdk-ffi/CHANGELOG.md | 1 + bindings/matrix-sdk-ffi/src/client.rs | 1 + bindings/matrix-sdk-ffi/src/notification.rs | 2 ++ crates/matrix-sdk-ui/CHANGELOG.md | 1 + crates/matrix-sdk-ui/src/notification_client.rs | 3 +++ 5 files changed, 8 insertions(+) diff --git a/bindings/matrix-sdk-ffi/CHANGELOG.md b/bindings/matrix-sdk-ffi/CHANGELOG.md index d5e047b12..8b1dea096 100644 --- a/bindings/matrix-sdk-ffi/CHANGELOG.md +++ b/bindings/matrix-sdk-ffi/CHANGELOG.md @@ -84,6 +84,7 @@ All notable changes to this project will be documented in this file. ### Features +- Expose `is_space` in `NotificationRoomInfo`, allowing clients to determine if the room that triggered the notification is a space. - Add push actions to `NotificationItem` and replace `SyncNotification` with `NotificationItem`. ([#5835](https://github.com/matrix-org/matrix-rust-sdk/pull/5835)) - Add `Client::new_grant_login_with_qr_code_handler` for granting login to a new device by way of diff --git a/bindings/matrix-sdk-ffi/src/client.rs b/bindings/matrix-sdk-ffi/src/client.rs index 81df1c66d..15bbb2f03 100644 --- a/bindings/matrix-sdk-ffi/src/client.rs +++ b/bindings/matrix-sdk-ffi/src/client.rs @@ -967,6 +967,7 @@ impl Client { joined_members_count: room.joined_members_count(), is_encrypted: Some(room.encryption_state().is_encrypted()), is_direct, + is_space: room.is_space(), }; listener.on_notification( diff --git a/bindings/matrix-sdk-ffi/src/notification.rs b/bindings/matrix-sdk-ffi/src/notification.rs index c79341773..0b3577189 100644 --- a/bindings/matrix-sdk-ffi/src/notification.rs +++ b/bindings/matrix-sdk-ffi/src/notification.rs @@ -36,6 +36,7 @@ pub struct NotificationRoomInfo { pub joined_members_count: u64, pub is_encrypted: Option, pub is_direct: bool, + pub is_space: bool, } #[derive(uniffi::Record)] @@ -82,6 +83,7 @@ impl NotificationItem { joined_members_count: item.joined_members_count, is_encrypted: item.is_room_encrypted, is_direct: item.is_direct_message_room, + is_space: item.is_space, }, is_noisy: item.is_noisy, has_mention: item.has_mention, diff --git a/crates/matrix-sdk-ui/CHANGELOG.md b/crates/matrix-sdk-ui/CHANGELOG.md index d0b1a389b..703a10f3d 100644 --- a/crates/matrix-sdk-ui/CHANGELOG.md +++ b/crates/matrix-sdk-ui/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. ### Features +- Expose `is_space` in `NotificationItem`, allowing clients to determine if the room that triggered the notification is a space. - [**breaking**] The `LatestEventValue::Local` type gains 2 new fields: `sender` and `profile`. ([#5885](https://github.com/matrix-org/matrix-rust-sdk/pull/5885)) diff --git a/crates/matrix-sdk-ui/src/notification_client.rs b/crates/matrix-sdk-ui/src/notification_client.rs index 60c65c3d9..a18086cf1 100644 --- a/crates/matrix-sdk-ui/src/notification_client.rs +++ b/crates/matrix-sdk-ui/src/notification_client.rs @@ -881,6 +881,8 @@ pub struct NotificationItem { pub is_direct_message_room: bool, /// Numbers of members who joined the room. pub joined_members_count: u64, + /// Is the room a space? + pub is_space: bool, /// Is it a noisy notification? (i.e. does any push action contain a sound /// action) @@ -982,6 +984,7 @@ impl NotificationItem { .map(|state| state.is_encrypted()) .ok(), joined_members_count: room.joined_members_count(), + is_space: room.is_space(), is_noisy, has_mention, thread_id,