Add window fullscreen detection and improve iPad controls spacing

Adds fullscreen detection utility to Constants.swift to determine if the window occupies the full screen on iOS. Uses this to conditionally add leading padding to player controls on iPad in non-fullscreen windows, preventing overlap with system window controls.
This commit is contained in:
Arkadiusz Fal
2025-11-15 00:04:30 +01:00
parent c47c52f8f3
commit ccdfdf781d
2 changed files with 34 additions and 0 deletions

View File

@@ -39,6 +39,32 @@ enum Constants {
#endif
}
static var isWindowFullscreen: Bool {
#if os(iOS)
guard let windowScene = UIApplication.shared.connectedScenes
.filter({ $0.activationState == .foregroundActive })
.compactMap({ $0 as? UIWindowScene })
.first,
let window = windowScene.windows.first
else {
return false
}
let screenBounds = windowScene.screen.bounds
let windowBounds = window.frame
// Check if window size matches screen bounds (accounting for small differences)
return abs(windowBounds.width - screenBounds.width) < 1 &&
abs(windowBounds.height - screenBounds.height) < 1
#else
return false
#endif
}
static var iPadSystemControlsWidth: CGFloat {
50
}
static var isTvOS: Bool {
#if os(tvOS)
true