Skip to content

Commit

Permalink
Make GestureView respond to double touch gesture (jellyfin#1260)
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenWong12 authored Oct 8, 2024
1 parent c5d6539 commit 071a1f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Swiftfin/Components/GestureView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class UIGestureView: UIView {

let pinchGesture = UIPinchGestureRecognizer(target: self, action: #selector(didPerformPinch))
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didPerformTap))
let doubleTouchGesture = UITapGestureRecognizer(target: self, action: #selector(didPerformTap))
let doubleTouchGesture = UITapGestureRecognizer(target: self, action: #selector(didPerformDoubleTouch))
doubleTouchGesture.numberOfTouchesRequired = 2
let longPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(didPerformLongPress))
longPressGesture.minimumPressDuration = longPressMinimumDuration
Expand Down
18 changes: 14 additions & 4 deletions Swiftfin/Views/VideoPlayer/VideoPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ extension VideoPlayer {
}

private func handleDoubleTouchGesture(unitPoint: UnitPoint, taps: Int) {
if doubleTouchGesture == .gestureLock {
guard !isPresentingOverlay else { return }
isGestureLocked.toggle()
}

guard !isGestureLocked else {
updateViewProxy.present(systemName: "lock.fill", title: "Gestures Locked")
return
Expand All @@ -385,10 +390,15 @@ extension VideoPlayer {
case .none:
return
case .aspectFill: ()
case .gestureLock:
guard !isPresentingOverlay else { return }
isGestureLocked.toggle()
case .pausePlay: ()
case .pausePlay:
switch videoPlayerManager.state {
case .playing:
videoPlayerManager.proxy.pause()
default:
videoPlayerManager.proxy.play()
}
default:
break
}
}
}
Expand Down

0 comments on commit 071a1f9

Please sign in to comment.