mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Emoji improvements
This commit is contained in:
parent
089d953bb5
commit
908705fc8e
@ -139,8 +139,8 @@ func chatHistoryEntriesForView(
|
||||
contentTypeHint = .animatedEmoji
|
||||
} else if stickersEnabled && message.text.count == 1, let _ = associatedData.animatedEmojiStickers[message.text.basicEmoji.0], (message.textEntitiesAttribute?.entities.isEmpty ?? true) {
|
||||
contentTypeHint = .animatedEmoji
|
||||
} else if message.text.count < 10 && messageIsElligibleForLargeEmoji(message) {
|
||||
contentTypeHint = .largeEmoji
|
||||
} else if messageIsElligibleForLargeEmoji(message) {
|
||||
contentTypeHint = .animatedEmoji
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,10 +218,12 @@ func chatHistoryEntriesForView(
|
||||
|
||||
var contentTypeHint: ChatMessageEntryContentType = .generic
|
||||
if presentationData.largeEmoji, topMessage.media.isEmpty {
|
||||
if stickersEnabled && topMessage.text.count == 1, let _ = associatedData.animatedEmojiStickers[topMessage.text.basicEmoji.0] {
|
||||
if stickersEnabled && messageIsElligibleForLargeCustomEmoji(topMessage) {
|
||||
contentTypeHint = .animatedEmoji
|
||||
} else if stickersEnabled && topMessage.text.count == 1, let _ = associatedData.animatedEmojiStickers[topMessage.text.basicEmoji.0] {
|
||||
contentTypeHint = .animatedEmoji
|
||||
} else if messageIsElligibleForLargeEmoji(topMessage) {
|
||||
contentTypeHint = .animatedEmoji
|
||||
} else if topMessage.text.count < 10 && messageIsElligibleForLargeEmoji(topMessage) {
|
||||
contentTypeHint = .largeEmoji
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -543,13 +543,10 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
|
||||
var emojiFile: TelegramMediaFile?
|
||||
var emojiString: String?
|
||||
if let _ = item.message.textEntitiesAttribute?.entities {
|
||||
if messageIsElligibleForLargeCustomEmoji(item.message) {
|
||||
emojiString = item.message.text
|
||||
}
|
||||
if messageIsElligibleForLargeCustomEmoji(item.message) || (item.message.text.count > 1 && messageIsElligibleForLargeEmoji(item.message)) {
|
||||
emojiString = item.message.text
|
||||
}
|
||||
|
||||
|
||||
if emojiFile == nil && emojiString == nil {
|
||||
emojiFile = item.associatedData.animatedEmojiStickers[emoji]?.first?.file
|
||||
}
|
||||
@ -970,9 +967,13 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
deliveryFailedInset += 24.0
|
||||
}
|
||||
|
||||
if item.message.forwardInfo != nil || item.message.attributes.first(where: { $0 is ReplyMessageAttribute }) != nil {
|
||||
tmpWidth -= 60.0
|
||||
}
|
||||
|
||||
tmpWidth -= deliveryFailedInset
|
||||
|
||||
let maximumContentWidth = floor(tmpWidth - layoutConstants.bubble.edgeInset - layoutConstants.bubble.edgeInset - layoutConstants.bubble.contentInsets.left - layoutConstants.bubble.contentInsets.right - avatarInset)
|
||||
let maximumContentWidth = floor(tmpWidth - layoutConstants.bubble.edgeInset - layoutConstants.bubble.edgeInset - layoutConstants.bubble.contentInsets.left - layoutConstants.bubble.contentInsets.right - avatarInset) - 70.0
|
||||
|
||||
let font = Font.regular(fontSizeForEmojiString(item.message.text))
|
||||
let attributedText = stringWithAppliedEntities(item.message.text, entities: item.message.textEntitiesAttribute?.entities ?? [], baseColor: .black, linkColor: .black, baseFont: font, linkFont: font, boldFont: font, italicFont: font, boldItalicFont: font, fixedFont: font, blockQuoteFont: font, message: item.message)
|
||||
|
@ -192,7 +192,7 @@ private func matchingEmojiEntry(_ emoji: String) -> (UInt8, UInt8, UInt8)? {
|
||||
}
|
||||
|
||||
func messageIsElligibleForLargeEmoji(_ message: Message) -> Bool {
|
||||
if !message.text.isEmpty && message.text.containsOnlyEmoji && message.text.emojis.count < 6 {
|
||||
if !message.text.isEmpty && message.text.containsOnlyEmoji {
|
||||
if !(message.textEntitiesAttribute?.entities.isEmpty ?? true) {
|
||||
return false
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user