Name color improvements

This commit is contained in:
Ilya Laktyushin
2023-10-25 14:36:42 +04:00
parent 7cb8f9739b
commit 014e3d8b76
10 changed files with 101 additions and 49 deletions

View File

@@ -6,6 +6,7 @@ import Postbox
import TelegramCore
import TelegramPresentationData
import LocalizedPeerData
import AccountContext
public enum ChatMessageForwardInfoType: Equatable {
case bubble(incoming: Bool)
@@ -106,10 +107,10 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
}
}
public static func asyncLayout(_ maybeNode: ChatMessageForwardInfoNode?) -> (_ presentationData: ChatPresentationData, _ strings: PresentationStrings, _ type: ChatMessageForwardInfoType, _ peer: Peer?, _ authorName: String?, _ psaType: String?, _ storyData: StoryData?, _ constrainedSize: CGSize) -> (CGSize, (CGFloat) -> ChatMessageForwardInfoNode) {
public static func asyncLayout(_ maybeNode: ChatMessageForwardInfoNode?) -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ strings: PresentationStrings, _ type: ChatMessageForwardInfoType, _ peer: Peer?, _ authorName: String?, _ psaType: String?, _ storyData: StoryData?, _ constrainedSize: CGSize) -> (CGSize, (CGFloat) -> ChatMessageForwardInfoNode) {
let textNodeLayout = TextNode.asyncLayout(maybeNode?.textNode)
return { presentationData, strings, type, peer, authorName, psaType, storyData, constrainedSize in
return { context, presentationData, strings, type, peer, authorName, psaType, storyData, constrainedSize in
let fontSize = floor(presentationData.fontSize.baseDisplaySize * 13.0 / 17.0)
let prefixFont = Font.regular(fontSize)
let peerFont = Font.medium(fontSize)
@@ -163,11 +164,11 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
}
} else {
if incoming {
// if let color = peer?.nameColor?.color {
// titleColor = color
// } else {
if let nameColor = peer?.nameColor {
titleColor = context.peerNameColors.get(nameColor).main
} else {
titleColor = presentationData.theme.theme.chat.message.incoming.accentTextColor
// }
}
} else {
titleColor = presentationData.theme.theme.chat.message.outgoing.accentTextColor
}