Show upgrade required message when reconnecting after a protocol change

Co-authored-by: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Max Brunsfeld 2022-06-21 10:26:34 -07:00
parent 69bd6bf1f3
commit 6a2c5e0dc1
3 changed files with 23 additions and 36 deletions

View file

@ -318,16 +318,20 @@ impl Client {
let mut delay = Duration::from_millis(100); let mut delay = Duration::from_millis(100);
while let Err(error) = this.authenticate_and_connect(true, &cx).await { while let Err(error) = this.authenticate_and_connect(true, &cx).await {
log::error!("failed to connect {}", error); log::error!("failed to connect {}", error);
this.set_status( if matches!(*this.status().borrow(), Status::ConnectionError) {
Status::ReconnectionError { this.set_status(
next_reconnection: Instant::now() + delay, Status::ReconnectionError {
}, next_reconnection: Instant::now() + delay,
&cx, },
); &cx,
cx.background().timer(delay).await; );
delay = delay cx.background().timer(delay).await;
.mul_f32(rng.gen_range(1.0..=2.0)) delay = delay
.min(reconnect_interval); .mul_f32(rng.gen_range(1.0..=2.0))
.min(reconnect_interval);
} else {
break;
}
} }
})); }));
} }

View file

@ -65,7 +65,6 @@ pub struct Titlebar {
pub avatar_margin: f32, pub avatar_margin: f32,
pub avatar_ribbon: AvatarRibbon, pub avatar_ribbon: AvatarRibbon,
pub offline_icon: OfflineIcon, pub offline_icon: OfflineIcon,
pub share_icon: Interactive<ShareIcon>,
pub avatar: ImageStyle, pub avatar: ImageStyle,
pub sign_in_prompt: Interactive<ContainedText>, pub sign_in_prompt: Interactive<ContainedText>,
pub outdated_warning: ContainedText, pub outdated_warning: ContainedText,
@ -87,13 +86,6 @@ pub struct OfflineIcon {
pub color: Color, pub color: Color,
} }
#[derive(Clone, Deserialize, Default)]
pub struct ShareIcon {
#[serde(flatten)]
pub container: ContainerStyle,
pub color: Color,
}
#[derive(Clone, Deserialize, Default)] #[derive(Clone, Deserialize, Default)]
pub struct Tab { pub struct Tab {
pub height: f32, pub height: f32,

View file

@ -39,6 +39,8 @@ export default function workspace(theme: Theme) {
}, },
}; };
const titlebarPadding = 6;
return { return {
background: backgroundColor(theme, 300), background: backgroundColor(theme, 300),
joiningProjectAvatar: { joiningProjectAvatar: {
@ -78,7 +80,7 @@ export default function workspace(theme: Theme) {
background: backgroundColor(theme, 100), background: backgroundColor(theme, 100),
padding: { padding: {
left: 80, left: 80,
right: 6, right: titlebarPadding,
}, },
title: text(theme, "sans", "primary"), title: text(theme, "sans", "primary"),
avatar: { avatar: {
@ -111,31 +113,20 @@ export default function workspace(theme: Theme) {
offlineIcon: { offlineIcon: {
color: iconColor(theme, "secondary"), color: iconColor(theme, "secondary"),
width: 16, width: 16,
margin: {
left: titlebarPadding,
},
padding: { padding: {
right: 4, 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: { outdatedWarning: {
...text(theme, "sans", "warning", { size: "xs" }), ...text(theme, "sans", "warning", { size: "xs" }),
background: backgroundColor(theme, "warning"), background: backgroundColor(theme, "warning"),
border: border(theme, "warning"), border: border(theme, "warning"),
margin: {
left: titlebarPadding,
},
padding: { padding: {
left: 6, left: 6,
right: 6, right: 6,