Bubble/Threaded/Views/Settings/AboutView.swift

64 lines
2.0 KiB
Swift
Raw Normal View History

2023-12-30 20:57:41 +01:00
//Made by Lumaa
import SwiftUI
struct AboutView: View {
@ObservedObject private var userPreferences: UserPreferences = .defaultPreferences
2024-02-20 20:57:07 +01:00
@EnvironmentObject private var navigator: Navigator
2023-12-30 20:57:41 +01:00
var body: some View {
List {
2024-01-27 08:56:54 +01:00
Section(footer: Text("about.version-\(AppInfo.appVersion)")) {
2024-01-06 03:38:54 +01:00
NavigationLink {
aboutApp
} label: {
Text("about.app")
}
.listRowThreaded()
2024-01-06 03:38:54 +01:00
Toggle("setting.experimental.activate", isOn: $userPreferences.showExperimental)
.listRowThreaded()
.tint(Color(uiColor: UIColor.label))
.onAppear {
do {
let oldPreferences = try UserPreferences.loadAsCurrent() ?? UserPreferences.defaultPreferences
userPreferences.showExperimental = oldPreferences.showExperimental
} catch {
print(error)
}
}
2024-01-06 03:38:54 +01:00
}
}
2024-01-06 03:40:24 +01:00
.listThreaded()
.navigationTitle("about")
.navigationBarTitleDisplayMode(.inline)
.onDisappear {
do {
if !userPreferences.showExperimental {
userPreferences.experimental = .init()
}
try userPreferences.saveAsCurrent()
} catch {
print(error)
}
}
}
var aboutApp: some View {
2024-01-10 17:46:19 +01:00
// TODO: Change this entire ugly thing
2024-02-18 12:47:57 +01:00
List {
Text("about.app.details")
.multilineTextAlignment(.leading)
.listRowThreaded()
Text("about.app.third-party")
.multilineTextAlignment(.leading)
.listRowThreaded()
}
2024-02-18 12:47:57 +01:00
.padding(.horizontal)
2024-01-06 03:40:24 +01:00
.listThreaded(tint: Color.blue)
.navigationTitle("about.app")
.navigationBarTitleDisplayMode(.large)
2023-12-30 20:57:41 +01:00
}
}