diff --git a/Model/Import Export Settings/Exporters/ControlsSettingsGroupExporter.swift b/Model/Import Export Settings/Exporters/ControlsSettingsGroupExporter.swift index d3bb4cc4..2b13a004 100644 --- a/Model/Import Export Settings/Exporters/ControlsSettingsGroupExporter.swift +++ b/Model/Import Export Settings/Exporters/ControlsSettingsGroupExporter.swift @@ -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], diff --git a/Model/Import Export Settings/Importers/ControlsSettingsGroupImporter.swift b/Model/Import Export Settings/Importers/ControlsSettingsGroupImporter.swift index fd528b23..b4886734 100644 --- a/Model/Import Export Settings/Importers/ControlsSettingsGroupImporter.swift +++ b/Model/Import Export Settings/Importers/ControlsSettingsGroupImporter.swift @@ -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 } diff --git a/Shared/Defaults.swift b/Shared/Defaults.swift index 4c060e22..98d44db8 100644 --- a/Shared/Defaults.swift +++ b/Shared/Defaults.swift @@ -116,6 +116,7 @@ extension Defaults.Keys { static let avPlayerUsesSystemControls = Key("avPlayerUsesSystemControls", default: Constants.isTvOS) static let horizontalPlayerGestureEnabled = Key("horizontalPlayerGestureEnabled", default: true) + static let fullscreenPlayerGestureEnabled = Key("fullscreenPlayerGestureEnabled", default: true) static let seekGestureSensitivity = Key("seekGestureSensitivity", default: 30.0) static let seekGestureSpeed = Key("seekGestureSpeed", default: 0.5) diff --git a/Shared/Player/PlayerDragGesture.swift b/Shared/Player/PlayerDragGesture.swift index 69c0c965..fe0102f4 100644 --- a/Shared/Player/PlayerDragGesture.swift +++ b/Shared/Player/PlayerDragGesture.swift @@ -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 diff --git a/Shared/Player/VideoPlayerView.swift b/Shared/Player/VideoPlayerView.swift index be678a8c..a4e5b6d6 100644 --- a/Shared/Player/VideoPlayerView.swift +++ b/Shared/Player/VideoPlayerView.swift @@ -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 diff --git a/Shared/Settings/PlayerControlsSettings.swift b/Shared/Settings/PlayerControlsSettings.swift index 9cf3be65..9efb612a 100644 --- a/Shared/Settings/PlayerControlsSettings.swift +++ b/Shared/Settings/PlayerControlsSettings.swift @@ -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 {