forked from shadowfacts/Tusker
Fix crash when action notification cell label leaks
This commit is contained in:
parent
de53e0dcd6
commit
038e4b2e4e
|
@ -60,7 +60,7 @@ class ActionNotificationGroupCollectionViewCell: UICollectionViewListCell {
|
|||
$0.adjustsFontForContentSizeCategory = true
|
||||
$0.numberOfLines = 2
|
||||
$0.lineBreakMode = .byTruncatingTail
|
||||
$0.combiner = { [unowned self] in self.updateActionLabel(names: $0) }
|
||||
$0.combiner = { [weak self] in self?.updateActionLabel(names: $0) ?? NSAttributedString() }
|
||||
}
|
||||
|
||||
private let statusContentLabel = UILabel().configure {
|
||||
|
|
|
@ -24,21 +24,18 @@ class MultiSourceEmojiLabel: UILabel, BaseEmojiLabel {
|
|||
|
||||
var attributedStrings = pairs.map { NSAttributedString(string: $0.0) }
|
||||
|
||||
func recombine() {
|
||||
if let combiner = self.combiner {
|
||||
let recombine = { [weak self] in
|
||||
if let self,
|
||||
let combiner = self.combiner {
|
||||
self.attributedText = combiner(attributedStrings)
|
||||
}
|
||||
}
|
||||
|
||||
recombine()
|
||||
|
||||
for (index, (string, emojis)) in pairs.enumerated() {
|
||||
self.replaceEmojis(in: string, emojis: emojis, identifier: identifier) { (attributedString, _) in
|
||||
attributedStrings[index] = attributedString
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let self else { return }
|
||||
recombine()
|
||||
}
|
||||
DispatchQueue.main.async(execute: recombine)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue