diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 9f490731be..fd11c5d378 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -8280,3 +8280,5 @@ Sorry for the inconvenience."; "OwnershipTransfer.EnterPassword" = "Enter Password"; "OwnershipTransfer.EnterPasswordText" = "Please enter your 2-Step Verification password to confirm the action."; + +"Navigation.AllChats" = "All Chats"; diff --git a/submodules/ChatListUI/Sources/Node/ChatListItem.swift b/submodules/ChatListUI/Sources/Node/ChatListItem.swift index a16a741f48..c4eee9066b 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListItem.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListItem.swift @@ -2551,8 +2551,6 @@ class ChatListItemNode: ItemListRevealOptionsItemNode { } } - compoundHighlightingNode.color = theme.itemHighlightedBackgroundColor.withMultipliedAlpha(0.5) - var topRect = topForumTopicRect topRect.origin.x -= 1.0 topRect.size.width += 2.0 @@ -2566,7 +2564,10 @@ class ChatListItemNode: ItemListRevealOptionsItemNode { let midY = floor((topForumTopicRect.minY + textRect.maxY) / 2.0) + 1.0 let finalTopRect = CGRect(origin: topRect.origin, size: CGSize(width: topRect.width, height: midY - topRect.minY)) - let finalBottomRect = CGRect(origin: CGPoint(x: textRect.minX, y: midY), size: CGSize(width: textRect.width, height: textRect.maxY - midY)) + var finalBottomRect = CGRect(origin: CGPoint(x: textRect.minX, y: midY), size: CGSize(width: textRect.width, height: textRect.maxY - midY)) + if finalBottomRect.maxX < finalTopRect.maxX && abs(finalBottomRect.maxX - finalTopRect.maxX) < 5.0 { + finalBottomRect.size.width = finalTopRect.maxX - finalBottomRect.minX + } compoundHighlightingNode.inset = 0.0 compoundHighlightingNode.outerRadius = floor(finalBottomRect.height * 0.5) @@ -2575,7 +2576,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode { compoundHighlightingNode.updateRects([ finalTopRect, finalBottomRect - ]) + ], color: theme.itemHighlightedBackgroundColor.withMultipliedAlpha(0.5)) compoundTextButtonNode.frame = compoundHighlightingNode.frame } else { @@ -3298,4 +3299,22 @@ class ChatListItemNode: ItemListRevealOptionsItemNode { self.backgroundNode.alpha = 1.0 return result } + + override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { + if let compoundTextButtonNode = self.compoundTextButtonNode, let compoundHighlightingNode = self.compoundHighlightingNode, compoundHighlightingNode.alpha != 0.0 { + let localPoint = self.view.convert(point, to: compoundHighlightingNode.view) + var matches = false + for rect in compoundHighlightingNode.rects { + if rect.contains(localPoint) { + matches = true + break + } + } + if matches { + return compoundTextButtonNode.view + } + } + + return super.hitTest(point, with: event) + } } diff --git a/submodules/Display/Source/LinkHighlightingNode.swift b/submodules/Display/Source/LinkHighlightingNode.swift index ad9f405f8b..4f05227f4d 100644 --- a/submodules/Display/Source/LinkHighlightingNode.swift +++ b/submodules/Display/Source/LinkHighlightingNode.swift @@ -303,10 +303,19 @@ public final class LinkHighlightingNode: ASDisplayNode { self.addSubnode(self.imageNode) } - public func updateRects(_ rects: [CGRect]) { + public func updateRects(_ rects: [CGRect], color: UIColor? = nil) { + var updated = false if self.rects != rects { + updated = true self.rects = rects - + } + + if let color, !color.isEqual(self.color) { + updated = true + self.color = color + } + + if updated { self.updateImage() } } diff --git a/submodules/Postbox/Sources/MessageHistoryHolesView.swift b/submodules/Postbox/Sources/MessageHistoryHolesView.swift index 0e5bcf7c4f..5329a60cdf 100644 --- a/submodules/Postbox/Sources/MessageHistoryHolesView.swift +++ b/submodules/Postbox/Sources/MessageHistoryHolesView.swift @@ -1,6 +1,6 @@ import Foundation -public struct MessageHistoryHolesViewEntry: Equatable, Hashable { +public struct MessageHistoryHolesViewEntry: Equatable, Hashable, CustomStringConvertible { public let hole: MessageHistoryViewHole public let direction: MessageHistoryViewRelativeHoleDirection public let space: MessageHistoryHoleSpace @@ -14,6 +14,10 @@ public struct MessageHistoryHolesViewEntry: Equatable, Hashable { self.count = count self.userId = userId } + + public var description: String { + return "hole: \(self.hole), direction: \(self.direction), space: \(self.space), count: \(self.count), userId: \(String(describing: self.userId))" + } } final class MutableMessageHistoryHolesView { diff --git a/submodules/TelegramCore/Sources/State/ManagedMessageHistoryHoles.swift b/submodules/TelegramCore/Sources/State/ManagedMessageHistoryHoles.swift index f78c8b9ff4..7c5c0e7d23 100644 --- a/submodules/TelegramCore/Sources/State/ManagedMessageHistoryHoles.swift +++ b/submodules/TelegramCore/Sources/State/ManagedMessageHistoryHoles.swift @@ -15,7 +15,7 @@ private final class ManagedMessageHistoryHolesState { } } - private struct PendingEntry { + private struct PendingEntry: CustomStringConvertible { var key: LocationKey var entry: MessageHistoryHolesViewEntry var disposable: Disposable @@ -25,6 +25,10 @@ private final class ManagedMessageHistoryHolesState { self.entry = entry self.disposable = disposable } + + var description: String { + return "entry: \(self.entry)" + } } private struct DiscardedEntry { @@ -87,6 +91,7 @@ private final class ManagedMessageHistoryHolesState { for i in (0 ..< self.discardedEntries.count).reversed() { if self.discardedEntries[i].timestamp < timestamp - 0.5 { result.append(self.discardedEntries[i].entry.disposable) + Logger.shared.log("ManagedMessageHistoryHoles", "Removing discarded entry \(self.discardedEntries[i].entry)") self.discardedEntries.remove(at: i) } } @@ -102,9 +107,9 @@ private final class ManagedMessageHistoryHolesState { for i in (0 ..< self.pendingEntries.count).reversed() { if !entries.contains(self.pendingEntries[i].entry) { + Logger.shared.log("ManagedMessageHistoryHoles", "Stashing entry \(self.pendingEntries[i])") self.discardedEntries.append(DiscardedEntry(entry: self.pendingEntries[i], timestamp: timestamp)) self.pendingEntries.remove(at: i) - //removed.append(self.pendingEntries[i].disposable) } } @@ -115,10 +120,13 @@ private final class ManagedMessageHistoryHolesState { if !self.pendingEntries.contains(where: { $0.key == key }) { if let discardedIndex = self.discardedEntries.firstIndex(where: { $0.entry.entry == entry }) { let discardedEntry = self.discardedEntries.remove(at: discardedIndex) + Logger.shared.log("ManagedMessageHistoryHoles", "Taking discarded entry \(discardedEntry.entry)") self.pendingEntries.append(discardedEntry.entry) } else { let disposable = MetaDisposable() - self.pendingEntries.append(PendingEntry(key: key, entry: entry, disposable: disposable)) + let pendingEntry = PendingEntry(key: key, entry: entry, disposable: disposable) + self.pendingEntries.append(pendingEntry) + Logger.shared.log("ManagedMessageHistoryHoles", "Adding pending entry \(pendingEntry), discarded entries: \(self.discardedEntries.map(\.entry))") added[entry] = disposable } } diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 7061429725..c22c2efe51 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -8959,8 +8959,8 @@ public final class PeerInfoScreenImpl: ViewController, PeerInfoScreen, KeyShortc var items: [ContextMenuItem] = [] - items.append(.action(ContextMenuActionItem(text: presentationData.strings.ChatList_Tabs_AllChats, icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Back"), color: theme.contextMenu.primaryColor) + items.append(.action(ContextMenuActionItem(text: presentationData.strings.Navigation_AllChats, icon: { theme in + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Chats"), color: theme.contextMenu.primaryColor) }, action: { _, f in f(.default)