From 6a2c5e0dc1fe7907cc52588cad6a25604000ca44 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 21 Jun 2022 10:26:34 -0700 Subject: [PATCH] Show upgrade required message when reconnecting after a protocol change Co-authored-by: Antonio Scandurra --- crates/client/src/client.rs | 24 ++++++++++++++---------- crates/theme/src/theme.rs | 8 -------- styles/src/styleTree/workspace.ts | 27 +++++++++------------------ 3 files changed, 23 insertions(+), 36 deletions(-) diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index 51da1f4c1c..084d43af1b 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -318,16 +318,20 @@ impl Client { let mut delay = Duration::from_millis(100); while let Err(error) = this.authenticate_and_connect(true, &cx).await { log::error!("failed to connect {}", error); - this.set_status( - Status::ReconnectionError { - next_reconnection: Instant::now() + delay, - }, - &cx, - ); - cx.background().timer(delay).await; - delay = delay - .mul_f32(rng.gen_range(1.0..=2.0)) - .min(reconnect_interval); + if matches!(*this.status().borrow(), Status::ConnectionError) { + this.set_status( + Status::ReconnectionError { + next_reconnection: Instant::now() + delay, + }, + &cx, + ); + cx.background().timer(delay).await; + delay = delay + .mul_f32(rng.gen_range(1.0..=2.0)) + .min(reconnect_interval); + } else { + break; + } } })); } diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 80e9a8619f..08ca7898f5 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -65,7 +65,6 @@ pub struct Titlebar { pub avatar_margin: f32, pub avatar_ribbon: AvatarRibbon, pub offline_icon: OfflineIcon, - pub share_icon: Interactive, pub avatar: ImageStyle, pub sign_in_prompt: Interactive, pub outdated_warning: ContainedText, @@ -87,13 +86,6 @@ pub struct OfflineIcon { pub color: Color, } -#[derive(Clone, Deserialize, Default)] -pub struct ShareIcon { - #[serde(flatten)] - pub container: ContainerStyle, - pub color: Color, -} - #[derive(Clone, Deserialize, Default)] pub struct Tab { pub height: f32, diff --git a/styles/src/styleTree/workspace.ts b/styles/src/styleTree/workspace.ts index 17c51bad4c..8863a8eb79 100644 --- a/styles/src/styleTree/workspace.ts +++ b/styles/src/styleTree/workspace.ts @@ -39,6 +39,8 @@ export default function workspace(theme: Theme) { }, }; + const titlebarPadding = 6; + return { background: backgroundColor(theme, 300), joiningProjectAvatar: { @@ -78,7 +80,7 @@ export default function workspace(theme: Theme) { background: backgroundColor(theme, 100), padding: { left: 80, - right: 6, + right: titlebarPadding, }, title: text(theme, "sans", "primary"), avatar: { @@ -111,31 +113,20 @@ export default function workspace(theme: Theme) { offlineIcon: { color: iconColor(theme, "secondary"), width: 16, + margin: { + left: titlebarPadding, + }, padding: { right: 4, }, }, - shareIcon: { - cornerRadius: 6, - margin: { top: 3, bottom: 2, left: 6 }, - color: iconColor(theme, "secondary"), - hover: { - background: backgroundColor(theme, 100, "hovered"), - color: iconColor(theme, "secondary"), - }, - active: { - background: backgroundColor(theme, 100, "active"), - color: iconColor(theme, "active"), - }, - activeHover: { - background: backgroundColor(theme, 100, "hovered"), - color: iconColor(theme, "active"), - } - }, outdatedWarning: { ...text(theme, "sans", "warning", { size: "xs" }), background: backgroundColor(theme, "warning"), border: border(theme, "warning"), + margin: { + left: titlebarPadding, + }, padding: { left: 6, right: 6,