mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Fix applying safe area insets on iOS
This commit is contained in:
@@ -68,9 +68,9 @@ struct PlayerBackendView: View {
|
||||
guard fullScreenLayout else { return 0 }
|
||||
|
||||
if UIDevice.current.userInterfaceIdiom != .pad {
|
||||
return verticalSizeClass == .compact ? safeAreaInsets.top : 0
|
||||
return verticalSizeClass == .compact ? SafeArea.insets.top : 0
|
||||
} else {
|
||||
return safeAreaInsets.top.isZero ? safeAreaInsets.bottom : safeAreaInsets.top
|
||||
return SafeArea.insets.top.isZero ? SafeArea.insets.bottom : SafeArea.insets.top
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,15 +78,11 @@ struct PlayerBackendView: View {
|
||||
guard fullScreenLayout else { return 0 }
|
||||
|
||||
if UIDevice.current.userInterfaceIdiom != .pad {
|
||||
return fullScreenLayout && verticalSizeClass == .compact ? safeAreaInsets.bottom : 0
|
||||
return fullScreenLayout && verticalSizeClass == .compact ? SafeArea.insets.bottom : 0
|
||||
} else {
|
||||
return fullScreenLayout ? safeAreaInsets.bottom : 0
|
||||
return fullScreenLayout ? SafeArea.insets.bottom : 0
|
||||
}
|
||||
}
|
||||
|
||||
var safeAreaInsets: UIEdgeInsets {
|
||||
UIApplication.shared.windows.first?.safeAreaInsets ?? .init()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -146,11 +146,11 @@ struct VideoPlayerView: View {
|
||||
|
||||
#if os(iOS)
|
||||
var playerWidth: Double? {
|
||||
fullScreenLayout ? (UIScreen.main.bounds.size.width - safeAreaInsets.left - safeAreaInsets.right) : nil
|
||||
fullScreenLayout ? (UIScreen.main.bounds.size.width - SafeArea.insets.left - SafeArea.insets.right) : nil
|
||||
}
|
||||
|
||||
var playerHeight: Double? {
|
||||
fullScreenLayout ? UIScreen.main.bounds.size.height - (OrientationTracker.shared.currentInterfaceOrientation.isPortrait ? (safeAreaInsets.top + safeAreaInsets.bottom) : 0) : nil
|
||||
fullScreenLayout ? UIScreen.main.bounds.size.height - (OrientationTracker.shared.currentInterfaceOrientation.isPortrait ? (SafeArea.insets.top + SafeArea.insets.bottom) : 0) : nil
|
||||
}
|
||||
|
||||
var playerEdgesIgnoringSafeArea: Edge.Set {
|
||||
@@ -403,10 +403,6 @@ struct VideoPlayerView: View {
|
||||
}
|
||||
}
|
||||
|
||||
var safeAreaInsets: UIEdgeInsets {
|
||||
UIApplication.shared.windows.first?.safeAreaInsets ?? .init()
|
||||
}
|
||||
|
||||
private func configureOrientationUpdatesBasedOnAccelerometer() {
|
||||
if OrientationTracker.shared.currentInterfaceOrientation.isLandscape,
|
||||
Defaults[.enterFullscreenInLandscape],
|
||||
|
Reference in New Issue
Block a user