2023-12-30 20:57:41 +01:00
|
|
|
//Made by Lumaa
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct AboutView: View {
|
2024-01-04 22:19:35 +01:00
|
|
|
@ObservedObject private var userPreferences: UserPreferences = .defaultPreferences
|
2024-02-20 20:57:07 +01:00
|
|
|
@EnvironmentObject private var navigator: Navigator
|
2024-01-04 22:19:35 +01:00
|
|
|
|
2023-12-30 20:57:41 +01:00
|
|
|
var body: some View {
|
2023-12-30 20:59:09 +01:00
|
|
|
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")
|
|
|
|
}
|
2024-01-04 22:19:35 +01:00
|
|
|
.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-04 22:19:35 +01:00
|
|
|
}
|
2024-01-06 03:38:54 +01:00
|
|
|
}
|
2023-12-30 20:59:09 +01:00
|
|
|
}
|
2024-01-06 03:40:24 +01:00
|
|
|
.listThreaded()
|
2023-12-30 20:59:09 +01:00
|
|
|
.navigationTitle("about")
|
|
|
|
.navigationBarTitleDisplayMode(.inline)
|
2024-01-04 22:19:35 +01:00
|
|
|
.onDisappear {
|
|
|
|
do {
|
|
|
|
if !userPreferences.showExperimental {
|
|
|
|
userPreferences.experimental = .init()
|
|
|
|
}
|
|
|
|
try userPreferences.saveAsCurrent()
|
|
|
|
} catch {
|
|
|
|
print(error)
|
|
|
|
}
|
|
|
|
}
|
2023-12-30 20:59:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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()
|
2023-12-30 20:59:09 +01:00
|
|
|
}
|
2024-02-18 12:47:57 +01:00
|
|
|
.padding(.horizontal)
|
2024-01-06 03:40:24 +01:00
|
|
|
.listThreaded(tint: Color.blue)
|
2023-12-30 20:59:09 +01:00
|
|
|
.navigationTitle("about.app")
|
|
|
|
.navigationBarTitleDisplayMode(.large)
|
2023-12-30 20:57:41 +01:00
|
|
|
}
|
|
|
|
}
|