wip: release candidate #34

Draft
reya wants to merge 12 commits from feat/rc into master
4 changed files with 84 additions and 79 deletions
Showing only changes of commit 2d3d90774c - Show all commits

View File

@@ -620,13 +620,19 @@ impl ChatPanel {
}) })
.is_err() .is_err()
{ {
window.push_notification( window.push_notification(Notification::error("Failed to change subject"), cx);
Notification::error("Failed to change subject").autohide(false),
cx,
);
} }
} }
Command::ChangeSigner(kind) => { Command::ChangeSigner(kind) => {
let is_nip4e_enabled = AppSettings::get_encryption_key(cx);
if !is_nip4e_enabled
&& (*kind == SignerKind::Encryption || *kind == SignerKind::Auto)
{
window.push_notification("Decoupling Encryption Key is not enabled", cx);
return;
}
if self if self
.room .room
.update(cx, |this, cx| { .update(cx, |this, cx| {
@@ -634,10 +640,7 @@ impl ChatPanel {
}) })
.is_err() .is_err()
{ {
window.push_notification( window.push_notification(Notification::error("Failed to change signer"), cx);
Notification::error("Failed to change signer").autohide(false),
cx,
);
} }
} }
Command::ToggleBackup => { Command::ToggleBackup => {
@@ -648,10 +651,7 @@ impl ChatPanel {
}) })
.is_err() .is_err()
{ {
window.push_notification( window.push_notification(Notification::error("Failed to toggle backup"), cx);
Notification::error("Failed to toggle backup").autohide(false),
cx,
);
} }
} }
Command::Copy(public_key) => { Command::Copy(public_key) => {

View File

@@ -67,8 +67,8 @@ impl Display for AuthMode {
/// Signer kind /// Signer kind
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub enum SignerKind { pub enum SignerKind {
#[default]
Auto, Auto,
#[default]
User, User,
Encryption, Encryption,
} }

View File

@@ -18,7 +18,7 @@ pub(crate) fn input_style(disabled: bool, cx: &App) -> (Hsla, Hsla) {
if disabled { if disabled {
(cx.theme().surface_background, cx.theme().text_muted) (cx.theme().surface_background, cx.theme().text_muted)
} else { } else {
(cx.theme().surface_background, cx.theme().text) (cx.theme().elevated_surface_background, cx.theme().text)
} }
} }

View File

@@ -641,6 +641,7 @@ impl Workspace {
let chat = ChatRegistry::global(cx); let chat = ChatRegistry::global(cx);
let initializing = chat.read(cx).initializing; let initializing = chat.read(cx).initializing;
let trash_messages = chat.read(cx).count_trash_messages(cx); let trash_messages = chat.read(cx).count_trash_messages(cx);
let is_nip4e_enabled = AppSettings::get_encryption_key(cx);
let device = DeviceRegistry::global(cx); let device = DeviceRegistry::global(cx);
let device_initializing = device.read(cx).initializing; let device_initializing = device.read(cx).initializing;
@@ -691,72 +692,76 @@ impl Workspace {
}), }),
) )
}) })
.child( .when(is_nip4e_enabled, |this| {
Button::new("key") this.child(
.icon(IconName::UserKey) Button::new("key")
.tooltip("Decoupled encryption key") .icon(IconName::UserKey)
.small() .tooltip("Decoupled encryption key")
.ghost() .small()
.loading(device_initializing) .ghost()
.when(device_initializing, |this| { .loading(device_initializing)
this.label("Dekey") .when(device_initializing, |this| {
.xsmall() this.label("Dekey")
.tooltip("Loading decoupled encryption key...") .xsmall()
}) .tooltip("Loading decoupled encryption key...")
.dropdown_menu(move |this, _window, _cx| { })
this.min_w(px(260.)) .dropdown_menu(move |this, _window, _cx| {
.label("Encryption Key") this.min_w(px(260.))
.when_some(announcement.as_ref(), |this, announcement| { .label("Encryption Key")
let name = announcement.client_name(); .when_some(announcement.as_ref(), |this, announcement| {
let pkey = shorten_pubkey(announcement.public_key(), 8); let name = announcement.client_name();
let pkey = shorten_pubkey(announcement.public_key(), 8);
this.item(PopupMenuItem::element(move |_window, cx| { this.item(PopupMenuItem::element(move |_window, cx| {
h_flex() h_flex()
.gap_1() .gap_1()
.text_sm() .text_sm()
.child( .child(
Icon::new(IconName::Device) Icon::new(IconName::Device)
.small() .small()
.text_color(cx.theme().icon_muted), .text_color(cx.theme().icon_muted),
) )
.child(name.clone()) .child(name.clone())
})) }))
.item(PopupMenuItem::element(move |_window, cx| { .item(
h_flex() PopupMenuItem::element(move |_window, cx| {
.gap_1() h_flex()
.text_sm() .gap_1()
.child( .text_sm()
Icon::new(IconName::UserKey) .child(
.small() Icon::new(IconName::UserKey)
.text_color(cx.theme().icon_muted), .small()
) .text_color(cx.theme().icon_muted),
.child(SharedString::from(pkey.clone())) )
})) .child(SharedString::from(pkey.clone()))
}) }),
.separator() )
.menu_with_icon( })
"Backup", .separator()
IconName::Shield, .menu_with_icon(
Box::new(Command::BackupEncryption), "Backup",
) IconName::Shield,
.menu_with_icon( Box::new(Command::BackupEncryption),
"Restore from secret key", )
IconName::Usb, .menu_with_icon(
Box::new(Command::ImportEncryption), "Restore from secret key",
) IconName::Usb,
.separator() Box::new(Command::ImportEncryption),
.menu_with_icon( )
"Reload", .separator()
IconName::Refresh, .menu_with_icon(
Box::new(Command::RefreshEncryption), "Reload",
) IconName::Refresh,
.menu_with_icon( Box::new(Command::RefreshEncryption),
"Reset", )
IconName::Warning, .menu_with_icon(
Box::new(Command::ResetEncryption), "Reset",
) IconName::Warning,
}), Box::new(Command::ResetEncryption),
) )
}),
)
})
.child( .child(
Button::new("inbox") Button::new("inbox")
.icon(IconName::Inbox) .icon(IconName::Inbox)