Merge branch 'charlesmchen/conversationColorsDefaultAvatarTextSize'

pull/1/head
Matthew Chen 7 years ago
commit 3c8639b8ad

@ -64,7 +64,7 @@ typedef void (^OWSAvatarDrawBlock)(CGContextRef context);
[self drawInitialsInAvatar:face [self drawInitialsInAvatar:face
textColor:self.avatarForegroundColor textColor:self.avatarForegroundColor
font:self.avatarTextFont font:[self avatarTextFontForDiameter:diameter]
diameter:diameter]; diameter:diameter];
}]; }];
} }
@ -74,9 +74,11 @@ typedef void (^OWSAvatarDrawBlock)(CGContextRef context);
return (Theme.isDarkThemeEnabled ? UIColor.ows_gray05Color : UIColor.ows_whiteColor); return (Theme.isDarkThemeEnabled ? UIColor.ows_gray05Color : UIColor.ows_whiteColor);
} }
+ (UIFont *)avatarTextFont + (UIFont *)avatarTextFontForDiameter:(NSUInteger)diameter
{ {
return [UIFont ows_mediumFontWithSize:20.f]; // Adapt the font size to reflect the diameter.
CGFloat fontSize = 20.f * diameter / kStandardAvatarSize;
return [UIFont ows_mediumFontWithSize:fontSize];
} }
+ (nullable UIImage *)avatarImageWithInitials:(NSString *)initials + (nullable UIImage *)avatarImageWithInitials:(NSString *)initials
@ -86,7 +88,7 @@ typedef void (^OWSAvatarDrawBlock)(CGContextRef context);
return [self avatarImageWithInitials:initials return [self avatarImageWithInitials:initials
backgroundColor:backgroundColor backgroundColor:backgroundColor
textColor:self.avatarForegroundColor textColor:self.avatarForegroundColor
font:self.avatarTextFont font:[self avatarTextFontForDiameter:diameter]
diameter:diameter]; diameter:diameter];
} }

Loading…
Cancel
Save