feat: add user menu and sign-out support
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s

This commit is contained in:
2026-10-06 15:50:30 +07:00
parent 62f355d70e
commit 237b6a6996
6 changed files with 188 additions and 10 deletions
+17 -1
View File
@@ -5,7 +5,9 @@ use std::time::{Duration, Instant};
use anyhow::{Error, anyhow, bail};
use bitcoin_hashes::sha1::Hash as Sha1Hash;
use gpui::{App, AppContext, AsyncApp, Context, Entity, EventEmitter, Global, Task, WeakEntity};
use gpui::{
App, AppContext, AsyncApp, Context, Entity, EventEmitter, Global, Task, TaskExt, WeakEntity,
};
use nostr::event::IntoEventBuilder;
use nostr::nips::nip19::Nip19Coordinate;
use nostr_connect::prelude::*;
@@ -944,6 +946,20 @@ impl Backend {
self.passphrase_required
}
pub fn sign_out(&mut self, cx: &mut Context<Self>) {
self.current_user = None;
self.passphrase_required = false;
self.inbox.update(cx, |inbox, cx| {
inbox.reset(cx);
});
cx.delete_credentials(USER_KEYRING).detach_and_log_err(cx);
cx.emit(BackendEvent::SignerChanged);
cx.emit(BackendEvent::SignerRequired);
cx.notify();
}
fn sync_inbox(&mut self, cx: &mut Context<Self>) {
let repo_store = RepoListStore::global(cx);
let client = self.client.clone();