This commit is contained in:
2026-06-10 13:00:51 +07:00
parent 0230fcff23
commit e812ae05a9
8 changed files with 94 additions and 67 deletions

View File

@@ -11,7 +11,7 @@ use state::NostrRegistry;
use theme::ActiveTheme;
use ui::button::{Button, ButtonVariants};
use ui::input::{Input, InputEvent, InputState};
use ui::{Disableable, v_flex};
use ui::{Disableable, WindowExtension, v_flex};
#[derive(Debug)]
pub struct ImportIdentity {
@@ -74,6 +74,7 @@ impl ImportIdentity {
nostr.update(cx, |this, cx| {
this.set_signer(keys, cx);
});
window.close_modal(cx);
} else {
self.set_error("Invalid key", cx);
}
@@ -109,9 +110,10 @@ impl ImportIdentity {
self.tasks.push(cx.spawn_in(window, async move |this, cx| {
match task.await {
Ok(keys) => {
nostr.update(cx, |this, cx| {
nostr.update_in(cx, |this, window, cx| {
this.set_signer(keys, cx);
});
window.close_modal(cx);
})?;
}
Err(e) => {
this.update(cx, |this, cx| {

View File

@@ -65,7 +65,7 @@ impl Render for Preferences {
let screening = AppSettings::get_screening(cx);
let hide_avatar = AppSettings::get_hide_avatar(cx);
let nip4e = AppSettings::get_encryption_key(cx);
let nip4e = AppSettings::get_nip4e(cx);
let auth_mode = AppSettings::get_auth_mode(cx);
let theme_mode = AppSettings::get_theme_mode(cx);
@@ -217,7 +217,7 @@ impl Render for Preferences {
.description(NIP4E)
.checked(nip4e)
.on_click(move |_, _window, cx| {
AppSettings::update_encryption_key(!nip4e, cx);
AppSettings::update_nip4e(!nip4e, cx);
}),
),
)

View File

@@ -659,7 +659,8 @@ impl Workspace {
fn titlebar_right(&mut self, cx: &mut Context<Self>) -> impl IntoElement {
let chat = ChatRegistry::global(cx);
let trash_messages = chat.read(cx).count_trash_messages(cx);
let is_nip4e_enabled = AppSettings::get_encryption_key(cx);
let is_nip4e_enabled = AppSettings::get_nip4e(cx);
let nostr = NostrRegistry::global(cx);
let Some(public_key) = nostr.read(cx).signer_pubkey(cx) else {