Merge branch 'mkirk/profile-avatar-in-contact-picker'

This commit is contained in:
Michael Kirk 2018-05-17 11:08:35 -04:00
commit 8d1d62b610
2 changed files with 17 additions and 1 deletions

View file

@ -92,7 +92,7 @@ class ContactCell: UITableViewCell {
diameter: ContactCell.kAvatarDiameter,
contactsManager: contactsManager)
contactImageView.image = avatarBuilder.buildDefaultImage()
contactImageView.image = avatarBuilder.build()
}
}

View file

@ -724,6 +724,10 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
- (UIImage *_Nullable)systemContactImageForPhoneIdentifier:(NSString *_Nullable)identifier
{
if (identifier.length == 0) {
return nil;
}
Contact *contact = self.allContactsMap[identifier];
if (!contact) {
// If we haven't loaded system contacts yet, we may have a cached
@ -736,16 +740,28 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
- (nullable UIImage *)profileImageForPhoneIdentifier:(nullable NSString *)identifier
{
if (identifier.length == 0) {
return nil;
}
return [self.profileManager profileAvatarForRecipientId:identifier];
}
- (nullable NSData *)profileImageDataForPhoneIdentifier:(nullable NSString *)identifier
{
if (identifier.length == 0) {
return nil;
}
return [self.profileManager profileAvatarDataForRecipientId:identifier];
}
- (UIImage *_Nullable)imageForPhoneIdentifier:(NSString *_Nullable)identifier
{
if (identifier.length == 0) {
return nil;
}
// Prefer the contact image from the local address book if available
UIImage *_Nullable image = [self systemContactImageForPhoneIdentifier:identifier];