mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Topic improvements
This commit is contained in:
parent
f81dab2f08
commit
5a81f9fe15
@ -8280,3 +8280,5 @@ Sorry for the inconvenience.";
|
|||||||
|
|
||||||
"OwnershipTransfer.EnterPassword" = "Enter Password";
|
"OwnershipTransfer.EnterPassword" = "Enter Password";
|
||||||
"OwnershipTransfer.EnterPasswordText" = "Please enter your 2-Step Verification password to confirm the action.";
|
"OwnershipTransfer.EnterPasswordText" = "Please enter your 2-Step Verification password to confirm the action.";
|
||||||
|
|
||||||
|
"Navigation.AllChats" = "All Chats";
|
||||||
|
@ -2551,8 +2551,6 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compoundHighlightingNode.color = theme.itemHighlightedBackgroundColor.withMultipliedAlpha(0.5)
|
|
||||||
|
|
||||||
var topRect = topForumTopicRect
|
var topRect = topForumTopicRect
|
||||||
topRect.origin.x -= 1.0
|
topRect.origin.x -= 1.0
|
||||||
topRect.size.width += 2.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 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 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.inset = 0.0
|
||||||
compoundHighlightingNode.outerRadius = floor(finalBottomRect.height * 0.5)
|
compoundHighlightingNode.outerRadius = floor(finalBottomRect.height * 0.5)
|
||||||
@ -2575,7 +2576,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
compoundHighlightingNode.updateRects([
|
compoundHighlightingNode.updateRects([
|
||||||
finalTopRect,
|
finalTopRect,
|
||||||
finalBottomRect
|
finalBottomRect
|
||||||
])
|
], color: theme.itemHighlightedBackgroundColor.withMultipliedAlpha(0.5))
|
||||||
|
|
||||||
compoundTextButtonNode.frame = compoundHighlightingNode.frame
|
compoundTextButtonNode.frame = compoundHighlightingNode.frame
|
||||||
} else {
|
} else {
|
||||||
@ -3298,4 +3299,22 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
self.backgroundNode.alpha = 1.0
|
self.backgroundNode.alpha = 1.0
|
||||||
return result
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,10 +303,19 @@ public final class LinkHighlightingNode: ASDisplayNode {
|
|||||||
self.addSubnode(self.imageNode)
|
self.addSubnode(self.imageNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func updateRects(_ rects: [CGRect]) {
|
public func updateRects(_ rects: [CGRect], color: UIColor? = nil) {
|
||||||
|
var updated = false
|
||||||
if self.rects != rects {
|
if self.rects != rects {
|
||||||
|
updated = true
|
||||||
self.rects = rects
|
self.rects = rects
|
||||||
|
}
|
||||||
|
|
||||||
|
if let color, !color.isEqual(self.color) {
|
||||||
|
updated = true
|
||||||
|
self.color = color
|
||||||
|
}
|
||||||
|
|
||||||
|
if updated {
|
||||||
self.updateImage()
|
self.updateImage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct MessageHistoryHolesViewEntry: Equatable, Hashable {
|
public struct MessageHistoryHolesViewEntry: Equatable, Hashable, CustomStringConvertible {
|
||||||
public let hole: MessageHistoryViewHole
|
public let hole: MessageHistoryViewHole
|
||||||
public let direction: MessageHistoryViewRelativeHoleDirection
|
public let direction: MessageHistoryViewRelativeHoleDirection
|
||||||
public let space: MessageHistoryHoleSpace
|
public let space: MessageHistoryHoleSpace
|
||||||
@ -14,6 +14,10 @@ public struct MessageHistoryHolesViewEntry: Equatable, Hashable {
|
|||||||
self.count = count
|
self.count = count
|
||||||
self.userId = userId
|
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 {
|
final class MutableMessageHistoryHolesView {
|
||||||
|
@ -15,7 +15,7 @@ private final class ManagedMessageHistoryHolesState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct PendingEntry {
|
private struct PendingEntry: CustomStringConvertible {
|
||||||
var key: LocationKey
|
var key: LocationKey
|
||||||
var entry: MessageHistoryHolesViewEntry
|
var entry: MessageHistoryHolesViewEntry
|
||||||
var disposable: Disposable
|
var disposable: Disposable
|
||||||
@ -25,6 +25,10 @@ private final class ManagedMessageHistoryHolesState {
|
|||||||
self.entry = entry
|
self.entry = entry
|
||||||
self.disposable = disposable
|
self.disposable = disposable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var description: String {
|
||||||
|
return "entry: \(self.entry)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct DiscardedEntry {
|
private struct DiscardedEntry {
|
||||||
@ -87,6 +91,7 @@ private final class ManagedMessageHistoryHolesState {
|
|||||||
for i in (0 ..< self.discardedEntries.count).reversed() {
|
for i in (0 ..< self.discardedEntries.count).reversed() {
|
||||||
if self.discardedEntries[i].timestamp < timestamp - 0.5 {
|
if self.discardedEntries[i].timestamp < timestamp - 0.5 {
|
||||||
result.append(self.discardedEntries[i].entry.disposable)
|
result.append(self.discardedEntries[i].entry.disposable)
|
||||||
|
Logger.shared.log("ManagedMessageHistoryHoles", "Removing discarded entry \(self.discardedEntries[i].entry)")
|
||||||
self.discardedEntries.remove(at: i)
|
self.discardedEntries.remove(at: i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,9 +107,9 @@ private final class ManagedMessageHistoryHolesState {
|
|||||||
|
|
||||||
for i in (0 ..< self.pendingEntries.count).reversed() {
|
for i in (0 ..< self.pendingEntries.count).reversed() {
|
||||||
if !entries.contains(self.pendingEntries[i].entry) {
|
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.discardedEntries.append(DiscardedEntry(entry: self.pendingEntries[i], timestamp: timestamp))
|
||||||
self.pendingEntries.remove(at: i)
|
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 !self.pendingEntries.contains(where: { $0.key == key }) {
|
||||||
if let discardedIndex = self.discardedEntries.firstIndex(where: { $0.entry.entry == entry }) {
|
if let discardedIndex = self.discardedEntries.firstIndex(where: { $0.entry.entry == entry }) {
|
||||||
let discardedEntry = self.discardedEntries.remove(at: discardedIndex)
|
let discardedEntry = self.discardedEntries.remove(at: discardedIndex)
|
||||||
|
Logger.shared.log("ManagedMessageHistoryHoles", "Taking discarded entry \(discardedEntry.entry)")
|
||||||
self.pendingEntries.append(discardedEntry.entry)
|
self.pendingEntries.append(discardedEntry.entry)
|
||||||
} else {
|
} else {
|
||||||
let disposable = MetaDisposable()
|
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
|
added[entry] = disposable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8959,8 +8959,8 @@ public final class PeerInfoScreenImpl: ViewController, PeerInfoScreen, KeyShortc
|
|||||||
|
|
||||||
var items: [ContextMenuItem] = []
|
var items: [ContextMenuItem] = []
|
||||||
|
|
||||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.ChatList_Tabs_AllChats, icon: { theme in
|
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Navigation_AllChats, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Back"), color: theme.contextMenu.primaryColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Chats"), color: theme.contextMenu.primaryColor)
|
||||||
}, action: { _, f in
|
}, action: { _, f in
|
||||||
f(.default)
|
f(.default)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user