diff --git a/Classes/ContactDetailsTableViewController.h b/Classes/ContactDetailsTableViewController.h index 7d804793e..d4ed1da3e 100644 --- a/Classes/ContactDetailsTableViewController.h +++ b/Classes/ContactDetailsTableViewController.h @@ -38,6 +38,7 @@ @property (nonatomic, retain) IBOutlet UIContactDetailsFooter *footerController; - (BOOL)isValid; +- (void)addPhoneField:(NSString*)number; - (void)addSipField:(NSString*)address; - (void)addEmailField:(NSString*)address; diff --git a/Classes/ContactDetailsTableViewController.m b/Classes/ContactDetailsTableViewController.m index 9e929611c..9be9e4e48 100644 --- a/Classes/ContactDetailsTableViewController.m +++ b/Classes/ContactDetailsTableViewController.m @@ -481,6 +481,12 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe [headerController setContact:contact]; } +- (void)addPhoneField:(NSString*)number { + int i = 0; + while(i < ContactSections_MAX && contactSections[i] != ContactSections_Number) ++i; + [self addEntry:[self tableView] section:i animated:FALSE value:number]; +} + - (void)addSipField:(NSString*)address { int i = 0; while(i < ContactSections_MAX && contactSections[i] != ContactSections_Sip) ++i; diff --git a/Classes/ContactDetailsViewController.m b/Classes/ContactDetailsViewController.m index a9edf62a0..eb038eb3e 100644 --- a/Classes/ContactDetailsViewController.m +++ b/Classes/ContactDetailsViewController.m @@ -159,18 +159,21 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf [self resetData]; contact = ABPersonCreate(); [tableController setContact:contact]; - if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_contacts_emails_preference"] == true) { - LinphoneAddress *linphoneAddress = linphone_address_new([address cStringUsingEncoding:[NSString defaultCStringEncoding]]); - NSString *username = [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)]; - if ([username rangeOfString:@"@"].length > 0) { - [tableController addEmailField:username]; - } else { - [tableController addSipField:address]; - } - linphone_address_destroy(linphoneAddress); - } else { - [tableController addSipField:address]; - } + + LinphoneAddress *linphoneAddress = linphone_address_new([address cStringUsingEncoding:[NSString defaultCStringEncoding]]); + NSString *username = [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)]; + + if (([username rangeOfString:@"@"].length > 0) && + ([[LinphoneManager instance] lpConfigBoolForKey:@"show_contacts_emails_preference"] == true)) { + [tableController addEmailField:username]; + } else if ((linphone_proxy_config_is_phone_number(NULL, [username UTF8String])) && + ([[LinphoneManager instance] lpConfigBoolForKey:@"save_new_contacts_as_phone_number"] == true)) { + [tableController addPhoneField:username]; + } else { + [tableController addSipField:address]; + } + linphone_address_destroy(linphoneAddress); + [self enableEdit:FALSE]; [[tableController tableView] reloadData]; } diff --git a/Classes/SettingsViewController.m b/Classes/SettingsViewController.m index 2810bf897..c860ee322 100644 --- a/Classes/SettingsViewController.m +++ b/Classes/SettingsViewController.m @@ -350,7 +350,6 @@ - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { [UINavigationControllerEx removeBackground:viewController.view]; - UIViewController *oldTopViewController = self.topViewController; [viewController viewWillAppear:animated]; // Force view UILabel *labelTitleView = [[UILabel alloc] init]; diff --git a/Resources/linphonerc-factory b/Resources/linphonerc-factory index 1ab74d64c..c3064bf5f 100644 --- a/Resources/linphonerc-factory +++ b/Resources/linphonerc-factory @@ -53,4 +53,4 @@ display_filter_auto_rotate=0 [app] #contact_display_username_only=1 -#contact_filter_on_default_domain=1 +#contact_filter_on_default_domain=1 \ No newline at end of file diff --git a/submodules/belle-sip b/submodules/belle-sip index 25de967b4..3e43b7c2c 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit 25de967b44e93c6156cc760be1a2058ac0238ebb +Subproject commit 3e43b7c2c85b785b2c1c5305ae70ca9a8cbc346c diff --git a/submodules/linphone b/submodules/linphone index 9ff2841b1..a14fa22cf 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 9ff2841b18dae9a6aa47d0b4d89f28354747d5b5 +Subproject commit a14fa22cf675d8193d90714548b17851accd0102