From fa57e92c5582d0edc7fc4b1f4be7f5e3380d93cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20C=C3=A9sar?= Date: Tue, 27 Dec 2016 20:32:54 +0100 Subject: [PATCH] CB-12196 (iOS) fix Status Bar Not Hiding This closes #74 --- src/ios/CDVStatusBar.h | 1 + src/ios/CDVStatusBar.m | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ios/CDVStatusBar.h b/src/ios/CDVStatusBar.h index 84f37fa..0be08cc 100644 --- a/src/ios/CDVStatusBar.h +++ b/src/ios/CDVStatusBar.h @@ -30,6 +30,7 @@ } @property (atomic, assign) BOOL statusBarOverlaysWebView; +@property (atomic, assign) BOOL statusBarVisible; - (void) overlaysWebView:(CDVInvokedUrlCommand*)command; diff --git a/src/ios/CDVStatusBar.m b/src/ios/CDVStatusBar.m index ee1d6cb..58fbc29 100644 --- a/src/ios/CDVStatusBar.m +++ b/src/ios/CDVStatusBar.m @@ -146,6 +146,8 @@ static const void *kStatusBarStyle = &kStatusBarStyle; [self.viewController.view sendSubviewToBack:fakeScrollView]; // Send it to the very back of the view heirarchy fakeScrollView.contentSize = CGSizeMake(UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.height * 2.0f); // Make the scroll view longer than the screen itself fakeScrollView.contentOffset = CGPointMake(0.0f, UIScreen.mainScreen.bounds.size.height); // Scroll down so a tap will take scroll view back to the top + + _statusBarVisible = ![UIApplication sharedApplication].isStatusBarHidden; } - (void)onReset { @@ -379,6 +381,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle; - (void) hide:(CDVInvokedUrlCommand*)command { + _statusBarVisible = NO; UIApplication* app = [UIApplication sharedApplication]; if (!app.isStatusBarHidden) @@ -411,6 +414,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle; - (void) show:(CDVInvokedUrlCommand*)command { + _statusBarVisible = YES; UIApplication* app = [UIApplication sharedApplication]; if (app.isStatusBarHidden) @@ -463,8 +467,10 @@ static const void *kStatusBarStyle = &kStatusBarStyle; CGFloat height = statusBarFrame.size.height; if (!self.statusBarOverlaysWebView) { - // CB-10158 If a full screen video is playing the status bar height will be 0, set it to 20 - frame.origin.y = height > 0 ? height: 20; + if (_statusBarVisible) { + // CB-10158 If a full screen video is playing the status bar height will be 0, set it to 20 if _statusBarVisible + frame.origin.y = height > 0 ? height: 20; + } } else { // Even if overlay is used, we want to handle in-call/recording/hotspot larger status bar frame.origin.y = height >= 20 ? height - 20 : 0;