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
|
|
|
|
|
2023-12-30 20:57:41 +01:00
|
|
|
var body: some View {
|
2023-12-30 20:59:09 +01:00
|
|
|
List {
|
2024-01-21 13:16:37 +01:00
|
|
|
Section(footer: Text("about.version-\(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown")")) {
|
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
|
2023-12-30 20:59:09 +01:00
|
|
|
ScrollView {
|
|
|
|
VStack (spacing: 15) {
|
|
|
|
Text("about.app.details")
|
|
|
|
.multilineTextAlignment(.leading)
|
|
|
|
Text("about.app.third-party")
|
|
|
|
.multilineTextAlignment(.leading)
|
|
|
|
}
|
|
|
|
.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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#Preview {
|
|
|
|
AboutView()
|
|
|
|
}
|