Increase size of bubble text when it's only composed of emojis

This commit is contained in:
benoit.martins 2023-04-07 11:12:18 +02:00 committed by QuentinArguillere
parent c619d61d8c
commit 67554b43f4

View file

@ -800,6 +800,18 @@ class MultilineMessageCell: UICollectionViewCell, UICollectionViewDataSource, UI
imagesGridCollectionViewNil += 1
}
if (content.utf8Text.trimmingCharacters(in: .whitespacesAndNewlines).unicodeScalars.first?.properties.isEmojiPresentation == true){
var onlyEmojis = true
content.utf8Text.trimmingCharacters(in: .whitespacesAndNewlines).unicodeScalars.forEach { emoji in
if !emoji.properties.isEmojiPresentation && !emoji.properties.isWhitespace{
onlyEmojis = false
}
}
if onlyEmojis {
label.font = label.font.withSize(51)
}
}
NSLayoutConstraint.deactivate(labelHiddenConstraints)
label.isHidden = false