Various fixes

This commit is contained in:
Ilya Laktyushin 2022-08-02 20:28:04 +03:00
parent 9dafff310d
commit be9735f670
3 changed files with 10 additions and 16 deletions

View File

@ -812,6 +812,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
var imageSize: CGSize = CGSize(width: 200.0, height: 200.0)
var imageVerticalInset: CGFloat = 0.0
var imageTopPadding: CGFloat = 0.0
var imageBottomPadding: CGFloat = 0.0
var imageHorizontalOffset: CGFloat = 0.0
if !(telegramFile?.videoThumbnails.isEmpty ?? true) {
@ -943,8 +944,9 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
imageSize = thumbnailSize.cgSize.aspectFitted(displaySize)
}
} else if let _ = emojiString {
imageVerticalInset = 4.0
imageBottomPadding = 24.0
imageVerticalInset = 0.0
imageTopPadding = 12.0
imageBottomPadding = 20.0
let baseWidth = params.width
var tmpWidth = layoutConstants.bubble.maximumWidthFill.widthFor(baseWidth)
@ -986,7 +988,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
var innerImageSize = imageSize
imageSize = CGSize(width: imageSize.width + imageInset * 2.0, height: imageSize.height + imageInset * 2.0)
let imageFrame = CGRect(origin: CGPoint(x: 0.0 + (incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + avatarInset + layoutConstants.bubble.contentInsets.left) : (params.width - params.rightInset - imageSize.width - layoutConstants.bubble.edgeInset - layoutConstants.bubble.contentInsets.left - deliveryFailedInset - imageHorizontalOffset)), y: imageVerticalInset), size: CGSize(width: imageSize.width, height: imageSize.height))
let imageFrame = CGRect(origin: CGPoint(x: 0.0 + (incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + avatarInset + layoutConstants.bubble.contentInsets.left) : (params.width - params.rightInset - imageSize.width - layoutConstants.bubble.edgeInset - layoutConstants.bubble.contentInsets.left - deliveryFailedInset - imageHorizontalOffset)), y: imageVerticalInset + imageTopPadding), size: CGSize(width: imageSize.width, height: imageSize.height))
if isEmoji {
innerImageSize = imageSize
}
@ -1136,7 +1138,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
let contentHeight: CGFloat
if let _ = emojiString {
contentHeight = imageSize.height + imageVerticalInset * 2.0 + imageBottomPadding
contentHeight = imageSize.height + imageVerticalInset * 2.0 + imageTopPadding + imageBottomPadding
} else {
contentHeight = max(imageSize.height + imageVerticalInset * 2.0, layoutConstants.image.minDimensions.height)
}

View File

@ -182,7 +182,7 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
let animationFrame = CGRect(origin: CGPoint(x: floor((size.width - width) / 2.0), y: floor((size.height - width) / 2.0) - bottomInset), size: CGSize(width: width, height: width))
var colorKeys: [String] = ["__allcolors__"]
let colorKeys: [String] = ["__allcolors__"]
let animationName: String
var animationMode: LottieAnimationComponent.AnimationItem.Mode = .still(position: .end)
@ -216,14 +216,6 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
break
}
let emojiColorKeys = [
"Ellipse 33.Ellipse 33.Stroke 1",
"Ellipse 34.Ellipse 34.Stroke 1",
"Oval.Oval.Fill 1",
"Oval 2.Oval.Fill 1",
"Path 85.Path 85.Stroke 1"
]
if let inputMode = inputMode {
switch inputMode {
case .keyboard:
@ -251,7 +243,7 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
} else if case .emoji = previousInputMode {
animationName = "input_anim_smileToSticker"
animationMode = .animating(loop: false)
colorKeys = emojiColorKeys
// colorKeys = emojiColorKeys
} else {
animationName = "input_anim_keyToSticker"
}
@ -266,7 +258,7 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
} else if case .stickers = previousInputMode {
animationName = "input_anim_stickerToSmile"
animationMode = .animating(loop: false)
colorKeys = emojiColorKeys
// colorKeys = emojiColorKeys
} else {
animationName = "input_anim_keyToSmile"
}

View File

@ -192,7 +192,7 @@ private func matchingEmojiEntry(_ emoji: String) -> (UInt8, UInt8, UInt8)? {
}
func messageIsElligibleForLargeEmoji(_ message: Message) -> Bool {
if !message.text.isEmpty && message.text.containsOnlyEmoji {
if !message.text.isEmpty && message.text.containsOnlyEmoji && message.text.emojis.count < 6 {
if !(message.textEntitiesAttribute?.entities.isEmpty ?? true) {
return false
}