forked from mirrors/linphone-iphone
Always display Avatar image the same way
This commit is contained in:
parent
29bbdeea75
commit
5987d4a456
15 changed files with 22 additions and 24 deletions
|
|
@ -99,7 +99,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
char *uri = linphone_address_as_string_uri_only(addr);
|
||||
_addressLabel.text = [NSString stringWithUTF8String:uri];
|
||||
ms_free(uri);
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:NO] bordered:YES withRoundedRadius:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:YES withRoundedRadius:YES];
|
||||
|
||||
_tabBar.hidden = linphone_call_params_video_enabled(linphone_call_get_remote_params(_call));
|
||||
_tabVideoBar.hidden = !_tabBar.hidden;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
char *uri = linphone_address_as_string_uri_only(addr);
|
||||
_addressLabel.text = [NSString stringWithUTF8String:uri];
|
||||
ms_free(uri);
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:NO] bordered:YES withRoundedRadius:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES];
|
||||
|
||||
[self hideSpeaker:LinphoneManager.instance.bluetoothAvailable];
|
||||
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
|
|||
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
|
||||
char *uri = linphone_address_as_string_uri_only(addr);
|
||||
ms_free(uri);
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:NO] bordered:YES withRoundedRadius:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:YES withRoundedRadius:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
@property BOOL added;
|
||||
|
||||
- (void)setAvatar:(UIImage *)avatar;
|
||||
- (UIImage *)avatar:(BOOL)thumbnail;
|
||||
- (UIImage *)avatar;
|
||||
- (NSString *)displayName;
|
||||
|
||||
- (instancetype)initWithPerson:(ABRecordRef)person;
|
||||
|
|
|
|||
|
|
@ -94,10 +94,9 @@
|
|||
}
|
||||
|
||||
#pragma mark - Getters
|
||||
- (UIImage *)avatar:(BOOL)thumbnail {
|
||||
- (UIImage *)avatar {
|
||||
if (_person && ABPersonHasImageData(_person)) {
|
||||
NSData *imgData = CFBridgingRelease(ABPersonCopyImageDataWithFormat(
|
||||
_person, thumbnail ? kABPersonImageFormatThumbnail : kABPersonImageFormatOriginalSize));
|
||||
NSData *imgData = CFBridgingRelease(ABPersonCopyImageDataWithFormat(_person, kABPersonImageFormatThumbnail));
|
||||
return [UIImage imageWithData:imgData];
|
||||
}
|
||||
return nil;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
}
|
||||
|
||||
LOGI(@"Reset data to contact %p", _contact);
|
||||
[_avatarImage setImage:[FastAddressBook imageForContact:_contact thumbnail:NO] bordered:NO withRoundedRadius:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForContact:_contact] bordered:NO withRoundedRadius:YES];
|
||||
[_tableController setContact:_contact];
|
||||
_emptyLabel.hidden = YES;
|
||||
_avatarImage.hidden = !_emptyLabel.hidden;
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
_deleteButton.hidden = !_emptyLabel.hidden;
|
||||
_editButton.hidden = !_emptyLabel.hidden;
|
||||
|
||||
[_avatarImage setImage:[FastAddressBook imageForContact:_contact thumbnail:NO] bordered:NO withRoundedRadius:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForContact:_contact] bordered:NO withRoundedRadius:YES];
|
||||
[ContactDisplay setDisplayNameLabel:_nameLabel forContact:_contact];
|
||||
[_tableController setContact:_contact];
|
||||
|
||||
|
|
@ -527,7 +527,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
[_contact setAvatar:image];
|
||||
|
||||
[_avatarImage setImage:[FastAddressBook imageForContact:_contact thumbnail:NO] bordered:NO withRoundedRadius:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForContact:_contact] bordered:NO withRoundedRadius:YES];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) {
|
|||
Contact *contact = subAr[indexPath.row];
|
||||
|
||||
// Cached avatar
|
||||
UIImage *image = [FastAddressBook imageForContact:contact thumbnail:true];
|
||||
UIImage *image = [FastAddressBook imageForContact:contact];
|
||||
[cell.avatarImage setImage:image bordered:NO withRoundedRadius:YES];
|
||||
[cell setContact:contact];
|
||||
[super accessoryForCell:cell atPath:indexPath];
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog);
|
||||
_addContactButton.hidden = ([FastAddressBook getContactWithAddress:addr] != nil);
|
||||
[ContactDisplay setDisplayNameLabel:_contactLabel forAddress:addr];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:NO] bordered:NO withRoundedRadius:YES];
|
||||
[_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);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
|
||||
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
|
||||
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:YES] bordered:NO withRoundedRadius:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES];
|
||||
|
||||
_durationLabel.text = [LinphoneUtils durationToString:linphone_call_get_duration(call)];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
[_pauseButton setType:UIPauseButtonType_Call call:call];
|
||||
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
|
||||
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:YES] bordered:NO withRoundedRadius:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES];
|
||||
_durationLabel.text = [LinphoneUtils durationToString:linphone_call_get_duration(call)];
|
||||
}
|
||||
[_pauseButton update];
|
||||
|
|
|
|||
|
|
@ -124,8 +124,7 @@
|
|||
if (outgoing) {
|
||||
_avatarImage.image = [LinphoneUtils selfAvatar];
|
||||
} else {
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:linphone_chat_message_get_peer_address(_message)
|
||||
thumbnail:YES]
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:linphone_chat_message_get_peer_address(_message)]
|
||||
bordered:NO
|
||||
withRoundedRadius:YES];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
}
|
||||
const LinphoneAddress *addr = linphone_chat_room_get_peer_address(chatRoom);
|
||||
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:YES] bordered:NO withRoundedRadius:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES];
|
||||
|
||||
LinphoneChatMessage *last_message = linphone_chat_room_get_user_data(chatRoom);
|
||||
if (last_message) {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@
|
|||
[displayNameLabel.text stringByAppendingString:[NSString stringWithFormat:@" (%lu)", count]];
|
||||
}
|
||||
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:YES] bordered:NO withRoundedRadius:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES];
|
||||
}
|
||||
|
||||
- (void)setEditing:(BOOL)editing {
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@
|
|||
|
||||
+ (Contact *)getContactWithAddress:(const LinphoneAddress *)address;
|
||||
|
||||
+ (UIImage *)imageForContact:(Contact *)contact thumbnail:(BOOL)thumbnail;
|
||||
+ (UIImage *)imageForAddress:(const LinphoneAddress *)addr thumbnail:(BOOL)thumbnail;
|
||||
+ (UIImage *)imageForContact:(Contact *)contact;
|
||||
+ (UIImage *)imageForAddress:(const LinphoneAddress *)addr;
|
||||
|
||||
+ (BOOL)contactHasValidSipDomain:(Contact *)person;
|
||||
+ (BOOL)isSipURIValid:(NSString*)addr;
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@
|
|||
|
||||
static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void *context);
|
||||
|
||||
+ (UIImage *)imageForContact:(Contact *)contact thumbnail:(BOOL)thumbnail {
|
||||
+ (UIImage *)imageForContact:(Contact *)contact {
|
||||
@synchronized(LinphoneManager.instance.fastAddressBook.addressBookMap) {
|
||||
UIImage *retImage = [contact avatar:thumbnail];
|
||||
UIImage *retImage = [contact avatar];
|
||||
if (retImage == nil) {
|
||||
retImage = [UIImage imageNamed:@"avatar.png"];
|
||||
}
|
||||
|
|
@ -44,11 +44,11 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
|
|||
}
|
||||
}
|
||||
|
||||
+ (UIImage *)imageForAddress:(const LinphoneAddress *)addr thumbnail:(BOOL)thumbnail {
|
||||
+ (UIImage *)imageForAddress:(const LinphoneAddress *)addr {
|
||||
if ([LinphoneManager isMyself:addr] && [LinphoneUtils hasSelfAvatar]) {
|
||||
return [LinphoneUtils selfAvatar];
|
||||
}
|
||||
return [FastAddressBook imageForContact:[FastAddressBook getContactWithAddress:addr] thumbnail:thumbnail];
|
||||
return [FastAddressBook imageForContact:[FastAddressBook getContactWithAddress:addr]];
|
||||
}
|
||||
|
||||
+ (Contact *)getContact:(NSString *)address {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue