Skip to content

Commit d270dcd

Browse files
committed
feat(rtc): Remove deprecated CallNotify in favour of RtcNotification
1 parent b8cbd6c commit d270dcd

File tree

22 files changed

+150
-147
lines changed

22 files changed

+150
-147
lines changed

Cargo.lock

Lines changed: 9 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ rand = "0.8.5"
6565
regex = "1.11.2"
6666
reqwest = { version = "0.12.23", default-features = false }
6767
rmp-serde = "1.3.0"
68-
ruma = { version = "0.13.0", features = [
68+
ruma = { git = "https://github.com/ruma/ruma", rev = "2f64faeabb85950de27e9829faeb389d2779ac57", features = [
6969
"client-api-c",
7070
"compat-upload-signatures",
7171
"compat-arbitrary-length-ids",

bindings/matrix-sdk-ffi/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ All notable changes to this project will be documented in this file.
1212
struct.
1313
([#5635](https://github.com/matrix-org/matrix-rust-sdk/pull/5635))
1414

15+
- Remove the deprecated `CallNotify` event (`org.matrix.msc4075.call.notify`) in favor of the new
16+
`RtcNotification` event (`org.matrix.msc4075.rtc.notification`).
17+
1518
## [0.14.0] - 2025-09-04
1619

1720
### Features:

bindings/matrix-sdk-ffi/src/event.rs

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use ruma::{
1818

1919
use crate::{
2020
room_member::MembershipState,
21-
ruma::{MessageType, NotifyType},
21+
ruma::{MessageType, RtcNotificationType},
2222
utils::Timestamp,
2323
ClientError,
2424
};
@@ -153,7 +153,11 @@ impl TryFrom<AnySyncStateEvent> for StateEventContent {
153153
pub enum MessageLikeEventContent {
154154
CallAnswer,
155155
CallInvite,
156-
CallNotify { notify_type: NotifyType },
156+
RtcNotification {
157+
notification_type: RtcNotificationType,
158+
/// The timestamp at which this notification is considered invalid.
159+
expiration_ts: Timestamp,
160+
},
157161
CallHangup,
158162
CallCandidates,
159163
KeyVerificationReady,
@@ -163,11 +167,21 @@ pub enum MessageLikeEventContent {
163167
KeyVerificationKey,
164168
KeyVerificationMac,
165169
KeyVerificationDone,
166-
Poll { question: String },
167-
ReactionContent { related_event_id: String },
170+
Poll {
171+
question: String,
172+
},
173+
ReactionContent {
174+
related_event_id: String,
175+
},
168176
RoomEncrypted,
169-
RoomMessage { message_type: MessageType, in_reply_to_event_id: Option<String> },
170-
RoomRedaction { redacted_event_id: Option<String>, reason: Option<String> },
177+
RoomMessage {
178+
message_type: MessageType,
179+
in_reply_to_event_id: Option<String>,
180+
},
181+
RoomRedaction {
182+
redacted_event_id: Option<String>,
183+
reason: Option<String>,
184+
},
171185
Sticker,
172186
}
173187

@@ -178,10 +192,13 @@ impl TryFrom<AnySyncMessageLikeEvent> for MessageLikeEventContent {
178192
let content = match value {
179193
AnySyncMessageLikeEvent::CallAnswer(_) => MessageLikeEventContent::CallAnswer,
180194
AnySyncMessageLikeEvent::CallInvite(_) => MessageLikeEventContent::CallInvite,
181-
AnySyncMessageLikeEvent::CallNotify(content) => {
182-
let original_content = get_message_like_event_original_content(content)?;
183-
MessageLikeEventContent::CallNotify {
184-
notify_type: original_content.notify_type.into(),
195+
AnySyncMessageLikeEvent::RtcNotification(event) => {
196+
let origin_server_ts = event.origin_server_ts();
197+
let original_content = get_message_like_event_original_content(event)?;
198+
let expiration_ts = original_content.expiration_ts(origin_server_ts, None).into();
199+
MessageLikeEventContent::RtcNotification {
200+
notification_type: original_content.notification_type.into(),
201+
expiration_ts,
185202
}
186203
}
187204
AnySyncMessageLikeEvent::CallHangup(_) => MessageLikeEventContent::CallHangup,
@@ -331,7 +348,7 @@ pub enum MessageLikeEventType {
331348
CallCandidates,
332349
CallHangup,
333350
CallInvite,
334-
CallNotify,
351+
RtcNotification,
335352
KeyVerificationAccept,
336353
KeyVerificationCancel,
337354
KeyVerificationDone,
@@ -357,7 +374,7 @@ impl From<MessageLikeEventType> for ruma::events::MessageLikeEventType {
357374
match val {
358375
MessageLikeEventType::CallAnswer => Self::CallAnswer,
359376
MessageLikeEventType::CallInvite => Self::CallInvite,
360-
MessageLikeEventType::CallNotify => Self::CallNotify,
377+
MessageLikeEventType::RtcNotification => Self::RtcNotification,
361378
MessageLikeEventType::CallHangup => Self::CallHangup,
362379
MessageLikeEventType::CallCandidates => Self::CallCandidates,
363380
MessageLikeEventType::KeyVerificationReady => Self::KeyVerificationReady,

bindings/matrix-sdk-ffi/src/room/mod.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use mime::Mime;
2121
use ruma::{
2222
assign,
2323
events::{
24-
call::notify,
2524
room::{
2625
avatar::ImageInfo as RumaAvatarImageInfo,
2726
history_visibility::HistoryVisibility as RumaHistoryVisibility,
@@ -1384,18 +1383,6 @@ impl TryFrom<ImageInfo> for RumaAvatarImageInfo {
13841383
}
13851384
}
13861385

1387-
#[derive(uniffi::Enum)]
1388-
pub enum RtcApplicationType {
1389-
Call,
1390-
}
1391-
impl From<RtcApplicationType> for notify::ApplicationType {
1392-
fn from(value: RtcApplicationType) -> Self {
1393-
match value {
1394-
RtcApplicationType::Call => notify::ApplicationType::Call,
1395-
}
1396-
}
1397-
}
1398-
13991386
/// Current draft of the composer for the room.
14001387
#[derive(uniffi::Record)]
14011388
pub struct ComposerDraft {

bindings/matrix-sdk-ffi/src/ruma.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use matrix_sdk::attachment::{BaseAudioInfo, BaseFileInfo, BaseImageInfo, BaseVid
2323
use ruma::{
2424
assign,
2525
events::{
26-
call::notify::NotifyType as RumaNotifyType,
2726
direct::DirectEventContent,
2827
fully_read::FullyReadEventContent,
2928
identity_server::IdentityServerEventContent,
@@ -57,6 +56,7 @@ use ruma::{
5756
ImageInfo as RumaImageInfo, MediaSource as RumaMediaSource,
5857
ThumbnailInfo as RumaThumbnailInfo,
5958
},
59+
rtc::notification::NotificationType as RumaNotificationType,
6060
secret_storage::{
6161
default_key::SecretStorageDefaultKeyEventContent,
6262
key::{
@@ -487,25 +487,25 @@ impl TryFrom<RumaMessageType> for MessageType {
487487
}
488488

489489
#[derive(Clone, uniffi::Enum)]
490-
pub enum NotifyType {
490+
pub enum RtcNotificationType {
491491
Ring,
492492
Notify,
493493
}
494494

495-
impl From<RumaNotifyType> for NotifyType {
496-
fn from(val: RumaNotifyType) -> Self {
495+
impl From<RumaNotificationType> for RtcNotificationType {
496+
fn from(val: RumaNotificationType) -> Self {
497497
match val {
498-
RumaNotifyType::Ring => Self::Ring,
498+
RumaNotificationType::Ring => Self::Ring,
499499
_ => Self::Notify,
500500
}
501501
}
502502
}
503503

504-
impl From<NotifyType> for RumaNotifyType {
505-
fn from(value: NotifyType) -> Self {
504+
impl From<RtcNotificationType> for RumaNotificationType {
505+
fn from(value: RtcNotificationType) -> Self {
506506
match value {
507-
NotifyType::Ring => RumaNotifyType::Ring,
508-
NotifyType::Notify => RumaNotifyType::Notify,
507+
RtcNotificationType::Ring => RumaNotificationType::Ring,
508+
RtcNotificationType::Notify => RumaNotificationType::Notification,
509509
}
510510
}
511511
}

bindings/matrix-sdk-ffi/src/timeline/content.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl From<matrix_sdk_ui::timeline::TimelineItemContent> for TimelineItemContent
3535

3636
Content::CallInvite => TimelineItemContent::CallInvite,
3737

38-
Content::CallNotify => TimelineItemContent::CallNotify,
38+
Content::RtcNotification => TimelineItemContent::RtcNotification,
3939

4040
Content::MembershipChange(membership) => {
4141
let reason = match membership.content() {
@@ -109,7 +109,7 @@ pub enum TimelineItemContent {
109109
content: MsgLikeContent,
110110
},
111111
CallInvite,
112-
CallNotify,
112+
RtcNotification,
113113
RoomMembership {
114114
user_id: String,
115115
user_display_name: Option<String>,

bindings/matrix-sdk-ffi/src/widget.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,12 @@ pub fn get_element_call_required_permissions(
204204
send: vec![
205205
// To notify other users that a call has started.
206206
WidgetEventFilter::MessageLikeWithType {
207-
event_type: "org.matrix.msc4075.rtc.notification".to_owned(),
207+
event_type: MessageLikeEventType::RtcNotification.to_string(),
208208
},
209209
// Also for call notifications, except this is the deprecated fallback type which
210210
// Element Call still sends.
211+
// Deprecated for now, kept for backward compatibility as widgets will send both
212+
// CallNotify and RtcNotification.
211213
WidgetEventFilter::MessageLikeWithType {
212214
event_type: MessageLikeEventType::CallNotify.to_string(),
213215
},

0 commit comments

Comments
 (0)