CB-5649 - InAppBrowser overrides App's orientation
This commit is contained in:
parent
11f833b46d
commit
b9f8fcd8a9
@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface CDVInAppBrowserViewController : UIViewController <UIWebViewDelegate>{
|
@interface CDVInAppBrowserViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{
|
||||||
@private
|
@private
|
||||||
NSString* _userAgent;
|
NSString* _userAgent;
|
||||||
NSString* _prevUserAgent;
|
NSString* _prevUserAgent;
|
||||||
@ -93,3 +93,9 @@
|
|||||||
- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions;
|
- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface CDVInAppBrowserNavigationController : UINavigationController
|
||||||
|
|
||||||
|
@property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
|
||||||
|
|
||||||
|
@end
|
@ -216,8 +216,9 @@
|
|||||||
|
|
||||||
_previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
|
_previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
|
||||||
|
|
||||||
UINavigationController* nav = [[UINavigationController alloc]
|
CDVInAppBrowserNavigationController* nav = [[CDVInAppBrowserNavigationController alloc]
|
||||||
initWithRootViewController:self.inAppBrowserViewController];
|
initWithRootViewController:self.inAppBrowserViewController];
|
||||||
|
nav.orientationDelegate = self.inAppBrowserViewController;
|
||||||
nav.navigationBarHidden = YES;
|
nav.navigationBarHidden = YES;
|
||||||
// Run later to avoid the "took a long time" log message.
|
// Run later to avoid the "took a long time" log message.
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
@ -964,4 +965,37 @@
|
|||||||
return obj;
|
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
|
@end
|
||||||
|
Loading…
Reference in New Issue
Block a user