mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-14 19:16:02 -04:00
ffi: Allow to get the user-defined notification mode for a room
This commit is contained in:
@@ -176,6 +176,24 @@ impl NotificationSettings {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get the user defined room notification mode
|
||||
pub async fn get_user_defined_room_notification_mode(
|
||||
&self,
|
||||
room_id: String,
|
||||
) -> Result<Option<RoomNotificationMode>, NotificationSettingsError> {
|
||||
let notification_settings = self.sdk_notification_settings.read().await;
|
||||
let parsed_room_id = RoomId::parse(&room_id)
|
||||
.map_err(|_e| NotificationSettingsError::InvalidRoomId(room_id))?;
|
||||
// Get the current user defined mode for this room
|
||||
if let Some(mode) =
|
||||
notification_settings.get_user_defined_room_notification_mode(&parsed_room_id).await
|
||||
{
|
||||
Ok(Some(mode.into()))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the default room notification mode
|
||||
///
|
||||
/// The mode will depend on the associated `PushRule` based on whether the
|
||||
|
||||
Reference in New Issue
Block a user