commit eeaa7d15015c74f63cd0fe0faf3ab030a43b6222
parent dce12946624fd3c3e7d41785497efe032febc1a8
Author: Michael Camilleri <[email protected]>
Date: Thu, 7 May 2026 16:15:59 +0900
Add external sources section to Settings
Diffstat:
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/Crossmate/Views/SettingsView.swift b/Crossmate/Views/SettingsView.swift
@@ -8,16 +8,30 @@ struct SettingsView: View {
@State private var showingNYTLogin = false
@State private var showResetConfirmation = false
+ @State private var externalSource: ExternalSource?
var body: some View {
@Bindable var preferences = preferences
NavigationStack {
Form {
- Section("NYT Account") {
- if nytAuth.isSignedIn {
- signedInView
- } else {
- signInView
+ Section("External Source") {
+ Picker("Publisher", selection: $externalSource) {
+ Text("None").tag(nil as ExternalSource?)
+ ForEach(ExternalSource.allCases) { source in
+ Text(source.title).tag(source as ExternalSource?)
+ }
+ }
+ .pickerStyle(.menu)
+
+ switch externalSource {
+ case nil:
+ EmptyView()
+ case .newYorkTimes:
+ if nytAuth.isSignedIn {
+ signedInView
+ } else {
+ signInView
+ }
}
}
@@ -76,6 +90,18 @@ struct SettingsView: View {
// MARK: - Subviews
+ private enum ExternalSource: String, CaseIterable, Identifiable {
+ case newYorkTimes
+
+ var id: String { rawValue }
+
+ var title: String {
+ switch self {
+ case .newYorkTimes: "New York Times"
+ }
+ }
+ }
+
@ViewBuilder
private var signedInView: some View {
if let email = nytAuth.signedInEmail {