diff --git a/Co-Badged Cards/SwiftUI/Co-Badged Cards Example/Assets/Localizable.xcstrings b/Co-Badged Cards/SwiftUI/Co-Badged Cards Example/Assets/Localizable.xcstrings index 722a547..5aaae76 100644 --- a/Co-Badged Cards/SwiftUI/Co-Badged Cards Example/Assets/Localizable.xcstrings +++ b/Co-Badged Cards/SwiftUI/Co-Badged Cards Example/Assets/Localizable.xcstrings @@ -1,6 +1,9 @@ { "sourceLanguage" : "en", "strings" : { + "" : { + + }, "App.Title" : { "localizations" : { "en" : { @@ -92,16 +95,6 @@ } } }, - "Settings.ClientTokenUrl.Placeholder" : { - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Client Token URL" - } - } - } - }, "Start.Button.MakePayment" : { "localizations" : { "en" : { diff --git a/Co-Badged Cards/SwiftUI/Co-Badged Cards Example/ExampleApp.swift b/Co-Badged Cards/SwiftUI/Co-Badged Cards Example/ExampleApp.swift index 86821fb..4cb1949 100644 --- a/Co-Badged Cards/SwiftUI/Co-Badged Cards Example/ExampleApp.swift +++ b/Co-Badged Cards/SwiftUI/Co-Badged Cards Example/ExampleApp.swift @@ -16,7 +16,7 @@ struct ExampleApp: App { static var clientToken = "" // 👇 You can point to a server that provides the client token here - static var clientTokenUrl = "https://localhost:3000" + static var clientTokenUrl = "" let service = PrimerDataService(clientToken: Self.clientToken) @@ -35,4 +35,5 @@ struct ExampleApp: App { } } } + } diff --git a/Co-Badged Cards/SwiftUI/Co-Badged Cards Example/Views/Pages/SettingsView.swift b/Co-Badged Cards/SwiftUI/Co-Badged Cards Example/Views/Pages/SettingsView.swift index f4ac9de..4a38a40 100644 --- a/Co-Badged Cards/SwiftUI/Co-Badged Cards Example/Views/Pages/SettingsView.swift +++ b/Co-Badged Cards/SwiftUI/Co-Badged Cards Example/Views/Pages/SettingsView.swift @@ -14,7 +14,7 @@ struct SettingsView: View { @StateObject var settingsModel: SettingsModel @State var isFetchingClientToken: Bool = false - + var body: some View { Group { Section { @@ -31,7 +31,11 @@ struct SettingsView: View { } Section { - TextField(LocalizedStringKey("Settings.ClientTokenUrl.Placeholder"), text: $settingsModel.clientTokenUrl) + TextField( + "", + text: $settingsModel.clientTokenUrl, + prompt: Text(verbatim: "https://my.glitch.server") + ) .keyboardType(.URL) .textInputAutocapitalization(.never) Button { @@ -59,8 +63,15 @@ struct SettingsView: View { } } } + .onAppear(perform: onAppear) } - + + private func onAppear() { + if let _ = URL(string: settingsModel.clientTokenUrl) { + onFetchClientToken() + } + } + private func onFetchClientToken() { Task { settingsModel.fetchErrorMessage = nil