From 7a5f5476dbada9efcd6fcd4bbf889d8f5df4d998 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Tue, 17 Jul 2018 13:40:54 -0600 Subject: [PATCH 1/2] rename to avoid confusion --- SignalMessaging/Views/OWSNavigationBar.swift | 2 +- SignalMessaging/utils/OWSWindowManager.h | 2 +- SignalMessaging/utils/OWSWindowManager.m | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SignalMessaging/Views/OWSNavigationBar.swift b/SignalMessaging/Views/OWSNavigationBar.swift index 24fe46f1d..fdc747df7 100644 --- a/SignalMessaging/Views/OWSNavigationBar.swift +++ b/SignalMessaging/Views/OWSNavigationBar.swift @@ -21,7 +21,7 @@ public class OWSNavigationBar: UINavigationBar { @objc public var callBannerHeight: CGFloat { - return OWSWindowManagerCallScreenHeight() + return OWSWindowManagerCallBannerHeight() } @objc diff --git a/SignalMessaging/utils/OWSWindowManager.h b/SignalMessaging/utils/OWSWindowManager.h index 4fee1784d..f8117d22c 100644 --- a/SignalMessaging/utils/OWSWindowManager.h +++ b/SignalMessaging/utils/OWSWindowManager.h @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - extern NSString *const OWSWindowManagerCallDidChangeNotification; -const CGFloat OWSWindowManagerCallScreenHeight(void); +const CGFloat OWSWindowManagerCallBannerHeight(void); extern const UIWindowLevel UIWindowLevel_Background; diff --git a/SignalMessaging/utils/OWSWindowManager.m b/SignalMessaging/utils/OWSWindowManager.m index 82cf86f3e..f1a9fd6f8 100644 --- a/SignalMessaging/utils/OWSWindowManager.m +++ b/SignalMessaging/utils/OWSWindowManager.m @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN NSString *const OWSWindowManagerCallDidChangeNotification = @"OWSWindowManagerCallDidChangeNotification"; -const CGFloat OWSWindowManagerCallScreenHeight(void) +const CGFloat OWSWindowManagerCallBannerHeight(void) { if ([UIDevice currentDevice].isIPhoneX) { // On an iPhoneX, the system return-to-call banner has been replaced by a much subtler green @@ -175,7 +175,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void) - (void)didChangeStatusBarFrame:(NSNotification *)notification { CGRect newFrame = self.returnToCallWindow.frame; - newFrame.size.height = OWSWindowManagerCallScreenHeight(); + newFrame.size.height = OWSWindowManagerCallBannerHeight(); DDLogDebug(@"%@ StatusBar changed frames - updating returnToCallWindowFrame: %@", self.logTag, @@ -195,7 +195,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void) // "Return to call" should remain at the top of the screen. CGRect windowFrame = UIScreen.mainScreen.bounds; - windowFrame.size.height = OWSWindowManagerCallScreenHeight(); + windowFrame.size.height = OWSWindowManagerCallBannerHeight(); UIWindow *window = [[UIWindow alloc] initWithFrame:windowFrame]; window.hidden = YES; window.windowLevel = UIWindowLevel_ReturnToCall(); From 11fc674ef406bce665cb03f77f88140126503f02 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Tue, 17 Jul 2018 13:41:03 -0600 Subject: [PATCH 2/2] Avoid blur as overly-tall navigation bar lingers after dismissal. Use the precise status bar height. --- SignalMessaging/Views/OWSNavigationBar.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SignalMessaging/Views/OWSNavigationBar.swift b/SignalMessaging/Views/OWSNavigationBar.swift index fdc747df7..cab3b561c 100644 --- a/SignalMessaging/Views/OWSNavigationBar.swift +++ b/SignalMessaging/Views/OWSNavigationBar.swift @@ -62,7 +62,9 @@ public class OWSNavigationBar: UINavigationBar { // so we have to set a zindex to avoid obscuring navbar title/buttons. blurEffectView.layer.zPosition = -1 - blurEffectView.autoPinEdgesToSuperviewEdges(with: UIEdgeInsets(top: -100, left: 0, bottom: 0, right: 0)) + // navbar frame doesn't account for statusBar, so, same as the built-in navbar background, we need to exceed + // the navbar bounds to have the blur extend up and behind the status bar. + blurEffectView.autoPinEdgesToSuperviewEdges(with: UIEdgeInsets(top: -statusBarHeight, left: 0, bottom: 0, right: 0)) } NotificationCenter.default.addObserver(self, selector: #selector(callDidChange), name: .OWSWindowManagerCallDidChange, object: nil)