Skip to content

Commit 8da228c

Browse files
committed
feat: Add disable_badge_count field to set pusher request
This allows the clients to stop receiving push notifications for unread counts in their devices, when it's not useful.
1 parent 878e02b commit 8da228c

File tree

7 files changed

+25
-22
lines changed

7 files changed

+25
-22
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ 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+
# TODO: revert this before merging
69+
ruma = { git = "https://github.com/jmartinesp/ruma", rev = "0dac817a7a3b4c08993ab275c47033d8f797a3f3", features = [
6970
"client-api-c",
7071
"compat-upload-signatures",
7172
"compat-arbitrary-length-ids",

bindings/matrix-sdk-ffi/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ crate-type = [
2424
]
2525

2626
[features]
27-
default = ["bundled-sqlite", "unstable-msc4274"]
27+
default = ["bundled-sqlite", "unstable-msc4274", "unstable-msc4076"]
2828
bundled-sqlite = ["matrix-sdk/bundled-sqlite"]
2929
unstable-msc4274 = ["matrix-sdk-ui/unstable-msc4274"]
3030
# Required when targeting a Javascript environment, like Wasm in a browser.
@@ -36,6 +36,8 @@ rustls-tls = ["matrix-sdk/rustls-tls", "sentry?/rustls"]
3636
# Enable sentry error monitoring, not compatible with Wasm platforms.
3737
sentry = ["dep:sentry", "dep:sentry-tracing"]
3838

39+
unstable-msc4076 = ["matrix-sdk/unstable-msc4076"]
40+
3941
[dependencies]
4042
anyhow.workspace = true
4143
extension-trait = "1.0.1"
@@ -57,7 +59,7 @@ matrix-sdk-ffi-macros.workspace = true
5759
matrix-sdk-ui = { workspace = true, features = ["uniffi"] }
5860
mime = "0.3.16"
5961
once_cell.workspace = true
60-
ruma = { workspace = true, features = ["html", "unstable-msc3488", "compat-unset-avatar", "unstable-msc3245-v1-compat", "unstable-msc4278", "unstable-hydra"] }
62+
ruma = { workspace = true, features = ["html", "unstable-msc3488", "compat-unset-avatar", "unstable-msc3245-v1-compat", "unstable-msc4278", "unstable-hydra", "unstable-msc4076"] }
6163
serde.workspace = true
6264
serde_json.workspace = true
6365
sentry = { workspace = true, optional = true, default-features = false, features = [

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,7 @@ impl Client {
11441144
}
11451145

11461146
/// Registers a pusher with given parameters
1147+
#[allow(clippy::too_many_arguments)]
11471148
pub async fn set_pusher(
11481149
&self,
11491150
identifiers: PusherIdentifiers,
@@ -1152,6 +1153,7 @@ impl Client {
11521153
device_display_name: String,
11531154
profile_tag: Option<String>,
11541155
lang: String,
1156+
#[cfg(feature = "unstable-msc4076")] disable_badge_count: bool,
11551157
) -> Result<(), ClientError> {
11561158
let ids = identifiers.into();
11571159

@@ -1162,6 +1164,8 @@ impl Client {
11621164
device_display_name,
11631165
profile_tag,
11641166
lang,
1167+
#[cfg(feature = "unstable-msc4076")]
1168+
disable_badge_count,
11651169
};
11661170
self.inner.pusher().set(pusher_init.into()).await?;
11671171
Ok(())

crates/matrix-sdk/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ docsrs = ["e2e-encryption", "sqlite", "indexeddb", "sso-login", "qrcode"]
7171
# Add support for inline media galleries via msgtypes
7272
unstable-msc4274 = ["ruma/unstable-msc4274", "matrix-sdk-base/unstable-msc4274"]
7373

74+
# Add support for disabling the pusher badge count
75+
unstable-msc4076 = ["ruma/unstable-msc4076"]
76+
7477
experimental-search = ["matrix-sdk-search"]
7578

7679
[dependencies]

crates/matrix-sdk/src/pusher.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ mod tests {
8585
lang: "EN".to_owned(),
8686
device_display_name: "name".to_owned(),
8787
profile_tag: None,
88+
#[cfg(feature = "unstable-msc4076")]
89+
disable_badge_count: true,
8890
};
8991

9092
let response = client.pusher().set(pusher.into()).await;

xtask/src/ci.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ fn check_clippy() -> Result<()> {
233233
"rustup run {NIGHTLY} cargo clippy --workspace --all-targets
234234
--exclude matrix-sdk-crypto --exclude xtask
235235
--no-default-features
236-
--features native-tls,sso-login,testing
236+
--features native-tls,sso-login,testing,unstable-msc4076
237237
-- -D warnings"
238238
)
239239
.run()?;

0 commit comments

Comments
 (0)