Fix various iPadOS bugs

This commit is contained in:
Lior Halphon 2025-06-29 20:17:05 +03:00
parent ae2d68aaf3
commit 69bb4c3e95
2 changed files with 10 additions and 2 deletions

View File

@ -12,6 +12,10 @@ static double StatusBarHeight(void)
UIEdgeInsets insets = window.safeAreaInsets;
ret = MAX(MAX(insets.left, insets.right), MAX(insets.top, insets.bottom)) ?: 20;
[window setHidden:true];
if (!ret && [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
ret = 32; // iPadOS is buggy af
}
NSLog(@"height = %f", ret);
}
});
return ret;
@ -47,7 +51,7 @@ static bool HasHomeBar(void)
}
_minY = StatusBarHeight() * _factor;
_cutout = _minY <= 24 * _factor? 0 : _minY;
_cutout = (_minY <= 24 * _factor || [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)? 0 : _minY;
if (HasHomeBar()) {
_homeBar = 21 * _factor;

View File

@ -156,8 +156,12 @@ static NSString *const tips[] = {
limitedToNumberOfLines:3].size;
size.width = ceil(size.width);
_tipLabel.frame = (CGRect){{8, 8}, size};
unsigned topInset = view.window.safeAreaInsets.top;
if (!topInset && [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
topInset = 32; // iPadOS is buggy af
}
_effectView.frame = (CGRect) {
{round((outerSize.width - size.width - 16) / 2), view.window.safeAreaInsets.top + 12},
{round((outerSize.width - size.width - 16) / 2), topInset + 12},
{size.width + 16, size.height + 16}
};
}