Fix MultiSourceEmojiLabel

This commit is contained in:
Shadowfacts 2023-05-11 18:38:49 -04:00
parent b21703f6d9
commit 35b390d3c1
1 changed files with 1 additions and 5 deletions

View File

@ -22,10 +22,6 @@ class MultiSourceEmojiLabel: UILabel, BaseEmojiLabel {
func setEmojis<ID: Hashable>(pairs: [(String, [Emoji])], identifier: ID) {
guard pairs.count > 0 else { return }
self.emojiIdentifier = identifier
emojiRequests.forEach { $0.cancel() }
emojiRequests = []
var attributedStrings = pairs.map { NSAttributedString(string: $0.0) }
func recombine() {
@ -40,7 +36,7 @@ class MultiSourceEmojiLabel: UILabel, BaseEmojiLabel {
self.replaceEmojis(in: string, emojis: emojis, identifier: identifier) { (attributedString, _) in
attributedStrings[index] = attributedString
DispatchQueue.main.async { [weak self] in
guard let self = self, self.emojiIdentifier == AnyHashable(identifier) else { return }
guard let self else { return }
recombine()
}
}