diff --git a/IceCubesApp.xcodeproj/project.pbxproj b/IceCubesApp.xcodeproj/project.pbxproj index 81ee2e46..25b5dfce 100644 --- a/IceCubesApp.xcodeproj/project.pbxproj +++ b/IceCubesApp.xcodeproj/project.pbxproj @@ -80,6 +80,7 @@ 9FE151A6293C90F900E9683D /* IconSelectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE151A5293C90F900E9683D /* IconSelectorView.swift */; }; 9FE3DB57296FEFCA00628CB0 /* AppAccount in Frameworks */ = {isa = PBXBuildFile; productRef = 9FE3DB56296FEFCA00628CB0 /* AppAccount */; }; C9B22677297F6C2E001F9EFE /* ContentSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B22676297F6C2E001F9EFE /* ContentSettingsView.swift */; }; + D08A9C3529956CFA00204A4A /* SwipeActionsSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08A9C3429956CFA00204A4A /* SwipeActionsSettingsView.swift */; }; E92817FA298443D600875FD1 /* Models in Frameworks */ = {isa = PBXBuildFile; productRef = E92817F9298443D600875FD1 /* Models */; }; E92817FC298443D600875FD1 /* Network in Frameworks */ = {isa = PBXBuildFile; productRef = E92817FB298443D600875FD1 /* Network */; }; E92817FE29844DB700875FD1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E92817FD29844DB700875FD1 /* Assets.xcassets */; }; @@ -224,6 +225,7 @@ C4CBB90B298A0DA3007E1707 /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/InfoPlist.strings"; sourceTree = ""; }; C4FBCF6F298FD88A0015DF22 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = ""; }; C9B22676297F6C2E001F9EFE /* ContentSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentSettingsView.swift; sourceTree = ""; }; + D08A9C3429956CFA00204A4A /* SwipeActionsSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwipeActionsSettingsView.swift; sourceTree = ""; }; DD31E2E5297FB68B00A4BE29 /* IceCubesApp.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = IceCubesApp.xcconfig; sourceTree = ""; }; E92817FD29844DB700875FD1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; E970C10929845A9400E88A8C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; @@ -466,6 +468,7 @@ 9F2A5410296A1429009B2D7C /* PushNotificationsView.swift */, 9FAE4ACA293783B000772766 /* SettingsTab.swift */, 9F2A540629699698009B2D7C /* SupportAppView.swift */, + D08A9C3429956CFA00204A4A /* SwipeActionsSettingsView.swift */, ); path = Settings; sourceTree = ""; @@ -758,6 +761,7 @@ 9F2B92FA295DA7D700DE16D0 /* AddAccountsView.swift in Sources */, 639CDF9C296AC82F00C35E58 /* SafariRouter.swift in Sources */, 9F35DB4729506F6600B3281A /* NotificationTab.swift in Sources */, + D08A9C3529956CFA00204A4A /* SwipeActionsSettingsView.swift in Sources */, 9F7335F22967608F00AFF0BA /* AddRemoteTimelineView.swift in Sources */, 9F55C68D2955968700F94077 /* ExploreTab.swift in Sources */, 9F1E8B47298EBCBB00609F80 /* HapticSettingsView.swift in Sources */, diff --git a/IceCubesApp/App/Tabs/Settings/SettingsTab.swift b/IceCubesApp/App/Tabs/Settings/SettingsTab.swift index e8c3576a..5ceb074f 100644 --- a/IceCubesApp/App/Tabs/Settings/SettingsTab.swift +++ b/IceCubesApp/App/Tabs/Settings/SettingsTab.swift @@ -113,6 +113,9 @@ struct SettingsTabs: View { NavigationLink(destination: ContentSettingsView()) { Label("settings.general.content", systemImage: "rectangle.on.rectangle") } + NavigationLink(destination: SwipeActionsSettingsView()) { + Label("settings.general.swipeactions", systemImage: "hand.draw") + } Link(destination: URL(string: UIApplication.openSettingsURLString)!) { Label("settings.system", systemImage: "gear") } diff --git a/IceCubesApp/App/Tabs/Settings/SwipeActionsSettingsView.swift b/IceCubesApp/App/Tabs/Settings/SwipeActionsSettingsView.swift new file mode 100644 index 00000000..abf0db59 --- /dev/null +++ b/IceCubesApp/App/Tabs/Settings/SwipeActionsSettingsView.swift @@ -0,0 +1,55 @@ +import DesignSystem +import Env +import SwiftUI + +struct SwipeActionsSettingsView: View { + @EnvironmentObject private var theme: Theme + @EnvironmentObject private var userPreferences: UserPreferences + + var body: some View { + + Form { + Section("settings.swipeactions.status") { + HStack { + Text("settings.swipeactions.status.leading") + Image(systemName: "arrow.right") + } + Picker(selection: $userPreferences.swipeActionsStatusLeadingLeft, label: makeSwipeLabel(left: true, text: "settings.swipeactions.status.leading.left")) { + ForEach(StatusAction.allCases) { action in + Text(action.displayName).tag(action) + } + } + Picker(selection: $userPreferences.swipeActionsStatusLeadingRight, label: makeSwipeLabel(left: false, text: "settings.swipeactions.status.leading.right")) { + ForEach(StatusAction.allCases) { action in + Text(action.displayName).tag(action) + } + } + HStack { + Text("settings.swipeactions.status.trailing") + Image(systemName: "arrow.left") + } + Picker(selection: $userPreferences.swipeActionsStatusTrailingLeft, label: makeSwipeLabel(left: true, text: "settings.swipeactions.status.trailing.left")) { + ForEach(StatusAction.allCases) { action in + Text(action.displayName).tag(action) + } + } + Picker(selection: $userPreferences.swipeActionsStatusTrailingRight, label: makeSwipeLabel(left: false, text: "settings.swipeactions.status.trailing.right")) { + ForEach(StatusAction.allCases) { action in + Text(action.displayName).tag(action) + } + } + } + .listRowBackground(theme.primaryBackgroundColor) + } + .navigationTitle("settings.swipeactions.navigation-title") + .scrollContentBackground(.hidden) + .background(theme.secondaryBackgroundColor) + } + + private func makeSwipeLabel(left: Bool, text: LocalizedStringKey) -> some View { + return HStack { + Image(systemName: left ? "rectangle.lefthalf.filled" : "rectangle.righthalf.filled") + Text(text) + }.padding(.leading, 16) + } +} diff --git a/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings index e1bd9bda..8259f658 100644 --- a/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings @@ -160,6 +160,22 @@ "settings.display.show-ipad-column" = "Habilitar columna secondària"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "Exploreu"; "tab.federated" = "Federat"; diff --git a/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings index 30c731ce..dedb05b0 100644 --- a/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings @@ -158,6 +158,22 @@ "settings.display.show-ipad-column" = "Zweite Spalte aktivieren"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + "enum.expand-media.show" = "Alle zeigen"; "enum.expand-media.hide" = "Alle ausblenden"; "enum.expand-media.hide-sensitive" = "Sensible ausblenden"; diff --git a/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings index 7137b1c9..5bc2a831 100644 --- a/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings @@ -164,6 +164,22 @@ "settings.display.show-ipad-column" = "Enable secondary column"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "Explore"; "tab.federated" = "Federated"; diff --git a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings index d325521e..3534a3df 100644 --- a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings @@ -162,6 +162,22 @@ "settings.display.show-ipad-column" = "Enable secondary column"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "Explore"; "tab.federated" = "Federated"; diff --git a/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings index ff183551..fd8185cb 100644 --- a/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings @@ -158,6 +158,22 @@ "settings.display.show-ipad-column" = "Enable secondary column"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + "enum.expand-media.show" = "Siempre"; "enum.expand-media.hide" = "Nunca"; "enum.expand-media.hide-sensitive" = "Ocultar contenido sensible"; diff --git a/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings index 344927f5..d055c5bd 100644 --- a/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings @@ -158,6 +158,22 @@ "settings.display.show-ipad-column" = "Gaitu bigarren zutabea"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + "enum.expand-media.show" = "Erakutsi guztia"; "enum.expand-media.hide" = "Ezkutatu guztia"; "enum.expand-media.hide-sensitive" = "Ezkutatu hunkigarria"; diff --git a/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings index f4d09f4e..04fdb446 100644 --- a/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings @@ -161,6 +161,22 @@ "settings.display.show-ipad-column" = "Activer la colonne secondaire"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "Explorer"; "tab.federated" = "Fédéré"; diff --git a/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings index c2a5f19c..caf93fbe 100644 --- a/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings @@ -161,6 +161,22 @@ "settings.display.show-ipad-column" = "Attiva la seconda colonna"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "Esplora"; "tab.federated" = "Federazione"; diff --git a/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings index 31f7715f..b8d681f4 100644 --- a/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings @@ -161,6 +161,22 @@ "settings.display.show-ipad-column" = "セカンドカラムを有効にする"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "エクスプローラー"; "tab.federated" = "連合"; diff --git a/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings index 6e5cf3f2..963fb4fd 100644 --- a/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings @@ -160,6 +160,22 @@ "settings.display.show-tab-label" = "하단 탭 바에 제목 표시"; "settings.display.show-ipad-column" = "보조 열 사용"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "둘러보기"; "tab.federated" = "연합"; diff --git a/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings index 24adcd11..e89b72f1 100644 --- a/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings @@ -161,6 +161,22 @@ "settings.display.show-ipad-column" = "Enable secondary column"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "Utforsk"; "tab.federated" = "Federert"; diff --git a/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings index 7f51b90a..d7546248 100644 --- a/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings @@ -158,6 +158,22 @@ "settings.display.show-ipad-column" = "Toon tweede kolom"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "Ontdekken"; "tab.federated" = "Gefedereerd"; diff --git a/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings index 04ff299b..4bef2375 100644 --- a/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings @@ -161,6 +161,22 @@ "settings.display.show-ipad-column" = "Włącz dodatkową kolumnę"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "Odkrywaj"; "tab.federated" = "Globalny"; diff --git a/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings index 185bf633..7c113fed 100644 --- a/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings @@ -161,6 +161,22 @@ "settings.display.show-ipad-column" = "Enable secondary column"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "Explorar"; "tab.federated" = "Linha global"; diff --git a/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings index e1df88ec..5e139264 100644 --- a/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings @@ -161,6 +161,22 @@ "settings.display.show-ipad-column" = "Enable secondary column"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "Keşfet"; "tab.federated" = "Birleştirilmiş"; diff --git a/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings index f7592491..8ae6a768 100644 --- a/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings @@ -161,6 +161,22 @@ "settings.display.show-ipad-column" = "启用边栏"; +"settings.general.swipeactions" = "Swipe Actions"; +"settings.swipeactions.navigation-title" = "Swipe Actions"; +"settings.swipeactions.status.action.bookmark" = "Bookmark"; +"settings.swipeactions.status.action.boost" = "Boost"; +"settings.swipeactions.status.action.favorite" = "Favorite"; +"settings.swipeactions.status.action.none" = "None"; +"settings.swipeactions.status.action.quote" = "Quote"; +"settings.swipeactions.status.action.reply" = "Reply"; +"settings.swipeactions.status.leading" = "Swipe right"; +"settings.swipeactions.status.leading.left" = "left"; +"settings.swipeactions.status.leading.right" = "right"; +"settings.swipeactions.status.trailing" = " Swipe left"; +"settings.swipeactions.status.trailing.left" = "left"; +"settings.swipeactions.status.trailing.right" = "right"; +"settings.swipeactions.status" = "Post"; + // MARK: Tabs "tab.explore" = "探索"; "tab.federated" = "跨站"; diff --git a/Packages/Env/Sources/Env/StatusAction.swift b/Packages/Env/Sources/Env/StatusAction.swift new file mode 100644 index 00000000..eb248ca2 --- /dev/null +++ b/Packages/Env/Sources/Env/StatusAction.swift @@ -0,0 +1,42 @@ +import SwiftUI + +public enum StatusAction : String, CaseIterable, Identifiable { + public var id: String { + "\(rawValue)" + } + case none, boost, reply, quote, favorite, bookmark + + public var displayName: LocalizedStringKey { + switch self { + case .none: + return "settings.swipeactions.status.action.none" + case .reply: + return "settings.swipeactions.status.action.reply" + case .quote: + return "settings.swipeactions.status.action.quote" + case .boost: + return "settings.swipeactions.status.action.boost" + case .favorite: + return "settings.swipeactions.status.action.favorite" + case .bookmark: + return "settings.swipeactions.status.action.bookmark" + } + } + + public func iconName(isReblogged: Bool = false, isFavorited: Bool = false, isBookmarked: Bool = false) -> String { + switch self { + case .none: + return "slash.circle" + case .reply: + return "arrowshape.turn.up.left" + case .quote: + return "quote.bubble" + case .boost: + return isReblogged ? "arrow.left.arrow.right.circle.fill" : "arrow.left.arrow.right.circle" + case .favorite: + return isFavorited ? "star.fill" : "star" + case .bookmark: + return isBookmarked ? "bookmark.fill" : "bookmark" + } + } +} diff --git a/Packages/Env/Sources/Env/UserPreferences.swift b/Packages/Env/Sources/Env/UserPreferences.swift index 1f5f2fca..a281dc63 100644 --- a/Packages/Env/Sources/Env/UserPreferences.swift +++ b/Packages/Env/Sources/Env/UserPreferences.swift @@ -40,6 +40,43 @@ public class UserPreferences: ObservableObject { @AppStorage("show_second_column_ipad") public var showiPadSecondaryColumn = true + @AppStorage("swipeactions.status.trailing.right") var _swipeActionsStatusTrailingRight = StatusAction.favorite.rawValue + public var swipeActionsStatusTrailingRight: StatusAction { + get { + StatusAction(rawValue: _swipeActionsStatusTrailingRight) ?? StatusAction.none + } + set { + _swipeActionsStatusTrailingRight = newValue.rawValue + } + } + @AppStorage("swipeactions.status.trailing.left") var _swipeActionsStatusTrailingLeft = StatusAction.boost.rawValue + public var swipeActionsStatusTrailingLeft: StatusAction { + get { + StatusAction(rawValue: _swipeActionsStatusTrailingLeft) ?? StatusAction.none + } + set { + _swipeActionsStatusTrailingLeft = newValue.rawValue + } + } + @AppStorage("swipeactions.status.leading.left") var _swipeActionsStatusLeadingLeft = StatusAction.reply.rawValue + public var swipeActionsStatusLeadingLeft: StatusAction { + get { + StatusAction(rawValue: _swipeActionsStatusLeadingLeft) ?? StatusAction.none + } + set { + _swipeActionsStatusLeadingLeft = newValue.rawValue + } + } + @AppStorage("swipeactions.status.leading.right") var _swipeActionsStatusLeadingRight = StatusAction.none.rawValue + public var swipeActionsStatusLeadingRight: StatusAction { + get { + StatusAction(rawValue: _swipeActionsStatusLeadingRight) ?? StatusAction.none + } + set { + _swipeActionsStatusLeadingRight = newValue.rawValue + } + } + public var postVisibility: Models.Visibility { if useInstanceContentSettings { return serverPreferences?.postVisibility ?? .pub diff --git a/Packages/Status/Sources/Status/Row/StatusRowView.swift b/Packages/Status/Sources/Status/Row/StatusRowView.swift index a4766e30..829000de 100644 --- a/Packages/Status/Sources/Status/Row/StatusRowView.swift +++ b/Packages/Status/Sources/Status/Row/StatusRowView.swift @@ -85,7 +85,7 @@ public struct StatusRowView: View { .listRowBackground(viewModel.highlightRowColor) .swipeActions(edge: .trailing) { if !viewModel.isCompact { - trailinSwipeActions + trailingSwipeActions } } .swipeActions(edge: .leading) { @@ -453,43 +453,88 @@ public struct StatusRowView: View { } @ViewBuilder - private var trailinSwipeActions: some View { - Button { - Task { - HapticManager.shared.fireHaptic(of: .notification(.success)) + private var trailingSwipeActions: some View { + if preferences.swipeActionsStatusTrailingRight != StatusAction.none { + makeSwipeButton(action: preferences.swipeActionsStatusTrailingRight) + .tint(theme.tintColor) + } + if preferences.swipeActionsStatusTrailingLeft != StatusAction.none { + makeSwipeButton(action: preferences.swipeActionsStatusTrailingLeft) + .tint(.gray) + } + } + + @ViewBuilder + private var leadingSwipeActions: some View { + if preferences.swipeActionsStatusLeadingLeft != StatusAction.none { + makeSwipeButton(action: preferences.swipeActionsStatusLeadingLeft) + .tint(theme.tintColor) + } + if preferences.swipeActionsStatusLeadingRight != StatusAction.none { + makeSwipeButton(action: preferences.swipeActionsStatusLeadingRight) + .tint(.gray) + } + } + + @ViewBuilder + private func makeSwipeButton(action: StatusAction) -> some View { + switch action { + case .reply: + makeSwipeButtonForRouterPath(action: action, destination: .replyToStatusEditor(status: viewModel.status)) + case .quote: + makeSwipeButtonForRouterPath(action: action, destination: .quoteStatusEditor(status: viewModel.status)) + case .favorite: + makeSwipeButtonForTask(action: action) { if viewModel.isFavorited { await viewModel.unFavorite() } else { await viewModel.favorite() } } - } label: { - Image(systemName: "star") - } - .tint(.yellow) - Button { - Task { - HapticManager.shared.fireHaptic(of: .notification(.success)) + case .boost: + makeSwipeButtonForTask(action: action) { if viewModel.isReblogged { await viewModel.unReblog() } else { await viewModel.reblog() } } - } label: { - Image(systemName: "arrow.left.arrow.right.circle") + case .bookmark: + makeSwipeButtonForTask(action: action) { + if viewModel.isBookmarked { + await viewModel.unbookmark() + } else { + await + viewModel.bookmark() + } + } + case .none: + EmptyView() } - .tint(theme.tintColor) } - + @ViewBuilder - private var leadingSwipeActions: some View { + private func makeSwipeButtonForRouterPath(action: StatusAction, destination: SheetDestinations) -> some View { Button { HapticManager.shared.fireHaptic(of: .notification(.success)) - routerPath.presentedSheet = .replyToStatusEditor(status: viewModel.status) + routerPath.presentedSheet = destination } label: { - Image(systemName: "arrowshape.turn.up.left") + Text(action.displayName) + Image(systemName: action.iconName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked)) + .foregroundColor(.red) + } + } + + @ViewBuilder + private func makeSwipeButtonForTask(action: StatusAction, task: @escaping () async -> Void ) -> some View { + Button { + Task { + HapticManager.shared.fireHaptic(of: .notification(.success)) + await task() + } + } label: { + Text(action.displayName) + Image(systemName: action.iconName(isReblogged: viewModel.isReblogged, isFavorited: viewModel.isFavorited, isBookmarked: viewModel.isBookmarked)) } - .tint(theme.tintColor) } }