diff --git a/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift b/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift index 529ab91c..039f65c8 100644 --- a/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift +++ b/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift @@ -203,6 +203,11 @@ struct DisplaySettingsView: View { Text(buttonStyle.description).tag(buttonStyle) } } + Picker("settings.display.status.action-secondary", selection: $theme.statusActionSecondary) { + ForEach(Theme.StatusActionSecondary.allCases, id: \.rawValue) { action in + Text(action.description).tag(action) + } + } Picker("settings.display.status.media-style", selection: $theme.statusDisplayStyle) { ForEach(Theme.StatusDisplayStyle.allCases, id: \.rawValue) { buttonStyle in Text(buttonStyle.description).tag(buttonStyle) diff --git a/IceCubesApp/Resources/Localization/Localizable.xcstrings b/IceCubesApp/Resources/Localization/Localizable.xcstrings index 97fabe8c..06d50691 100644 --- a/IceCubesApp/Resources/Localization/Localizable.xcstrings +++ b/IceCubesApp/Resources/Localization/Localizable.xcstrings @@ -44735,6 +44735,124 @@ } } }, + "settings.display.status.action-secondary" : { + "localizations" : { + "be" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "ca" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "de" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Secondary status action" + } + }, + "en-GB" : { + "stringUnit" : { + "state" : "translated", + "value" : "Secondary status action" + } + }, + "es" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "eu" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "fr" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "it" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "ja" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "ko" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "nb" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "nl" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "pl" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "pt-BR" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "tr" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "uk" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Secondary status action" + } + } + } + }, "settings.display.status.media-style" : { "localizations" : { "be" : { diff --git a/Packages/DesignSystem/Sources/DesignSystem/Theme.swift b/Packages/DesignSystem/Sources/DesignSystem/Theme.swift index af23162a..8e433792 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/Theme.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/Theme.swift @@ -10,6 +10,7 @@ import SwiftUI case followSystemColorSchme case displayFullUsernameTimeline case lineSpacing + case statusActionSecondary } @AppStorage("is_previously_set") public var isThemePreviouslySet: Bool = false @@ -26,6 +27,7 @@ import SwiftUI @AppStorage(ThemeKey.followSystemColorSchme.rawValue) public var followSystemColorScheme: Bool = true @AppStorage(ThemeKey.displayFullUsernameTimeline.rawValue) public var displayFullUsername: Bool = false @AppStorage(ThemeKey.lineSpacing.rawValue) public var lineSpacing: Double = 1.2 + @AppStorage(ThemeKey.statusActionSecondary.rawValue) public var statusActionSecondary: StatusActionSecondary = .share @AppStorage("font_size_scale") public var fontSizeScale: Double = 1 @AppStorage("chosen_font") public var chosenFontData: Data? @@ -67,6 +69,19 @@ import SwiftUI } } } + + public enum StatusActionSecondary: String, CaseIterable { + case share, bookmark + + public var description: LocalizedStringKey { + switch self { + case .share: + "status.action.share-title" + case .bookmark: + "status.action.bookmark" + } + } + } public enum AvatarShape: String, CaseIterable { case circle, rounded @@ -202,6 +217,12 @@ import SwiftUI themeStorage.statusDisplayStyle = statusDisplayStyle } } + + public var statusActionSecondary: StatusActionSecondary { + didSet { + themeStorage.statusActionSecondary = statusActionSecondary + } + } public var followSystemColorScheme: Bool { didSet { @@ -254,6 +275,7 @@ import SwiftUI lineSpacing = themeStorage.lineSpacing fontSizeScale = themeStorage.fontSizeScale chosenFontData = themeStorage.chosenFontData + statusActionSecondary = themeStorage.statusActionSecondary selectedSet = storedSet } diff --git a/Packages/Status/Sources/Status/Row/Subviews/StatusRowActionsView.swift b/Packages/Status/Sources/Status/Row/Subviews/StatusRowActionsView.swift index 789b4ffd..c8b8963e 100644 --- a/Packages/Status/Sources/Status/Row/Subviews/StatusRowActionsView.swift +++ b/Packages/Status/Sources/Status/Row/Subviews/StatusRowActionsView.swift @@ -21,21 +21,20 @@ struct StatusRowActionsView: View { func privateBoost() -> Bool { viewModel.status.visibility == .priv && viewModel.status.account.id == currentAccount.account?.id } + + var actions: [Action] { + switch theme.statusActionSecondary { + case .share: + return [.respond, .boost, .favorite, .share, .menu] + case .bookmark: + return [.respond, .boost, .favorite, .bookmark, .menu] + } + } @MainActor - enum Action: CaseIterable { + enum Action { case respond, boost, favorite, bookmark, share, menu - // Have to implement this manually here due to compiler not implicitly - // inserting `nonisolated`, which leads to a warning: - // - // Main actor-isolated static property 'allCases' cannot be used to - // satisfy nonisolated protocol requirement - // - public nonisolated static var allCases: [StatusRowActionsView.Action] { - [.respond, .boost, .favorite, .share, .menu] - } - func image(dataController: StatusDataController, privateBoost: Bool = false) -> Image { switch self { case .respond: @@ -128,7 +127,7 @@ struct StatusRowActionsView: View { var body: some View { VStack(spacing: 12) { HStack { - ForEach(Action.allCases, id: \.self) { action in + ForEach(actions, id: \.self) { action in if action == .share { if let urlString = viewModel.finalStatus.url, let url = URL(string: urlString)