From 3ef056b4c6194e85a874de6575a3f82ce23a7f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bj=C3=B6rkert?= Date: Tue, 8 Jul 2025 11:45:34 +0200 Subject: [PATCH 1/2] Fix Nightscout token autofill by adding textContentType --- LoopFollow/Helpers/Views/TogglableSecureInput.swift | 9 +++++++-- LoopFollow/Nightscout/NightscoutSettingsView.swift | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/LoopFollow/Helpers/Views/TogglableSecureInput.swift b/LoopFollow/Helpers/Views/TogglableSecureInput.swift index 10c37a9f9..9881c59be 100644 --- a/LoopFollow/Helpers/Views/TogglableSecureInput.swift +++ b/LoopFollow/Helpers/Views/TogglableSecureInput.swift @@ -10,6 +10,7 @@ struct TogglableSecureInput: View { let placeholder: String @Binding var text: String let style: Style + var textContentType: UITextContentType? = nil @State private var isVisible = false @FocusState private var isFocused: Bool @@ -20,9 +21,13 @@ struct TogglableSecureInput: View { switch style { case .singleLine: if isVisible { - TextField(placeholder, text: $text).multilineTextAlignment(.trailing) + TextField(placeholder, text: $text) + .multilineTextAlignment(.trailing) + .textContentType(textContentType) } else { - SecureField(placeholder, text: $text).multilineTextAlignment(.trailing) + SecureField(placeholder, text: $text) + .multilineTextAlignment(.trailing) + .textContentType(textContentType) } case .multiLine: diff --git a/LoopFollow/Nightscout/NightscoutSettingsView.swift b/LoopFollow/Nightscout/NightscoutSettingsView.swift index a968a9f3a..60c32a0ea 100644 --- a/LoopFollow/Nightscout/NightscoutSettingsView.swift +++ b/LoopFollow/Nightscout/NightscoutSettingsView.swift @@ -43,7 +43,8 @@ struct NightscoutSettingsView: View { TogglableSecureInput( placeholder: "Enter Token", text: $viewModel.nightscoutToken, - style: .singleLine + style: .singleLine, + textContentType: .password ) } } From aa9252e9b68de4d1aeaa76c7df86a02afcf60087 Mon Sep 17 00:00:00 2001 From: marionbarker Date: Tue, 8 Jul 2025 15:46:25 -0700 Subject: [PATCH 2/2] modify textContentType for URL --- LoopFollow/Nightscout/NightscoutSettingsView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LoopFollow/Nightscout/NightscoutSettingsView.swift b/LoopFollow/Nightscout/NightscoutSettingsView.swift index 60c32a0ea..3780702cf 100644 --- a/LoopFollow/Nightscout/NightscoutSettingsView.swift +++ b/LoopFollow/Nightscout/NightscoutSettingsView.swift @@ -27,7 +27,7 @@ struct NightscoutSettingsView: View { private var urlSection: some View { Section(header: Text("URL")) { TextField("Enter URL", text: $viewModel.nightscoutURL) - .textContentType(.URL) + .textContentType(.username) .autocapitalization(.none) .disableAutocorrection(true) .onChange(of: viewModel.nightscoutURL) { newValue in