mirror of
https://github.com/yattee/yattee.git
synced 2026-05-13 19:05:03 +00:00
Restrict swipe actions to iOS
This commit is contained in:
@@ -7,14 +7,22 @@
|
|||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
#if os(tvOS)
|
#if !os(iOS)
|
||||||
|
|
||||||
extension View {
|
extension View {
|
||||||
/// On tvOS, swipe actions are not supported - returns the view unmodified.
|
/// Swipe actions are iOS-only; on macOS/tvOS this returns the view unmodified.
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
func swipeActions(
|
func swipeActions(
|
||||||
config: SwipeActionConfig = .init(),
|
config _: SwipeActionConfig = .init(),
|
||||||
@SwipeActionBuilder actions: () -> [SwipeAction]
|
@SwipeActionBuilder actions _: () -> [SwipeAction]
|
||||||
|
) -> some View {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
func swipeActions(
|
||||||
|
config _: SwipeActionConfig = .init(),
|
||||||
|
actionsArray _: [SwipeAction]
|
||||||
) -> some View {
|
) -> some View {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ struct QueueItemRow: View {
|
|||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
#if !os(tvOS)
|
#if os(iOS)
|
||||||
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
||||||
Button(role: .destructive) {
|
Button(role: .destructive) {
|
||||||
onRemove()
|
onRemove()
|
||||||
|
|||||||
@@ -196,11 +196,13 @@ private struct VideoActionsSection: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if os(iOS)
|
||||||
NavigationLink {
|
NavigationLink {
|
||||||
SwipeActionsSettingsView()
|
SwipeActionsSettingsView()
|
||||||
} label: {
|
} label: {
|
||||||
Label(String(localized: "settings.appearance.swipeActions"), systemImage: "hand.draw")
|
Label(String(localized: "settings.appearance.swipeActions"), systemImage: "hand.draw")
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} header: {
|
} header: {
|
||||||
Text(String(localized: "settings.videoActions.header"))
|
Text(String(localized: "settings.videoActions.header"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -380,7 +380,7 @@ private struct PresetRow: View {
|
|||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
#if !os(tvOS)
|
#if os(iOS)
|
||||||
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
|
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
|
||||||
if let onDelete, !preset.isBuiltIn, canDelete {
|
if let onDelete, !preset.isBuiltIn, canDelete {
|
||||||
Button(role: .destructive) {
|
Button(role: .destructive) {
|
||||||
|
|||||||
Reference in New Issue
Block a user