Skip to content

Commit d2ca026

Browse files
authored
feat(element-call url params): split url params into configuration and properties (#5560)
This PR is part of an onging effort to move responsiblity to the EC app and out of the EX apps. 4 intends (f.ex `join_existing` `start_new_dm`... ) (as url paramters) are introduced in recent element call versions. Those intends behave like defaults. If an intend is set a set of url parameters are predefined. Not all params can be covered by the intend (for insteance the `widget_id` or the `host_url`). This PR splits the url parameters into configuration (things that can be configured by the intent) and properties (things that still need to be passed one by one) The goal with this change is that EX only needs to configre the intent once and the EC codebase can update the behavior in those 4 specific scenarios in case new features come along (auto hangup when other participants leave, send call ring notification...) Signed-off-by: Timo K <toger5@hotmail.de> <!-- description of the changes in this PR --> - [ ] Public API changes documented in changelogs (optional) <!-- Sign-off, if not part of the commits --> <!-- See CONTRIBUTING.md if you don't know what this is --> Signed-off-by: --------- Signed-off-by: Timo K <toger5@hotmail.de>
1 parent f106442 commit d2ca026

File tree

5 files changed

+207
-124
lines changed

5 files changed

+207
-124
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,10 @@ pub async fn generate_webview_url(
125125
/// call widget.
126126
#[matrix_sdk_ffi_macros::export]
127127
pub fn new_virtual_element_call_widget(
128-
props: matrix_sdk::widget::VirtualElementCallWidgetOptions,
128+
props: matrix_sdk::widget::VirtualElementCallWidgetProperties,
129+
config: matrix_sdk::widget::VirtualElementCallWidgetConfig,
129130
) -> Result<WidgetSettings, ParseError> {
130-
Ok(matrix_sdk::widget::WidgetSettings::new_virtual_element_call_widget(props)
131+
Ok(matrix_sdk::widget::WidgetSettings::new_virtual_element_call_widget(props, config)
131132
.map(|w| w.into())?)
132133
}
133134

crates/matrix-sdk/CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,40 @@ All notable changes to this project will be documented in this file.
8484
([#5431](https://github.com/matrix-org/matrix-rust-sdk/pull/5431))
8585
- [**breaking**] `Room::send_call_notification` and `Room::send_call_notification_if_needed` have been removed, since the event type they send is outdated, and `Client` is not actually supposed to be able to join MatrixRTC sessions (yet). In practice, users of these methods probably already rely on another MatrixRTC implementation to participate in sessions, and such an implementation should be capable of sending notifications itself.
8686
([#5452](https://github.com/matrix-org/matrix-rust-sdk/pull/5452))
87+
- [**breaking**] The `new_virtual_element_call_widget` now uses a `props` and a `config` parameter instead of only `props`.
88+
This splits the configuration of the widget into required properties ("widget_id", "parent_url"...) so the widget can work
89+
and optional config parameters ("skip_lobby", "header", "...").
90+
The config option should in most cases only provide the `"intent"` property.
91+
All other config options will then be chosen by EC based on platform + `intent`.
92+
93+
Before:
94+
95+
```rust
96+
new_virtual_element_call_widget(
97+
VirtualElementCallWidgetProperties {
98+
widget_id: "my_widget_id", // required property
99+
skip_lobby: Some(true), // optional configuration
100+
preload: Some(true), // optional configuration
101+
// ...
102+
}
103+
)
104+
```
105+
106+
Now:
107+
108+
```rust
109+
new_virtual_element_call_widget(
110+
VirtualElementCallWidgetProperties {
111+
widget_id: "my_widget_id", // required property
112+
// ... only required properties
113+
},
114+
VirtualElementCallWidgetConfig {
115+
intend: Intend.StartCallDM, // defines the default values for all other configuration
116+
skip_lobby: Some(false), // overwrite a specific default value
117+
..VirtualElementCallWidgetConfig::default() // set all other config options to `None`. Use defaults from intent.
118+
}
119+
)
120+
```
87121

88122
### Bugfix
89123

crates/matrix-sdk/src/widget/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ pub use self::{
4545
capabilities::{Capabilities, CapabilitiesProvider},
4646
filter::{Filter, MessageLikeEventFilter, StateEventFilter, ToDeviceEventFilter},
4747
settings::{
48-
ClientProperties, EncryptionSystem, Intent, VirtualElementCallWidgetOptions, WidgetSettings,
48+
ClientProperties, EncryptionSystem, Intent, VirtualElementCallWidgetConfig,
49+
VirtualElementCallWidgetProperties, WidgetSettings,
4950
},
5051
};
5152

0 commit comments

Comments
 (0)