mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Merge pull request #814 from yattee/fullscreen-gesture-toggle
allow users to disable fullscreen swipe gesture
This commit is contained in:
commit
f69ccb6bd6
@ -5,6 +5,7 @@ final class ConstrolsSettingsGroupExporter: SettingsGroupExporter {
|
||||
override var globalJSON: JSON {
|
||||
[
|
||||
"avPlayerUsesSystemControls": Defaults[.avPlayerUsesSystemControls],
|
||||
"fullscreenPlayerGestureEnabled": Defaults[.fullscreenPlayerGestureEnabled],
|
||||
"horizontalPlayerGestureEnabled": Defaults[.horizontalPlayerGestureEnabled],
|
||||
"seekGestureSensitivity": Defaults[.seekGestureSensitivity],
|
||||
"seekGestureSpeed": Defaults[.seekGestureSpeed],
|
||||
|
@ -9,6 +9,10 @@ struct ConstrolsSettingsGroupImporter {
|
||||
Defaults[.avPlayerUsesSystemControls] = avPlayerUsesSystemControls
|
||||
}
|
||||
|
||||
if let fullscreenPlayerGestureEnabled = json["fullscreenPlayerGestureEnabled"].bool {
|
||||
Defaults[.fullscreenPlayerGestureEnabled] = fullscreenPlayerGestureEnabled
|
||||
}
|
||||
|
||||
if let horizontalPlayerGestureEnabled = json["horizontalPlayerGestureEnabled"].bool {
|
||||
Defaults[.horizontalPlayerGestureEnabled] = horizontalPlayerGestureEnabled
|
||||
}
|
||||
|
@ -116,6 +116,7 @@ extension Defaults.Keys {
|
||||
|
||||
static let avPlayerUsesSystemControls = Key<Bool>("avPlayerUsesSystemControls", default: Constants.isTvOS)
|
||||
static let horizontalPlayerGestureEnabled = Key<Bool>("horizontalPlayerGestureEnabled", default: true)
|
||||
static let fullscreenPlayerGestureEnabled = Key<Bool>("fullscreenPlayerGestureEnabled", default: true)
|
||||
static let seekGestureSensitivity = Key<Double>("seekGestureSensitivity", default: 30.0)
|
||||
static let seekGestureSpeed = Key<Double>("seekGestureSpeed", default: 0.5)
|
||||
|
||||
|
@ -63,7 +63,7 @@ extension VideoPlayerView {
|
||||
}
|
||||
|
||||
// Toggle fullscreen on upward drag only when not disabled
|
||||
if verticalDrag < -50 {
|
||||
if fullscreenPlayerGestureEnabled, verticalDrag < -50 {
|
||||
player.toggleFullScreenAction()
|
||||
disableGestureTemporarily()
|
||||
return
|
||||
|
@ -66,6 +66,7 @@ struct VideoPlayerView: View {
|
||||
#endif
|
||||
|
||||
@Default(.horizontalPlayerGestureEnabled) var horizontalPlayerGestureEnabled
|
||||
@Default(.fullscreenPlayerGestureEnabled) var fullscreenPlayerGestureEnabled
|
||||
@Default(.seekGestureSpeed) var seekGestureSpeed
|
||||
@Default(.seekGestureSensitivity) var seekGestureSensitivity
|
||||
@Default(.playerSidebar) var playerSidebar
|
||||
|
@ -8,6 +8,7 @@ struct PlayerControlsSettings: View {
|
||||
@Default(.playerControlsLayout) private var playerControlsLayout
|
||||
@Default(.fullScreenPlayerControlsLayout) private var fullScreenPlayerControlsLayout
|
||||
@Default(.horizontalPlayerGestureEnabled) private var horizontalPlayerGestureEnabled
|
||||
@Default(.fullscreenPlayerGestureEnabled) private var fullscreenPlayerGestureEnabled
|
||||
@Default(.seekGestureSpeed) private var seekGestureSpeed
|
||||
@Default(.seekGestureSensitivity) private var seekGestureSensitivity
|
||||
@Default(.buttonBackwardSeekDuration) private var buttonBackwardSeekDuration
|
||||
@ -64,9 +65,10 @@ struct PlayerControlsSettings: View {
|
||||
|
||||
@ViewBuilder var sections: some View {
|
||||
#if !os(tvOS)
|
||||
Section(header: SettingsHeader(text: "Controls".localized()), footer: controlsLayoutFooter) {
|
||||
#if !os(tvOS)
|
||||
avPlayerUsesSystemControlsToggle
|
||||
Section(header: SettingsHeader(text: "Player Controls".localized()), footer: controlsLayoutFooter) {
|
||||
avPlayerUsesSystemControlsToggle
|
||||
#if os(iOS)
|
||||
fullscreenPlayerGestureEnabledToggle
|
||||
#endif
|
||||
horizontalPlayerGestureEnabledToggle
|
||||
SettingsHeader(text: "Seek gesture sensitivity".localized(), secondary: true)
|
||||
@ -112,7 +114,7 @@ struct PlayerControlsSettings: View {
|
||||
}
|
||||
|
||||
var controlsButtonsSection: some View {
|
||||
Section(header: SettingsHeader(text: "Controls Buttons".localized())) {
|
||||
Section(header: SettingsHeader(text: "Player Control Buttons".localized())) {
|
||||
controlButtonToggles
|
||||
}
|
||||
}
|
||||
@ -157,8 +159,12 @@ struct PlayerControlsSettings: View {
|
||||
#endif
|
||||
}
|
||||
|
||||
private var fullscreenPlayerGestureEnabledToggle: some View {
|
||||
Toggle("Swipe up toggles fullscreen", isOn: $fullscreenPlayerGestureEnabled)
|
||||
}
|
||||
|
||||
private var horizontalPlayerGestureEnabledToggle: some View {
|
||||
Toggle("Seek with horizontal swipe on video", isOn: $horizontalPlayerGestureEnabled)
|
||||
Toggle("Seek with horizontal swipe", isOn: $horizontalPlayerGestureEnabled)
|
||||
}
|
||||
|
||||
private var avPlayerUsesSystemControlsToggle: some View {
|
||||
|
Loading…
Reference in New Issue
Block a user