mastodon-ios/Mastodon/Scene/Settings/About Mastodon/AboutSettings.swift

39 lines
1.1 KiB
Swift
Raw Normal View History

// Copyright © 2023 Mastodon gGmbH. All rights reserved.
import Foundation
import MastodonCore
import MastodonLocalization
struct AboutSettingsSection: Hashable {
let entries: [AboutSettingsEntry]
}
enum AboutSettingsEntry: Hashable {
case evenMoreSettings
case contributeToMastodon
case privacyPolicy
case clearMediaCache(Int)
var text: String {
switch self {
case .evenMoreSettings:
return L10n.Scene.Settings.AboutMastodon.moreSettings
case .contributeToMastodon:
return L10n.Scene.Settings.AboutMastodon.contributeToMastodon
case .privacyPolicy:
return L10n.Scene.Settings.AboutMastodon.privacyPolicy
case .clearMediaCache(_):
2023-10-09 14:40:15 +02:00
return L10n.Scene.Settings.AboutMastodon.clearMediaStorage
}
}
var secondaryText: String? {
switch self {
case .evenMoreSettings, .contributeToMastodon, .privacyPolicy:
return nil
case .clearMediaCache(let mediaStorage):
return AppContext.byteCountFormatter.string(fromByteCount: Int64(mediaStorage))
}
}
}