Skip to content

Commit 9bc2aee

Browse files
authored
feat: show if proxy is enabled in connectivity view (#7359)
closes #7269
1 parent 56370c2 commit 9bc2aee

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

deltachat-ffi/deltachat.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7736,6 +7736,16 @@ void dc_event_unref(dc_event_t* event);
77367736
/// `%1$s` will be replaced with the channel name.
77377737
#define DC_STR_SECURE_JOIN_CHANNEL_QR_DESC 201
77387738

7739+
/// "Proxy Enabled"
7740+
///
7741+
/// Title for proxy section in connectivity view.
7742+
#define DC_STR_PROXY_ENABLED 220
7743+
7744+
/// "You are using a proxy. If you're having trouble connecting, try a different proxy."
7745+
///
7746+
/// Description in connectivity view when proxy is enabled.
7747+
#define DC_STR_PROXY_ENABLED_DESCRIPTION 221
7748+
77397749
/**
77407750
* @}
77417751
*/

src/scheduler/connectivity.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,19 @@ impl Context {
351351
<body>"#
352352
.to_string();
353353

354+
// =============================================================================================
355+
// Get proxy state
356+
// =============================================================================================
357+
358+
if self
359+
.get_config_bool(crate::config::Config::ProxyEnabled)
360+
.await?
361+
{
362+
let proxy_enabled = stock_str::proxy_enabled(self).await;
363+
let proxy_description = stock_str::proxy_description(self).await;
364+
ret += &format!("<h3>{proxy_enabled}</h3><ul><li>{proxy_description}</li></ul>");
365+
}
366+
354367
// =============================================================================================
355368
// Get the states from the RwLock
356369
// =============================================================================================

src/stock_str.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,14 @@ https://delta.chat/donate"))]
436436
fallback = "The attachment contains anonymous usage statistics, which helps us improve Delta Chat. Thank you!"
437437
))]
438438
StatsMsgBody = 210,
439+
440+
#[strum(props(fallback = "Proxy Enabled"))]
441+
ProxyEnabled = 220,
442+
443+
#[strum(props(
444+
fallback = "You are using a proxy. If you're having trouble connecting, try a different proxy."
445+
))]
446+
ProxyEnabledDescription = 221,
439447
}
440448

441449
impl StockMessage {
@@ -1309,6 +1317,16 @@ pub(crate) async fn backup_transfer_msg_body(context: &Context) -> String {
13091317
translated(context, StockMessage::BackupTransferMsgBody).await
13101318
}
13111319

1320+
/// Stock string: `Proxy Enabled`.
1321+
pub(crate) async fn proxy_enabled(context: &Context) -> String {
1322+
translated(context, StockMessage::ProxyEnabled).await
1323+
}
1324+
1325+
/// Stock string: `You are using a proxy. If you're having trouble connecting, try a different proxy.`.
1326+
pub(crate) async fn proxy_description(context: &Context) -> String {
1327+
translated(context, StockMessage::ProxyEnabledDescription).await
1328+
}
1329+
13121330
impl Context {
13131331
/// Set the stock string for the [StockMessage].
13141332
///

0 commit comments

Comments
 (0)