Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix todos in auto-update
Mikaylaead520674126
diff --git a/crates/auto_update2/src/auto_update.rs b/crates/auto_update2/src/auto_update.rsindex 31e474242ac..4bf2bca0633 100644--- a/crates/auto_update2/src/auto_update.rs+++ b/crates/auto_update2/src/auto_update.rs@@ -9,12 +9,14 @@ use gpui::{ViewContext, VisualContext,};use isahc::AsyncBody;+use serde::Deserialize;use serde_derive::Serialize;use smol::io::AsyncReadExt;use settings::{Settings, SettingsStore};use smol::{fs::File, process::Command};+use std::{ffi::OsString, sync::Arc, time::Duration};use update_notification::UpdateNotification;use util::channel::{AppCommitSha, ReleaseChannel};@@ -24,16 +26,7 @@ use workspace::Workspace;const SHOULD_SHOW_UPDATE_NOTIFICATION_KEY: &str = "auto-updater-should-show-updated-notification";const POLL_INTERVAL: Duration = Duration::from_secs(60 * 60);-//todo!(remove CheckThatAutoUpdaterWorks)-actions!(- auto_update,- [- Check,- DismissErrorMessage,- ViewReleaseNotes,- CheckThatAutoUpdaterWorks- ]-);+actions!(auto_update, [Check, DismissErrorMessage, ViewReleaseNotes]);#[derive(Serialize)]struct UpdateRequestBody {@@ -90,7 +83,10 @@ pub fn init(http_client: Arc<dyn HttpClient>, server_url: String, cx: &mut AppCocx.observe_new_views(|workspace: &mut Workspace, _cx| {workspace.register_action(|_, action: &Check, cx| check(action, cx));+ workspace.register_action(|_, action, cx| view_release_notes(action, cx));+// @nate - code to trigger update notification on launch+ // todo!("remove this when Nate is done")// workspace.show_notification(0, _cx, |cx| {// cx.build_view(|_| UpdateNotification::new(SemanticVersion::from_str("1.1.1").unwrap()))// });@@ -119,9 +115,6 @@ pub fn init(http_client: Arc<dyn HttpClient>, server_url: String, cx: &mut AppCoupdater});cx.set_global(Some(auto_updater));- //todo!(action)- // cx.add_global_action(view_release_notes);- // cx.add_action(UpdateNotification::dismiss);}}diff --git a/crates/auto_update2/src/update_notification.rs b/crates/auto_update2/src/update_notification.rsindex 4a2efcf8076..8bb08912b01 100644--- a/crates/auto_update2/src/update_notification.rs+++ b/crates/auto_update2/src/update_notification.rs@@ -2,6 +2,7 @@ use gpui::{div, DismissEvent, Div, EventEmitter, InteractiveElement, ParentElement, Render,SemanticVersion, StatefulInteractiveElement, Styled, ViewContext,};+use menu::Cancel;use util::channel::ReleaseChannel;use workspace::ui::{h_stack, v_stack, Icon, IconElement, Label, StyledExt};@@ -18,6 +19,7 @@ impl Render for UpdateNotification {let app_name = cx.global::<ReleaseChannel>().display_name();v_stack()+ .on_action(cx.listener(UpdateNotification::dismiss)).elevation_3(cx).p_4().child(@@ -32,7 +34,7 @@ impl Render for UpdateNotification {.id("cancel").child(IconElement::new(Icon::Close)).cursor_pointer()- .on_click(cx.listener(|this, _, cx| this.dismiss(cx))),+ .on_click(cx.listener(|this, _, cx| this.dismiss(&menu::Cancel, cx))),),).child(@@ -50,7 +52,7 @@ impl UpdateNotification {Self { version }}- pub fn dismiss(&mut self, cx: &mut ViewContext<Self>) {+ pub fn dismiss(&mut self, _: &Cancel, cx: &mut ViewContext<Self>) {cx.emit(DismissEvent);}}