diff --git a/Cargo.lock b/Cargo.lock index ee01791d..db46edf2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -299,7 +299,7 @@ dependencies = [ [[package]] name = "assets" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "anyhow", "gpui-kit", @@ -542,7 +542,7 @@ dependencies = [ [[package]] name = "auto_update" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "futures", "gpui-pre", @@ -1041,7 +1041,7 @@ dependencies = [ [[package]] name = "chat" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "anyhow", "common", @@ -1064,7 +1064,7 @@ dependencies = [ [[package]] name = "chat_ui" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "anyhow", "chat", @@ -1221,7 +1221,7 @@ dependencies = [ [[package]] name = "common" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "chrono", "dirs 5.0.1", @@ -1335,7 +1335,7 @@ dependencies = [ [[package]] name = "coop" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "assets", "auto_update", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "coop_web" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "chat", "console_error_panic_hook", @@ -4765,7 +4765,7 @@ checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nip29" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "anyhow", "chat", @@ -4783,7 +4783,7 @@ dependencies = [ [[package]] name = "nip29_ui" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "anyhow", "chat", @@ -4804,7 +4804,7 @@ dependencies = [ [[package]] name = "nip4e" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "anyhow", "flume 0.11.1", @@ -5697,7 +5697,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "person" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "anyhow", "common", @@ -6576,9 +6576,9 @@ checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" [[package]] name = "roxmltree" -version = "0.21.1" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1964b10c76125c36f8afe190065a4bf9a87bf324842c05701330bba9f1cacbb" +checksum = "9da7f59328b09405b181fee1018925fad50f157afb43c0c0f5c522c256dd5907" dependencies = [ "memchr", ] @@ -7161,7 +7161,7 @@ dependencies = [ [[package]] name = "settings" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "anyhow", "common", @@ -7417,7 +7417,7 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "state" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "aes-gcm", "anyhow", @@ -8236,7 +8236,7 @@ dependencies = [ [[package]] name = "ui" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "common", "gpui-base", @@ -8444,7 +8444,7 @@ dependencies = [ "kurbo 0.13.1", "log", "pico-args", - "roxmltree 0.21.1", + "roxmltree 0.21.2", "rustybuzz", "simplecss", "siphasher", @@ -9674,7 +9674,7 @@ checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] name = "workspace" -version = "2.0.0-alpha" +version = "2.0.0-alpha2" dependencies = [ "anyhow", "auto_update", diff --git a/crates/auto_update/Cargo.toml b/crates/auto_update/Cargo.toml index 90d9004c..0a08d154 100644 --- a/crates/auto_update/Cargo.toml +++ b/crates/auto_update/Cargo.toml @@ -11,6 +11,7 @@ serde.workspace = true serde_json.workspace = true futures.workspace = true +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] gpui-updater-pre = "0.2" [dev-dependencies] diff --git a/crates/state/src/lib.rs b/crates/state/src/lib.rs index 5a53fcf6..b157bf9b 100644 --- a/crates/state/src/lib.rs +++ b/crates/state/src/lib.rs @@ -6,6 +6,7 @@ use anyhow::{Error, anyhow}; use browser_signer_proxy::prelude::*; use common::config_dir; use gpui::{App, AppContext, Context, Entity, EventEmitter, Global, Task, TaskExt}; +#[cfg(not(target_arch = "wasm32"))] use gpui_tokio::Tokio; use instant::Duration; use nostr_connect::prelude::*; diff --git a/crates/workspace/src/dialogs/import.rs b/crates/workspace/src/dialogs/import.rs index f9a7f45b..e492595b 100644 --- a/crates/workspace/src/dialogs/import.rs +++ b/crates/workspace/src/dialogs/import.rs @@ -226,7 +226,6 @@ impl Render for ImportIdentity { const BUNKER_WARN: &str = "Nostr Connect will usually take more time to get all your messages. Please keep your session open until you see all your messages."; const KEY_WARN: &str = "Coop encrypts your key with your passphrase and stores it on this device. You only need the passphrase to sign in next time."; - let is_wasm = cfg!(target_arch = "wasm32"); let is_unlock = self.mode == Mode::Unlock; let value = self.key_input.read(cx).value().trim().to_string(); @@ -305,26 +304,32 @@ impl Render for ImportIdentity { ) }), ) - .child( - Button::new("login") - .label(if is_unlock { "Unlock" } else { "Continue" }) - .primary() - .loading(self.loading) - .disabled(self.loading) - .on_click(cx.listener(move |this, _ev, _window, cx| { - this.login(cx); - })), - ) - .when(!is_wasm && !is_unlock, |this| { - this.child( - Button::new("proxy") - .label("Connect via Web Extension (Experimental)") - .ghost() + .child({ + let content = v_flex().child( + Button::new("login") + .label(if is_unlock { "Unlock" } else { "Continue" }) + .primary() + .loading(self.loading) .disabled(self.loading) .on_click(cx.listener(move |this, _ev, _window, cx| { - this.proxy(cx); + this.login(cx); })), - ) + ); + + #[cfg(not(target_arch = "wasm32"))] + let content = content.when(!is_unlock, |this| { + this.child( + Button::new("proxy") + .label("Connect via Web Extension (Experimental)") + .ghost() + .disabled(self.loading) + .on_click(cx.listener(move |this, _ev, _window, cx| { + this.proxy(cx); + })), + ) + }); + + content }) .when_some(self.error.read(cx).as_ref(), |this, error| { this.child( diff --git a/crates/workspace/src/lib.rs b/crates/workspace/src/lib.rs index a0482b24..9ae51eff 100644 --- a/crates/workspace/src/lib.rs +++ b/crates/workspace/src/lib.rs @@ -2,6 +2,7 @@ use std::sync::Arc; use ::settings::{AppSettings, AppearanceMode}; use anyhow::Error; +#[cfg(not(target_arch = "wasm32"))] use auto_update::AutoUpdater; use chat::{ChatEvent, ChatRegistry}; use common::download_dir; @@ -372,7 +373,9 @@ impl Workspace { Command::ImportEncryption => { self.import_encryption(window, cx); } - Command::Update => { + Command::Update => + { + #[cfg(not(target_arch = "wasm32"))] if let Some(auto_updater) = AutoUpdater::try_global(cx) { auto_updater.update(cx, |this, cx| this.check(cx)); } diff --git a/crates/workspace/src/sidebar/header.rs b/crates/workspace/src/sidebar/header.rs index fc0ca359..3f19b598 100644 --- a/crates/workspace/src/sidebar/header.rs +++ b/crates/workspace/src/sidebar/header.rs @@ -1,3 +1,4 @@ +#[cfg(not(target_arch = "wasm32"))] use auto_update::AutoUpdater; use gpui::prelude::FluentBuilder; use gpui::{ @@ -25,6 +26,7 @@ impl Sidebar { current_user: &PublicKey, cx: &mut Context, ) -> Stateful
{ + #[cfg(not(target_arch = "wasm32"))] let updater = AutoUpdater::try_global(cx); let profile = self.directory.read(cx).person(current_user, cx); let avatar = profile.avatar(); @@ -62,12 +64,15 @@ impl Sidebar { ) }), ) - .child( - h_flex() - .gap_1() - .when_some(updater, |this, updater| { - this.child(self.render_updater(updater, cx)) - }) + .child({ + let actions = h_flex().gap_1(); + + #[cfg(not(target_arch = "wasm32"))] + let actions = actions.when_some(updater, |this, updater| { + this.child(self.render_updater(updater, cx)) + }); + + actions .child( Button::new("sidebar-search") .icon(IconName::Search) @@ -104,8 +109,8 @@ impl Sidebar { this.hide_group(cx); })), ) - }), - ) + }) + }) } /// The bottom navigation, pinned below the list like signed's sidebar. @@ -128,6 +133,7 @@ impl Sidebar { ) } + #[cfg(not(target_arch = "wasm32"))] fn render_updater(&self, updater: Entity, cx: &mut App) -> AnyElement { let status = updater.read(cx).status(); let up_to_date = updater.read(cx).up_to_date();