From 6aa0239fa81671e864aea7ef76a624c991ab25a7 Mon Sep 17 00:00:00 2001 From: codebymini Date: Wed, 27 Aug 2025 08:53:57 +0200 Subject: [PATCH 1/2] Change input fields to be masked instead of invisible in screenshots --- .../Helpers/Views/TogglableSecureInput.swift | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/LoopFollow/Helpers/Views/TogglableSecureInput.swift b/LoopFollow/Helpers/Views/TogglableSecureInput.swift index ac79c2e23..e0a021d21 100644 --- a/LoopFollow/Helpers/Views/TogglableSecureInput.swift +++ b/LoopFollow/Helpers/Views/TogglableSecureInput.swift @@ -20,18 +20,22 @@ struct TogglableSecureInput: View { Group { switch style { case .singleLine: - if isVisible { - TextField(placeholder, text: $text) - .multilineTextAlignment(.trailing) - .textContentType(textContentType) - .submitLabel(.done) - .focused($isFocused) - } else { - SecureField(placeholder, text: $text) - .multilineTextAlignment(.trailing) - .textContentType(textContentType) - .submitLabel(.done) - .focused($isFocused) + ZStack(alignment: .trailing) { + if isVisible { + TextField(placeholder, text: $text) + .multilineTextAlignment(.trailing) + .textContentType(textContentType) + .submitLabel(.done) + .focused($isFocused) + } else { + HStack { + Spacer() + Text(maskString) + .font(.body.monospaced()) + .foregroundColor(.primary) + .allowsHitTesting(false) + } + } } case .multiLine: @@ -53,15 +57,13 @@ struct TogglableSecureInput: View { } if !isVisible { - Text(maskString) - .font(.body.monospaced()) - .foregroundColor(.primary) - .frame(maxWidth: .infinity, - maxHeight: .infinity, - alignment: .topLeading) - .padding(.top, 8) - .padding(.leading, 5) - .allowsHitTesting(false) + HStack { + Spacer() + Text(maskString) + .font(.body.monospaced()) + .foregroundColor(.primary) + .allowsHitTesting(false) + } } } .frame(minHeight: 100) From e0abc6ba8bbd5dbe46e38f1f849eaa5272f8b8e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bj=C3=B6rkert?= Date: Fri, 29 Aug 2025 15:48:57 +0200 Subject: [PATCH 2/2] Reveal single line when tapping the dots --- .../Helpers/Views/TogglableSecureInput.swift | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/LoopFollow/Helpers/Views/TogglableSecureInput.swift b/LoopFollow/Helpers/Views/TogglableSecureInput.swift index e0a021d21..f6ed70343 100644 --- a/LoopFollow/Helpers/Views/TogglableSecureInput.swift +++ b/LoopFollow/Helpers/Views/TogglableSecureInput.swift @@ -82,13 +82,19 @@ struct TogglableSecureInput: View { } .contentShape(Rectangle()) .onTapGesture { - if style == .multiLine && !isVisible { + if !isVisible { isVisible = true - isMultilineFocused = true - } else if style == .singleLine { - isFocused = true - } else if style == .multiLine && isVisible { - isMultilineFocused = true + if style == .singleLine { + isFocused = true + } else if style == .multiLine { + isMultilineFocused = true + } + } else { + if style == .singleLine { + isFocused = true + } else if style == .multiLine { + isMultilineFocused = true + } } } }