mirror of
https://github.com/yattee/yattee.git
synced 2026-10-23 13:12:53 +00:00
Make the player pill an on/off setting on iPad, drop the dead wide-layout pill overlay
On iPad both orientations show the video next to a panel, the corner layout hosts the portrait panel in landscape, and Split View windows make "portrait" mean "narrow", so the portrait/landscape visibility split never matched what the user saw. PillVisibility now treats any mode except Never as visible on iPad, and the pill editor shows a Show pill toggle there (writes Both/Never, reads synced orientation modes as on). iPhone keeps the four-way picker. ExpandedPlayerSheet's bottomPillsOverlay was unreferenced; the floating panel renders its own pill row.
This commit is contained in:
@@ -31,10 +31,26 @@ enum PillVisibility: String, Codable, Hashable, Sendable, CaseIterable {
|
||||
}
|
||||
}
|
||||
|
||||
/// iPad treats the pill as on/off: both orientations show the video next
|
||||
/// to a panel, the corner layout hosts the portrait panel in landscape,
|
||||
/// and Split View windows make "portrait" mean "narrow" — so an
|
||||
/// orientation split never matches what the user sees.
|
||||
static var isOrientationAgnostic: Bool {
|
||||
#if os(iOS)
|
||||
return UIDevice.current.userInterfaceIdiom == .pad
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Whether the pill is enabled at all (any mode except `.never`).
|
||||
var isEnabled: Bool { self != .never }
|
||||
|
||||
/// Returns whether the pill should be visible for the given layout context.
|
||||
/// - Parameter isWideLayout: True if in wide/landscape layout, false for portrait.
|
||||
/// - Returns: Whether the pill should be shown.
|
||||
func isVisible(isWideLayout: Bool) -> Bool {
|
||||
if Self.isOrientationAgnostic { return isEnabled }
|
||||
switch self {
|
||||
case .portraitOnly:
|
||||
return !isWideLayout
|
||||
|
||||
Reference in New Issue
Block a user