forked from mirrors/linphone-iphone
Add option save_new_contacts_as_phone_number to automatically add new contacts as phone number instead of sip address in case of phone number
This commit is contained in:
parent
7c75cfd825
commit
945fb7005c
7 changed files with 25 additions and 16 deletions
|
|
@ -38,6 +38,7 @@
|
|||
@property (nonatomic, retain) IBOutlet UIContactDetailsFooter *footerController;
|
||||
|
||||
- (BOOL)isValid;
|
||||
- (void)addPhoneField:(NSString*)number;
|
||||
- (void)addSipField:(NSString*)address;
|
||||
- (void)addEmailField:(NSString*)address;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 25de967b44e93c6156cc760be1a2058ac0238ebb
|
||||
Subproject commit 3e43b7c2c85b785b2c1c5305ae70ca9a8cbc346c
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 9ff2841b18dae9a6aa47d0b4d89f28354747d5b5
|
||||
Subproject commit a14fa22cf675d8193d90714548b17851accd0102
|
||||
Loading…
Add table
Reference in a new issue