diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 616e2c6fe..e893b9326 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -173,12 +173,12 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); if (elem && (ai=(LinphoneAuthInfo*)elem->data)){ [self setString: linphone_auth_info_get_passwd(ai) forKey:@"password_preference"]; [self setString: linphone_auth_info_get_ha1(ai) forKey:@"ha1_preference"]; // hidden but useful if provisioned + [self setString:linphone_auth_info_get_userid(ai) forKey:@"userid_preference"]; } } { [self setString: linphone_core_get_stun_server(lc) forKey:@"stun_preference"]; - [self - setBool:linphone_core_get_firewall_policy(lc)==LinphonePolicyUseIce forKey:@"ice_preference"]; + [self setBool:linphone_core_get_firewall_policy(lc)==LinphonePolicyUseIce forKey:@"ice_preference"]; } { @@ -188,7 +188,9 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self setInteger:lp_config_get_int(conf, "audio", "codec_bitrate_limit", kLinphoneAudioVbrCodecDefaultBitrate) forKey:@"audio_codec_bitrate_limit_preference"]; } - + + [self setBool:lp_config_get_int(conf, LINPHONERC_APPLICATION_KEY, "advanced_account_preference", 0) forKey:@"advanced_account_preference"]; + { LinphoneMediaEncryption menc=linphone_core_get_media_encryption(lc); const char *val; @@ -345,6 +347,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); //mandatory parameters NSString* username = [self stringForKey:@"username_preference"]; + NSString* userID = [self stringForKey:@"userid_preference"]; NSString* domain = [self stringForKey:@"domain_preference"]; NSString* transport = [self stringForKey:@"transport_preference"]; NSString* accountHa1 = [self stringForKey:@"ha1_preference"]; @@ -397,7 +400,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); // add username password LinphoneAddress *from = linphone_address_new(identity); if (from != 0){ - info=linphone_auth_info_new(linphone_address_get_username(from),NULL,password,ha1,NULL,linphone_proxy_config_get_domain(proxyCfg)); + const char* userid_str = (userID != nil)? [userID UTF8String] : NULL; + info=linphone_auth_info_new(linphone_address_get_username(from),userid_str,password,ha1,NULL,linphone_proxy_config_get_domain(proxyCfg)); linphone_address_destroy(from); } @@ -656,7 +660,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "backgroundmode_preference", isbackgroundModeEnabled); lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "start_at_boot_preference", [self boolForKey:@"start_at_boot_preference"]); lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "autoanswer_notif_preference", [self boolForKey:@"autoanswer_notif_preference"]); - + lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "advanced_account_preference", [self boolForKey:@"advanced_account_preference"]); BOOL firstloginview = [self boolForKey:@"enable_first_login_view_preference"]; lp_config_set_int(config, LINPHONERC_APPLICATION_KEY, "enable_first_login_view_preference", firstloginview); diff --git a/Classes/SettingsViewController.m b/Classes/SettingsViewController.m index 458acc1c9..702df5c96 100644 --- a/Classes/SettingsViewController.m +++ b/Classes/SettingsViewController.m @@ -540,7 +540,23 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"console_button"]; } [settingsController setHiddenKeys:hiddenKeys animated:TRUE]; - } + } else if( [@"advanced_account_preference" compare:notif.object] == NSOrderedSame) { + BOOL advanced = [[notif.userInfo objectForKey:@"advanced_account_preference"] boolValue]; + NSMutableSet *hiddenKeys = [NSMutableSet setWithSet:[settingsController hiddenKeys]]; + + if( advanced ){ + [hiddenKeys removeObject:@"userid_preference"]; + [hiddenKeys removeObject:@"proxy_preference"]; + [hiddenKeys removeObject:@"outbound_proxy_preference"]; + [hiddenKeys removeObject:@"avpf_preference"]; + } else { + [hiddenKeys addObject:@"userid_preference"]; + [hiddenKeys addObject:@"proxy_preference"]; + [hiddenKeys addObject:@"outbound_proxy_preference"]; + [hiddenKeys addObject:@"avpf_preference"]; + } + [settingsController setHiddenKeys:hiddenKeys animated:TRUE]; + } } @@ -616,6 +632,7 @@ static UICompositeViewDescription *compositeDescription = nil; if(![LinphoneManager isLcReady]) { [LinphoneLogger log:LinphoneLoggerWarning format:@"Can't filter settings: Linphone core not read"]; } + LinphoneManager* lm = [LinphoneManager instance]; NSMutableSet *hiddenKeys = [NSMutableSet set]; #ifndef DEBUG @@ -650,7 +667,7 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"backgroundmode_preference"]; [hiddenKeys addObject:@"start_at_boot_preference"]; } else { - if(![[LinphoneManager instance] lpConfigBoolForKey:@"backgroundmode_preference"]) { + if(![lm lpConfigBoolForKey:@"backgroundmode_preference"]) { [hiddenKeys addObject:@"start_at_boot_preference"]; } } @@ -668,7 +685,7 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObjectsFromArray:[[LinphoneManager unsupportedCodecs] allObjects]]; - BOOL random_port = [[LinphoneManager instance] lpConfigBoolForKey:@"random_port_preference"]; + BOOL random_port = [lm lpConfigBoolForKey:@"random_port_preference"]; if(random_port) { [hiddenKeys addObject:@"port_preference"]; } @@ -677,21 +694,28 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"ice_preference"]; } - if(![[LinphoneManager instance] lpConfigBoolForKey:@"debugenable_preference"]) { + if(![lm lpConfigBoolForKey:@"debugenable_preference"]) { [hiddenKeys addObject:@"console_button"]; } if(![LinphoneManager runningOnIpad]) { [hiddenKeys addObject:@"preview_preference"]; } - if([[LinphoneManager instance] lpConfigBoolForKey:@"hide_run_assistant_preference"]) { + if([lm lpConfigBoolForKey:@"hide_run_assistant_preference"]) { [hiddenKeys addObject:@"wizard_button"]; } if (!linphone_core_tunnel_available()){ [hiddenKeys addObject:@"tunnel_menu"]; } - + + if( ![lm lpConfigBoolForKey:@"advanced_account_preference"] ){ + [hiddenKeys addObject:@"userid_preference"]; + [hiddenKeys addObject:@"proxy_preference"]; + [hiddenKeys addObject:@"outbound_proxy_preference"]; + [hiddenKeys addObject:@"avpf_preference"]; + } + return hiddenKeys; } diff --git a/Settings/InAppSettings.bundle/Root.plist b/Settings/InAppSettings.bundle/Root.plist index edbd83561..dccfa9342 100644 --- a/Settings/InAppSettings.bundle/Root.plist +++ b/Settings/InAppSettings.bundle/Root.plist @@ -36,6 +36,24 @@ Type PSTextFieldSpecifier + + AutocapitalizationType + None + AutocorrectionType + No + DefaultValue + + IsSecure + + Key + userid_preference + KeyboardType + Alphabet + Title + User ID + Type + PSTextFieldSpecifier + AutocapitalizationType None @@ -132,6 +150,16 @@ Type PSToggleSwitchSpecifier + + Type + PSToggleSwitchSpecifier + Title + Advanced account + Key + advanced_account_preference + DefaultValue + + Title Settings diff --git a/Settings/InAppSettings.bundle/en.lproj/Root.strings b/Settings/InAppSettings.bundle/en.lproj/Root.strings index 536d4563e..1a85d55e8 100644 --- a/Settings/InAppSettings.bundle/en.lproj/Root.strings +++ b/Settings/InAppSettings.bundle/en.lproj/Root.strings @@ -7,6 +7,9 @@ /* User name */ "User name" = "User name"; +/* User ID */ +"User ID" = "User ID"; + /* Password */ "Password" = "Password"; diff --git a/Settings/InAppSettings.bundle/fr.lproj/Root.strings b/Settings/InAppSettings.bundle/fr.lproj/Root.strings index e075895e0..89e7a7acc 100644 --- a/Settings/InAppSettings.bundle/fr.lproj/Root.strings +++ b/Settings/InAppSettings.bundle/fr.lproj/Root.strings @@ -7,6 +7,9 @@ /* User name */ "User name" = "Nom d'utilisateur"; +/* User name */ +"User ID" = "ID d'utilisateur"; + /* Password */ "Password" = "Mot de passe"; diff --git a/Settings/InAppSettings.bundle/ru.lproj/Root.strings b/Settings/InAppSettings.bundle/ru.lproj/Root.strings index 066c31782..9ab5a7195 100644 --- a/Settings/InAppSettings.bundle/ru.lproj/Root.strings +++ b/Settings/InAppSettings.bundle/ru.lproj/Root.strings @@ -7,6 +7,9 @@ /* User name */ "User name" = "Имя пользователя"; +/* User name */ +"User ID" = "ID пользователя"; + /* Password */ "Password" = "Пароль";