diff --git a/Signal/Images.xcassets/contact-avatar.imageset/Contents.json b/Signal/Images.xcassets/contact-avatar.imageset/Contents.json new file mode 100644 index 000000000..731480b4c --- /dev/null +++ b/Signal/Images.xcassets/contact-avatar.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "profile-28@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "profile-28@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "profile-28@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Signal/Images.xcassets/contact-avatar.imageset/profile-28@1x.png b/Signal/Images.xcassets/contact-avatar.imageset/profile-28@1x.png new file mode 100644 index 000000000..6064b87bc Binary files /dev/null and b/Signal/Images.xcassets/contact-avatar.imageset/profile-28@1x.png differ diff --git a/Signal/Images.xcassets/contact-avatar.imageset/profile-28@2x.png b/Signal/Images.xcassets/contact-avatar.imageset/profile-28@2x.png new file mode 100644 index 000000000..82223704a Binary files /dev/null and b/Signal/Images.xcassets/contact-avatar.imageset/profile-28@2x.png differ diff --git a/Signal/Images.xcassets/contact-avatar.imageset/profile-28@3x.png b/Signal/Images.xcassets/contact-avatar.imageset/profile-28@3x.png new file mode 100644 index 000000000..6cc4daf05 Binary files /dev/null and b/Signal/Images.xcassets/contact-avatar.imageset/profile-28@3x.png differ diff --git a/SignalMessaging/utils/OWSContactAvatarBuilder.m b/SignalMessaging/utils/OWSContactAvatarBuilder.m index d0cd2b4a8..57230dc6a 100644 --- a/SignalMessaging/utils/OWSContactAvatarBuilder.m +++ b/SignalMessaging/utils/OWSContactAvatarBuilder.m @@ -129,16 +129,24 @@ NS_ASSUME_NONNULL_BEGIN initials = [[initials substringWithRange:stringRange] mutableCopy]; } - if (initials.length == 0) { - // We don't have a name for this contact, so we can't make an "initials" image - [initials appendString:@"#"]; - } - UIColor *color = [UIColor ows_conversationColorOrDefaultForColorName:self.colorName].themeColor; OWSAssertDebug(color); - UIImage *_Nullable image = - [OWSAvatarBuilder avatarImageWithInitials:initials backgroundColor:color diameter:self.diameter]; + UIImage *_Nullable image; + if (initials.length == 0) { + // We don't have a name for this contact, so we can't make an "initials" image. + + UIImage *icon = [UIImage imageNamed:@"contact-avatar"]; + // The contact-avatar asset is designed for the kStandardAvatarSize. + // Adjust its size to reflect the actual output diameter. + CGFloat scaling = self.diameter / (CGFloat)kStandardAvatarSize; + CGSize iconSize = CGSizeScale(icon.size, scaling); + image = + [OWSAvatarBuilder avatarImageWithIcon:icon iconSize:iconSize backgroundColor:color diameter:self.diameter]; + } else { + image = [OWSAvatarBuilder avatarImageWithInitials:initials backgroundColor:color diameter:self.diameter]; + } + if (!image) { OWSFailDebug(@"Could not generate avatar."); return nil;