Show custom emoji in profile field names
This commit is contained in:
parent
722b81dad9
commit
1cd3e6adf9
|
@ -24,6 +24,8 @@ class EmojiLabel: UILabel {
|
||||||
emojiRequests = []
|
emojiRequests = []
|
||||||
|
|
||||||
let matches = emojiRegex.matches(in: attributedText.string, options: [], range: attributedText.fullRange)
|
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 emojiImages = CachedDictionary<UIImage>(name: "EmojiLabel Emoji Images")
|
||||||
|
|
||||||
let group = DispatchGroup()
|
let group = DispatchGroup()
|
||||||
|
|
|
@ -133,13 +133,14 @@ class ProfileHeaderView: UIView {
|
||||||
fieldNamesStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
|
fieldNamesStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
|
||||||
fieldValuesStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
|
fieldValuesStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
|
||||||
for field in account.fields {
|
for field in account.fields {
|
||||||
let nameLabel = UILabel()
|
let nameLabel = EmojiLabel()
|
||||||
nameLabel.text = field.name
|
nameLabel.text = field.name
|
||||||
nameLabel.font = .boldSystemFont(ofSize: 17)
|
nameLabel.font = .boldSystemFont(ofSize: 17)
|
||||||
nameLabel.textAlignment = .right
|
nameLabel.textAlignment = .right
|
||||||
nameLabel.numberOfLines = 0
|
nameLabel.numberOfLines = 0
|
||||||
nameLabel.lineBreakMode = .byWordWrapping
|
nameLabel.lineBreakMode = .byWordWrapping
|
||||||
nameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
nameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||||
|
nameLabel.setEmojis(account.emojis, identifier: "")
|
||||||
fieldNamesStackView.addArrangedSubview(nameLabel)
|
fieldNamesStackView.addArrangedSubview(nameLabel)
|
||||||
|
|
||||||
let valueTextView = ContentTextView()
|
let valueTextView = ContentTextView()
|
||||||
|
|
Loading…
Reference in New Issue