diff --git a/Shared/Player/Controls/PlayerControlsLayout.swift b/Shared/Player/Controls/PlayerControlsLayout.swift index 95205f2d..0d8cc079 100644 --- a/Shared/Player/Controls/PlayerControlsLayout.swift +++ b/Shared/Player/Controls/PlayerControlsLayout.swift @@ -1,5 +1,8 @@ import Defaults import Foundation +#if os(iOS) + import UIKit +#endif enum PlayerControlsLayout: String, CaseIterable, Defaults.Serializable { case tvRegular @@ -9,6 +12,36 @@ enum PlayerControlsLayout: String, CaseIterable, Defaults.Serializable { case small case smaller + var available: Bool { + var isATV = false + var isIPad = false + #if os(tvOS) + isATV = true + #endif + #if os(iOS) + isIPad = UIDevice.current.userInterfaceIdiom == .pad + #endif + switch self { + case .tvRegular: + return isATV + case .veryLarge: + #if os(macOS) + return true + #else + return isIPad + #endif + + case .large: + return true + case .medium: + return true + case .small: + return true + case .smaller: + return true + } + } + var description: String { switch self { case .tvRegular: diff --git a/Shared/Settings/PlayerSettings.swift b/Shared/Settings/PlayerSettings.swift index 3fc5255c..e58ea1d7 100644 --- a/Shared/Settings/PlayerSettings.swift +++ b/Shared/Settings/PlayerSettings.swift @@ -197,13 +197,13 @@ struct PlayerSettings: View { @ViewBuilder private var controlsLayoutFooter: some View { #if os(iOS) - Text("Large and bigger layouts are not suitable for all devices and using them may cause controls not to fit on the screen.") + Text("Large layout is not suitable for all devices and using it may cause controls not to fit on the screen.") #endif } private var playerControlsLayoutPicker: some View { Picker("Regular Size", selection: $playerControlsLayout) { - ForEach(PlayerControlsLayout.allCases, id: \.self) { layout in + ForEach(PlayerControlsLayout.allCases.filter(\.available), id: \.self) { layout in Text(layout.description).tag(layout.rawValue) } } @@ -212,7 +212,7 @@ struct PlayerSettings: View { private var fullScreenPlayerControlsLayoutPicker: some View { Picker("Fullscreen Size", selection: $fullScreenPlayerControlsLayout) { - ForEach(PlayerControlsLayout.allCases, id: \.self) { layout in + ForEach(PlayerControlsLayout.allCases.filter(\.available), id: \.self) { layout in Text(layout.description).tag(layout.rawValue) } }