mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-30 06:15:08 +01:00
124aeef7fb
* swipe actions improvements * use old values as default settings * Polish swipe actions settings * Fix background color --------- Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
56 lines
2.1 KiB
Swift
56 lines
2.1 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("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)
|
|
}
|
|
}
|