From a2cac142c077f3a91f3d719b400a4a09ff7761cf Mon Sep 17 00:00:00 2001 From: kernelkind Date: Mon, 18 Dec 2023 13:22:00 -0500 Subject: [PATCH] Remove private key leak warning Remove the private key leak warning in the DMChatView and PostView since they are no longer needed since nsec is automatically converted into npub. Changelog-Removed: Removed old nsec key warning, nsec automatically convert to npub when posting Signed-off-by: kernelkind Reviewed-by: William Casarin Signed-off-by: William Casarin --- damus/Views/DMChatView.swift | 15 +-------------- damus/Views/PostView.swift | 15 +-------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/damus/Views/DMChatView.swift b/damus/Views/DMChatView.swift index 725a6e92..217f022e 100644 --- a/damus/Views/DMChatView.swift +++ b/damus/Views/DMChatView.swift @@ -11,7 +11,6 @@ import Combine struct DMChatView: View, KeyboardReadable { let damus_state: DamusState @ObservedObject var dms: DirectMessageModel - @State var showPrivateKeyWarning: Bool = false var pubkey: Pubkey { dms.pubkey @@ -106,11 +105,7 @@ struct DMChatView: View, KeyboardReadable { Button( role: .none, action: { - showPrivateKeyWarning = contentContainsPrivateKey(dms.draft) - - if !showPrivateKeyWarning { - send_message() - } + send_message() } ) { Label("", image: "send") @@ -165,14 +160,6 @@ struct DMChatView: View, KeyboardReadable { dms.draft = "" } } - .alert(NSLocalizedString("Note contains \"nsec1\" private key. Are you sure?", comment: "Alert user that they might be attempting to paste a private key and ask them to confirm."), isPresented: $showPrivateKeyWarning, actions: { - Button(NSLocalizedString("No", comment: "Button to cancel out of posting a note after being alerted that it looks like they might be posting a private key."), role: .cancel) { - showPrivateKeyWarning = false - } - Button(NSLocalizedString("Yes, Post with Private Key", comment: "Button to proceed with posting a note even though it looks like they might be posting a private key."), role: .destructive) { - send_message() - } - }) } } diff --git a/damus/Views/PostView.swift b/damus/Views/PostView.swift index acb15aec..5803e3db 100644 --- a/damus/Views/PostView.swift +++ b/damus/Views/PostView.swift @@ -46,7 +46,6 @@ enum PostAction { struct PostView: View { @State var post: NSMutableAttributedString = NSMutableAttributedString() @FocusState var focus: Bool - @State var showPrivateKeyWarning: Bool = false @State var attach_media: Bool = false @State var attach_camera: Bool = false @State var error: String? = nil @@ -159,11 +158,7 @@ struct PostView: View { var PostButton: some View { Button(NSLocalizedString("Post", comment: "Button to post a note.")) { - showPrivateKeyWarning = contentContainsPrivateKey(self.post.string) - - if !showPrivateKeyWarning { - self.send_post() - } + self.send_post() } .disabled(posting_disabled) .opacity(posting_disabled ? 0.5 : 1.0) @@ -480,14 +475,6 @@ struct PostView: View { clear_draft() } } - .alert(NSLocalizedString("Note contains \"nsec1\" private key. Are you sure?", comment: "Alert user that they might be attempting to paste a private key and ask them to confirm."), isPresented: $showPrivateKeyWarning, actions: { - Button(NSLocalizedString("No", comment: "Button to cancel out of posting a note after being alerted that it looks like they might be posting a private key."), role: .cancel) { - showPrivateKeyWarning = false - } - Button(NSLocalizedString("Yes, Post with Private Key", comment: "Button to proceed with posting a note even though it looks like they might be posting a private key."), role: .destructive) { - self.send_post() - } - }) } } }