diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift index a9c2181733..3a9ddba34e 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift @@ -1717,35 +1717,38 @@ public final class EmojiPagerContentComponent: Component { private let shimmerView: PortalSourceView? private var placeholderView: PortalView? private let placeholderMaskLayer: SimpleLayer + private var placeholderImageView: UIImageView? public init( context: AccountContext, file: TelegramMediaFile, shimmerView: PortalSourceView?, - color: UIColor?, + color: UIColor, size: CGSize ) { self.shimmerView = shimmerView - self.placeholderView = PortalView() self.placeholderMaskLayer = SimpleLayer() super.init(frame: CGRect()) - if let placeholderView = self.placeholderView, let shimmerView = self.shimmerView { + if let shimmerView = self.shimmerView, let placeholderView = PortalView() { + self.placeholderView = placeholderView + placeholderView.view.clipsToBounds = true placeholderView.view.layer.mask = self.placeholderMaskLayer self.addSubview(placeholderView.view) shimmerView.addPortal(view: placeholderView) } + let useDirectContent = self.placeholderView == nil Queue.concurrentDefaultQueue().async { [weak self] in - if let image = generateStickerPlaceholderImage(data: file.immediateThumbnailData, size: size, scale: min(2.0, UIScreenScale), imageSize: file.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0), backgroundColor: nil, foregroundColor: color ?? .black) { + if let image = generateStickerPlaceholderImage(data: file.immediateThumbnailData, size: size, scale: min(2.0, UIScreenScale), imageSize: file.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0), backgroundColor: nil, foregroundColor: useDirectContent ? color : .black) { Queue.mainQueue().async { guard let strongSelf = self else { return } - if let _ = color { + if useDirectContent { strongSelf.layer.contents = image.cgImage } else { strongSelf.placeholderMaskLayer.contents = image.cgImage @@ -3329,6 +3332,7 @@ public final class EmojiPagerContentComponent: Component { itemTransition = .immediate animateItemIn = !transition.animation.isImmediate + let placeholderColor = keyboardChildEnvironment.theme.chat.inputPanel.primaryTextColor.withMultipliedAlpha(0.1) itemLayer = ItemLayer( item: item, context: component.context, @@ -3337,7 +3341,7 @@ public final class EmojiPagerContentComponent: Component { staticEmoji: item.staticEmoji, cache: component.animationCache, renderer: component.animationRenderer, - placeholderColor: keyboardChildEnvironment.theme.chat.inputPanel.primaryTextColor.withMultipliedAlpha(0.1), + placeholderColor: placeholderColor, blurredBadgeColor: keyboardChildEnvironment.theme.chat.inputPanel.panelBackgroundColor.withMultipliedAlpha(0.5), pointSize: item.staticEmoji == nil ? itemPlaybackSize : itemVisibleFitSize, onUpdateDisplayPlaceholder: { [weak self] displayPlaceholder, duration in @@ -3354,7 +3358,7 @@ public final class EmojiPagerContentComponent: Component { context: component.context, file: file, shimmerView: strongSelf.shimmerHostView, - color: nil, + color: placeholderColor, size: itemNativeFitSize ) strongSelf.visibleItemPlaceholderViews[itemId] = placeholderView diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopPanelComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopPanelComponent.swift index 7b95bf7d1f..934c2bafd0 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopPanelComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopPanelComponent.swift @@ -138,9 +138,9 @@ final class EntityKeyboardAnimationTopPanelComponent: Component { } } - let iconFitSize: CGSize = itemEnvironment.isExpanded ? CGSize(width: 44.0, height: 44.0) : CGSize(width: 26.0, height: 26.0) + let iconFitSize: CGSize = itemEnvironment.isExpanded ? CGSize(width: 44.0, height: 44.0) : CGSize(width: 24.0, height: 24.0) let iconSize = dimensions.aspectFitted(iconFitSize) - let iconFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - iconSize.width) / 2.0), y: floor((iconFitSize.height - iconSize.height) / 2.0)), size: iconSize) + let iconFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - iconSize.width) / 2.0), y: floor((iconFitSize.height - iconSize.height) / 2.0)), size: iconSize).insetBy(dx: -1.0, dy: -1.0) if let itemLayer = self.itemLayer { transition.setPosition(layer: itemLayer, position: CGPoint(x: iconFrame.midX, y: iconFrame.midY)) @@ -464,7 +464,7 @@ final class EntityKeyboardStaticStickersPanelComponent: Component { self.isExpanded = isExpanded self.isActive = isActive self.baseItemSize = 42.0 - self.itemSize = isExpanded ? self.baseItemSize : 24.0 + self.itemSize = isExpanded ? self.baseItemSize : 26.0 self.itemSpacing = 4.0 self.sideInset = isExpanded ? 5.0 : 2.0 self.itemOffset = isExpanded ? -8.0 : 0.0 @@ -608,13 +608,16 @@ final class EntityKeyboardStaticStickersPanelComponent: Component { animationName = "emojicat_flags" } - let color: UIColor + let baseColor: UIColor if itemEnvironment.highlightedSubgroupId == AnyHashable(items[i].rawValue) { - color = component.theme.chat.inputMediaPanel.panelHighlightedIconColor + baseColor = component.theme.chat.inputMediaPanel.panelHighlightedIconColor } else { - color = component.theme.chat.inputMediaPanel.panelIconColor + baseColor = component.theme.chat.inputMediaPanel.panelIconColor } + let baseHighlightedColor = component.theme.chat.inputMediaPanel.panelHighlightedIconBackgroundColor.blitOver(component.theme.chat.inputPanel.panelBackgroundColor, alpha: 1.0) + let color = baseColor.blitOver(baseHighlightedColor, alpha: 1.0) + let _ = itemTransition let _ = itemView.update( transition: .immediate, diff --git a/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift index 513996dde0..7673f8f510 100644 --- a/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift @@ -407,6 +407,8 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView { if self.visibilityStatus != oldValue { self.updateVisibility() self.haptic?.enabled = self.visibilityStatus == true + + self.replyInfoNode?.visibility = self.visibilityStatus == true } } } diff --git a/submodules/TelegramUI/Sources/ChatMessageInstantVideoItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageInstantVideoItemNode.swift index b9e933d3f8..ea5cbd4cf7 100644 --- a/submodules/TelegramUI/Sources/ChatMessageInstantVideoItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageInstantVideoItemNode.swift @@ -65,6 +65,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureRecognizerD if wasVisible != isVisible { self.interactiveVideoNode.visibility = isVisible + self.replyInfoNode?.visibility = isVisible } } } diff --git a/submodules/TelegramUI/Sources/ChatMessageStickerItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageStickerItemNode.swift index 1b79c9be75..7724544ea2 100644 --- a/submodules/TelegramUI/Sources/ChatMessageStickerItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageStickerItemNode.swift @@ -57,6 +57,25 @@ class ChatMessageStickerItemNode: ChatMessageItemView { private var enableSynchronousImageApply: Bool = false + override var visibility: ListViewItemNodeVisibility { + didSet { + let wasVisible = oldValue != .none + let isVisible = self.visibility != .none + + if wasVisible != isVisible { + self.visibilityStatus = isVisible + } + } + } + + private var visibilityStatus: Bool? { + didSet { + if self.visibilityStatus != oldValue { + self.replyInfoNode?.visibility = self.visibilityStatus == true + } + } + } + required init() { self.contextSourceNode = ContextExtractedContentContainingNode() self.containerNode = ContextControllerSourceNode() diff --git a/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift b/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift index 7b23cb2613..f4a504d8eb 100644 --- a/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift +++ b/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift @@ -290,7 +290,7 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode { var colors: [String: UIColor] = [:] for colorKey in colorKeys { - colors[colorKey] = self.theme.chat.inputPanel.inputControlColor + colors[colorKey] = self.theme.chat.inputPanel.inputControlColor.blitOver(self.theme.chat.inputPanel.inputBackgroundColor, alpha: 1.0) } let animationSize = animationView.update(