From 3f3892ba1d7e92765384cb68aaeacc58b848ec81 Mon Sep 17 00:00:00 2001 From: Terry Yiu <963907+tyiu@users.noreply.github.com> Date: Mon, 20 Mar 2023 10:48:15 -0600 Subject: [PATCH] Add validation to prevent whitespaces be inputted on NIP-05 input field Changelog-Changed: Add validation to prevent whitespaces be inputted on NIP-05 input field Closes: #793 --- damus/Views/EditMetadataView.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/damus/Views/EditMetadataView.swift b/damus/Views/EditMetadataView.swift index eb32b893..353d6506 100644 --- a/damus/Views/EditMetadataView.swift +++ b/damus/Views/EditMetadataView.swift @@ -6,6 +6,7 @@ // import SwiftUI +import Combine let PPM_SIZE: CGFloat = 80.0 let BANNER_HEIGHT: CGFloat = 150.0; @@ -197,6 +198,9 @@ struct EditMetadataView: View { TextField(NSLocalizedString("jb55@jb55.com", comment: "Placeholder example text for identifier used for NIP-05 verification."), text: $nip05) .autocorrectionDisabled(true) .textInputAutocapitalization(.never) + .onReceive(Just(nip05)) { newValue in + self.nip05 = newValue.trimmingCharacters(in: .whitespaces) + } }, header: { Text("NIP-05 Verification", comment: "Label for NIP-05 Verification section of user profile form.") }, footer: {