add nip4e settings

This commit is contained in:
2026-06-05 08:34:34 +07:00
parent 2d3d90774c
commit a0d76e2cf4
2 changed files with 22 additions and 8 deletions

View File

@@ -68,9 +68,9 @@ impl Display for AuthMode {
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub enum SignerKind {
Auto,
Encryption,
#[default]
User,
Encryption,
}
impl SignerKind {
@@ -98,7 +98,7 @@ impl RoomConfig {
pub fn new() -> Self {
Self {
backup: true,
signer_kind: SignerKind::Auto,
signer_kind: SignerKind::default(),
}
}

View File

@@ -56,17 +56,16 @@ impl Preferences {
impl Render for Preferences {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
const SCREENING: &str =
"When opening a request, a popup will appear to help you identify the sender.";
const AVATAR: &str =
"Hide all avatar pictures to improve performance and protect your privacy.";
const MODE: &str =
"Choose whether to use the selected light or dark theme, or to follow the OS.";
const SCREENING: &str = "Show an screening dialog to verify the unknown sender.";
const AVATAR: &str = "Hide all avatar pictures to improve performance.";
const MODE: &str = "Use the selected light or dark theme, or to follow the OS.";
const NIP4E: &str = "Use a dedicated key to encrypt and decrypt messages.";
const AUTH: &str = "Choose the authentication behavior for relays.";
const RESET: &str = "Reset the theme to the default one.";
let screening = AppSettings::get_screening(cx);
let hide_avatar = AppSettings::get_hide_avatar(cx);
let nip4e = AppSettings::get_encryption_key(cx);
let auth_mode = AppSettings::get_auth_mode(cx);
let theme_mode = AppSettings::get_theme_mode(cx);
@@ -207,6 +206,21 @@ impl Render for Preferences {
),
),
)
.child(
GroupBox::new()
.id("experiments")
.title("Experiments")
.fill()
.child(
Switch::new("nip4e")
.label("Decoupling Encryption Key")
.description(NIP4E)
.checked(nip4e)
.on_click(move |_, _window, cx| {
AppSettings::update_encryption_key(!nip4e, cx);
}),
),
)
.child(
GroupBox::new()
.id("media")