ios_app_v2/yobble/Services/ThemeOption.swift
2025-10-07 00:28:48 +03:00

75 lines
1.6 KiB
Swift

import Foundation
enum ThemeOption: String, CaseIterable, Identifiable {
case system
case oledDark
case lightTest
case dark
case custom
var id: String { rawValue }
var title: String {
switch self {
case .system:
return "Системная"
case .oledDark:
return "OLEG тёмный"
case .dark:
return "Тёмная"
case .lightTest:
return "Светлая"
case .custom:
return "Кастомная"
}
}
var note: String? {
switch self {
case .lightTest:
return "Тестовая версия"
case .dark, .custom:
return "Недоступна"
default:
return nil
}
}
var isEnabled: Bool {
switch self {
case .dark, .custom:
return false
default:
return true
}
}
var mappedTheme: Theme? {
switch self {
case .system:
return .system
case .oledDark:
return .oledDark
case .lightTest:
return .light
case .dark, .custom:
return nil
}
}
static var ordered: [ThemeOption] {
[.system, .oledDark, .lightTest, .dark, .custom]
}
static func option(for theme: Theme) -> ThemeOption {
switch theme {
case .system:
return .system
case .light:
return .lightTest
case .oledDark:
return .oledDark
}
}
}