Merge branch 'CB-8863'

This commit is contained in:
Jesse MacFadyen 2015-11-17 13:03:39 -08:00
commit 8fb2244432

View File

@ -214,14 +214,17 @@
_previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
CDVInAppBrowserNavigationController* nav = [[CDVInAppBrowserNavigationController alloc]
__block CDVInAppBrowserNavigationController* nav = [[CDVInAppBrowserNavigationController alloc]
initWithRootViewController:self.inAppBrowserViewController];
nav.orientationDelegate = self.inAppBrowserViewController;
nav.navigationBarHidden = YES;
__weak CDVInAppBrowser* weakSelf = self;
// Run later to avoid the "took a long time" log message.
dispatch_async(dispatch_get_main_queue(), ^{
if (self.inAppBrowserViewController != nil) {
[self.viewController presentViewController:nav animated:YES completion:nil];
if (weakSelf.inAppBrowserViewController != nil) {
[weakSelf.viewController presentViewController:nav animated:YES completion:nil];
}
});
}
@ -755,12 +758,14 @@
[self.navigationDelegate browserExit];
}
__weak UIViewController* weakSelf = self;
// Run later to avoid the "took a long time" log message.
dispatch_async(dispatch_get_main_queue(), ^{
if ([self respondsToSelector:@selector(presentingViewController)]) {
[[self presentingViewController] dismissViewControllerAnimated:YES completion:nil];
if ([weakSelf respondsToSelector:@selector(presentingViewController)]) {
[[weakSelf presentingViewController] dismissViewControllerAnimated:YES completion:nil];
} else {
[[self parentViewController] dismissViewControllerAnimated:YES completion:nil];
[[weakSelf parentViewController] dismissViewControllerAnimated:YES completion:nil];
}
});
}
@ -772,10 +777,11 @@
if (_userAgentLockToken != 0) {
[self.webView loadRequest:request];
} else {
__weak CDVInAppBrowser* weakSelf = self;
[CDVUserAgentUtil acquireLock:^(NSInteger lockToken) {
_userAgentLockToken = lockToken;
[CDVUserAgentUtil setUserAgent:_userAgent lockToken:lockToken];
[self.webView loadRequest:request];
[weakSelf.webView loadRequest:request];
}];
}
}