Dark theme improvements

This commit is contained in:
Ilya Laktyushin 2022-10-19 21:23:10 +03:00
parent 4780bd8912
commit a645b57563
9 changed files with 125 additions and 37 deletions

View File

@ -60,6 +60,8 @@ public enum ChatMessageBackgroundType: Equatable {
}
public class ChatMessageBackground: ASDisplayNode {
public weak var backdropNode: ASDisplayNode?
public private(set) var type: ChatMessageBackgroundType?
private var currentHighlighted: Bool?
private var hasWallpaper: Bool?
@ -116,7 +118,7 @@ public class ChatMessageBackground: ASDisplayNode {
self.backgroundNode = backgroundNode
self.hasWallpaper = hasWallpaper
let image: UIImage?
var image: UIImage?
switch type {
case .none:
@ -227,7 +229,7 @@ public class ChatMessageBackground: ASDisplayNode {
tempLayer.contentsGravity = self.imageNode.layer.contentsGravity
tempLayer.contentsCenter = self.imageNode.layer.contentsCenter
tempLayer.frame = self.bounds
tempLayer.frame = self.imageNode.frame
self.layer.insertSublayer(tempLayer, above: self.imageNode.layer)
transition.updateAlpha(layer: tempLayer, alpha: 0.0, completion: { [weak tempLayer] _ in
tempLayer?.removeFromSuperlayer()
@ -246,9 +248,11 @@ public class ChatMessageBackground: ASDisplayNode {
tempLayer.rasterizationScale = self.imageNode.layer.rasterizationScale
tempLayer.contentsGravity = self.imageNode.layer.contentsGravity
tempLayer.contentsCenter = self.imageNode.layer.contentsCenter
tempLayer.compositingFilter = self.imageNode.layer.compositingFilter
tempLayer.frame = self.bounds
self.layer.insertSublayer(tempLayer, above: self.imageNode.layer)
tempLayer.frame = self.imageNode.frame
self.imageNode.supernode?.layer.insertSublayer(tempLayer, above: self.imageNode.layer)
transition.updateAlpha(layer: tempLayer, alpha: 0.0, completion: { [weak tempLayer] _ in
tempLayer?.removeFromSuperlayer()
})
@ -257,6 +261,19 @@ public class ChatMessageBackground: ASDisplayNode {
}
self.imageNode.image = image
if highlighted && maskMode, let backdropNode = self.backdropNode {
self.imageNode.layer.compositingFilter = "overlayBlendMode"
self.imageNode.alpha = 1.0
backdropNode.addSubnode(self.imageNode)
} else {
self.imageNode.layer.compositingFilter = nil
self.imageNode.alpha = 1.0
if self.imageNode.supernode != self {
self.addSubnode(self.imageNode)
}
}
self.outlineImageNode.image = outlineImage
}

View File

@ -206,7 +206,7 @@ public func customizeDefaultDarkPresentationTheme(theme: PresentationTheme, edit
fileTitleColor: accentColor,
polls: chat.message.incoming.polls.withUpdated(
radioProgress: accentColor,
highlight: accentColor?.withAlphaComponent(0.12),
highlight: UIColor(rgb: 0xffffff, alpha: 0.5),
bar: accentColor,
barIconForeground: accentColor.flatMap { accentColor -> UIColor in
if accentColor.rgb == 0xffffff {
@ -261,7 +261,7 @@ public func customizeDefaultDarkPresentationTheme(theme: PresentationTheme, edit
),
freeform: chat.message.freeform.withUpdated(
withWallpaper: chat.message.freeform.withWallpaper.withUpdated(
reactionInactiveBackground: UIColor(rgb: 0xffffff, alpha: 0.12),
reactionInactiveBackground: UIColor(rgb: 0xffffff, alpha: 0.07),
reactionInactiveForeground: UIColor(rgb: 0xffffff),
reactionActiveBackground: accentColor,
reactionActiveForeground: monochrome ? UIColor(rgb: 0x000000) : UIColor(rgb: 0xffffff),
@ -269,7 +269,7 @@ public func customizeDefaultDarkPresentationTheme(theme: PresentationTheme, edit
reactionActiveMediaPlaceholder: UIColor(rgb: 0xffffff, alpha: 0.1)
),
withoutWallpaper: chat.message.freeform.withoutWallpaper.withUpdated(
reactionInactiveBackground: chat.message.incoming.bubble.withoutWallpaper.fill.last,
reactionInactiveBackground: UIColor(rgb: 0xffffff, alpha: 0.07),
reactionInactiveForeground: UIColor(rgb: 0xffffff),
reactionActiveBackground: accentColor,
reactionActiveForeground: monochrome ? UIColor(rgb: 0x000000) : UIColor(rgb: 0xffffff),
@ -511,10 +511,10 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
bubble: PresentationThemeBubbleColor(
withWallpaper: PresentationThemeBubbleColorComponents(
fill: [UIColor(rgb: 0x1D1D1D, alpha: incomingBubbleAlpha)],
highlightedFill: UIColor(rgb: 0x353539),
highlightedFill: UIColor(rgb: 0xffffff, alpha: 1.0),
stroke: .clear,
shadow: nil,
reactionInactiveBackground: UIColor(rgb: 0xffffff, alpha: 0.1),
reactionInactiveBackground: UIColor(rgb: 0xffffff, alpha: 0.07),
reactionInactiveForeground: UIColor(rgb: 0xffffff),
reactionActiveBackground: UIColor(rgb: 0xffffff, alpha: 1.0),
reactionActiveForeground: .clear,
@ -523,10 +523,10 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
),
withoutWallpaper: PresentationThemeBubbleColorComponents(
fill: [UIColor(rgb: 0x1D1D1D, alpha: incomingBubbleAlpha)],
highlightedFill: UIColor(rgb: 0x353539),
highlightedFill: UIColor(rgb: 0xffffff, alpha: 1.0),
stroke: .clear,
shadow: nil,
reactionInactiveBackground: UIColor(rgb: 0xffffff, alpha: 0.1),
reactionInactiveBackground: UIColor(rgb: 0xffffff, alpha: 0.07),
reactionInactiveForeground: UIColor(rgb: 0xffffff),
reactionActiveBackground: UIColor(rgb: 0xffffff, alpha: 1.0),
reactionActiveForeground: .clear,
@ -535,7 +535,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
)
),
primaryTextColor: UIColor(rgb: 0xffffff),
secondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5), linkTextColor: UIColor(rgb: 0xffffff), linkHighlightColor: UIColor(rgb: 0xffffff, alpha: 0.5), scamColor: UIColor(rgb: 0xeb5545), textHighlightColor: UIColor(rgb: 0xf5c038), accentTextColor: UIColor(rgb: 0xffffff), accentControlColor: UIColor(rgb: 0xffffff), accentControlDisabledColor: UIColor(rgb: 0xffffff, alpha: 0.5), mediaActiveControlColor: UIColor(rgb: 0xffffff), mediaInactiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.4), mediaControlInnerBackgroundColor: UIColor(rgb: 0x262628), pendingActivityColor: UIColor(rgb: 0xffffff, alpha: 0.5), fileTitleColor: UIColor(rgb: 0xffffff), fileDescriptionColor: UIColor(rgb: 0xffffff, alpha: 0.5), fileDurationColor: UIColor(rgb: 0xffffff, alpha: 0.5), mediaPlaceholderColor: UIColor(rgb: 0x1f1f1f).mixedWith(UIColor(rgb: 0xffffff), alpha: 0.05), polls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0x737373), radioProgress: UIColor(rgb: 0xffffff), highlight: UIColor(rgb: 0xffffff, alpha: 0.12), separator: UIColor(rgb: 0x000000), bar: UIColor(rgb: 0xffffff), barIconForeground: .clear, barPositive: UIColor(rgb: 0x00A700), barNegative: UIColor(rgb: 0xFE3824)), actionButtonsFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)), actionButtonsStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2, alpha: 0.18)), actionButtonsTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)), textSelectionColor: UIColor(rgb: 0xffffff, alpha: 0.2), textSelectionKnobColor: UIColor(rgb: 0xffffff)
secondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5), linkTextColor: UIColor(rgb: 0xffffff), linkHighlightColor: UIColor(rgb: 0xffffff, alpha: 0.5), scamColor: UIColor(rgb: 0xeb5545), textHighlightColor: UIColor(rgb: 0xf5c038), accentTextColor: UIColor(rgb: 0xffffff), accentControlColor: UIColor(rgb: 0xffffff), accentControlDisabledColor: UIColor(rgb: 0xffffff, alpha: 0.5), mediaActiveControlColor: UIColor(rgb: 0xffffff), mediaInactiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.4), mediaControlInnerBackgroundColor: UIColor(rgb: 0x262628), pendingActivityColor: UIColor(rgb: 0xffffff, alpha: 0.5), fileTitleColor: UIColor(rgb: 0xffffff), fileDescriptionColor: UIColor(rgb: 0xffffff, alpha: 0.5), fileDurationColor: UIColor(rgb: 0xffffff, alpha: 0.5), mediaPlaceholderColor: UIColor(rgb: 0x1f1f1f).mixedWith(UIColor(rgb: 0xffffff), alpha: 0.05), polls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0x737373), radioProgress: UIColor(rgb: 0xffffff), highlight: UIColor(rgb: 0xffffff, alpha: 0.5), separator: UIColor(rgb: 0x000000), bar: UIColor(rgb: 0xffffff), barIconForeground: .clear, barPositive: UIColor(rgb: 0x00A700), barNegative: UIColor(rgb: 0xFE3824)), actionButtonsFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)), actionButtonsStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2, alpha: 0.18)), actionButtonsTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)), textSelectionColor: UIColor(rgb: 0xffffff, alpha: 0.2), textSelectionKnobColor: UIColor(rgb: 0xffffff)
),
outgoing: PresentationThemePartedColors(
bubble: PresentationThemeBubbleColor(
@ -571,7 +571,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
highlightedFill: UIColor(rgb: 0x2a2a2a),
stroke: UIColor(rgb: 0x1f1f1f),
shadow: nil,
reactionInactiveBackground: UIColor(rgb: 0x1f1f1f),
reactionInactiveBackground: UIColor(rgb: 0xffffff, alpha: 0.07),
reactionInactiveForeground: UIColor(rgb: 0xffffff),
reactionActiveBackground: UIColor(rgb: 0xffffff, alpha: 1.0),
reactionActiveForeground: .clear,
@ -583,7 +583,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
highlightedFill: UIColor(rgb: 0x2a2a2a),
stroke: UIColor(rgb: 0x1f1f1f),
shadow: nil,
reactionInactiveBackground: UIColor(rgb: 0x1f1f1f),
reactionInactiveBackground: UIColor(rgb: 0xffffff, alpha: 0.07),
reactionInactiveForeground: UIColor(rgb: 0xffffff),
reactionActiveBackground: UIColor(rgb: 0xffffff, alpha: 1.0),
reactionActiveForeground: .clear,

View File

@ -454,7 +454,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
self.inputPanelBottomBackgroundSeparatorNode.backgroundColor = self.chatPresentationInterfaceState.theme.chat.inputMediaPanel.panelSeparatorColor
self.inputPanelBottomBackgroundSeparatorNode.isLayerBacked = true
self.navigateButtons = ChatHistoryNavigationButtons(theme: self.chatPresentationInterfaceState.theme, dateTimeFormat: self.chatPresentationInterfaceState.dateTimeFormat)
self.navigateButtons = ChatHistoryNavigationButtons(theme: self.chatPresentationInterfaceState.theme, dateTimeFormat: self.chatPresentationInterfaceState.dateTimeFormat, backgroundNode: self.backgroundNode)
self.navigateButtons.accessibilityElementsHidden = true
super.init()
@ -1764,6 +1764,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
transition.updateFrame(node: self.inputPanelBackgroundSeparatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: apparentInputBackgroundFrame.origin.y), size: CGSize(width: apparentInputBackgroundFrame.size.width, height: UIScreenPixel)))
transition.updateFrame(node: self.navigateButtons, frame: apparentNavigateButtonsFrame)
self.navigateButtons.update(rect: apparentNavigateButtonsFrame, within: layout.size, transition: transition)
if let titleAccessoryPanelNode = self.titleAccessoryPanelNode, let titleAccessoryPanelFrame = titleAccessoryPanelFrame, !titleAccessoryPanelNode.frame.equalTo(titleAccessoryPanelFrame) {
titleAccessoryPanelNode.frame = titleAccessoryPanelFrame
@ -2240,7 +2241,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
let updateInputTextState = self.chatPresentationInterfaceState.interfaceState.effectiveInputState != chatPresentationInterfaceState.interfaceState.effectiveInputState
self.chatPresentationInterfaceState = chatPresentationInterfaceState
self.navigateButtons.update(theme: chatPresentationInterfaceState.theme, dateTimeFormat: chatPresentationInterfaceState.dateTimeFormat)
self.navigateButtons.update(theme: chatPresentationInterfaceState.theme, dateTimeFormat: chatPresentationInterfaceState.dateTimeFormat, backgroundNode: self.backgroundNode)
if themeUpdated {
if case let .color(color) = self.chatPresentationInterfaceState.chatWallpaper, UIColor(rgb: color).isEqual(self.chatPresentationInterfaceState.theme.chat.inputPanel.panelBackgroundColorNoWallpaper) {

View File

@ -3,6 +3,7 @@ import UIKit
import AsyncDisplayKit
import Display
import TelegramPresentationData
import WallpaperBackgroundNode
private let badgeFont = Font.regular(13.0)
@ -16,6 +17,7 @@ class ChatHistoryNavigationButtonNode: ContextControllerSourceNode {
let containerNode: ContextExtractedContentContainingNode
private let buttonNode: HighlightTrackingButtonNode
private let backgroundNode: NavigationBackgroundNode
private var backgroundContent: WallpaperBubbleBackgroundNode?
private let imageNode: ASImageNode
private let badgeBackgroundNode: ASImageNode
private let badgeTextNode: ASTextNode
@ -43,7 +45,7 @@ class ChatHistoryNavigationButtonNode: ContextControllerSourceNode {
private var theme: PresentationTheme
private let type: ChatHistoryNavigationButtonType
init(theme: PresentationTheme, type: ChatHistoryNavigationButtonType) {
init(theme: PresentationTheme, backgroundNode: WallpaperBackgroundNode, type: ChatHistoryNavigationButtonType) {
self.theme = theme
self.type = type
@ -102,7 +104,7 @@ class ChatHistoryNavigationButtonNode: ContextControllerSourceNode {
self.frame = CGRect(origin: CGPoint(), size: size)
}
func updateTheme(theme: PresentationTheme) {
func updateTheme(theme: PresentationTheme, backgroundNode: WallpaperBackgroundNode) {
if self.theme !== theme {
self.theme = theme
@ -122,6 +124,34 @@ class ChatHistoryNavigationButtonNode: ContextControllerSourceNode {
self.badgeTextNode.redrawIfPossible()
}
}
if backgroundNode.hasExtraBubbleBackground() {
if self.backgroundContent == nil {
if let backgroundContent = backgroundNode.makeBubbleBackground(for: .free) {
backgroundContent.allowsGroupOpacity = true
backgroundContent.clipsToBounds = true
backgroundContent.alpha = 0.2
backgroundContent.cornerRadius = 19.0
backgroundContent.frame = self.backgroundNode.frame
self.buttonNode.insertSubnode(backgroundContent, aboveSubnode: self.backgroundNode)
self.backgroundContent = backgroundContent
}
}
} else {
self.backgroundContent?.removeFromSupernode()
self.backgroundContent = nil
}
if let (rect, containerSize) = self.absoluteRect {
self.backgroundContent?.update(rect: rect, within: containerSize, transition: .immediate)
}
}
private var absoluteRect: (CGRect, CGSize)?
func update(rect: CGRect, within containerSize: CGSize, transition: ContainedViewLayoutTransition) {
self.absoluteRect = (rect, containerSize)
self.backgroundContent?.update(rect: rect, within: containerSize, transition: transition)
}
@objc func onTap() {

View File

@ -3,6 +3,7 @@ import UIKit
import Display
import AsyncDisplayKit
import TelegramPresentationData
import WallpaperBackgroundNode
final class ChatHistoryNavigationButtons: ASDisplayNode {
private var theme: PresentationTheme
@ -67,19 +68,19 @@ final class ChatHistoryNavigationButtons: ASDisplayNode {
}
}
init(theme: PresentationTheme, dateTimeFormat: PresentationDateTimeFormat) {
init(theme: PresentationTheme, dateTimeFormat: PresentationDateTimeFormat, backgroundNode: WallpaperBackgroundNode) {
self.theme = theme
self.dateTimeFormat = dateTimeFormat
self.mentionsButton = ChatHistoryNavigationButtonNode(theme: theme, type: .mentions)
self.mentionsButton = ChatHistoryNavigationButtonNode(theme: theme, backgroundNode: backgroundNode, type: .mentions)
self.mentionsButton.alpha = 0.0
self.mentionsButton.isHidden = true
self.reactionsButton = ChatHistoryNavigationButtonNode(theme: theme, type: .reactions)
self.reactionsButton = ChatHistoryNavigationButtonNode(theme: theme, backgroundNode: backgroundNode, type: .reactions)
self.reactionsButton.alpha = 0.0
self.reactionsButton.isHidden = true
self.downButton = ChatHistoryNavigationButtonNode(theme: theme, type: .down)
self.downButton = ChatHistoryNavigationButtonNode(theme: theme, backgroundNode: backgroundNode, type: .down)
self.downButton.alpha = 0.0
self.downButton.isHidden = true
@ -104,15 +105,33 @@ final class ChatHistoryNavigationButtons: ASDisplayNode {
super.didLoad()
}
func update(theme: PresentationTheme, dateTimeFormat: PresentationDateTimeFormat) {
if self.theme !== theme || self.dateTimeFormat != dateTimeFormat {
self.theme = theme
self.dateTimeFormat = dateTimeFormat
func update(theme: PresentationTheme, dateTimeFormat: PresentationDateTimeFormat, backgroundNode: WallpaperBackgroundNode) {
self.theme = theme
self.dateTimeFormat = dateTimeFormat
self.reactionsButton.updateTheme(theme: theme)
self.mentionsButton.updateTheme(theme: theme)
self.downButton.updateTheme(theme: theme)
}
self.reactionsButton.updateTheme(theme: theme, backgroundNode: backgroundNode)
self.mentionsButton.updateTheme(theme: theme, backgroundNode: backgroundNode)
self.downButton.updateTheme(theme: theme, backgroundNode: backgroundNode)
}
private var absoluteRect: (CGRect, CGSize)?
func update(rect: CGRect, within containerSize: CGSize, transition: ContainedViewLayoutTransition) {
self.absoluteRect = (rect, containerSize)
var reactionsFrame = self.reactionsButton.frame
reactionsFrame.origin.x += rect.minX
reactionsFrame.origin.y += rect.minY
self.reactionsButton.update(rect: reactionsFrame, within: containerSize, transition: transition)
var mentionsFrame = self.mentionsButton.frame
mentionsFrame.origin.x += rect.minX
mentionsFrame.origin.y += rect.minY
self.mentionsButton.update(rect: mentionsFrame, within: containerSize, transition: transition)
var downFrame = self.downButton.frame
downFrame.origin.x += rect.minX
downFrame.origin.y += rect.minY
self.downButton.update(rect: downFrame, within: containerSize, transition: transition)
}
func updateLayout(transition: ContainedViewLayoutTransition) -> CGSize {
@ -173,6 +192,10 @@ final class ChatHistoryNavigationButtons: ASDisplayNode {
transition.updatePosition(node: self.reactionsButton, position: CGRect(origin: CGPoint(x: 0.0, y: completeSize.height - buttonSize.height - mentionsOffset - reactionsOffset), size: buttonSize).center)
if let (rect, containerSize) = self.absoluteRect {
self.update(rect: rect, within: containerSize, transition: transition)
}
return completeSize
}

View File

@ -76,6 +76,8 @@ class ChatMessageShareButton: HighlightableButtonNode {
super.init(pointerStyle: nil)
self.allowsGroupOpacity = true
self.addSubnode(self.backgroundNode)
self.addSubnode(self.iconNode)
}
@ -169,7 +171,6 @@ class ChatMessageShareButton: HighlightableButtonNode {
if controllerInteraction.presentationContext.backgroundNode?.hasExtraBubbleBackground() == true {
if self.backgroundContent == nil, let backgroundContent = controllerInteraction.presentationContext.backgroundNode?.makeBubbleBackground(for: .free) {
backgroundContent.clipsToBounds = true
backgroundContent.allowsGroupOpacity = true
self.backgroundContent = backgroundContent
self.insertSubnode(backgroundContent, at: 0)
}

View File

@ -7,6 +7,7 @@ import TelegramCore
import TelegramUIPreferences
import TelegramPresentationData
import AccountContext
import ChatMessageBackground
enum ChatMessageBubbleContentBackgroundHiding {
case never
@ -134,7 +135,7 @@ class ChatMessageBubbleContentNode: ASDisplayNode {
return false
}
weak var bubbleBackgroundNode: ASDisplayNode?
weak var bubbleBackgroundNode: ChatMessageBackground?
var visibility: ListViewItemNodeVisibility = .none

View File

@ -571,6 +571,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
self.contentContainersWrapperNode = ASDisplayNode()
self.backgroundNode = ChatMessageBackground()
self.backgroundNode.backdropNode = self.backgroundWallpaperNode
self.shadowNode = ChatMessageShadowNode()
self.clippingNode = ChatMessageBubbleClippingNode()

View File

@ -10,6 +10,7 @@ import SwiftSignalKit
import AccountContext
import AvatarNode
import TelegramPresentationData
import ChatMessageBackground
func isPollEffectivelyClosed(message: Message, poll: TelegramMediaPoll) -> Bool {
if poll.isClosed {
@ -524,6 +525,12 @@ private final class ChatMessagePollOptionNode: ASDisplayNode {
self.buttonNode.highligthedChanged = { [weak self] highlighted in
if let strongSelf = self {
if highlighted {
if "".isEmpty, let contentNode = strongSelf.supernode as? ChatMessagePollBubbleContentNode, let backdropNode = contentNode.bubbleBackgroundNode?.backdropNode {
strongSelf.highlightedBackgroundNode.layer.compositingFilter = "overlayBlendMode"
strongSelf.highlightedBackgroundNode.frame = strongSelf.view.convert(strongSelf.highlightedBackgroundNode.frame, to: backdropNode.view)
backdropNode.addSubnode(strongSelf.highlightedBackgroundNode)
}
strongSelf.highlightedBackgroundNode.layer.removeAnimation(forKey: "opacity")
strongSelf.highlightedBackgroundNode.alpha = 1.0
@ -534,7 +541,13 @@ private final class ChatMessagePollOptionNode: ASDisplayNode {
strongSelf.previousOptionNode?.separatorNode.alpha = 0.0
} else {
strongSelf.highlightedBackgroundNode.alpha = 0.0
strongSelf.highlightedBackgroundNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3)
strongSelf.highlightedBackgroundNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, completion: { finished in
if finished && strongSelf.highlightedBackgroundNode.supernode != strongSelf {
strongSelf.highlightedBackgroundNode.layer.compositingFilter = nil
strongSelf.highlightedBackgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -UIScreenPixel), size: strongSelf.highlightedBackgroundNode.frame.size)
strongSelf.insertSubnode(strongSelf.highlightedBackgroundNode, at: 0)
}
})
strongSelf.separatorNode.alpha = 1.0
strongSelf.separatorNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3)
@ -733,8 +746,9 @@ private final class ChatMessagePollOptionNode: ASDisplayNode {
}
node.buttonNode.frame = CGRect(origin: CGPoint(x: 1.0, y: 0.0), size: CGSize(width: width - 2.0, height: contentHeight))
node.highlightedBackgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -UIScreenPixel), size: CGSize(width: width, height: contentHeight + UIScreenPixel))
if node.highlightedBackgroundNode.supernode == node {
node.highlightedBackgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -UIScreenPixel), size: CGSize(width: width, height: contentHeight + UIScreenPixel))
}
node.separatorNode.backgroundColor = incoming ? presentationData.theme.theme.chat.message.incoming.polls.separator : presentationData.theme.theme.chat.message.outgoing.polls.separator
node.separatorNode.frame = CGRect(origin: CGPoint(x: leftInset, y: contentHeight - UIScreenPixel), size: CGSize(width: width - leftInset, height: UIScreenPixel))