From af61ff7914e07a886785ab3e9b2659975eaeca57 Mon Sep 17 00:00:00 2001 From: Chanhwi Joo <56245920+te6-in@users.noreply.github.com> Date: Tue, 14 Feb 2023 15:01:55 +0900 Subject: [PATCH] Improve swipe actions (#825) * Remove icons from settings * Add new toggle for using the theme tint * Localizations * Add icon style picker * Localizations --------- Co-authored-by: Thomas Ricouard --- .../Settings/SwipeActionsSettingsView.swift | 24 +++++++++++------ .../Localization/ca.lproj/Localizable.strings | 4 +++ .../Localization/de.lproj/Localizable.strings | 4 +++ .../en-GB.lproj/Localizable.strings | 4 +++ .../Localization/en.lproj/Localizable.strings | 4 +++ .../Localization/es.lproj/Localizable.strings | 4 +++ .../Localization/eu.lproj/Localizable.strings | 8 ++++-- .../Localization/fr.lproj/Localizable.strings | 4 +++ .../Localization/it.lproj/Localizable.strings | 4 +++ .../Localization/ja.lproj/Localizable.strings | 4 +++ .../Localization/ko.lproj/Localizable.strings | 6 ++++- .../Localization/nb.lproj/Localizable.strings | 4 +++ .../Localization/nl.lproj/Localizable.strings | 4 +++ .../Localization/pl.lproj/Localizable.strings | 4 +++ .../pt-BR.lproj/Localizable.strings | 4 +++ .../Localization/tr.lproj/Localizable.strings | 4 +++ .../zh-Hans.lproj/Localizable.strings | 4 +++ Packages/Env/Sources/Env/StatusAction.swift | 10 ++++--- .../Env/Sources/Env/UserPreferences.swift | 15 +++++++++++ .../Sources/Status/Row/StatusRowView.swift | 26 ++++++++++++++----- 20 files changed, 124 insertions(+), 21 deletions(-) diff --git a/IceCubesApp/App/Tabs/Settings/SwipeActionsSettingsView.swift b/IceCubesApp/App/Tabs/Settings/SwipeActionsSettingsView.swift index ce9e97f9..e6895e6c 100644 --- a/IceCubesApp/App/Tabs/Settings/SwipeActionsSettingsView.swift +++ b/IceCubesApp/App/Tabs/Settings/SwipeActionsSettingsView.swift @@ -12,24 +12,24 @@ struct SwipeActionsSettingsView: View { Label("settings.swipeactions.status.leading", systemImage: "arrow.right.circle") Picker(selection: $userPreferences.swipeActionsStatusLeadingLeft, label: makeSwipeLabel(left: true, text: "settings.swipeactions.status.leading.left")) { Section { - Label(StatusAction.none.displayName(), systemImage: StatusAction.none.iconName()).tag(StatusAction.none) + Text(StatusAction.none.displayName()).tag(StatusAction.none) } Section { ForEach(StatusAction.allCases) { action in if action != .none { - Label(action.displayName(), systemImage: action.iconName()).tag(action) + Text(action.displayName()).tag(action) } } } } Picker(selection: $userPreferences.swipeActionsStatusLeadingRight, label: makeSwipeLabel(left: false, text: "settings.swipeactions.status.leading.right")) { Section { - Label(StatusAction.none.displayName(), systemImage: StatusAction.none.iconName()).tag(StatusAction.none) + Text(StatusAction.none.displayName()).tag(StatusAction.none) } Section { ForEach(StatusAction.allCases) { action in if action != .none { - Label(action.displayName(), systemImage: action.iconName()).tag(action) + Text(action.displayName()).tag(action) } } } @@ -37,28 +37,36 @@ struct SwipeActionsSettingsView: View { Label("settings.swipeactions.status.trailing", systemImage: "arrow.left.circle") Picker(selection: $userPreferences.swipeActionsStatusTrailingLeft, label: makeSwipeLabel(left: true, text: "settings.swipeactions.status.trailing.left")) { Section { - Label(StatusAction.none.displayName(), systemImage: StatusAction.none.iconName()).tag(StatusAction.none) + Text(StatusAction.none.displayName()).tag(StatusAction.none) } Section { ForEach(StatusAction.allCases) { action in if action != .none { - Label(action.displayName(), systemImage: action.iconName()).tag(action) + Text(action.displayName()).tag(action) } } } } Picker(selection: $userPreferences.swipeActionsStatusTrailingRight, label: makeSwipeLabel(left: false, text: "settings.swipeactions.status.trailing.right")) { Section { - Label(StatusAction.none.displayName(), systemImage: StatusAction.none.iconName()).tag(StatusAction.none) + Text(StatusAction.none.displayName()).tag(StatusAction.none) } Section { ForEach(StatusAction.allCases) { action in if action != .none { - Label(action.displayName(), systemImage: action.iconName()).tag(action) + Text(action.displayName()).tag(action) } } } } + Toggle(isOn: $userPreferences.swipeActionsUseThemeColor) { + Label("settings.swipeactions.status.use-theme-colors", systemImage: "paintbrush.pointed") + } + Picker(selection: $userPreferences.swipeActionsIconStyle, label: Label("settings.swipeactions.status.icon-style", systemImage: "text.below.photo")) { + ForEach(UserPreferences.SwipeActionsIconStyle.allCases, id: \.rawValue) { style in + Text(style.description).tag(style) + } + } } .listRowBackground(theme.primaryBackgroundColor) } diff --git a/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings index 8b17db05..4abf3773 100644 --- a/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings @@ -36,6 +36,8 @@ "enum.status-actions-display.only-buttons" = "Només els botons"; "enum.status-display-style.compact" = "Compacte"; "enum.status-display-style.large" = "Gran"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Dominis"; @@ -177,6 +179,8 @@ "settings.swipeactions.status.trailing.left" = "left"; "settings.swipeactions.status.trailing.right" = "right"; "settings.swipeactions.status" = "Post"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; // MARK: Tabs "tab.explore" = "Exploreu"; diff --git a/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings index 04293018..1bfd579e 100644 --- a/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "Nur Buttons"; "enum.status-display-style.compact" = "Kompakt"; "enum.status-display-style.large" = "Groß"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Domains"; @@ -175,6 +177,8 @@ "settings.swipeactions.status.trailing.left" = "links"; "settings.swipeactions.status.trailing.right" = "rechts"; "settings.swipeactions.status" = "Beitrag"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; "enum.expand-media.show" = "Alle zeigen"; "enum.expand-media.hide" = "Alle ausblenden"; diff --git a/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings index dd062423..8f903a3a 100644 --- a/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "Only buttons"; "enum.status-display-style.compact" = "Compact"; "enum.status-display-style.large" = "Large"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Domains"; @@ -181,6 +183,8 @@ "settings.swipeactions.status.trailing.left" = "left"; "settings.swipeactions.status.trailing.right" = "right"; "settings.swipeactions.status" = "Post"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; // MARK: Tabs "tab.explore" = "Explore"; diff --git a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings index aae8b0ce..c5c70652 100644 --- a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "Only buttons"; "enum.status-display-style.compact" = "Compact"; "enum.status-display-style.large" = "Large"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Domains"; @@ -179,6 +181,8 @@ "settings.swipeactions.status.trailing.left" = "left"; "settings.swipeactions.status.trailing.right" = "right"; "settings.swipeactions.status" = "Post"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; // MARK: Tabs "tab.explore" = "Explore"; diff --git a/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings index 5689c8ce..6d8a36ef 100644 --- a/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "Sólo botones"; "enum.status-display-style.compact" = "Compacto"; "enum.status-display-style.large" = "Grande"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Dominios"; @@ -175,6 +177,8 @@ "settings.swipeactions.status.trailing.left" = "left"; "settings.swipeactions.status.trailing.right" = "right"; "settings.swipeactions.status" = "Post"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; "enum.expand-media.show" = "Siempre"; "enum.expand-media.hide" = "Nunca"; diff --git a/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings index b3014b75..3182cc0c 100644 --- a/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "Botoiak bakarrik"; "enum.status-display-style.compact" = "Trinkoa"; "enum.status-display-style.large" = "Handia"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Domeinuak"; @@ -175,6 +177,8 @@ "settings.swipeactions.status.trailing.left" = "ezker"; "settings.swipeactions.status.trailing.right" = "eskuma"; "settings.swipeactions.status" = "Argitaratu"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; "enum.expand-media.show" = "Erakutsi guztia"; "enum.expand-media.hide" = "Ezkutatu guztia"; @@ -241,8 +245,8 @@ "account.follow.requested" = "Eskaera eginda"; "account.follow-request.accept" = "Onartu"; "account.follow-request.reject" = "Baztertu"; -"account.follow-requests.pending-requests" = "Erabakitzeke eskaerak"; -"account.follow-requests.instructions" = "Erabiltzaile horiek ez dituzte zure bidalketak ikusiko onartzen ez dituzun arte."; +"account.follow-requests.pending-requests" = "Erabakitzeko eskaerak"; +"account.follow-requests.instructions" = "Erabiltzaile horiek ez dituzte zure bidalketak ikusiko onartzen ez dituzun arte."; "account.followers" = "Jarraitzaile"; "account.following" = "Jarraitzen"; "account.list.create" = "Sortu zerrenda berria"; diff --git a/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings index 8bb4692b..0d7c0ff4 100644 --- a/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "Seulement les boutons"; "enum.status-display-style.compact" = "Compact"; "enum.status-display-style.large" = "Grand"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Domaines"; @@ -178,6 +180,8 @@ "settings.swipeactions.status.trailing.left" = "left"; "settings.swipeactions.status.trailing.right" = "right"; "settings.swipeactions.status" = "Post"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; // MARK: Tabs "tab.explore" = "Explorer"; diff --git a/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings index 8cf9e332..fef9992a 100644 --- a/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "Solo bottoni"; "enum.status-display-style.compact" = "Compatto"; "enum.status-display-style.large" = "Completo"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Domini"; @@ -178,6 +180,8 @@ "settings.swipeactions.status.trailing.left" = "sinistra"; "settings.swipeactions.status.trailing.right" = "destra"; "settings.swipeactions.status" = "Post"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; // MARK: Tabs "tab.explore" = "Esplora"; diff --git a/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings index f867581d..b6926a92 100644 --- a/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "ボタンのみ"; "enum.status-display-style.compact" = "コンパクト"; "enum.status-display-style.large" = "ラージ"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "ドメイン"; @@ -178,6 +180,8 @@ "settings.swipeactions.status.trailing.left" = "左"; "settings.swipeactions.status.trailing.right" = "右"; "settings.swipeactions.status" = "投稿"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; // MARK: Tabs "tab.explore" = "エクスプローラー"; diff --git a/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings index 798c17b5..688938d1 100644 --- a/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "버튼만 표시"; "enum.status-display-style.compact" = "작게"; "enum.status-display-style.large" = "크게"; +"enum.swipeactions.icon-with-text" = "아이콘과 텍스트"; +"enum.swipeactions.icon-only" = "아이콘만"; // MARK: Instances "instance.info.domains" = "도메인"; @@ -177,7 +179,9 @@ "settings.swipeactions.status.trailing" = "왼쪽으로 쓸어넘길 때"; "settings.swipeactions.status.trailing.left" = "왼쪽 버튼"; "settings.swipeactions.status.trailing.right" = "오른쪽 버튼"; -"settings.swipeactions.status" = "글을"; +"settings.swipeactions.status" = "글"; +"settings.swipeactions.status.use-theme-colors" = "기본 색상 대신 테마 색상 사용"; +"settings.swipeactions.status.icon-style" = "아이콘 모양"; // MARK: Tabs "tab.explore" = "둘러보기"; diff --git a/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings index 3cb9a6d1..c556f97b 100644 --- a/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "Bare knapper"; "enum.status-display-style.compact" = "Kompakt"; "enum.status-display-style.large" = "Stor"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Domener"; @@ -178,6 +180,8 @@ "settings.swipeactions.status.trailing.left" = "left"; "settings.swipeactions.status.trailing.right" = "right"; "settings.swipeactions.status" = "Post"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; // MARK: Tabs "tab.explore" = "Utforsk"; diff --git a/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings index f47e579e..d39a3f5c 100644 --- a/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "Zonder tekst"; "enum.status-display-style.compact" = "Compact"; "enum.status-display-style.large" = "Groot"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Domeinen"; @@ -175,6 +177,8 @@ "settings.swipeactions.status.trailing.left" = "links"; "settings.swipeactions.status.trailing.right" = "rechts"; "settings.swipeactions.status" = "Post"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; // MARK: Tabs "tab.explore" = "Ontdekken"; diff --git a/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings index a70af904..fa82da50 100644 --- a/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "Tylko przyciski"; "enum.status-display-style.compact" = "Pomniejszone"; "enum.status-display-style.large" = "Duże"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Domeny"; @@ -178,6 +180,8 @@ "settings.swipeactions.status.trailing.left" = "lewa"; "settings.swipeactions.status.trailing.right" = "prawa"; "settings.swipeactions.status" = "Post"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; // MARK: Tabs "tab.explore" = "Odkrywaj"; diff --git a/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings index a34a180c..3658e4e9 100644 --- a/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "Somente botões"; "enum.status-display-style.compact" = "Compacto"; "enum.status-display-style.large" = "Largo"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Domínios"; @@ -178,6 +180,8 @@ "settings.swipeactions.status.trailing.left" = "left"; "settings.swipeactions.status.trailing.right" = "right"; "settings.swipeactions.status" = "Post"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; // MARK: Tabs "tab.explore" = "Explorar"; diff --git a/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings index 31b89961..51a59ebd 100644 --- a/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "Sadece Butonlar"; "enum.status-display-style.compact" = "Kompakt"; "enum.status-display-style.large" = "Geniş"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "Domainler"; @@ -178,6 +180,8 @@ "settings.swipeactions.status.trailing.left" = "left"; "settings.swipeactions.status.trailing.right" = "right"; "settings.swipeactions.status" = "Post"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; // MARK: Tabs "tab.explore" = "Keşfet"; diff --git a/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings index 4c83e321..eb2dd790 100644 --- a/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings @@ -37,6 +37,8 @@ "enum.status-actions-display.only-buttons" = "仅图标"; "enum.status-display-style.compact" = "紧凑"; "enum.status-display-style.large" = "宽松"; +"enum.swipeactions.icon-with-text" = "Icon with text"; +"enum.swipeactions.icon-only" = "Icon only"; // MARK: Instances "instance.info.domains" = "域名"; @@ -178,6 +180,8 @@ "settings.swipeactions.status.trailing.left" = "左"; "settings.swipeactions.status.trailing.right" = "右"; "settings.swipeactions.status" = "嘟文"; +"settings.swipeactions.status.use-theme-colors" = "Use theme colors instead of default colors"; +"settings.swipeactions.status.icon-style" = "Icon style"; // MARK: Tabs "tab.explore" = "探索"; diff --git a/Packages/Env/Sources/Env/StatusAction.swift b/Packages/Env/Sources/Env/StatusAction.swift index b277b63b..b30c2a86 100644 --- a/Packages/Env/Sources/Env/StatusAction.swift +++ b/Packages/Env/Sources/Env/StatusAction.swift @@ -41,14 +41,18 @@ public enum StatusAction: String, CaseIterable, Identifiable { } } - public func color(themeTintColor: Color) -> Color { + public func color(themeTintColor: Color, useThemeColor: Bool, outside: Bool) -> Color { + if (useThemeColor) { + return outside ? themeTintColor : .gray + } + switch self { case .none: return .gray case .reply: - return .gray + return outside ? .gray : Color(white: 0.45) case .quote: - return .gray + return outside ? .gray : Color(white: 0.45) case .boost: return themeTintColor case .favorite: diff --git a/Packages/Env/Sources/Env/UserPreferences.swift b/Packages/Env/Sources/Env/UserPreferences.swift index 2420edf0..3ac8cbd2 100644 --- a/Packages/Env/Sources/Env/UserPreferences.swift +++ b/Packages/Env/Sources/Env/UserPreferences.swift @@ -44,6 +44,21 @@ public class UserPreferences: ObservableObject { @AppStorage("swipeactions-status-trailing-left") public var swipeActionsStatusTrailingLeft = StatusAction.boost @AppStorage("swipeactions-status-leading-left") public var swipeActionsStatusLeadingLeft = StatusAction.reply @AppStorage("swipeactions-status-leading-right") public var swipeActionsStatusLeadingRight = StatusAction.none + @AppStorage("swipeactions-use-theme-color") public var swipeActionsUseThemeColor = false + @AppStorage("swipeactions-icon-style") public var swipeActionsIconStyle: SwipeActionsIconStyle = .iconWithText + + public enum SwipeActionsIconStyle: String, CaseIterable { + case iconWithText, iconOnly + + public var description: LocalizedStringKey { + switch self { + case .iconWithText: + return "enum.swipeactions.icon-with-text" + case .iconOnly: + return "enum.swipeactions.icon-only" + } + } + } public var postVisibility: Models.Visibility { if useInstanceContentSettings { diff --git a/Packages/Status/Sources/Status/Row/StatusRowView.swift b/Packages/Status/Sources/Status/Row/StatusRowView.swift index a55655c2..1c27388e 100644 --- a/Packages/Status/Sources/Status/Row/StatusRowView.swift +++ b/Packages/Status/Sources/Status/Row/StatusRowView.swift @@ -467,9 +467,11 @@ public struct StatusRowView: View { private var trailingSwipeActions: some View { if preferences.swipeActionsStatusTrailingRight != StatusAction.none, !viewModel.isRemote { makeSwipeButton(action: preferences.swipeActionsStatusTrailingRight) + .tint(preferences.swipeActionsStatusTrailingRight.color(themeTintColor: theme.tintColor, useThemeColor: preferences.swipeActionsUseThemeColor, outside: true)) } if preferences.swipeActionsStatusTrailingLeft != StatusAction.none, !viewModel.isRemote { makeSwipeButton(action: preferences.swipeActionsStatusTrailingLeft) + .tint(preferences.swipeActionsStatusTrailingLeft.color(themeTintColor: theme.tintColor, useThemeColor: preferences.swipeActionsUseThemeColor, outside: false)) } } @@ -477,9 +479,11 @@ public struct StatusRowView: View { private var leadingSwipeActions: some View { if preferences.swipeActionsStatusLeadingLeft != StatusAction.none, !viewModel.isRemote { makeSwipeButton(action: preferences.swipeActionsStatusLeadingLeft) + .tint(preferences.swipeActionsStatusLeadingLeft.color(themeTintColor: theme.tintColor, useThemeColor: preferences.swipeActionsUseThemeColor, outside: true)) } if preferences.swipeActionsStatusLeadingRight != StatusAction.none, !viewModel.isRemote { makeSwipeButton(action: preferences.swipeActionsStatusLeadingRight) + .tint(preferences.swipeActionsStatusLeadingRight.color(themeTintColor: theme.tintColor, useThemeColor: preferences.swipeActionsUseThemeColor, outside: false)) } } @@ -526,11 +530,8 @@ public struct StatusRowView: View { HapticManager.shared.fireHaptic(of: .notification(.success)) routerPath.presentedSheet = destination } label: { - Text(action.displayName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked)) - Image(systemName: action.iconName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked)) - .environment(\.symbolVariants, .none) + makeSwipeLabel(action: action, style: preferences.swipeActionsIconStyle) } - .tint(action.color(themeTintColor: theme.tintColor)) } @ViewBuilder @@ -541,10 +542,21 @@ public struct StatusRowView: View { await task() } } label: { - Text(action.displayName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked)) - Image(systemName: action.iconName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked)) + makeSwipeLabel(action: action, style: preferences.swipeActionsIconStyle) + } + } + + @ViewBuilder + private func makeSwipeLabel(action: StatusAction, style: UserPreferences.SwipeActionsIconStyle) -> some View { + switch (style) { + case .iconOnly: + Label(action.displayName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked), systemImage: action.iconName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked)) + .labelStyle(.iconOnly) + .environment(\.symbolVariants, .none) + case .iconWithText: + Label(action.displayName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked), systemImage: action.iconName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked)) + .labelStyle(.titleAndIcon) .environment(\.symbolVariants, .none) } - .tint(action.color(themeTintColor: theme.tintColor)) } }