mirror of
https://github.com/yattee/yattee.git
synced 2024-12-23 14:03:41 +00:00
Allow swipe down to open controls settings on tvOS
This commit is contained in:
parent
4ec9791467
commit
263f0e63a6
@ -142,8 +142,14 @@ struct PlayerControls: View {
|
||||
}
|
||||
}
|
||||
#if os(tvOS)
|
||||
.onReceive(model.reporter) { _ in
|
||||
.onReceive(model.reporter) { value in
|
||||
if value == "swipe down", !model.presentingControls, !model.presentingOverlays {
|
||||
withAnimation(Self.animation) {
|
||||
model.presentingControlsOverlay = true
|
||||
}
|
||||
} else {
|
||||
model.show()
|
||||
}
|
||||
model.resetTimer()
|
||||
}
|
||||
#endif
|
||||
|
@ -19,7 +19,7 @@ struct TVControls: UIViewRepresentable {
|
||||
let upSwipe = UISwipeGestureRecognizer(target: context.coordinator, action: #selector(Coordinator.handleSwipe(sender:)))
|
||||
upSwipe.direction = .up
|
||||
|
||||
let downSwipe = UISwipeGestureRecognizer(target: context.coordinator, action: #selector(Coordinator.handleSwipe(sender:)))
|
||||
let downSwipe = UISwipeGestureRecognizer(target: context.coordinator, action: #selector(Coordinator.handleSwipeDown(sender:)))
|
||||
downSwipe.direction = .down
|
||||
|
||||
controlsArea.addGestureRecognizer(leftSwipe)
|
||||
@ -63,5 +63,9 @@ struct TVControls: UIViewRepresentable {
|
||||
let location = sender.location(in: view)
|
||||
model.reporter.send("swipe \(location)")
|
||||
}
|
||||
|
||||
@objc func handleSwipeDown(sender _: UISwipeGestureRecognizer) {
|
||||
model.reporter.send("swipe down")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user