mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 08:10:59 +00:00
Bold name in reblog label
This commit is contained in:
parent
cad54a5818
commit
0c97096211
1 changed files with 14 additions and 4 deletions
|
@ -336,10 +336,20 @@ private extension StatusView {
|
||||||
let metaText = String.localizedStringWithFormat(
|
let metaText = String.localizedStringWithFormat(
|
||||||
NSLocalizedString("status.reblogged-by", comment: ""),
|
NSLocalizedString("status.reblogged-by", comment: ""),
|
||||||
viewModel.rebloggedByDisplayName)
|
viewModel.rebloggedByDisplayName)
|
||||||
let mutableMetaText = NSMutableAttributedString(string: metaText)
|
let mutableInfoText = NSMutableAttributedString(string: metaText)
|
||||||
mutableMetaText.insert(emoji: viewModel.rebloggedByDisplayNameEmoji, view: infoLabel)
|
|
||||||
mutableMetaText.resizeAttachments(toLineHeight: infoLabel.font.lineHeight)
|
let range = (mutableInfoText.string as NSString).range(of: viewModel.rebloggedByDisplayName)
|
||||||
infoLabel.attributedText = mutableMetaText
|
|
||||||
|
if range.location != NSNotFound,
|
||||||
|
let boldFontDescriptor = infoLabel.font.fontDescriptor.withSymbolicTraits([.traitBold]) {
|
||||||
|
let boldFont = UIFont(descriptor: boldFontDescriptor, size: infoLabel.font.pointSize)
|
||||||
|
|
||||||
|
mutableInfoText.setAttributes([NSAttributedString.Key.font: boldFont], range: range)
|
||||||
|
}
|
||||||
|
|
||||||
|
mutableInfoText.insert(emoji: viewModel.rebloggedByDisplayNameEmoji, view: infoLabel)
|
||||||
|
mutableInfoText.resizeAttachments(toLineHeight: infoLabel.font.lineHeight)
|
||||||
|
infoLabel.attributedText = mutableInfoText
|
||||||
infoIcon.image = UIImage(
|
infoIcon.image = UIImage(
|
||||||
systemName: "arrow.2.squarepath",
|
systemName: "arrow.2.squarepath",
|
||||||
withConfiguration: UIImage.SymbolConfiguration(scale: .small))
|
withConfiguration: UIImage.SymbolConfiguration(scale: .small))
|
||||||
|
|
Loading…
Reference in a new issue