Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ rand = "0.8.5"
regex = "1.11.2"
reqwest = { version = "0.12.23", default-features = false }
rmp-serde = "1.3.0"
ruma = { version = "0.13.0", features = [
ruma = { git = "https://github.com/ruma/ruma", rev = "2f64faeabb85950de27e9829faeb389d2779ac57", features = [
"client-api-c",
"compat-upload-signatures",
"compat-arbitrary-length-ids",
Expand Down
3 changes: 3 additions & 0 deletions bindings/matrix-sdk-ffi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ All notable changes to this project will be documented in this file.
struct.
([#5635](https://github.com/matrix-org/matrix-rust-sdk/pull/5635))

- Remove the deprecated `CallNotify` event (`org.matrix.msc4075.call.notify`) in favor of the new
`RtcNotification` event (`org.matrix.msc4075.rtc.notification`).

## [0.14.0] - 2025-09-04

### Features:
Expand Down
41 changes: 29 additions & 12 deletions bindings/matrix-sdk-ffi/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use ruma::{

use crate::{
room_member::MembershipState,
ruma::{MessageType, NotifyType},
ruma::{MessageType, RtcNotificationType},
utils::Timestamp,
ClientError,
};
Expand Down Expand Up @@ -153,7 +153,11 @@ impl TryFrom<AnySyncStateEvent> for StateEventContent {
pub enum MessageLikeEventContent {
CallAnswer,
CallInvite,
CallNotify { notify_type: NotifyType },
RtcNotification {
notification_type: RtcNotificationType,
/// The timestamp at which this notification is considered invalid.
expiration_ts: Timestamp,
},
CallHangup,
CallCandidates,
KeyVerificationReady,
Expand All @@ -163,11 +167,21 @@ pub enum MessageLikeEventContent {
KeyVerificationKey,
KeyVerificationMac,
KeyVerificationDone,
Poll { question: String },
ReactionContent { related_event_id: String },
Poll {
question: String,
},
ReactionContent {
related_event_id: String,
},
RoomEncrypted,
RoomMessage { message_type: MessageType, in_reply_to_event_id: Option<String> },
RoomRedaction { redacted_event_id: Option<String>, reason: Option<String> },
RoomMessage {
message_type: MessageType,
in_reply_to_event_id: Option<String>,
},
RoomRedaction {
redacted_event_id: Option<String>,
reason: Option<String>,
},
Sticker,
}

Expand All @@ -178,10 +192,13 @@ impl TryFrom<AnySyncMessageLikeEvent> for MessageLikeEventContent {
let content = match value {
AnySyncMessageLikeEvent::CallAnswer(_) => MessageLikeEventContent::CallAnswer,
AnySyncMessageLikeEvent::CallInvite(_) => MessageLikeEventContent::CallInvite,
AnySyncMessageLikeEvent::CallNotify(content) => {
let original_content = get_message_like_event_original_content(content)?;
MessageLikeEventContent::CallNotify {
notify_type: original_content.notify_type.into(),
AnySyncMessageLikeEvent::RtcNotification(event) => {
let origin_server_ts = event.origin_server_ts();
let original_content = get_message_like_event_original_content(event)?;
let expiration_ts = original_content.expiration_ts(origin_server_ts, None).into();
MessageLikeEventContent::RtcNotification {
notification_type: original_content.notification_type.into(),
expiration_ts,
}
}
AnySyncMessageLikeEvent::CallHangup(_) => MessageLikeEventContent::CallHangup,
Expand Down Expand Up @@ -331,7 +348,7 @@ pub enum MessageLikeEventType {
CallCandidates,
CallHangup,
CallInvite,
CallNotify,
RtcNotification,
KeyVerificationAccept,
KeyVerificationCancel,
KeyVerificationDone,
Expand All @@ -357,7 +374,7 @@ impl From<MessageLikeEventType> for ruma::events::MessageLikeEventType {
match val {
MessageLikeEventType::CallAnswer => Self::CallAnswer,
MessageLikeEventType::CallInvite => Self::CallInvite,
MessageLikeEventType::CallNotify => Self::CallNotify,
MessageLikeEventType::RtcNotification => Self::RtcNotification,
MessageLikeEventType::CallHangup => Self::CallHangup,
MessageLikeEventType::CallCandidates => Self::CallCandidates,
MessageLikeEventType::KeyVerificationReady => Self::KeyVerificationReady,
Expand Down
13 changes: 0 additions & 13 deletions bindings/matrix-sdk-ffi/src/room/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use mime::Mime;
use ruma::{
assign,
events::{
call::notify,
room::{
avatar::ImageInfo as RumaAvatarImageInfo,
history_visibility::HistoryVisibility as RumaHistoryVisibility,
Expand Down Expand Up @@ -1384,18 +1383,6 @@ impl TryFrom<ImageInfo> for RumaAvatarImageInfo {
}
}

#[derive(uniffi::Enum)]
pub enum RtcApplicationType {
Call,
}
impl From<RtcApplicationType> for notify::ApplicationType {
fn from(value: RtcApplicationType) -> Self {
match value {
RtcApplicationType::Call => notify::ApplicationType::Call,
}
}
}

/// Current draft of the composer for the room.
#[derive(uniffi::Record)]
pub struct ComposerDraft {
Expand Down
18 changes: 9 additions & 9 deletions bindings/matrix-sdk-ffi/src/ruma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use matrix_sdk::attachment::{BaseAudioInfo, BaseFileInfo, BaseImageInfo, BaseVid
use ruma::{
assign,
events::{
call::notify::NotifyType as RumaNotifyType,
direct::DirectEventContent,
fully_read::FullyReadEventContent,
identity_server::IdentityServerEventContent,
Expand Down Expand Up @@ -57,6 +56,7 @@ use ruma::{
ImageInfo as RumaImageInfo, MediaSource as RumaMediaSource,
ThumbnailInfo as RumaThumbnailInfo,
},
rtc::notification::NotificationType as RumaNotificationType,
secret_storage::{
default_key::SecretStorageDefaultKeyEventContent,
key::{
Expand Down Expand Up @@ -487,25 +487,25 @@ impl TryFrom<RumaMessageType> for MessageType {
}

#[derive(Clone, uniffi::Enum)]
pub enum NotifyType {
pub enum RtcNotificationType {
Ring,
Notify,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be renamed Notification to align with Ruma?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, done 9d53bc1

}

impl From<RumaNotifyType> for NotifyType {
fn from(val: RumaNotifyType) -> Self {
impl From<RumaNotificationType> for RtcNotificationType {
fn from(val: RumaNotificationType) -> Self {
match val {
RumaNotifyType::Ring => Self::Ring,
RumaNotificationType::Ring => Self::Ring,
_ => Self::Notify,
}
}
}

impl From<NotifyType> for RumaNotifyType {
fn from(value: NotifyType) -> Self {
impl From<RtcNotificationType> for RumaNotificationType {
fn from(value: RtcNotificationType) -> Self {
match value {
NotifyType::Ring => RumaNotifyType::Ring,
NotifyType::Notify => RumaNotifyType::Notify,
RtcNotificationType::Ring => RumaNotificationType::Ring,
RtcNotificationType::Notify => RumaNotificationType::Notification,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions bindings/matrix-sdk-ffi/src/timeline/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl From<matrix_sdk_ui::timeline::TimelineItemContent> for TimelineItemContent

Content::CallInvite => TimelineItemContent::CallInvite,

Content::CallNotify => TimelineItemContent::CallNotify,
Content::RtcNotification => TimelineItemContent::RtcNotification,

Content::MembershipChange(membership) => {
let reason = match membership.content() {
Expand Down Expand Up @@ -109,7 +109,7 @@ pub enum TimelineItemContent {
content: MsgLikeContent,
},
CallInvite,
CallNotify,
RtcNotification,
RoomMembership {
user_id: String,
user_display_name: Option<String>,
Expand Down
4 changes: 3 additions & 1 deletion bindings/matrix-sdk-ffi/src/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,12 @@ pub fn get_element_call_required_permissions(
send: vec![
// To notify other users that a call has started.
WidgetEventFilter::MessageLikeWithType {
event_type: "org.matrix.msc4075.rtc.notification".to_owned(),
event_type: MessageLikeEventType::RtcNotification.to_string(),
},
// Also for call notifications, except this is the deprecated fallback type which
// Element Call still sends.
// Deprecated for now, kept for backward compatibility as widgets will send both
// CallNotify and RtcNotification.
WidgetEventFilter::MessageLikeWithType {
event_type: MessageLikeEventType::CallNotify.to_string(),
},
Expand Down
Loading
Loading