[ContactDisplay] add settings to display phone only or displayName + sipAddress

This commit is contained in:
Brieuc Viel 2018-01-11 15:15:47 +01:00
parent e2ce82e131
commit 8e0270067c
6 changed files with 19 additions and 6 deletions

View file

@ -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];

View file

@ -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];

View file

@ -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)];

View file

@ -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 <UIKit/UIColor.h>

View file

@ -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)

View file

@ -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