Show custom emoji in profile field names

This commit is contained in:
Shadowfacts 2020-08-16 15:05:58 -04:00
parent 722b81dad9
commit 1cd3e6adf9
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 4 additions and 1 deletions

View File

@ -24,6 +24,8 @@ class EmojiLabel: UILabel {
emojiRequests = []
let matches = emojiRegex.matches(in: attributedText.string, options: [], range: attributedText.fullRange)
guard !matches.isEmpty else { return }
let emojiImages = CachedDictionary<UIImage>(name: "EmojiLabel Emoji Images")
let group = DispatchGroup()

View File

@ -133,13 +133,14 @@ class ProfileHeaderView: UIView {
fieldNamesStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
fieldValuesStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
for field in account.fields {
let nameLabel = UILabel()
let nameLabel = EmojiLabel()
nameLabel.text = field.name
nameLabel.font = .boldSystemFont(ofSize: 17)
nameLabel.textAlignment = .right
nameLabel.numberOfLines = 0
nameLabel.lineBreakMode = .byWordWrapping
nameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
nameLabel.setEmojis(account.emojis, identifier: "")
fieldNamesStackView.addArrangedSubview(nameLabel)
let valueTextView = ContentTextView()