Remove rotation preferences: we now use the iOS feature of screen rotation lock. Fixes #2002

This commit is contained in:
Guillaume BIENKOWSKI 2015-01-15 12:49:54 +01:00
parent 2eb5458592
commit a6f850a8b7
5 changed files with 30 additions and 89 deletions

View file

@ -204,7 +204,6 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
}
[self setString:val forKey:@"media_encryption_preference"];
}
[self setString: lp_config_get_string(conf, LINPHONERC_APPLICATION_KEY, "rotation_preference", "auto") forKey:@"rotation_preference"];
[self setBool: lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "edge_opt_preference", 0) forKey:@"edge_opt_preference"];
[self setBool: lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "enable_first_login_view_preference", 0) forKey:@"enable_first_login_view_preference"];
[self setBool: lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "debugenable_preference", 0) forKey:@"debugenable_preference"];
@ -684,9 +683,6 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
BOOL edgeOpt = [self boolForKey:@"edge_opt_preference"];
lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "edge_opt_preference", edgeOpt);
NSString *landscape = [self stringForKey:@"rotation_preference"];
lp_config_set_string(config, LINPHONERC_APPLICATION_KEY, "rotation_preference", [landscape UTF8String]);
BOOL debugmode = [self boolForKey:@"debugenable_preference"];
lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "debugenable_preference", debugmode);
[[LinphoneManager instance] setLogsEnabled:debugmode];

View file

@ -372,76 +372,45 @@
[controller view]; // Load the view
}
}
return controller;
return controller;
}
- (UIInterfaceOrientation)getCorrectInterfaceOrientation:(UIDeviceOrientation)deviceOrientation {
if(currentViewDescription != nil) {
// If unknown return status bar orientation
if(deviceOrientation == UIDeviceOrientationUnknown && currentOrientation == UIDeviceOrientationUnknown) {
return [UIApplication sharedApplication].statusBarOrientation;
}
NSString* rotationPreference = [[LinphoneManager instance] lpConfigStringForKey:@"rotation_preference"];
if([rotationPreference isEqualToString:@"auto"]) {
// Don't rotate in UIDeviceOrientationFaceUp UIDeviceOrientationFaceDown
if(!UIDeviceOrientationIsPortrait(deviceOrientation) && !UIDeviceOrientationIsLandscape(deviceOrientation)) {
if(currentOrientation == UIDeviceOrientationUnknown) {
return [UIApplication sharedApplication].statusBarOrientation;
}
deviceOrientation = (UIDeviceOrientation)currentOrientation;
}
if (UIDeviceOrientationIsPortrait(deviceOrientation)) {
if ([currentViewDescription portraitMode]) {
return (UIInterfaceOrientation)deviceOrientation;
} else {
return UIInterfaceOrientationLandscapeLeft;
}
}
if (UIDeviceOrientationIsLandscape(deviceOrientation)) {
if ([currentViewDescription landscapeMode]) {
return (UIInterfaceOrientation)deviceOrientation;
} else {
return UIInterfaceOrientationPortrait;
}
}
} else if([rotationPreference isEqualToString:@"portrait"]) {
if ([currentViewDescription portraitMode]) {
if (UIDeviceOrientationIsPortrait(deviceOrientation)) {
return (UIInterfaceOrientation)deviceOrientation;
} else {
if(UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
return [UIApplication sharedApplication].statusBarOrientation;
} else {
return UIInterfaceOrientationPortrait;
}
}
} else {
return UIInterfaceOrientationLandscapeLeft;
}
} else if([rotationPreference isEqualToString:@"landscape"]) {
if ([currentViewDescription landscapeMode]) {
if (UIDeviceOrientationIsLandscape(deviceOrientation)) {
return (UIInterfaceOrientation)deviceOrientation;
} else {
if(UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
return [UIApplication sharedApplication].statusBarOrientation;
} else {
return UIInterfaceOrientationLandscapeLeft;
}
}
} else {
return UIInterfaceOrientationPortrait;
}
}
}
if(currentViewDescription != nil) {
// If unknown return status bar orientation
if(deviceOrientation == UIDeviceOrientationUnknown && currentOrientation == UIDeviceOrientationUnknown) {
return [UIApplication sharedApplication].statusBarOrientation;
}
// Don't rotate in UIDeviceOrientationFaceUp UIDeviceOrientationFaceDown
if(!UIDeviceOrientationIsPortrait(deviceOrientation) && !UIDeviceOrientationIsLandscape(deviceOrientation)) {
if(currentOrientation == UIDeviceOrientationUnknown) {
return [UIApplication sharedApplication].statusBarOrientation;
}
deviceOrientation = (UIDeviceOrientation)currentOrientation;
}
if (UIDeviceOrientationIsPortrait(deviceOrientation)) {
if ([currentViewDescription portraitMode]) {
return (UIInterfaceOrientation)deviceOrientation;
} else {
return UIInterfaceOrientationLandscapeLeft;
}
}
if (UIDeviceOrientationIsLandscape(deviceOrientation)) {
if ([currentViewDescription landscapeMode]) {
return (UIInterfaceOrientation)deviceOrientation;
} else {
return UIInterfaceOrientationPortrait;
}
}
}
return UIInterfaceOrientationPortrait;
}
#define IPHONE_STATUSBAR_HEIGHT 20
- (void)update: (UICompositeViewDescription*) description tabBar:(NSNumber*)tabBar stateBar:(NSNumber*)stateBar fullscreen:(NSNumber*)fullscreen {
UIViewController *oldContentViewController = self.contentViewController;
UIViewController *oldStateBarViewController = self.stateBarViewController;
UIViewController *oldTabBarViewController = self.tabBarViewController;

View file

@ -30,7 +30,6 @@ capture_dev_id=AU: Audio Unit Receiver
eq_active=0
[app]
rotation_preference=auto
animations_preference=1
edge_opt_preference=0
use_system_contacts=0

View file

@ -30,7 +30,6 @@ capture_dev_id=AU: Audio Unit Receiver
eq_active=0
[app]
rotation_preference=auto
animations_preference=1
edge_opt_preference=0
use_system_contacts=0

View file

@ -52,28 +52,6 @@
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<string>auto</string>
<key>Key</key>
<string>rotation_preference</string>
<key>Title</key>
<string>Rotation</string>
<key>Titles</key>
<array>
<string>Automatic</string>
<string>Portrait</string>
<string>Landscape</string>
</array>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Values</key>
<array>
<string>auto</string>
<string>portrait</string>
<string>landscape</string>
</array>
</dict>
<dict>
<key>DefaultValue</key>
<true/>