Various fixes

This commit is contained in:
Ilya Laktyushin 2022-11-10 19:03:06 +04:00
parent 1cd53598d0
commit 57c7a4d521
2 changed files with 12 additions and 6 deletions

View File

@ -178,7 +178,7 @@ public class ChatListItem: ListViewItem, ChatListSearchItemNeighbour {
if case let .forum(_, _, threadIdValue, _, _) = self.index { if case let .forum(_, _, threadIdValue, _, _) = self.index {
threadId = threadIdValue threadId = threadIdValue
} }
self.interaction.messageSelected(peer, threadId, message, promoInfo) self.interaction.messageSelected(peer, threadId ?? message.threadId, message, promoInfo)
} else if let peer = peer.peer { } else if let peer = peer.peer {
self.interaction.peerSelected(peer, nil, nil, promoInfo) self.interaction.peerSelected(peer, nil, nil, promoInfo)
} else if let peer = peer.peers[peer.peerId] { } else if let peer = peer.peers[peer.peerId] {
@ -1351,6 +1351,10 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
hasUnseenReactions = hasUnseenReactionsValue hasUnseenReactions = hasUnseenReactionsValue
forumTopicData = forumTopicDataValue forumTopicData = forumTopicDataValue
topForumTopicItems = topForumTopicItemsValue topForumTopicItems = topForumTopicItemsValue
if item.interaction.searchTextHighightState != nil, threadInfo == nil, topForumTopicItems.isEmpty, let message = messagesValue.first, let threadId = message.threadId, let associatedThreadInfo = message.associatedThreadInfo {
topForumTopicItems = [EngineChatList.ForumTopicData(id: threadId, title: associatedThreadInfo.title, iconFileId: associatedThreadInfo.icon, iconColor: associatedThreadInfo.iconColor, maxOutgoingReadMessageId: message.id, isUnread: false)]
}
switch peerValue.peer { switch peerValue.peer {
case .user, .secretChat: case .user, .secretChat:
@ -2018,14 +2022,16 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
var effectiveAuthorTitle = (hideAuthor && !hasDraft) ? nil : authorAttributedString var effectiveAuthorTitle = (hideAuthor && !hasDraft) ? nil : authorAttributedString
let isSearching = item.interaction.searchTextHighightState != nil
var forumThreads: [(id: Int64, title: NSAttributedString, iconId: Int64?, iconColor: Int32)] = [] var forumThreads: [(id: Int64, title: NSAttributedString, iconId: Int64?, iconColor: Int32)] = []
if forumThread != nil || !topForumTopicItems.isEmpty { if forumThread != nil || !topForumTopicItems.isEmpty {
if let forumThread = forumThread { if let forumThread = forumThread {
forumThreads.append((id: forumThread.id, title: NSAttributedString(string: forumThread.title, font: textFont, textColor: forumThread.isUnread ? theme.authorNameColor : theme.messageTextColor), iconId: forumThread.iconId, iconColor: forumThread.iconColor)) forumThreads.append((id: forumThread.id, title: NSAttributedString(string: forumThread.title, font: textFont, textColor: forumThread.isUnread || isSearching ? theme.authorNameColor : theme.messageTextColor), iconId: forumThread.iconId, iconColor: forumThread.iconColor))
} }
for item in topForumTopicItems { for item in topForumTopicItems {
if forumThread?.id != item.id { if forumThread?.id != item.id {
forumThreads.append((id: item.id, title: NSAttributedString(string: item.title, font: textFont, textColor: item.isUnread ? theme.authorNameColor : theme.messageTextColor), iconId: item.iconFileId, iconColor: item.iconColor)) forumThreads.append((id: item.id, title: NSAttributedString(string: item.title, font: textFont, textColor: item.isUnread || isSearching ? theme.authorNameColor : theme.messageTextColor), iconId: item.iconFileId, iconColor: item.iconColor))
} }
} }
@ -2492,7 +2498,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
let textNodeFrame = CGRect(origin: CGPoint(x: contentRect.origin.x - 1.0, y: contentRect.minY + titleLayout.size.height - 1.0 + UIScreenPixel + (authorLayout.height.isZero ? 0.0 : (authorLayout.height - 3.0))), size: textLayout.size) let textNodeFrame = CGRect(origin: CGPoint(x: contentRect.origin.x - 1.0, y: contentRect.minY + titleLayout.size.height - 1.0 + UIScreenPixel + (authorLayout.height.isZero ? 0.0 : (authorLayout.height - 3.0))), size: textLayout.size)
strongSelf.textNode.textNode.frame = textNodeFrame strongSelf.textNode.textNode.frame = textNodeFrame
if let textArrowImage = textArrowImage { if let textArrowImage = textArrowImage, !isSearching {
let textArrowNode: ASImageNode let textArrowNode: ASImageNode
if let current = strongSelf.textArrowNode { if let current = strongSelf.textArrowNode {
textArrowNode = current textArrowNode = current
@ -2510,7 +2516,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
textArrowNode.removeFromSupernode() textArrowNode.removeFromSupernode()
} }
if let topForumTopicRect { if let topForumTopicRect, !isSearching {
let compoundHighlightingNode: LinkHighlightingNode let compoundHighlightingNode: LinkHighlightingNode
if let current = strongSelf.compoundHighlightingNode { if let current = strongSelf.compoundHighlightingNode {
compoundHighlightingNode = current compoundHighlightingNode = current

View File

@ -666,7 +666,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
panelSeparatorColor: UIColor(rgb: 0x545458, alpha: 0.3), panelSeparatorColor: UIColor(rgb: 0x545458, alpha: 0.3),
panelBackgroundColor: UIColor(rgb: 0x141414, alpha: 0.65), panelBackgroundColor: UIColor(rgb: 0x141414, alpha: 0.65),
buttonFillColor: UIColor(rgb: 0xe9e9e9, alpha: 0.85), buttonFillColor: UIColor(rgb: 0xe9e9e9, alpha: 0.85),
buttonHighlightColor: UIColor(rgb: 0xffffff, alpha: 0.1), buttonHighlightColor: UIColor(rgb: 0xffffff, alpha: 0.05),
buttonStrokeColor: UIColor(rgb: 0x000000, alpha: 0.85), buttonStrokeColor: UIColor(rgb: 0x000000, alpha: 0.85),
buttonHighlightedFillColor: UIColor(rgb: 0x5a5a5a, alpha: 0.7), buttonHighlightedFillColor: UIColor(rgb: 0x5a5a5a, alpha: 0.7),
buttonHighlightedStrokeColor: UIColor(rgb: 0x0c0c0c), buttonHighlightedStrokeColor: UIColor(rgb: 0x0c0c0c),