diff --git a/Classes/LinphoneApp.xib b/Classes/LinphoneApp.xib
index ea771f481..b446fd98d 100644
--- a/Classes/LinphoneApp.xib
+++ b/Classes/LinphoneApp.xib
@@ -41,6 +41,7 @@
{320, 480}
+
-
+
0
IBCocoaTouchFramework
diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m
index ce49f55ce..6b9c27131 100644
--- a/Classes/LinphoneAppDelegate.m
+++ b/Classes/LinphoneAppDelegate.m
@@ -161,6 +161,7 @@ int __aeabi_idiv(int a, int b) {
}
- (void)setupUI {
+
if ([[LinphoneManager instance].settingsStore boolForKey:@"enable_first_login_view_preference"] == true) {
// Change to fist login view
[[PhoneMainView instance] changeCurrentView: [FirstLoginViewController compositeViewDescription]];
@@ -173,7 +174,6 @@ int __aeabi_idiv(int a, int b) {
[[PhoneMainView instance] changeCurrentView: [WizardViewController compositeViewDescription]];
}
}
-
[UIDevice currentDevice].batteryMonitoringEnabled = YES;
}
diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m
index 4790470b0..23e303f35 100644
--- a/Classes/LinphoneCoreSettingsStore.m
+++ b/Classes/LinphoneCoreSettingsStore.m
@@ -177,7 +177,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
}
[self setString:val forKey:@"media_encryption_preference"];
}
- [self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","landscape_preference", 1) forKey:@"landscape_preference"];
+ [self setString: lp_config_get_string(linphone_core_get_config(lc),"app","rotation_preference", "auto") forKey:@"rotation_preference"];
[self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","enable_first_login_view_preference", 0) forKey:@"enable_first_login_view_preference"];
[self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","debugenable_preference", 0) forKey:@"debugenable_preference"];
[self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","check_config_disable_preference", 0) forKey:@"check_config_disable_preference"];
@@ -452,8 +452,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
BOOL firstloginview = [self boolForKey:@"enable_first_login_view_preference"];
lp_config_set_int(linphone_core_get_config(lc),"app","enable_first_login_view_preference", firstloginview);
- BOOL landscape = [self boolForKey:@"landscape_preference"];
- lp_config_set_int(linphone_core_get_config(lc),"app","landscape_preference", landscape);
+ NSString *landscape = [self stringForKey:@"rotation_preference"];
+ lp_config_set_string(linphone_core_get_config(lc),"app","rotation_preference", [landscape UTF8String]);
BOOL debugmode = [self boolForKey:@"debugenable_preference"];
lp_config_set_int(linphone_core_get_config(lc),"app","debugenable_preference", debugmode);
diff --git a/Classes/LinphoneUI/UICompositeViewController.m b/Classes/LinphoneUI/UICompositeViewController.m
index 8891fad2b..5deef5c71 100644
--- a/Classes/LinphoneUI/UICompositeViewController.m
+++ b/Classes/LinphoneUI/UICompositeViewController.m
@@ -148,12 +148,13 @@
[contentViewController viewWillAppear:animated];
[tabBarViewController viewWillAppear:animated];
[stateBarViewController viewWillAppear:animated];
- [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(orientationChanged:)
- name:UIDeviceOrientationDidChangeNotification
+ name:UIDeviceOrientationDidChangeNotification
object:nil];
+ [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
+ //currentOrientation = [UIDevice currentDevice].orientation;
}
- (void)viewDidAppear:(BOOL)animated {
@@ -168,8 +169,8 @@
[contentViewController viewWillDisappear:animated];
[tabBarViewController viewWillDisappear:animated];
[stateBarViewController viewWillDisappear:animated];
- [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
+ [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIDeviceOrientationDidChangeNotification
object:nil];
@@ -211,15 +212,19 @@
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- if(currentViewDescription != nil && [[LinphoneManager instance].settingsStore boolForKey:@"landscape_preference"]) {
- if (UIInterfaceOrientationIsPortrait(interfaceOrientation) && [currentViewDescription portraitMode]) {
+ if(currentViewDescription != nil) {
+ NSString* rotationPreference = [[LinphoneManager instance].settingsStore objectForKey:@"rotation_preference"];
+ if (UIInterfaceOrientationIsPortrait(interfaceOrientation) && [currentViewDescription portraitMode] &&
+ ([rotationPreference isEqualToString:@"auto"] || [rotationPreference isEqualToString:@"portrait"])) {
return YES;
}
- if (UIInterfaceOrientationIsLandscape(interfaceOrientation) && [currentViewDescription landscapeMode]) {
+ if (UIInterfaceOrientationIsLandscape(interfaceOrientation) && [currentViewDescription landscapeMode] &&
+ ([rotationPreference isEqualToString:@"auto"] || [rotationPreference isEqualToString:@"landscape"])) {
return YES;
}
+ return NO;
}
- return NO;
+ return YES;
}
@@ -263,17 +268,63 @@
}
- (UIInterfaceOrientation)getCorrectInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- if(currentViewDescription != nil && [[LinphoneManager instance].settingsStore boolForKey:@"landscape_preference"]) {
- if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
- if ([currentViewDescription portraitMode]) {
- return interfaceOrientation;
+ if(currentViewDescription != nil) {
+ NSString* rotationPreference = [[LinphoneManager instance].settingsStore objectForKey:@"rotation_preference"];
+ if([rotationPreference isEqualToString:@"auto"]) {
+ if(currentOrientation == UIDeviceOrientationUnknown) {
+ return [UIApplication sharedApplication].statusBarOrientation;
+ }
+ if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
+ if ([currentViewDescription portraitMode]) {
+ return interfaceOrientation;
+ } else {
+ return UIInterfaceOrientationLandscapeLeft;
+ }
+ }
+ if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
+ if ([currentViewDescription landscapeMode]) {
+ return interfaceOrientation;
+ } else {
+ return UIInterfaceOrientationPortrait;
+ }
+ }
+ } else if([rotationPreference isEqualToString:@"portrait"]) {
+ if ([currentViewDescription landscapeMode]) {
+ if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
+ if(currentOrientation == UIDeviceOrientationUnknown) {
+ return [UIApplication sharedApplication].statusBarOrientation;
+ }
+ return interfaceOrientation;
+ } else {
+ if(UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
+ if(currentOrientation == UIDeviceOrientationUnknown) {
+ return [UIApplication sharedApplication].statusBarOrientation;
+ }
+ return [UIApplication sharedApplication].statusBarOrientation;
+ } else {
+ return UIInterfaceOrientationPortrait;
+ }
+ }
} else {
return UIInterfaceOrientationLandscapeLeft;
}
- }
- if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
+ } else if([rotationPreference isEqualToString:@"landscape"]) {
if ([currentViewDescription landscapeMode]) {
- return interfaceOrientation;
+ if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
+ if(currentOrientation == UIDeviceOrientationUnknown) {
+ return [UIApplication sharedApplication].statusBarOrientation;
+ }
+ return interfaceOrientation;
+ } else {
+ if(UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
+ if(currentOrientation == UIDeviceOrientationUnknown) {
+ return [UIApplication sharedApplication].statusBarOrientation;
+ }
+ return [UIApplication sharedApplication].statusBarOrientation;
+ } else {
+ return UIInterfaceOrientationLandscapeLeft;
+ }
+ }
} else {
return UIInterfaceOrientationPortrait;
}
diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m
index 61f3a0dcf..e81ec6860 100644
--- a/Classes/PhoneMainView.m
+++ b/Classes/PhoneMainView.m
@@ -85,11 +85,6 @@ static PhoneMainView* phoneMainViewInstance=nil;
[super viewDidLoad];
[self.view addSubview: mainViewController.view];
-
- if ([[UIDevice currentDevice].systemVersion doubleValue] >= 5.0) {
- UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
- [self willRotateToInterfaceOrientation:interfaceOrientation duration:0.2f];
- }
}
- (void)viewWillAppear:(BOOL)animated {
@@ -162,11 +157,14 @@ static PhoneMainView* phoneMainViewInstance=nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- return [mainViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
+ if(mainViewController != nil) {
+ return [mainViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
+ } else {
+ return YES;
+ }
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
-
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
[mainViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
}
@@ -178,6 +176,7 @@ static PhoneMainView* phoneMainViewInstance=nil;
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
+ NSLog(@"%d", fromInterfaceOrientation);
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
[mainViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
}
diff --git a/Classes/PhoneMainView.xib b/Classes/PhoneMainView.xib
index 119c7ab72..e569e57d7 100644
--- a/Classes/PhoneMainView.xib
+++ b/Classes/PhoneMainView.xib
@@ -180,7 +180,7 @@
- 216
+ 217
diff --git a/Settings/InAppSettings.bundle/Advanced.plist b/Settings/InAppSettings.bundle/Advanced.plist
index 6bec34682..13eecede9 100644
--- a/Settings/InAppSettings.bundle/Advanced.plist
+++ b/Settings/InAppSettings.bundle/Advanced.plist
@@ -16,13 +16,25 @@
DefaultValue
-
+ auto
Key
- landscape_preference
+ rotation_preference
Title
- Landscape
+ Rotation
+ Titles
+
+ Automatic
+ Portrait
+ Landscape
+
Type
- PSToggleSwitchSpecifier
+ PSMultiValueSpecifier
+ Values
+
+ auto
+ portrait
+ landscape
+
DefaultValue
diff --git a/linphone-Info.plist b/linphone-Info.plist
index 6fcc7adf1..9015e66a1 100644
--- a/linphone-Info.plist
+++ b/linphone-Info.plist
@@ -47,5 +47,19 @@
UIRequiresPersistentWiFi
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationLandscapeRight
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationPortrait
+