[WIP] iOS 16 support

This commit is contained in:
Ali 2022-09-15 00:35:54 +04:00
parent 6e96f92671
commit 1a4d09a552
5 changed files with 25 additions and 1 deletions

View File

@ -141,6 +141,9 @@ public final class EmojiStatusSelectionComponent: Component {
fatalError("init(coder:) has not been implemented")
}
deinit {
}
func update(component: EmojiStatusSelectionComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<EnvironmentType>, transition: Transition) -> CGSize {
self.backgroundColor = component.backgroundColor
let panelBackgroundColor = component.backgroundColor.withMultipliedAlpha(0.85)

View File

@ -1913,7 +1913,7 @@ public final class EmojiPagerContentComponent: Component {
public let peekBehavior: EmojiContentPeekBehavior?
public let customLayout: CustomLayout?
public let externalBackground: ExternalBackground?
public let externalExpansionView: UIView?
public weak var externalExpansionView: UIView?
public let useOpaqueTheme: Bool
public init(

View File

@ -110,6 +110,10 @@ private class ApplicationStatusBarHost: StatusBarHost {
}
var keyboardWindow: UIWindow? {
if #available(iOS 16.0, *) {
return UIApplication.shared.internalGetKeyboard()
}
for window in UIApplication.shared.windows {
if isKeyboardWindow(window: window) {
return window

View File

@ -22,6 +22,7 @@ typedef NS_OPTIONS(NSUInteger, UIResponderDisableAutomaticKeyboardHandling) {
- (void)internalSetStatusBarStyle:(UIStatusBarStyle)style animated:(BOOL)animated;
- (void)internalSetStatusBarHidden:(BOOL)hidden animation:(UIStatusBarAnimation)animation;
- (UIWindow * _Nullable)internalGetKeyboard;
@end

View File

@ -139,6 +139,12 @@ static bool notyfyingShiftState = false;
@end
@protocol UIRemoteKeyboardWindowProtocol
+ (UIWindow * _Nullable)remoteKeyboardWindowForScreen:(UIScreen * _Nullable)screen create:(BOOL)create;
@end
@implementation UIViewController (Navigation)
+ (void)load
@ -155,6 +161,8 @@ static bool notyfyingShiftState = false;
[RuntimeUtils swizzleInstanceMethodOfClass:[UIViewController class] currentSelector:@selector(presentViewController:animated:completion:) newSelector:@selector(_65087dc8_presentViewController:animated:completion:)];
[RuntimeUtils swizzleInstanceMethodOfClass:[UIViewController class] currentSelector:@selector(setNeedsStatusBarAppearanceUpdate) newSelector:@selector(_65087dc8_setNeedsStatusBarAppearanceUpdate)];
[RuntimeUtils swizzleClassMethodOfClass:NSClassFromString(@"UIRemoteKeyboardWindow") currentSelector:NSSelectorFromString(@"remoteKeyboardWindowForScreen:create:") newSelector:NSSelectorFromString(@"_65087dc8_remoteKeyboardWindowForScreen:create:")];
if (@available(iOS 15.0, *)) {
[RuntimeUtils swizzleInstanceMethodOfClass:[CADisplayLink class] currentSelector:@selector(setPreferredFrameRateRange:) newSelector:@selector(_65087dc8_setPreferredFrameRateRange:)];
}
@ -291,6 +299,14 @@ static bool notyfyingShiftState = false;
#pragma clang diagnostic pop
}
- (UIWindow * _Nullable)internalGetKeyboard {
Class windowClass = NSClassFromString(@"UIRemoteKeyboardWindow");
if (!windowClass) {
return nil;
}
return [(id<UIRemoteKeyboardWindowProtocol>)windowClass remoteKeyboardWindowForScreen:[UIScreen mainScreen] create:false];
}
@end
@implementation UIView (Navigation)