From bd0b063bd1c6df9e6a8b7c21cfc0e1d9dfe5622d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 5 Apr 2022 10:07:45 +0200 Subject: [PATCH] =?UTF-8?q?Display=20`Installing=20update=E2=80=A6`=20when?= =?UTF-8?q?=20the=20new=20app=20is=20being=20copied?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/auto_update/src/auto_update.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/auto_update/src/auto_update.rs b/crates/auto_update/src/auto_update.rs index a129caf51f980c25423b5a85f543f861836940dd..a39f8027e6cd4d9a50a38ea5657be0ea82da787c 100644 --- a/crates/auto_update/src/auto_update.rs +++ b/crates/auto_update/src/auto_update.rs @@ -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(),