[Settings] implement Turn into Settings view + some methods updates

This commit is contained in:
Brieuc Viel 2016-08-29 16:52:59 +02:00
parent 829e40a2e3
commit 3121b1e7b7
8 changed files with 47 additions and 26 deletions

View file

@ -57,7 +57,8 @@
linphone_friend_add_phone_number(_friend, phone.UTF8String);
#endif
}
linphone_core_add_friend(LC, _friend);
if (_friend)
linphone_core_add_friend(LC, _friend);
}
linphone_friend_ref(_friend);
} else if (_friend) {

View file

@ -1,21 +1,21 @@
/* ContactDetailsViewController.m
*
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
*
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "ContactDetailsView.h"
#import "PhoneMainView.h"

View file

@ -304,7 +304,8 @@
[self setBool:[lm lpConfigBoolForKey:@"edge_opt_preference" withDefault:NO] forKey:@"edge_opt_preference"];
[self setBool:[lm lpConfigBoolForKey:@"wifi_only_preference" withDefault:NO] forKey:@"wifi_only_preference"];
[self setCString:linphone_core_get_stun_server(LC) forKey:@"stun_preference"];
[self setBool:linphone_core_get_firewall_policy(LC) == LinphonePolicyUseIce forKey:@"ice_preference"];
[self setBool:linphone_nat_policy_ice_enabled(linphone_core_get_nat_policy(LC)) forKey:@"ice_preference"];
[self setBool:linphone_nat_policy_turn_enabled(linphone_core_get_nat_policy(LC)) forKey:@"turn_preference"];
int random_port_preference = [lm lpConfigIntForKey:@"random_port_preference" withDefault:1];
[self setInteger:random_port_preference forKey:@"random_port_preference"];
int port = [lm lpConfigIntForKey:@"port_preference" withDefault:5060];
@ -713,19 +714,23 @@
[LinphoneManager.instance setupNetworkReachabilityCallback];
}
LinphoneNatPolicy *LNP = linphone_core_get_nat_policy(LC);
NSString *stun_server = [self stringForKey:@"stun_preference"];
if ([stun_server length] > 0) {
linphone_core_set_stun_server(LC, [stun_server UTF8String]);
BOOL ice_preference = [self boolForKey:@"ice_preference"];
if (ice_preference) {
linphone_core_set_firewall_policy(LC, LinphonePolicyUseIce);
} else {
linphone_core_set_firewall_policy(LC, LinphonePolicyUseStun);
}
linphone_nat_policy_enable_ice(LNP, ice_preference);
BOOL turn_preference = [self boolForKey:@"turn_preference"];
linphone_nat_policy_enable_turn(LNP, turn_preference);
} else {
linphone_nat_policy_enable_stun(LNP, FALSE);
linphone_core_set_stun_server(LC, NULL);
linphone_core_set_firewall_policy(LC, LinphonePolicyNoFirewall);
// TODO :
// Do ice and turn should be off too ?
}
linphone_core_set_nat_policy(LC, LNP);
{
NSString *audio_port_preference = [self stringForKey:@"audio_port_preference"];

View file

@ -413,6 +413,8 @@ static UICompositeViewDescription *compositeDescription = nil;
NSString *stun_server = [notif.userInfo objectForKey:@"stun_preference"];
removeFromHiddenKeys = (stun_server && ([stun_server length] > 0));
[keys addObject:@"ice_preference"];
removeFromHiddenKeys = [[notif.userInfo objectForKey:@"turn_preference"] boolValue];
[keys addObject:@"turn_preference"];
} else if ([@"debugenable_preference" compare:notif.object] == NSOrderedSame) {
int debugLevel = [[notif.userInfo objectForKey:@"debugenable_preference"] intValue];
BOOL debugEnabled = (debugLevel >= ORTP_DEBUG && debugLevel < ORTP_ERROR);
@ -596,6 +598,7 @@ static UICompositeViewDescription *compositeDescription = nil;
if (linphone_core_get_stun_server(LC) == NULL) {
[hiddenKeys addObject:@"ice_preference"];
[hiddenKeys addObject:@"turn_preference"];
}
if (![lm lpConfigBoolForKey:@"debugenable_preference"]) {

View file

@ -6,6 +6,7 @@ edge_opt_preference=0
enable_log_collect=0
file_transfer_migration_done=1
ice_preference=1
turn_preference=1
preview_preference=0
random_port_preference=1
start_at_boot_preference=1

View file

@ -6,6 +6,7 @@ edge_opt_preference=0
enable_log_collect=0
file_transfer_migration_done=1
ice_preference=1
turn_preference=1
preview_preference=1
random_port_preference=1
start_at_boot_preference=1

View file

@ -50,6 +50,16 @@
<key>DefaultValue</key>
<false/>
</dict>
<dict>
<key>Title</key>
<string>TURN</string>
<key>Key</key>
<string>turn_preference</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>DefaultValue</key>
<false/>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>

@ -1 +1 @@
Subproject commit 2aa8e46934e7df2e5ac06bbdaf1e0ce4bcc913bc
Subproject commit 9cbccee8de5686fcfed41717429c4130d13d7ee8