Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

add version check

Mikayla Maki705e36827c8e
diff --git a/crates/util/src/channel.rs b/crates/util/src/channel.rs
index 2b45cb6b661..274fd576a05 100644
--- a/crates/util/src/channel.rs
+++ b/crates/util/src/channel.rs
@@ -2,8 +2,6 @@ use std::env;
use lazy_static::lazy_static;
-pub struct ZedVersion(pub &'static str);
-
lazy_static! {
pub static ref RELEASE_CHANNEL_NAME: String = if cfg!(debug_assertions) {
env::var("ZED_RELEASE_CHANNEL")
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs
index 73cc811e764..7033530f96e 100644
--- a/crates/workspace/src/workspace.rs
+++ b/crates/workspace/src/workspace.rs
@@ -19,7 +19,7 @@ use assets::Assets;
use call::ActiveCall;
use client::{
proto::{self, PeerId},
- Client, TypedEnvelope, UserStore,
+ Client, TypedEnvelope, UserStore, ZED_APP_VERSION,
};
use collections::{hash_map, HashMap, HashSet};
use drag_and_drop::DragAndDrop;
@@ -83,7 +83,7 @@ use status_bar::StatusBar;
pub use status_bar::StatusItemView;
use theme::{Theme, ThemeSettings};
pub use toolbar::{ToolbarItemLocation, ToolbarItemView};
-use util::{async_iife, channel::ZedVersion, paths, ResultExt};
+use util::{async_iife, paths, ResultExt};
pub use workspace_settings::{AutosaveSetting, GitGutterSetting, WorkspaceSettings};
lazy_static! {
@@ -3197,6 +3197,14 @@ fn notify_of_new_dock(workspace: &WeakViewHandle<Workspace>, cx: &mut AsyncAppCo
if workspace
.read_with(cx, |workspace, cx| {
+ let version = ZED_APP_VERSION
+ .or_else(|| cx.platform().app_version().ok())
+ .map(|v| v.to_string()).unwrap_or_default();
+
+ if !version.contains("0.88") || !version.contains("0.89") || !version.contains("0.90") || !version.contains("0.91") {
+ return true;
+ }
+
workspace.has_shown_notification_once::<MessageNotification>(MESSAGE_ID, cx)
})
.unwrap_or(false)
diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs
index 558796807be..31f331ef93e 100644
--- a/crates/zed/src/main.rs
+++ b/crates/zed/src/main.rs
@@ -119,7 +119,6 @@ fn main() {
app.run(move |cx| {
cx.set_global(*RELEASE_CHANNEL);
- cx.set_global(util::channel::ZedVersion(env!("CARGO_PKG_VERSION")));
#[cfg(debug_assertions)]
cx.set_global(StaffMode(true));