mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Limit available controls layout
This commit is contained in:
@@ -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:
|
||||
|
Reference in New Issue
Block a user