mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Merge commit 'bcbcc94b585076fe8dbd2bb7b0f4b01dbb89a904'
# Conflicts: # submodules/TelegramUI/Components/Chat/ChatMessageAttachedContentNode/Sources/ChatMessageAttachedContentNode.swift # submodules/TelegramUI/Components/Chat/ChatMessageReplyInfoNode/Sources/ChatMessageReplyInfoNode.swift
This commit is contained in:
@@ -100,6 +100,7 @@ public class ChatMessageReplyInfoNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
private let backgroundView: UIImageView
|
||||
private var lineDashView: UIImageView?
|
||||
private var quoteIconView: UIImageView?
|
||||
private let contentNode: ASDisplayNode
|
||||
private var titleNode: TextNode?
|
||||
@@ -233,30 +234,33 @@ public class ChatMessageReplyInfoNode: ASDisplayNode {
|
||||
let dustColor: UIColor
|
||||
|
||||
var authorNameColor: UIColor?
|
||||
var dashSecondaryColor: UIColor?
|
||||
|
||||
let author = arguments.message?.effectiveAuthor
|
||||
|
||||
if [Namespaces.Peer.CloudGroup, Namespaces.Peer.CloudChannel].contains(arguments.parentMessage.id.peerId.namespace) && author?.id.namespace == Namespaces.Peer.CloudUser {
|
||||
authorNameColor = author.flatMap { chatMessagePeerIdColors[Int(clamping: $0.id.id._internalGetInt64Value() % 7)] }
|
||||
if let rawAuthorNameColor = authorNameColor {
|
||||
var dimColors = false
|
||||
switch arguments.presentationData.theme.theme.name {
|
||||
case .builtin(.nightAccent), .builtin(.night):
|
||||
dimColors = true
|
||||
default:
|
||||
break
|
||||
}
|
||||
if dimColors {
|
||||
var hue: CGFloat = 0.0
|
||||
var saturation: CGFloat = 0.0
|
||||
var brightness: CGFloat = 0.0
|
||||
rawAuthorNameColor.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: nil)
|
||||
authorNameColor = UIColor(hue: hue, saturation: saturation * 0.7, brightness: min(1.0, brightness * 1.2), alpha: 1.0)
|
||||
}
|
||||
}
|
||||
if author?.hasCustomNameColor == true || ([Namespaces.Peer.CloudGroup, Namespaces.Peer.CloudChannel].contains(arguments.parentMessage.id.peerId.namespace) && author?.id.namespace == Namespaces.Peer.CloudUser) {
|
||||
authorNameColor = author?.nameColor?.color
|
||||
dashSecondaryColor = author?.nameColor?.dashColors.1
|
||||
// if let rawAuthorNameColor = authorNameColor {
|
||||
// var dimColors = false
|
||||
// switch arguments.presentationData.theme.theme.name {
|
||||
// case .builtin(.nightAccent), .builtin(.night):
|
||||
// dimColors = true
|
||||
// default:
|
||||
// break
|
||||
// }
|
||||
// if dimColors {
|
||||
// var hue: CGFloat = 0.0
|
||||
// var saturation: CGFloat = 0.0
|
||||
// var brightness: CGFloat = 0.0
|
||||
// rawAuthorNameColor.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: nil)
|
||||
// authorNameColor = UIColor(hue: hue, saturation: saturation * 0.7, brightness: min(1.0, brightness * 1.2), alpha: 1.0)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
let mainColor: UIColor
|
||||
var secondaryColor: UIColor?
|
||||
|
||||
switch arguments.type {
|
||||
case let .bubble(incoming):
|
||||
@@ -264,6 +268,7 @@ public class ChatMessageReplyInfoNode: ASDisplayNode {
|
||||
if incoming {
|
||||
if let authorNameColor {
|
||||
mainColor = authorNameColor
|
||||
secondaryColor = dashSecondaryColor
|
||||
} else {
|
||||
mainColor = arguments.presentationData.theme.theme.chat.message.incoming.accentTextColor
|
||||
}
|
||||
@@ -643,9 +648,23 @@ public class ChatMessageReplyInfoNode: ASDisplayNode {
|
||||
node.backgroundView.tintColor = mainColor
|
||||
node.backgroundView.frame = backgroundFrame
|
||||
|
||||
#if DEBUG && false
|
||||
node.backgroundColor = .blue
|
||||
#endif
|
||||
if let secondaryColor {
|
||||
let lineDashView: UIImageView
|
||||
if let current = node.lineDashView {
|
||||
lineDashView = current
|
||||
} else {
|
||||
lineDashView = UIImageView(image: PresentationResourcesChat.chatReplyLineDashTemplateImage(arguments.presentationData.theme.theme))
|
||||
node.lineDashView = lineDashView
|
||||
node.contentNode.view.addSubview(lineDashView)
|
||||
}
|
||||
lineDashView.tintColor = secondaryColor
|
||||
lineDashView.frame = CGRect(origin: .zero, size: CGSize(width: 3.0, height: backgroundFrame.height))
|
||||
} else {
|
||||
if let lineDashView = node.lineDashView {
|
||||
node.lineDashView = nil
|
||||
lineDashView.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
|
||||
if arguments.quote != nil || arguments.replyForward?.quote != nil {
|
||||
let quoteIconView: UIImageView
|
||||
|
||||
Reference in New Issue
Block a user