chore: update deps

This commit is contained in:
2026-01-10 09:26:19 +07:00
parent 11d694d51d
commit 0ccf1b43c4
10 changed files with 157 additions and 173 deletions

View File

@@ -253,12 +253,10 @@ impl AutoUpdater {
}
fn check_for_updates(version: Version, cx: &AsyncApp) -> Task<Result<Vec<EventId>, Error>> {
let Ok(client) = cx.update(|cx| {
let client = cx.update(|cx| {
let nostr = NostrRegistry::global(cx);
nostr.read(cx).client()
}) else {
return Task::ready(Err(anyhow!("Entity has been released")));
};
});
cx.background_spawn(async move {
let opts = SubscribeAutoCloseOptions::default().exit_policy(ReqExitPolicy::ExitOnEOSE);
@@ -416,7 +414,7 @@ async fn install_release_macos(
downloaded_dmg: PathBuf,
cx: &AsyncApp,
) -> Result<(), Error> {
let running_app_path = cx.update(|cx| cx.app_path())??;
let running_app_path = cx.update(|cx| cx.app_path())?;
let running_app_filename = running_app_path
.file_name()
.with_context(|| format!("invalid running app path {running_app_path:?}"))?;

View File

@@ -7,10 +7,10 @@ use common::{nip96_upload, RenderedTimestamp};
use gpui::prelude::FluentBuilder;
use gpui::{
div, img, list, px, red, relative, rems, svg, white, AnyElement, App, AppContext,
ClipboardItem, Context, Entity, EventEmitter, Flatten, FocusHandle, Focusable,
InteractiveElement, IntoElement, ListAlignment, ListOffset, ListState, MouseButton, ObjectFit,
ParentElement, PathPromptOptions, Render, RetainAllImageCache, SharedString,
StatefulInteractiveElement, Styled, StyledImage, Subscription, Task, WeakEntity, Window,
ClipboardItem, Context, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement,
IntoElement, ListAlignment, ListOffset, ListState, MouseButton, ObjectFit, ParentElement,
PathPromptOptions, Render, RetainAllImageCache, SharedString, StatefulInteractiveElement,
Styled, StyledImage, Subscription, Task, WeakEntity, Window,
};
use gpui_tokio::Tokio;
use indexset::{BTreeMap, BTreeSet};
@@ -446,25 +446,19 @@ impl ChatPanel {
Some(url)
});
if let Ok(task) = upload {
if let Ok(task) = upload.await {
this.update(cx, |this, cx| {
this.set_uploading(true, cx);
})
.ok();
let result = Flatten::flatten(task.await.map_err(|e| e.into()));
this.update_in(cx, |this, window, cx| {
match result {
Ok(Some(url)) => {
this.update_in(cx, |this, _window, cx| {
match task {
Some(url) => {
this.add_attachment(url, cx);
this.set_uploading(false, cx);
}
Ok(None) => {
this.set_uploading(false, cx);
}
Err(e) => {
window.push_notification(Notification::error(e.to_string()), cx);
None => {
this.set_uploading(false, cx);
}
};

View File

@@ -83,8 +83,7 @@ pub fn reset(cx: &mut App) {
cx.update(|cx| {
cx.restart();
})
.ok();
});
})
.detach();
}

View File

@@ -3,8 +3,8 @@ use std::time::Duration;
use anyhow::{anyhow, Error};
use common::home_dir;
use gpui::{
div, App, AppContext, ClipboardItem, Context, Entity, Flatten, IntoElement, ParentElement,
Render, SharedString, Styled, Task, Window,
div, App, AppContext, ClipboardItem, Context, Entity, IntoElement, ParentElement, Render,
SharedString, Styled, Task, Window,
};
use nostr_sdk::prelude::*;
use smallvec::{smallvec, SmallVec};
@@ -60,7 +60,7 @@ impl Backup {
let nsec = self.secret_input.read(cx).value().to_string();
cx.spawn_in(window, async move |this, cx| {
match Flatten::flatten(path.await.map_err(|e| e.into())) {
match path.await {
Ok(Ok(Some(path))) => {
if let Err(e) = smol::fs::write(&path, nsec).await {
this.update_in(cx, |this, window, cx| {

View File

@@ -1,9 +1,8 @@
use anyhow::{anyhow, Error};
use common::{default_nip17_relays, default_nip65_relays, nip96_upload, BOOTSTRAP_RELAYS};
use gpui::{
rems, AnyElement, App, AppContext, Context, Entity, EventEmitter, Flatten, FocusHandle,
Focusable, IntoElement, ParentElement, PathPromptOptions, Render, SharedString, Styled, Task,
Window,
rems, AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable,
IntoElement, ParentElement, PathPromptOptions, Render, SharedString, Styled, Task, Window,
};
use gpui_tokio::Tokio;
use key_store::{KeyItem, KeyStore};
@@ -221,8 +220,8 @@ impl NewAccount {
});
let task = Tokio::spawn(cx, async move {
match Flatten::flatten(paths.await.map_err(|e| e.into())) {
Ok(Some(mut paths)) => {
match paths.await {
Ok(Ok(Some(mut paths))) => {
if let Some(path) = paths.pop() {
let file = fs::read(path).await?;
let url = nip96_upload(&client, &nip96_server, file).await?;
@@ -232,13 +231,12 @@ impl NewAccount {
Err(anyhow!("Path not found"))
}
}
Ok(None) => Err(anyhow!("User cancelled")),
Err(e) => Err(anyhow!("File dialog error: {e}")),
_ => Err(anyhow!("Error")),
}
});
cx.spawn_in(window, async move |this, cx| {
let result = Flatten::flatten(task.await.map_err(|e| e.into()));
let result = task.await;
this.update_in(cx, |this, window, cx| {
match result {

View File

@@ -5,7 +5,7 @@ use anyhow::{anyhow, Error};
use common::{nip96_upload, shorten_pubkey};
use gpui::prelude::FluentBuilder;
use gpui::{
div, img, App, AppContext, ClipboardItem, Context, Entity, Flatten, IntoElement, ParentElement,
div, img, App, AppContext, ClipboardItem, Context, Entity, IntoElement, ParentElement,
PathPromptOptions, Render, SharedString, Styled, Task, Window,
};
use gpui_tokio::Tokio;
@@ -194,8 +194,8 @@ impl UserProfile {
});
let task = Tokio::spawn(cx, async move {
match Flatten::flatten(paths.await.map_err(|e| e.into())) {
Ok(Some(mut paths)) => {
match paths.await {
Ok(Ok(Some(mut paths))) => {
if let Some(path) = paths.pop() {
let file = fs::read(path).await?;
let url = nip96_upload(&client, &nip96_server, file).await?;
@@ -205,13 +205,12 @@ impl UserProfile {
Err(anyhow!("Path not found"))
}
}
Ok(None) => Err(anyhow!("User cancelled")),
Err(e) => Err(anyhow!("File dialog error: {e}")),
_ => Err(anyhow!("Error")),
}
});
cx.spawn_in(window, async move |this, cx| {
let result = Flatten::flatten(task.await.map_err(|e| e.into()));
let result = task.await;
this.update_in(cx, |this, window, cx| {
match result {

View File

@@ -96,7 +96,7 @@ impl KeyBackend for KeyringProvider {
url: &'a str,
cx: &'a AsyncApp,
) -> Pin<Box<dyn Future<Output = Result<Option<(String, Vec<u8>)>>> + 'a>> {
async move { cx.update(|cx| cx.read_credentials(url))?.await }.boxed_local()
async move { cx.update(|cx| cx.read_credentials(url)).await }.boxed_local()
}
fn write_credentials<'a>(
@@ -107,7 +107,7 @@ impl KeyBackend for KeyringProvider {
cx: &'a AsyncApp,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'a>> {
async move {
cx.update(move |cx| cx.write_credentials(url, username, password))?
cx.update(move |cx| cx.write_credentials(url, username, password))
.await
}
.boxed_local()
@@ -118,7 +118,7 @@ impl KeyBackend for KeyringProvider {
url: &'a str,
cx: &'a AsyncApp,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'a>> {
async move { cx.update(move |cx| cx.delete_credentials(url))?.await }.boxed_local()
async move { cx.update(move |cx| cx.delete_credentials(url)).await }.boxed_local()
}
}

View File

@@ -182,16 +182,15 @@ impl TabPanel {
// Sync the active state to all panels
cx.spawn(async move |view, cx| {
_ = cx.update(|cx| {
_ = view.update(cx, |view, cx| {
if let Some(last_active) = view.panels.get(last_active_ix) {
last_active.set_active(false, cx);
}
if let Some(active) = view.panels.get(view.active_ix) {
active.set_active(true, cx);
}
});
});
view.update(cx, |view, cx| {
if let Some(last_active) = view.panels.get(last_active_ix) {
last_active.set_active(false, cx);
}
if let Some(active) = view.panels.get(view.active_ix) {
active.set_active(true, cx);
}
})
.ok();
})
.detach();
@@ -923,11 +922,10 @@ impl TabPanel {
cx.spawn({
let is_zoomed = self.is_zoomed;
async move |view, cx| {
_ = cx.update(|cx| {
_ = view.update(cx, |view, cx| {
view.set_zoomed(is_zoomed, cx);
});
});
view.update(cx, |view, cx| {
view.set_zoomed(is_zoomed, cx);
})
.ok();
}
})
.detach();

View File

@@ -56,7 +56,7 @@ impl BlinkCursor {
cx.spawn(async move |this, cx| {
Timer::after(INTERVAL).await;
if let Some(this) = this.upgrade() {
this.update(cx, |this, cx| this.blink(epoch, cx)).ok();
this.update(cx, |this, cx| this.blink(epoch, cx));
}
})
.detach();
@@ -82,8 +82,7 @@ impl BlinkCursor {
this.update(cx, |this, cx| {
this.paused = false;
this.blink(epoch, cx);
})
.ok();
});
}
})
.detach();