mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-04 21:41:45 +00:00
no message
This commit is contained in:
parent
d403d674e1
commit
d52005a3f2
@ -14,6 +14,7 @@
|
||||
D015F7581D1B467200E269B5 /* ActionSheetController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D015F7571D1B467200E269B5 /* ActionSheetController.swift */; };
|
||||
D015F75A1D1B46B600E269B5 /* ActionSheetControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D015F7591D1B46B600E269B5 /* ActionSheetControllerNode.swift */; };
|
||||
D02BDB021B6AC703008AFAD2 /* RuntimeUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02BDB011B6AC703008AFAD2 /* RuntimeUtils.swift */; };
|
||||
D03B0E701D6331FB00955575 /* StatusBarHost.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0E6F1D6331FB00955575 /* StatusBarHost.swift */; };
|
||||
D03BCCEB1C72AE590097A291 /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03BCCEA1C72AE590097A291 /* Theme.swift */; };
|
||||
D03E7DE41C96A90100C07816 /* NavigationShadow@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D03E7DE31C96A90100C07816 /* NavigationShadow@2x.png */; };
|
||||
D03E7DE61C96B96E00C07816 /* NavigationBarTransitionContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03E7DE51C96B96E00C07816 /* NavigationBarTransitionContainer.swift */; };
|
||||
@ -69,8 +70,6 @@
|
||||
D08E903C1D2417E000533158 /* ActionSheetButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08E903B1D2417E000533158 /* ActionSheetButtonItem.swift */; };
|
||||
D08E903E1D24187900533158 /* ActionSheetItemGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08E903D1D24187900533158 /* ActionSheetItemGroup.swift */; };
|
||||
D08E90471D243C2F00533158 /* HighlightTrackingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08E90461D243C2F00533158 /* HighlightTrackingButton.swift */; };
|
||||
D0AE2C971C94529600F2FD3C /* StatusBarUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = D0AE2C951C94529600F2FD3C /* StatusBarUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D0AE2C981C94529600F2FD3C /* StatusBarUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AE2C961C94529600F2FD3C /* StatusBarUtils.m */; };
|
||||
D0AE2CA61C94548900F2FD3C /* GenerateImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AE2CA51C94548900F2FD3C /* GenerateImage.swift */; };
|
||||
D0AE3D4D1D25C816001CCE13 /* NavigationBarTransitionState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AE3D4C1D25C816001CCE13 /* NavigationBarTransitionState.swift */; };
|
||||
D0B367201C94A53A00346D2E /* StatusBarProxyNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B3671F1C94A53A00346D2E /* StatusBarProxyNode.swift */; };
|
||||
@ -118,6 +117,7 @@
|
||||
D015F7571D1B467200E269B5 /* ActionSheetController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionSheetController.swift; sourceTree = "<group>"; };
|
||||
D015F7591D1B46B600E269B5 /* ActionSheetControllerNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionSheetControllerNode.swift; sourceTree = "<group>"; };
|
||||
D02BDB011B6AC703008AFAD2 /* RuntimeUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RuntimeUtils.swift; sourceTree = "<group>"; };
|
||||
D03B0E6F1D6331FB00955575 /* StatusBarHost.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusBarHost.swift; sourceTree = "<group>"; };
|
||||
D03BCCEA1C72AE590097A291 /* Theme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = "<group>"; };
|
||||
D03E7DE31C96A90100C07816 /* NavigationShadow@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "NavigationShadow@2x.png"; sourceTree = "<group>"; };
|
||||
D03E7DE51C96B96E00C07816 /* NavigationBarTransitionContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationBarTransitionContainer.swift; sourceTree = "<group>"; };
|
||||
@ -176,8 +176,6 @@
|
||||
D08E903B1D2417E000533158 /* ActionSheetButtonItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionSheetButtonItem.swift; sourceTree = "<group>"; };
|
||||
D08E903D1D24187900533158 /* ActionSheetItemGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionSheetItemGroup.swift; sourceTree = "<group>"; };
|
||||
D08E90461D243C2F00533158 /* HighlightTrackingButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HighlightTrackingButton.swift; sourceTree = "<group>"; };
|
||||
D0AE2C951C94529600F2FD3C /* StatusBarUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatusBarUtils.h; sourceTree = "<group>"; };
|
||||
D0AE2C961C94529600F2FD3C /* StatusBarUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatusBarUtils.m; sourceTree = "<group>"; };
|
||||
D0AE2CA51C94548900F2FD3C /* GenerateImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GenerateImage.swift; sourceTree = "<group>"; };
|
||||
D0AE3D4C1D25C816001CCE13 /* NavigationBarTransitionState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationBarTransitionState.swift; sourceTree = "<group>"; };
|
||||
D0B3671F1C94A53A00346D2E /* StatusBarProxyNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusBarProxyNode.swift; sourceTree = "<group>"; };
|
||||
@ -390,8 +388,6 @@
|
||||
D05CC3131B695A9600E235A3 /* NavigationControllerProxy.m */,
|
||||
D05CC3221B695B0700E235A3 /* NavigationBarProxy.h */,
|
||||
D05CC3231B695B0700E235A3 /* NavigationBarProxy.m */,
|
||||
D0AE2C951C94529600F2FD3C /* StatusBarUtils.h */,
|
||||
D0AE2C961C94529600F2FD3C /* StatusBarUtils.m */,
|
||||
D05CC2E41B69555800E235A3 /* CAAnimationUtils.swift */,
|
||||
D02BDB011B6AC703008AFAD2 /* RuntimeUtils.swift */,
|
||||
D06EE8441B7140FF00837186 /* Font.swift */,
|
||||
@ -436,6 +432,7 @@
|
||||
D0078A671C92B21400DF6D92 /* StatusBar.swift */,
|
||||
D0B3671F1C94A53A00346D2E /* StatusBarProxyNode.swift */,
|
||||
D03E7DFE1C96F7B400C07816 /* StatusBarManager.swift */,
|
||||
D03B0E6F1D6331FB00955575 /* StatusBarHost.swift */,
|
||||
);
|
||||
name = "Status Bar";
|
||||
sourceTree = "<group>";
|
||||
@ -517,7 +514,6 @@
|
||||
D05CC2ED1B69558A00E235A3 /* RuntimeUtils.h in Headers */,
|
||||
D05CC3201B695A9600E235A3 /* NavigationControllerProxy.h in Headers */,
|
||||
D03E7DF81C96C5F200C07816 /* NSWeakReference.h in Headers */,
|
||||
D0AE2C971C94529600F2FD3C /* StatusBarUtils.h in Headers */,
|
||||
D05CC2FB1B6955D000E235A3 /* UINavigationItem+Proxy.h in Headers */,
|
||||
D05CC3241B695B0700E235A3 /* NavigationBarProxy.h in Headers */,
|
||||
D05CC31E1B695A9600E235A3 /* UIBarButtonItem+Proxy.h in Headers */,
|
||||
@ -696,10 +692,10 @@
|
||||
D0C85DD41D1C1E6A00124894 /* ActionSheetItemGroupNode.swift in Sources */,
|
||||
D08E903E1D24187900533158 /* ActionSheetItemGroup.swift in Sources */,
|
||||
D0B367201C94A53A00346D2E /* StatusBarProxyNode.swift in Sources */,
|
||||
D0AE2C981C94529600F2FD3C /* StatusBarUtils.m in Sources */,
|
||||
D05CC2A21B69326C00E235A3 /* Window.swift in Sources */,
|
||||
D015F7541D1B0F6C00E269B5 /* SystemContainedControllerTransitionCoordinator.swift in Sources */,
|
||||
D05CC3151B695A9600E235A3 /* NavigationTransitionCoordinator.swift in Sources */,
|
||||
D03B0E701D6331FB00955575 /* StatusBarHost.swift in Sources */,
|
||||
D08E90471D243C2F00533158 /* HighlightTrackingButton.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -815,6 +811,7 @@
|
||||
D05CC2781B69316F00E235A3 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
@ -839,6 +836,7 @@
|
||||
D05CC2791B69316F00E235A3 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
@ -927,6 +925,7 @@
|
||||
D086A56F1CC0115D00F08284 /* Hockeyapp */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<key>DisplayTests.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>20</integer>
|
||||
<integer>15</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
|
||||
@ -26,7 +26,6 @@ FOUNDATION_EXPORT const unsigned char DisplayVersionString[];
|
||||
#import <Display/UIBarButtonItem+Proxy.h>
|
||||
#import <Display/NavigationControllerProxy.h>
|
||||
#import <Display/NavigationBarProxy.h>
|
||||
#import <Display/StatusBarUtils.h>
|
||||
#import <UIKit/UIGestureRecognizerSubclass.h>
|
||||
#import <Display/NSWeakReference.h>
|
||||
#import <Display/FBAnimationPerformanceTracker.h>
|
||||
|
||||
@ -20,7 +20,8 @@ class InteractiveTransitionGestureRecognizer: UIPanGestureRecognizer {
|
||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) {
|
||||
super.touchesBegan(touches, with: event)
|
||||
|
||||
self.firstLocation = touches.first!.location(in: self.view)
|
||||
let touch = touches.first!
|
||||
self.firstLocation = touch.location(in: self.view)
|
||||
}
|
||||
|
||||
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent) {
|
||||
|
||||
@ -61,12 +61,12 @@ public class StatusBar: ASDisplayNode {
|
||||
})
|
||||
}
|
||||
|
||||
func updateProxyNode() {
|
||||
func updateProxyNode(statusBar: UIView) {
|
||||
self.removeProxyNodeScheduled = false
|
||||
if let proxyNode = proxyNode {
|
||||
proxyNode.style = self.style
|
||||
} else {
|
||||
self.proxyNode = StatusBarProxyNode(style: self.style)
|
||||
self.proxyNode = StatusBarProxyNode(style: self.style, statusBar: statusBar)
|
||||
self.proxyNode!.isHidden = false
|
||||
self.addSubnode(self.proxyNode!)
|
||||
}
|
||||
|
||||
8
Display/StatusBarHost.swift
Normal file
8
Display/StatusBarHost.swift
Normal file
@ -0,0 +1,8 @@
|
||||
import UIKit
|
||||
|
||||
public protocol StatusBarHost {
|
||||
var statusBarFrame: CGRect { get }
|
||||
var statusBarStyle: UIStatusBarStyle { get set }
|
||||
var statusBarWindow: UIView? { get }
|
||||
var statusBarView: UIView? { get }
|
||||
}
|
||||
@ -21,7 +21,7 @@ private func mappedSurface(_ surface: StatusBarSurface) -> MappedStatusBarSurfac
|
||||
return MappedStatusBarSurface(statusBars: surface.statusBars.map(mapStatusBar), surface: surface)
|
||||
}
|
||||
|
||||
private func optimizeMappedSurface(_ surface: MappedStatusBarSurface) -> MappedStatusBarSurface {
|
||||
private func optimizeMappedSurface(statusBarSize: CGSize, surface: MappedStatusBarSurface) -> MappedStatusBarSurface {
|
||||
if surface.statusBars.count > 1 {
|
||||
for i in 1 ..< surface.statusBars.count {
|
||||
if surface.statusBars[i].style != surface.statusBars[i - 1].style || abs(surface.statusBars[i].frame.origin.y - surface.statusBars[i - 1].frame.origin.y) > CGFloat(FLT_EPSILON) {
|
||||
@ -31,7 +31,7 @@ private func optimizeMappedSurface(_ surface: MappedStatusBarSurface) -> MappedS
|
||||
return surface
|
||||
}
|
||||
}
|
||||
let size = UIApplication.shared.statusBarFrame.size
|
||||
let size = statusBarSize
|
||||
return MappedStatusBarSurface(statusBars: [MappedStatusBar(style: surface.statusBars[0].style, frame: CGRect(origin: CGPoint(x: 0.0, y: surface.statusBars[0].frame.origin.y), size: size), statusBar: nil)], surface: surface.surface)
|
||||
} else {
|
||||
return surface
|
||||
@ -52,14 +52,23 @@ private func displayHiddenAnimation() -> CAAnimation {
|
||||
}
|
||||
|
||||
class StatusBarManager {
|
||||
private var host: StatusBarHost
|
||||
|
||||
var surfaces: [StatusBarSurface] = [] {
|
||||
didSet {
|
||||
self.updateSurfaces(oldValue)
|
||||
}
|
||||
}
|
||||
|
||||
init(host: StatusBarHost) {
|
||||
self.host = host
|
||||
}
|
||||
|
||||
private func updateSurfaces(_ previousSurfaces: [StatusBarSurface]) {
|
||||
var mappedSurfaces = self.surfaces.map({ optimizeMappedSurface(mappedSurface($0)) })
|
||||
let statusBarFrame = self.host.statusBarFrame
|
||||
let statusBarView = self.host.statusBarView!
|
||||
|
||||
var mappedSurfaces = self.surfaces.map({ optimizeMappedSurface(statusBarSize: statusBarFrame.size, surface: mappedSurface($0)) })
|
||||
|
||||
var reduceSurfaces = true
|
||||
var reduceSurfacesStatusBarStyle: StatusBarStyle?
|
||||
@ -139,17 +148,17 @@ class StatusBarManager {
|
||||
}
|
||||
|
||||
for statusBar in visibleStatusBars {
|
||||
statusBar.updateProxyNode()
|
||||
statusBar.updateProxyNode(statusBar: statusBarView)
|
||||
}
|
||||
|
||||
if let globalStatusBar = globalStatusBar {
|
||||
let statusBarStyle: UIStatusBarStyle = globalStatusBar.0 == .Black ? .default : .lightContent
|
||||
if UIApplication.shared.statusBarStyle != statusBarStyle {
|
||||
UIApplication.shared.setStatusBarStyle(statusBarStyle, animated: false)
|
||||
if self.host.statusBarStyle != statusBarStyle {
|
||||
self.host.statusBarStyle = statusBarStyle
|
||||
}
|
||||
StatusBarUtils.statusBarWindow()!.alpha = globalStatusBar.1
|
||||
self.host.statusBarWindow?.alpha = globalStatusBar.1
|
||||
} else {
|
||||
StatusBarUtils.statusBarWindow()!.alpha = 0.0
|
||||
self.host.statusBarWindow?.alpha = 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,8 +11,8 @@ private enum StatusBarItemType {
|
||||
case Battery
|
||||
}
|
||||
|
||||
func makeStatusBarProxy(_ style: StatusBarStyle) -> StatusBarProxyNode {
|
||||
return StatusBarProxyNode(style: style)
|
||||
func makeStatusBarProxy(_ style: StatusBarStyle, statusBar: UIView) -> StatusBarProxyNode {
|
||||
return StatusBarProxyNode(style: style, statusBar: statusBar)
|
||||
}
|
||||
|
||||
private class StatusBarItemNode: ASDisplayNode {
|
||||
@ -232,6 +232,8 @@ private class StatusBarProxyNodeTimerTarget: NSObject {
|
||||
}
|
||||
|
||||
class StatusBarProxyNode: ASDisplayNode {
|
||||
private let statusBar: UIView
|
||||
|
||||
var timer: Timer?
|
||||
var style: StatusBarStyle {
|
||||
didSet {
|
||||
@ -266,8 +268,9 @@ class StatusBarProxyNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
init(style: StatusBarStyle) {
|
||||
init(style: StatusBarStyle, statusBar: UIView) {
|
||||
self.style = style
|
||||
self.statusBar = statusBar
|
||||
|
||||
super.init()
|
||||
|
||||
@ -276,8 +279,6 @@ class StatusBarProxyNode: ASDisplayNode {
|
||||
self.clipsToBounds = true
|
||||
//self.backgroundColor = UIColor.blueColor().colorWithAlphaComponent(0.2)
|
||||
|
||||
let statusBar = StatusBarUtils.statusBar()!
|
||||
|
||||
for subview in statusBar.subviews {
|
||||
let itemNode = StatusBarItemNode(style: style, targetView: subview)
|
||||
self.itemNodes.append(itemNode)
|
||||
@ -292,7 +293,7 @@ class StatusBarProxyNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
private func updateItems() {
|
||||
let statusBar = StatusBarUtils.statusBar()!
|
||||
let statusBar = self.statusBar
|
||||
|
||||
var i = 0
|
||||
while i < self.itemNodes.count {
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface StatusBarUtils : NSObject
|
||||
|
||||
+ (UIView * _Nullable)statusBarWindow;
|
||||
+ (UIView * _Nullable)statusBar;
|
||||
|
||||
@end
|
||||
@ -1,33 +0,0 @@
|
||||
#import "StatusBarUtils.h"
|
||||
|
||||
@implementation StatusBarUtils
|
||||
|
||||
+ (UIView *)statusBarWindow {
|
||||
UIWindow *window = [[UIApplication sharedApplication] valueForKey:@"statusBarWindow"];
|
||||
return window;
|
||||
//UIView *view = window.subviews.firstObject;
|
||||
//return view;
|
||||
}
|
||||
|
||||
+ (UIView *)statusBar {
|
||||
UIWindow *window = [[UIApplication sharedApplication] valueForKey:@"statusBarWindow"];
|
||||
UIView *view = window.subviews.firstObject;
|
||||
|
||||
static Class foregroundClass = nil;
|
||||
static Class batteryClass = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
foregroundClass = NSClassFromString(@"UIStatusBarForegroundView");
|
||||
batteryClass = NSClassFromString(@"UIStatusBarBatteryItemView");
|
||||
});
|
||||
|
||||
for (UIView *foreground in view.subviews) {
|
||||
if ([foreground isKindOfClass:foregroundClass]) {
|
||||
return foreground;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -170,13 +170,26 @@ import SwiftSignalKit
|
||||
}
|
||||
}
|
||||
|
||||
private var window: Window? {
|
||||
if let window = self.view.window as? Window {
|
||||
return window
|
||||
} else if let superwindow = self.view.window {
|
||||
for subview in superwindow.subviews {
|
||||
if let subview = subview as? Window {
|
||||
return subview
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
public func present(_ controller: ViewController, in context: PresentationContextType, with arguments: Any? = nil) {
|
||||
controller.presentationArguments = arguments
|
||||
switch context {
|
||||
case .current:
|
||||
self.presentationContext.present(controller)
|
||||
case .window:
|
||||
(self.view.window as? Window)?.present(controller)
|
||||
self.window?.present(controller)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +92,8 @@ private func containedLayoutForWindowLayout(_ layout: WindowLayout) -> Container
|
||||
}
|
||||
|
||||
public class Window: UIWindow {
|
||||
private let statusBarManager: StatusBarManager
|
||||
private let statusBarHost: StatusBarHost?
|
||||
private let statusBarManager: StatusBarManager?
|
||||
private var statusBarChangeObserver: AnyObject?
|
||||
private var keyboardFrameChangeObserver: AnyObject?
|
||||
|
||||
@ -107,13 +108,17 @@ public class Window: UIWindow {
|
||||
|
||||
private var statusBarHidden = false
|
||||
|
||||
public convenience init() {
|
||||
self.init(frame: UIScreen.main.bounds)
|
||||
}
|
||||
|
||||
public override init(frame: CGRect) {
|
||||
self.statusBarManager = StatusBarManager()
|
||||
self.windowLayout = WindowLayout(size: frame.size, statusBarHeight: UIApplication.shared.statusBarFrame.size.height, inputHeight: 0.0)
|
||||
public init(frame: CGRect, statusBarHost: StatusBarHost?) {
|
||||
self.statusBarHost = statusBarHost
|
||||
let statusBarHeight: CGFloat
|
||||
if let statusBarHost = statusBarHost {
|
||||
self.statusBarManager = StatusBarManager(host: statusBarHost)
|
||||
statusBarHeight = statusBarHost.statusBarFrame.size.height
|
||||
} else {
|
||||
self.statusBarManager = nil
|
||||
statusBarHeight = 20.0
|
||||
}
|
||||
self.windowLayout = WindowLayout(size: frame.size, statusBarHeight: statusBarHeight, inputHeight: 0.0)
|
||||
self.presentationContext = PresentationContext()
|
||||
|
||||
super.init(frame: frame)
|
||||
@ -244,11 +249,11 @@ public class Window: UIWindow {
|
||||
override public func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
if self.tracingStatusBarsInvalidated {
|
||||
if self.tracingStatusBarsInvalidated, let statusBarManager = statusBarManager {
|
||||
self.tracingStatusBarsInvalidated = false
|
||||
|
||||
if self.statusBarHidden {
|
||||
self.statusBarManager.surfaces = []
|
||||
statusBarManager.surfaces = []
|
||||
} else {
|
||||
var statusBarSurfaces: [StatusBarSurface] = []
|
||||
for layers in self.layer.traceableLayerSurfaces() {
|
||||
@ -263,7 +268,7 @@ public class Window: UIWindow {
|
||||
statusBarSurfaces.append(surface)
|
||||
}
|
||||
self.layer.adjustTraceableLayerTransforms(CGSize())
|
||||
self.statusBarManager.surfaces = statusBarSurfaces
|
||||
statusBarManager.surfaces = statusBarSurfaces
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,7 +321,12 @@ public class Window: UIWindow {
|
||||
if let updatingLayout = self.updatingLayout {
|
||||
self.updatingLayout = nil
|
||||
if updatingLayout.layout != self.windowLayout {
|
||||
var statusBarHeight = UIApplication.shared.statusBarFrame.size.height
|
||||
var statusBarHeight: CGFloat
|
||||
if let statusBarHost = self.statusBarHost {
|
||||
statusBarHeight = statusBarHost.statusBarFrame.size.height
|
||||
} else {
|
||||
statusBarHeight = 20.0
|
||||
}
|
||||
var statusBarWasHidden = self.statusBarHidden
|
||||
if statusBarHiddenInLandscape && updatingLayout.layout.size.width > updatingLayout.layout.size.height {
|
||||
statusBarHeight = 0.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user