CB-5649 - InAppBrowser overrides App's orientation
This commit is contained in:
parent
11f833b46d
commit
b9f8fcd8a9
@ -63,7 +63,7 @@
|
||||
|
||||
@end
|
||||
|
||||
@interface CDVInAppBrowserViewController : UIViewController <UIWebViewDelegate>{
|
||||
@interface CDVInAppBrowserViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{
|
||||
@private
|
||||
NSString* _userAgent;
|
||||
NSString* _prevUserAgent;
|
||||
@ -92,4 +92,10 @@
|
||||
|
||||
- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions;
|
||||
|
||||
@end
|
||||
|
||||
@interface CDVInAppBrowserNavigationController : UINavigationController
|
||||
|
||||
@property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
|
||||
|
||||
@end
|
@ -216,8 +216,9 @@
|
||||
|
||||
_previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
|
||||
|
||||
UINavigationController* nav = [[UINavigationController alloc]
|
||||
CDVInAppBrowserNavigationController* nav = [[CDVInAppBrowserNavigationController alloc]
|
||||
initWithRootViewController:self.inAppBrowserViewController];
|
||||
nav.orientationDelegate = self.inAppBrowserViewController;
|
||||
nav.navigationBarHidden = YES;
|
||||
// Run later to avoid the "took a long time" log message.
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@ -964,4 +965,37 @@
|
||||
return obj;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CDVInAppBrowserNavigationController : UINavigationController
|
||||
|
||||
#pragma mark CDVScreenOrientationDelegate
|
||||
|
||||
- (BOOL)shouldAutorotate
|
||||
{
|
||||
if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotate)]) {
|
||||
return [self.orientationDelegate shouldAutorotate];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSUInteger)supportedInterfaceOrientations
|
||||
{
|
||||
if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(supportedInterfaceOrientations)]) {
|
||||
return [self.orientationDelegate supportedInterfaceOrientations];
|
||||
}
|
||||
|
||||
return 1 << UIInterfaceOrientationPortrait;
|
||||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
||||
{
|
||||
if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)]) {
|
||||
return [self.orientationDelegate shouldAutorotateToInterfaceOrientation:interfaceOrientation];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user