Display Installing update… when the new app is being copied

This commit is contained in:
Antonio Scandurra 2022-04-05 10:07:45 +02:00
parent 61c479ebc8
commit bd0b063bd1

View file

@ -30,6 +30,7 @@ pub enum AutoUpdateStatus {
Idle,
Checking,
Downloading,
Installing,
Updated,
Errored,
}
@ -175,6 +176,11 @@ impl AutoUpdater {
smol::io::copy(response.bytes(), &mut dmg_file).await?;
log::info!("downloaded update. path:{:?}", dmg_path);
this.update(&mut cx, |this, cx| {
this.status = AutoUpdateStatus::Installing;
cx.notify();
});
let output = Command::new("hdiutil")
.args(&["attach", "-nobrowse"])
.arg(&dmg_path)
@ -215,7 +221,7 @@ impl AutoUpdater {
}
this.update(&mut cx, |this, cx| {
this.status = AutoUpdateStatus::Idle;
this.status = AutoUpdateStatus::Updated;
cx.notify();
});
Ok(())
@ -245,6 +251,11 @@ impl View for AutoUpdateIndicator {
theme.auto_update_progress_message.clone(),
)
.boxed(),
AutoUpdateStatus::Installing => Text::new(
"Installing update…".to_string(),
theme.auto_update_done_message.clone(),
)
.boxed(),
AutoUpdateStatus::Updated => Text::new(
"Restart to update Zed".to_string(),
theme.auto_update_done_message.clone(),