Merge pull request #1215 from zed-industries/suggest-upgrade-on-reconnect

Show upgrade required message when reconnecting after a protocol change
This commit is contained in:
Antonio Scandurra 2022-06-21 20:41:36 +02:00 committed by GitHub
commit 83f38aa1ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 36 deletions

View file

@ -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;
}
}
}));
}

View file

@ -65,7 +65,6 @@ pub struct Titlebar {
pub avatar_margin: f32,
pub avatar_ribbon: AvatarRibbon,
pub offline_icon: OfflineIcon,
pub share_icon: Interactive<ShareIcon>,
pub avatar: ImageStyle,
pub sign_in_prompt: Interactive<ContainedText>,
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,

View file

@ -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,