CB-12196 (iOS) fix Status Bar Not Hiding

This closes #74
This commit is contained in:
Julio César 2016-12-27 20:32:54 +01:00 committed by Steve Gill
parent 3dd497135f
commit aebe3c60bf
2 changed files with 9 additions and 2 deletions

View File

@ -30,6 +30,7 @@
} }
@property (atomic, assign) BOOL statusBarOverlaysWebView; @property (atomic, assign) BOOL statusBarOverlaysWebView;
@property (atomic, assign) BOOL statusBarVisible;
- (void) overlaysWebView:(CDVInvokedUrlCommand*)command; - (void) overlaysWebView:(CDVInvokedUrlCommand*)command;

View File

@ -146,6 +146,8 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
[self.viewController.view sendSubviewToBack:fakeScrollView]; // Send it to the very back of the view heirarchy [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.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 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 { - (void)onReset {
@ -379,6 +381,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
- (void) hide:(CDVInvokedUrlCommand*)command - (void) hide:(CDVInvokedUrlCommand*)command
{ {
_statusBarVisible = NO;
UIApplication* app = [UIApplication sharedApplication]; UIApplication* app = [UIApplication sharedApplication];
if (!app.isStatusBarHidden) if (!app.isStatusBarHidden)
@ -411,6 +414,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
- (void) show:(CDVInvokedUrlCommand*)command - (void) show:(CDVInvokedUrlCommand*)command
{ {
_statusBarVisible = YES;
UIApplication* app = [UIApplication sharedApplication]; UIApplication* app = [UIApplication sharedApplication];
if (app.isStatusBarHidden) if (app.isStatusBarHidden)
@ -463,8 +467,10 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
CGFloat height = statusBarFrame.size.height; CGFloat height = statusBarFrame.size.height;
if (!self.statusBarOverlaysWebView) { if (!self.statusBarOverlaysWebView) {
// 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; // 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 { } else {
// Even if overlay is used, we want to handle in-call/recording/hotspot larger status bar // Even if overlay is used, we want to handle in-call/recording/hotspot larger status bar
frame.origin.y = height >= 20 ? height - 20 : 0; frame.origin.y = height >= 20 ? height - 20 : 0;