diff --git a/Classes/CallIncomingView.m b/Classes/CallIncomingView.m index 17cd56edf..c81d20549 100644 --- a/Classes/CallIncomingView.m +++ b/Classes/CallIncomingView.m @@ -95,9 +95,8 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)update { const LinphoneAddress *addr = linphone_call_get_remote_address(_call); - [ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr]; + [ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr withAddressLabel:_addressLabel]; char *uri = linphone_address_as_string_uri_only(addr); - _addressLabel.text = [NSString stringWithUTF8String:uri]; ms_free(uri); [_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:YES withRoundedRadius:YES]; diff --git a/Classes/CallOutgoingView.m b/Classes/CallOutgoingView.m index 4d6d6958f..292217a7b 100644 --- a/Classes/CallOutgoingView.m +++ b/Classes/CallOutgoingView.m @@ -63,9 +63,8 @@ static UICompositeViewDescription *compositeDescription = nil; } const LinphoneAddress *addr = linphone_call_get_remote_address(call); - [ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr]; + [ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr withAddressLabel:_addressLabel]; char *uri = linphone_address_as_string_uri_only(addr); - _addressLabel.text = [NSString stringWithUTF8String:uri]; ms_free(uri); [_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES]; diff --git a/Classes/HistoryDetailsView.m b/Classes/HistoryDetailsView.m index d33dbc4d7..6bd1648d3 100644 --- a/Classes/HistoryDetailsView.m +++ b/Classes/HistoryDetailsView.m @@ -144,10 +144,9 @@ static UICompositeViewDescription *compositeDescription = nil; LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog); _addContactButton.hidden = ([FastAddressBook getContactWithAddress:addr] != nil); - [ContactDisplay setDisplayNameLabel:_contactLabel forAddress:addr]; + [ContactDisplay setDisplayNameLabel:_contactLabel forAddress:addr withAddressLabel:_addressLabel]; [_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES]; char *addrURI = linphone_address_as_string_uri_only(addr); - _addressLabel.text = [NSString stringWithUTF8String:addrURI]; ms_free(addrURI); [_tableView loadDataForAddress:(callLog ? linphone_call_log_get_remote_address(callLog) : NULL)]; diff --git a/Classes/Utils/Utils.h b/Classes/Utils/Utils.h index 4fc336c75..fde7484e5 100644 --- a/Classes/Utils/Utils.h +++ b/Classes/Utils/Utils.h @@ -73,6 +73,7 @@ typedef enum { @interface ContactDisplay : NSObject + (void)setDisplayNameLabel:(UILabel *)label forContact:(Contact *)contact; + (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr; ++ (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr withAddressLabel:(UILabel*)addressLabel; @end #import diff --git a/Classes/Utils/Utils.m b/Classes/Utils/Utils.m index 5aaa54dcc..1899e3b48 100644 --- a/Classes/Utils/Utils.m +++ b/Classes/Utils/Utils.m @@ -571,6 +571,20 @@ } } ++ (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr withAddressLabel:(UILabel*)addressLabel{ + Contact *contact = [FastAddressBook getContactWithAddress:addr]; + if (contact) { + [ContactDisplay setDisplayNameLabel:label forContact:contact]; + } else { + label.text = [FastAddressBook displayNameForAddress:addr]; + } + if([LinphoneManager.instance lpConfigStringForKey:@"display_phone_only" inSection:@"app"]) + addressLabel.text = [NSString stringWithUTF8String:linphone_address_as_string_uri_only(addr)]; + else + addressLabel.hidden = TRUE; +} + + @end @implementation UIImage (squareCrop) diff --git a/Resources/linphonerc b/Resources/linphonerc index 9fe2fff69..e2861ccd8 100644 --- a/Resources/linphonerc +++ b/Resources/linphonerc @@ -13,6 +13,7 @@ start_at_boot_preference=1 stun_preference=stun.linphone.org voiceproc_preference=1 repeat_call_notification=1 +display_phone_only=0 [in_app_purchase] #set to 1 if in-app purchases are to be shown in the application