From ade7d7f44fdd61bb577e5c13e58d1b7c0e9db9f9 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Mon, 31 Jul 2023 10:52:57 +0800 Subject: [PATCH] ios: Improve the modal when setting self hosting data --- .../Sources/App/Views/SelfHostSettingsView.swift | 6 ++++++ apple/OmnivoreKit/Sources/Models/AppEnvironment.swift | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/SelfHostSettingsView.swift b/apple/OmnivoreKit/Sources/App/Views/SelfHostSettingsView.swift index 06d7eea87..372dbed51 100644 --- a/apple/OmnivoreKit/Sources/App/Views/SelfHostSettingsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/SelfHostSettingsView.swift @@ -39,16 +39,22 @@ Section("API Server Base URL") { TextField("URL", text: $apiServerAddress, prompt: Text("https://api-prod.omnivore.app")) .keyboardType(.URL) + .autocorrectionDisabled(true) + .textInputAutocapitalization(.never) } Section("Web Server URL") { TextField("URL", text: $webServerAddress, prompt: Text("https://omnivore.app")) .keyboardType(.URL) + .autocorrectionDisabled(true) + .textInputAutocapitalization(.never) } Section("Text-to-speech Server URL") { TextField("URL", text: $ttsServerAddress, prompt: Text("https://tts.omnivore.app")) .keyboardType(.URL) + .autocorrectionDisabled(true) + .textInputAutocapitalization(.never) } Section { diff --git a/apple/OmnivoreKit/Sources/Models/AppEnvironment.swift b/apple/OmnivoreKit/Sources/Models/AppEnvironment.swift index d29e3d8a8..1bf4affc3 100644 --- a/apple/OmnivoreKit/Sources/Models/AppEnvironment.swift +++ b/apple/OmnivoreKit/Sources/Models/AppEnvironment.swift @@ -40,9 +40,9 @@ private enum AppEnvironmentUserDefaultKey: String { public extension AppEnvironment { static func setCustom(serverBaseURL: String, webAppBaseURL: String, ttsBaseURL: String) { - UserDefaults.standard.set(serverBaseURL, forKey: AppEnvironmentUserDefaultKey.serverBaseURL.rawValue) - UserDefaults.standard.set(webAppBaseURL, forKey: AppEnvironmentUserDefaultKey.webAppBaseURL.rawValue) - UserDefaults.standard.set(ttsBaseURL, forKey: AppEnvironmentUserDefaultKey.ttsBaseURL.rawValue) + UserDefaults.standard.set(serverBaseURL.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines), forKey: AppEnvironmentUserDefaultKey.serverBaseURL.rawValue) + UserDefaults.standard.set(webAppBaseURL.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines), forKey: AppEnvironmentUserDefaultKey.webAppBaseURL.rawValue) + UserDefaults.standard.set(ttsBaseURL.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines), forKey: AppEnvironmentUserDefaultKey.ttsBaseURL.rawValue) } var graphqlPath: String {