IceCubes/IceCubesApp/App/Tabs/Settings/SwipeActionsSettingsView.swift
Ico Davids 678f6f0cdd
Redesigned swipe actions settings (#937)
* Redesigned Swipe Action Settings screen

* Add TODO comments

* Redesigned Swipe Action Settings screen

* Redesigned Swipe Action Settings screen

* Add EN localization strings for primary/secondary

* Consolidate left/right swipe actions into one section

* Switch to targeted Swift concurrency warnings + fix them

* Polish localization update (#936)

* Updates to Dutch localization: (#935)

* de: translated the notes feature (#933)

* Fix 1 line note in centre (#938)

* Sort lists alphabetically in ListAddAccountView (#943)

* Optimize viewId (#942)

* Update Localizable.strings (#941)

Co-authored-by: Yusuke Arakawa <nekolaboratory@users.noreply.github.com>

* Update Nuke (#940)

* Remove Sendable conformance on Client as it's not needed

* Profile: Show about fields inline

* Added a tip that it's a video, and not an image when autoplay is off (#939)

* Added a tip that it's a video, and not an image when autoplay is off

* Centered - bigger version of the video tip

* Share post as image close #885

* Honour in app browser settings when opening profile about fields

* Fix threading UI

* More tweak to capture mode

* Update Localizable.strings (#948)

* Update Localizable.strings (#946)

Translated..

* Updated EmojiText to 2.x (#944)

Interface used by IceCubeApp has not changed from 1.x to 2.x
Looking at the library diff shows new features like SFSymbol powered emojis. Not like we're going to make use of that
https://github.com/divadretlaw/EmojiText/compare/v1.2.0...2.0.2

* Bump to 1.5.5

* Polish localization update (#949)

* Optimize avatar view (#950)

* Reduce AvatarPlaceholderView body calls

* Resize avatars

* Reworked post header view + add option to hide server name from username

* Better header spacing

* Further improvement to the post header

* Polish localization update (#954)

* Update Localizable.strings (#953)

* Show post header thread icon more consistently

* Fix post header

* Fix threading UI

* Fix trending refresh

* de: 1 new string -> translated (#955)

* Update Simplified Chinese Translation (#926)

* Update Korean localization (#957)

* Trim whitespace and newlines in instance rules list (#956)

* Fix theme not being applied live on status row close #961

* Update some translations (#959)

* Add indicator for bots accounts

* Bump to 1.5.6

* Fix status actions on boosting posts (#974)

* Fix context menus for boosts

* Allow my boost of my followers-only post

* Disable boost context menu on posts can't be boosted and show different string for boosting my own private post

* Localizations

* CR

---------

Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>

* Fix crash when opening account details (#972) close #918

* Tweak the theme selector view (#975)

Co-authored-by: Yusuke Arakawa <nekolaboratory@users.noreply.github.com>

* Change the Content Settings icon to match the timeline icon again. (#969)

* Fix display of multiple vote polls (#967)

Closes #952

* Updates to Dutch localization (#966)

* Font picker consistency (#960)

* Put SF Rounded into the popup menu with Hyperlegible & Dislexia

* Remove SF Rounded Toggle

* Fix In-App Safari (#945)

* Fix In-App Safari

* Open SFSafariViewController in a separate window

* Swiftformat

* Optimize custom font

* Fix a localization + make the ... menu zone bigger

* Update Localizable.strings (#976)

* Fix Equatable impl for Status and Account (thanks class)

* Make secondary column available on any size + add a toggle + faster macOS window resize

* Bigger secondary column width

* Composer: Fix swipe to dismiss

* Composer: Better ALT editing UI

* updates for Basque (#983)

added missing translations and small fixes

* Updated spanish localization (#982)

Co-authored-by: Roberto Pastor <roberto.pastor@cabify.com>

* Polish localization update (#980)

* Update Localizable.strings (#979)

More strings

* Singularize enum type names (#978)

* Fixes for composer and DM

* Remove padding

* Rename settings.swipeactions.status.icon-style

* Remove unused left/right localizable strings

* Add settings.swipeactions.appearance

* Add settings.swipeactions.status.explanation

* Add settings.swipeactions.primary and settings.swipeactions.secondary

* Add settings.swipeactions.use-theme-colors and settings.swipeactions.use-theme-colors-explanation

* Dutch localization update

---------

Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
Co-authored-by: Andrzej Rózga <53080024+AndrzejRozga@users.noreply.github.com>
Co-authored-by: Cthulhux <github@tuxproject.de>
Co-authored-by: Sean Goldin <EvilOne@users.noreply.github.com>
Co-authored-by: David Davies-Payne <d2p@me.com>
Co-authored-by: Alex Grebenyuk <grebenyuk.alexander@gmail.com>
Co-authored-by: Yusuke Arakawa <108506642+nekolaboratory@users.noreply.github.com>
Co-authored-by: Yusuke Arakawa <nekolaboratory@users.noreply.github.com>
Co-authored-by: Thomas Durand <Dean151@users.noreply.github.com>
Co-authored-by: Dejavu Moe <jialong.vip@gmail.com>
Co-authored-by: Chanhwi Joo <56245920+te6-in@users.noreply.github.com>
Co-authored-by: Henrik Nyh <henrik@nyh.se>
Co-authored-by: nixzhu <zhuhongxu@gmail.com>
Co-authored-by: Gareth Simpson <g@xurble.org>
Co-authored-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
Co-authored-by: David Walter <divadretlaw@users.noreply.github.com>
Co-authored-by: Xabi <xabi.rn@gmail.com>
Co-authored-by: Roberto Pastor <wedge.hero@gmail.com>
Co-authored-by: Roberto Pastor <roberto.pastor@cabify.com>
Co-authored-by: Louis Lac <lac.louis5@gmail.com>
2023-02-22 07:07:26 +01:00

87 lines
3.2 KiB
Swift

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 {
Label("settings.swipeactions.status.leading", systemImage: "arrow.right")
.foregroundColor(.secondary)
createStatusActionPicker(selection: $userPreferences.swipeActionsStatusLeadingLeft,
label: "settings.swipeactions.primary")
.onChange(of: userPreferences.swipeActionsStatusLeadingLeft) { action in
if action == .none {
userPreferences.swipeActionsStatusLeadingRight = .none;
}
}
createStatusActionPicker(selection: $userPreferences.swipeActionsStatusLeadingRight,
label: "settings.swipeactions.secondary")
.disabled(userPreferences.swipeActionsStatusLeadingLeft == .none)
Label("settings.swipeactions.status.trailing", systemImage: "arrow.left")
.foregroundColor(.secondary)
createStatusActionPicker(selection: $userPreferences.swipeActionsStatusTrailingRight,
label: "settings.swipeactions.primary")
.onChange(of: userPreferences.swipeActionsStatusTrailingRight) { action in
if action == .none {
userPreferences.swipeActionsStatusTrailingLeft = .none;
}
}
createStatusActionPicker(selection: $userPreferences.swipeActionsStatusTrailingLeft,
label: "settings.swipeactions.secondary")
.disabled(userPreferences.swipeActionsStatusTrailingRight == .none)
} header: {
Text("settings.swipeactions.status")
} footer: {
Text("settings.swipeactions.status.explanation")
}
.listRowBackground(theme.primaryBackgroundColor)
Section {
Picker(selection: $userPreferences.swipeActionsIconStyle, label: Text("settings.swipeactions.icon-style")) {
ForEach(UserPreferences.SwipeActionsIconStyle.allCases, id: \.rawValue) { style in
Text(style.description).tag(style)
}
}
Toggle(isOn: $userPreferences.swipeActionsUseThemeColor) {
Text("settings.swipeactions.use-theme-colors")
}
} header: {
Text("settings.swipeactions.appearance")
} footer: {
Text("settings.swipeactions.use-theme-colors-explanation")
}
.listRowBackground(theme.primaryBackgroundColor)
}
.navigationTitle("settings.swipeactions.navigation-title")
.scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor)
}
private func createStatusActionPicker(selection: Binding<StatusAction>, label: LocalizedStringKey) -> some View {
return Picker(selection: selection, label: Text(label)) {
Section {
Text(StatusAction.none.displayName()).tag(StatusAction.none)
}
Section {
ForEach(StatusAction.allCases) { action in
if action != .none {
Text(action.displayName()).tag(action)
}
}
}
}
}
}