2021-04-26 10:57:50 +02:00
|
|
|
//
|
|
|
|
// SettingsItem.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by MainasuK Cirno on 2021-4-25.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import CoreData
|
|
|
|
|
|
|
|
enum SettingsItem: Hashable {
|
2021-06-22 14:52:30 +02:00
|
|
|
case appearance(settingObjectID: NSManagedObjectID)
|
2021-04-26 10:57:50 +02:00
|
|
|
case notification(settingObjectID: NSManagedObjectID, switchMode: NotificationSwitchMode)
|
2021-07-15 14:48:26 +02:00
|
|
|
case preferenceDarkMode(settingObjectID: NSManagedObjectID)
|
|
|
|
case preferenceDisableAvatarAnimation(settingObjectID: NSManagedObjectID)
|
2021-07-08 09:56:52 +02:00
|
|
|
case preferenceUsingDefaultBrowser(settingObjectID: NSManagedObjectID)
|
2021-04-26 10:57:50 +02:00
|
|
|
case boringZone(item: Link)
|
|
|
|
case spicyZone(item: Link)
|
|
|
|
}
|
|
|
|
|
|
|
|
extension SettingsItem {
|
|
|
|
|
|
|
|
enum AppearanceMode: String {
|
|
|
|
case automatic
|
|
|
|
case light
|
|
|
|
case dark
|
|
|
|
}
|
|
|
|
|
|
|
|
enum NotificationSwitchMode: CaseIterable {
|
|
|
|
case favorite
|
|
|
|
case follow
|
|
|
|
case reblog
|
|
|
|
case mention
|
|
|
|
|
|
|
|
var title: String {
|
|
|
|
switch self {
|
|
|
|
case .favorite: return L10n.Scene.Settings.Section.Notifications.favorites
|
|
|
|
case .follow: return L10n.Scene.Settings.Section.Notifications.follows
|
|
|
|
case .reblog: return L10n.Scene.Settings.Section.Notifications.boosts
|
|
|
|
case .mention: return L10n.Scene.Settings.Section.Notifications.mentions
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Link: CaseIterable {
|
2021-07-13 11:39:38 +02:00
|
|
|
case accountSettings
|
2021-04-26 10:57:50 +02:00
|
|
|
case termsOfService
|
|
|
|
case privacyPolicy
|
|
|
|
case clearMediaCache
|
|
|
|
case signOut
|
|
|
|
|
|
|
|
var title: String {
|
|
|
|
switch self {
|
2021-07-15 15:04:31 +02:00
|
|
|
case .accountSettings: return L10n.Scene.Settings.Section.BoringZone.accountSettings
|
|
|
|
case .termsOfService: return L10n.Scene.Settings.Section.BoringZone.terms
|
|
|
|
case .privacyPolicy: return L10n.Scene.Settings.Section.BoringZone.privacy
|
|
|
|
case .clearMediaCache: return L10n.Scene.Settings.Section.SpicyZone.clear
|
|
|
|
case .signOut: return L10n.Scene.Settings.Section.SpicyZone.signout
|
2021-04-26 10:57:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var textColor: UIColor {
|
|
|
|
switch self {
|
2021-07-13 11:39:38 +02:00
|
|
|
case .accountSettings: return Asset.Colors.brandBlue.color
|
2021-06-22 14:52:30 +02:00
|
|
|
case .termsOfService: return Asset.Colors.brandBlue.color
|
|
|
|
case .privacyPolicy: return Asset.Colors.brandBlue.color
|
2021-04-26 10:57:50 +02:00
|
|
|
case .clearMediaCache: return .systemRed
|
|
|
|
case .signOut: return .systemRed
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|