CB-4930 - iOS - InAppBrowser should take into account the status bar
This commit is contained in:
parent
ce7a796cb0
commit
c7972b6cff
@ -32,6 +32,11 @@
|
||||
|
||||
#pragma mark CDVInAppBrowser
|
||||
|
||||
@interface CDVInAppBrowser () {
|
||||
UIStatusBarStyle _previousStatusBarStyle;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation CDVInAppBrowser
|
||||
|
||||
- (CDVInAppBrowser*)initWithWebView:(UIWebView*)theWebView
|
||||
@ -115,6 +120,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
_previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
|
||||
|
||||
CDVInAppBrowserOptions* browserOptions = [CDVInAppBrowserOptions parseOptions:options];
|
||||
[self.inAppBrowserViewController showLocationBar:browserOptions.location];
|
||||
@ -155,8 +161,13 @@
|
||||
}
|
||||
|
||||
if (! browserOptions.hidden) {
|
||||
|
||||
UINavigationController* nav = [[UINavigationController alloc]
|
||||
initWithRootViewController:self.inAppBrowserViewController];
|
||||
nav.navigationBarHidden = YES;
|
||||
|
||||
if (self.viewController.modalViewController != self.inAppBrowserViewController) {
|
||||
[self.viewController presentModalViewController:self.inAppBrowserViewController animated:YES];
|
||||
[self.viewController presentModalViewController:nav animated:YES];
|
||||
}
|
||||
}
|
||||
[self.inAppBrowserViewController navigateTo:url];
|
||||
@ -166,7 +177,13 @@
|
||||
{
|
||||
if ([self.inAppBrowserViewController isViewLoaded] && self.inAppBrowserViewController.view.window)
|
||||
return;
|
||||
[self.viewController presentModalViewController:self.inAppBrowserViewController animated:YES];
|
||||
|
||||
_previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
|
||||
|
||||
UINavigationController* nav = [[UINavigationController alloc]
|
||||
initWithRootViewController:self.inAppBrowserViewController];
|
||||
nav.navigationBarHidden = YES;
|
||||
[self.viewController presentModalViewController:nav animated:YES];
|
||||
}
|
||||
|
||||
- (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options
|
||||
@ -362,6 +379,10 @@
|
||||
// Don't recycle the ViewController since it may be consuming a lot of memory.
|
||||
// Also - this is required for the PDF/User-Agent bug work-around.
|
||||
self.inAppBrowserViewController = nil;
|
||||
|
||||
if (IsAtLeastiOSVersion(@"7.0")) {
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:_previousStatusBarStyle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -632,6 +653,11 @@
|
||||
[CDVUserAgentUtil releaseLock:&_userAgentLockToken];
|
||||
[super viewDidUnload];
|
||||
}
|
||||
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||
{
|
||||
return UIStatusBarStyleDefault;
|
||||
}
|
||||
|
||||
- (void)close
|
||||
{
|
||||
@ -674,6 +700,15 @@
|
||||
{
|
||||
[self.webView goForward];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
if (IsAtLeastiOSVersion(@"7.0")) {
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:[self preferredStatusBarStyle]];
|
||||
}
|
||||
|
||||
[super viewWillAppear:animated];
|
||||
}
|
||||
|
||||
#pragma mark UIWebViewDelegate
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user