avoid using UIScreen.main
This commit is contained in:
@@ -29,7 +29,7 @@ class ExpoBlueskyContextMenuView: ExpoView, UIContextMenuInteractionDelegate {
|
|||||||
override var bounds: CGRect {
|
override var bounds: CGRect {
|
||||||
get {
|
get {
|
||||||
let b = super.bounds
|
let b = super.bounds
|
||||||
let s = UIScreen.main.scale
|
let s = self.window?.screen.scale ?? UIScreen.main.scale
|
||||||
return CGRect(
|
return CGRect(
|
||||||
x: b.origin.x,
|
x: b.origin.x,
|
||||||
y: b.origin.y,
|
y: b.origin.y,
|
||||||
|
|||||||
@@ -86,9 +86,11 @@ final class ImagePreviewController: UIViewController {
|
|||||||
|
|
||||||
/// Caps the preview to a comfortable size within the current key window.
|
/// Caps the preview to a comfortable size within the current key window.
|
||||||
private static func sizeForAspect(_ aspect: CGFloat) -> CGSize {
|
private static func sizeForAspect(_ aspect: CGFloat) -> CGSize {
|
||||||
let screen = UIScreen.main.bounds
|
let screenBounds = UIApplication.shared.connectedScenes
|
||||||
let maxW = screen.width - 32
|
.compactMap { $0 as? UIWindowScene }
|
||||||
let maxH = screen.height * 0.7
|
.first?.screen.bounds ?? UIScreen.main.bounds
|
||||||
|
let maxW = screenBounds.width - 32
|
||||||
|
let maxH = screenBounds.height * 0.7
|
||||||
var w = maxW
|
var w = maxW
|
||||||
var h = w / aspect
|
var h = w / aspect
|
||||||
if h > maxH {
|
if h > maxH {
|
||||||
|
|||||||
Reference in New Issue
Block a user