2023-06-28 18:46:54 +02:00
|
|
|
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
|
|
|
|
|
|
|
|
import UIKit
|
2023-06-29 22:49:35 +02:00
|
|
|
import MastodonLocalization
|
2023-06-28 18:46:54 +02:00
|
|
|
|
|
|
|
struct GeneralSettingsSection: Hashable {
|
|
|
|
let type: GeneralSettingsSectionType
|
|
|
|
let entries: [GeneralSetting]
|
|
|
|
}
|
|
|
|
|
|
|
|
enum GeneralSettingsSectionType: Hashable {
|
|
|
|
case appearance
|
|
|
|
case design
|
|
|
|
case links
|
|
|
|
|
|
|
|
var sectionTitle: String {
|
|
|
|
switch self {
|
|
|
|
case .appearance:
|
2023-06-29 22:49:35 +02:00
|
|
|
return L10n.Scene.Settings.General.Appearance.sectionTitle
|
2023-06-28 18:46:54 +02:00
|
|
|
case .design:
|
2023-06-29 22:49:35 +02:00
|
|
|
return L10n.Scene.Settings.General.Design.sectionTitle
|
2023-06-28 18:46:54 +02:00
|
|
|
case .links:
|
2023-06-29 22:49:35 +02:00
|
|
|
return L10n.Scene.Settings.General.Links.sectionTitle
|
2023-06-28 18:46:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enum GeneralSetting: Hashable {
|
|
|
|
|
|
|
|
case appearance(Appearance)
|
|
|
|
case design(Design)
|
|
|
|
case openLinksIn(OpenLinksIn)
|
|
|
|
|
|
|
|
enum Appearance: Int, CaseIterable {
|
|
|
|
case light = 1
|
|
|
|
case dark = 2
|
|
|
|
case system = 0
|
|
|
|
|
|
|
|
var title: String {
|
|
|
|
switch self {
|
|
|
|
case .light:
|
2023-06-29 22:49:35 +02:00
|
|
|
return L10n.Scene.Settings.General.Appearance.light
|
2023-06-28 18:46:54 +02:00
|
|
|
case .dark:
|
2023-06-29 22:49:35 +02:00
|
|
|
return L10n.Scene.Settings.General.Appearance.dark
|
2023-06-28 18:46:54 +02:00
|
|
|
case .system:
|
2023-06-29 22:49:35 +02:00
|
|
|
return L10n.Scene.Settings.General.Appearance.system
|
2023-06-28 18:46:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var interfaceStyle: UIUserInterfaceStyle {
|
|
|
|
.init(rawValue: rawValue) ?? .unspecified
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Design: Hashable {
|
|
|
|
case showAnimations
|
|
|
|
|
|
|
|
var title: String {
|
|
|
|
switch self {
|
|
|
|
case .showAnimations:
|
2023-06-29 22:49:35 +02:00
|
|
|
return L10n.Scene.Settings.General.Design.showAnimations
|
2023-06-28 18:46:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enum OpenLinksIn: Hashable, CaseIterable {
|
|
|
|
case mastodon
|
|
|
|
case browser
|
|
|
|
|
|
|
|
var title: String {
|
|
|
|
switch self {
|
|
|
|
case .mastodon:
|
2023-06-29 22:49:35 +02:00
|
|
|
return L10n.Scene.Settings.General.Links.openInMastodon
|
2023-06-28 18:46:54 +02:00
|
|
|
case .browser:
|
2023-06-29 22:49:35 +02:00
|
|
|
return L10n.Scene.Settings.General.Links.openInBrowser
|
2023-06-28 18:46:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|