add version check

Mikayla Maki created

Change summary

crates/util/src/channel.rs        |  2 --
crates/workspace/src/workspace.rs | 12 ++++++++++--
crates/zed/src/main.rs            |  1 -
3 files changed, 10 insertions(+), 5 deletions(-)

Detailed changes

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")

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)

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