From 9bc2aeebb8a1ceff935ecc22a15b31f3354bd8a2 Mon Sep 17 00:00:00 2001 From: Simon Laux Date: Fri, 31 Oct 2025 23:53:05 +0100 Subject: [PATCH] feat: show if proxy is enabled in connectivity view (#7359) closes #7269 --- deltachat-ffi/deltachat.h | 10 ++++++++++ src/scheduler/connectivity.rs | 13 +++++++++++++ src/stock_str.rs | 18 ++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index 2fd419fc9..441e58351 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -7736,6 +7736,16 @@ void dc_event_unref(dc_event_t* event); /// `%1$s` will be replaced with the channel name. #define DC_STR_SECURE_JOIN_CHANNEL_QR_DESC 201 +/// "Proxy Enabled" +/// +/// Title for proxy section in connectivity view. +#define DC_STR_PROXY_ENABLED 220 + +/// "You are using a proxy. If you're having trouble connecting, try a different proxy." +/// +/// Description in connectivity view when proxy is enabled. +#define DC_STR_PROXY_ENABLED_DESCRIPTION 221 + /** * @} */ diff --git a/src/scheduler/connectivity.rs b/src/scheduler/connectivity.rs index 1e2ede5bf..090cadfeb 100644 --- a/src/scheduler/connectivity.rs +++ b/src/scheduler/connectivity.rs @@ -351,6 +351,19 @@ impl Context { "# .to_string(); + // ============================================================================================= + // Get proxy state + // ============================================================================================= + + if self + .get_config_bool(crate::config::Config::ProxyEnabled) + .await? + { + let proxy_enabled = stock_str::proxy_enabled(self).await; + let proxy_description = stock_str::proxy_description(self).await; + ret += &format!("

{proxy_enabled}

"); + } + // ============================================================================================= // Get the states from the RwLock // ============================================================================================= diff --git a/src/stock_str.rs b/src/stock_str.rs index 89266471a..b23f95138 100644 --- a/src/stock_str.rs +++ b/src/stock_str.rs @@ -436,6 +436,14 @@ https://delta.chat/donate"))] fallback = "The attachment contains anonymous usage statistics, which helps us improve Delta Chat. Thank you!" ))] StatsMsgBody = 210, + + #[strum(props(fallback = "Proxy Enabled"))] + ProxyEnabled = 220, + + #[strum(props( + fallback = "You are using a proxy. If you're having trouble connecting, try a different proxy." + ))] + ProxyEnabledDescription = 221, } impl StockMessage { @@ -1309,6 +1317,16 @@ pub(crate) async fn backup_transfer_msg_body(context: &Context) -> String { translated(context, StockMessage::BackupTransferMsgBody).await } +/// Stock string: `Proxy Enabled`. +pub(crate) async fn proxy_enabled(context: &Context) -> String { + translated(context, StockMessage::ProxyEnabled).await +} + +/// Stock string: `You are using a proxy. If you're having trouble connecting, try a different proxy.`. +pub(crate) async fn proxy_description(context: &Context) -> String { + translated(context, StockMessage::ProxyEnabledDescription).await +} + impl Context { /// Set the stock string for the [StockMessage]. ///