71 lines
1.5 KiB
Swift
71 lines
1.5 KiB
Swift
//
|
|
// SettingsView.swift
|
|
// Jel
|
|
//
|
|
// Created by zerocool on 12/13/23.
|
|
//
|
|
|
|
import SwiftUI
|
|
import PulseUI
|
|
|
|
struct SettingsView: View {
|
|
@Binding var showingSettingsView: Bool
|
|
|
|
@StateObject var authState: AuthStateController = AuthStateController.shared
|
|
|
|
@ObservedObject var settingsController: SettingsController = SettingsController.shared
|
|
var body: some View {
|
|
NavigationStack {
|
|
Form {
|
|
Section() {
|
|
AppearancePicker()
|
|
} header: {
|
|
Text("Accessibility")
|
|
}
|
|
|
|
Section {
|
|
NavigationLink {
|
|
ConsoleView()
|
|
.closeButtonHidden()
|
|
} label: {
|
|
Text("Logs")
|
|
}
|
|
|
|
Button(role: .destructive) {
|
|
authState.loggedIn = false
|
|
authState.save()
|
|
} label: {
|
|
Text("Sign out")
|
|
}
|
|
}
|
|
}
|
|
.navigationTitle("Settings")
|
|
.toolbar {
|
|
ToolbarItem {
|
|
Button {
|
|
showingSettingsView.toggle()
|
|
settingsController.save()
|
|
} label: {
|
|
Text("Done")
|
|
.bold()
|
|
}
|
|
}
|
|
}
|
|
.preferredColorScheme({
|
|
switch settingsController.appearance {
|
|
case .dark:
|
|
return ColorScheme.dark
|
|
case .light:
|
|
return ColorScheme.light
|
|
case .automatic:
|
|
return .none
|
|
}
|
|
}())
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
SettingsView(showingSettingsView: .constant(true))
|
|
}
|