From 1fb196d2e3ac0f997a8482072cf260d806dcf121 Mon Sep 17 00:00:00 2001 From: Jamil Date: Mon, 14 Aug 2023 00:12:56 -0500 Subject: [PATCH] Fix SettingsView for iOS (#1897) Just a quick fix to get the buttons working for iOS so we can test the packet tunnel. Could still be improved. --- .../FirezoneKit/Features/SettingsView.swift | 58 +++++++++++-------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/SettingsView.swift b/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/SettingsView.swift index 7ae2c532f..8e0a81257 100644 --- a/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/SettingsView.swift +++ b/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/SettingsView.swift @@ -60,8 +60,20 @@ public struct SettingsView: View { #if os(iOS) private var ios: some View { - NavigationView { - form + NavigationView() { + VStack() { + form + HStack(spacing: 30) { + Button("Cancel", action: { + self.cancelButtonTapped() + }) + Button("Save", action: { + self.saveButtonTapped() + }) + .disabled(!isTeamIdValid(model.settings.teamId)) + } + Spacer() + } } } #endif @@ -87,7 +99,7 @@ public struct SettingsView: View { Form { Section { FormTextField( - title: "Team URL:", + title: "Team ID:", baseURLString: AuthStore.getAuthBaseURLFromInfoPlist().absoluteString, placeholder: "team-id", text: Binding( @@ -97,7 +109,7 @@ public struct SettingsView: View { ) } } - .navigationTitle("Settings - Firezone") + .navigationTitle("Settings") .toolbar { ToolbarItem(placement: .primaryAction) { } @@ -127,33 +139,31 @@ struct FormTextField: View { var body: some View { #if os(iOS) - HStack { + HStack(spacing: 15) { Text(title) Spacer() - TextField(placeholder, text: text) - .autocorrectionDisabled() - .multilineTextAlignment(.trailing) - .foregroundColor(.secondary) - .frame(maxWidth: .infinity) - .textInputAutocapitalization(.never) - .textContentType(.URL) - .keyboardType(.URL) - } - #else - HStack(spacing: 30) { - Spacer() - VStack(alignment: .leading) { - Label(title, image: "") - .labelStyle(.titleOnly) - .multilineTextAlignment(.leading) TextField(baseURLString, text: text, prompt: Text(placeholder)) .autocorrectionDisabled() .multilineTextAlignment(.leading) .foregroundColor(.secondary) - .frame(maxWidth: 360) + .frame(maxWidth: .infinity) + .textInputAutocapitalization(.never) + } + #else + HStack(spacing: 30) { + Spacer() + VStack(alignment: .leading) { + Label(title, image: "") + .labelStyle(.titleOnly) + .multilineTextAlignment(.leading) + TextField(baseURLString, text: text, prompt: Text(placeholder)) + .autocorrectionDisabled() + .multilineTextAlignment(.leading) + .foregroundColor(.secondary) + .frame(maxWidth: 360) + } + Spacer() } - Spacer() - } #endif } }