Fix report peer title panel

This commit is contained in:
Ali 2021-06-12 22:50:15 +04:00
parent 581475d666
commit 3a40025624
3 changed files with 25 additions and 20 deletions

View File

@ -7,6 +7,12 @@ private var backArrowImageCache: [Int32: UIImage] = [:]
public final class SparseNode: ASDisplayNode {
override public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
for view in self.view.subviews {
if let result = view.hitTest(self.view.convert(point, to: view), with: event) {
return result
}
}
let result = super.hitTest(point, with: event)
if result != self.view {
return result

View File

@ -30,8 +30,8 @@ class ChatReplyCountItem: ListViewItem {
func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {
async {
let node = ChatReplyCountItemNode()
node.layoutForParams(params, item: self, previousItem: previousItem, nextItem: nextItem)
Queue.mainQueue().async {
node.layoutForParams(params, item: self, previousItem: previousItem, nextItem: nextItem)
completion(node, {
return (nil, { _ in })
})
@ -63,9 +63,9 @@ class ChatReplyCountItem: ListViewItem {
class ChatReplyCountItemNode: ListViewItemNode {
var item: ChatReplyCountItem?
let labelNode: TextNode
var backgroundNode: WallpaperBackgroundNode.BubbleBackgroundNode?
var backgroundColorNode: ASDisplayNode
private let labelNode: TextNode
private var backgroundNode: WallpaperBackgroundNode.BubbleBackgroundNode?
private let backgroundColorNode: ASDisplayNode
private var theme: ChatPresentationThemeData?

View File

@ -106,21 +106,19 @@ private final class ChatInfoTitlePanelInviteInfoNode: ASDisplayNode {
private var theme: PresentationTheme?
private let labelNode: ImmediateTextNode
private let filledBackgroundFillNode: LinkHighlightingNode
private let filledBackgroundNode: LinkHighlightingNode
private let backgroundNode: NavigationBackgroundNode
init(openInvitePeer: @escaping () -> Void) {
self.labelNode = ImmediateTextNode()
self.labelNode.maximumNumberOfLines = 1
self.labelNode.textAlignment = .center
self.filledBackgroundFillNode = LinkHighlightingNode(color: .clear)
self.filledBackgroundNode = LinkHighlightingNode(color: .clear)
self.backgroundNode = NavigationBackgroundNode(color: .clear)
super.init()
self.addSubnode(self.filledBackgroundFillNode)
self.addSubnode(self.filledBackgroundNode)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.labelNode)
self.labelNode.highlightAttributeAction = { attributes in
@ -191,19 +189,15 @@ private final class ChatInfoTitlePanelInviteInfoNode: ASDisplayNode {
labelRects[i].origin.x = floor((labelLayout.size.width - labelRects[i].width) / 2.0)
}
let backgroundLayout = self.filledBackgroundNode.asyncLayout()
let backgroundFillLayout = self.filledBackgroundFillNode.asyncLayout()
let backgroundApply = backgroundLayout(selectDateFillStaticColor(theme: theme, wallpaper: wallpaper), labelRects, 10.0, 10.0, 0.0)
let backgroundFillApply = backgroundFillLayout(theme.chat.serviceMessage.components.withDefaultWallpaper.dateFillFloating, labelRects, 10.0, 10.0, 0.0)
backgroundApply()
backgroundFillApply()
let backgroundSize = CGSize(width: labelLayout.size.width + 8.0 + 8.0, height: labelLayout.size.height + 4.0)
let labelFrame = CGRect(origin: CGPoint(x: floor((width - labelLayout.size.width) / 2.0), y: topInset + floorToScreenPixels((backgroundSize.height - labelLayout.size.height) / 2.0) - 1.0), size: labelLayout.size)
self.labelNode.frame = labelFrame
self.filledBackgroundNode.frame = labelFrame.offsetBy(dx: 0.0, dy: -11.0)
self.filledBackgroundFillNode.frame = labelFrame.offsetBy(dx: 0.0, dy: -11.0)
let backgroundFrame = labelFrame.offsetBy(dx: 0.0, dy: 1.0).insetBy(dx: -5.0, dy: -2.0)
self.backgroundNode.updateColor(color: selectDateFillStaticColor(theme: theme, wallpaper: wallpaper), enableBlur: dateFillNeedsBlur(theme: theme, wallpaper: wallpaper), transition: .immediate)
transition.updateFrame(node: self.backgroundNode, frame: backgroundFrame)
self.backgroundNode.update(size: self.backgroundNode.bounds.size, cornerRadius: self.backgroundNode.bounds.size.height / 2.0, transition: transition)
return topInset + backgroundSize.height + bottomInset
}
@ -529,6 +523,11 @@ final class ChatReportPeerTitlePanelNode: ChatTitleAccessoryPanelNode {
if let result = self.closeButton.hitTest(CGPoint(x: point.x - self.closeButton.frame.minX, y: point.y - self.closeButton.frame.minY), with: event) {
return result
}
if let inviteInfoNode = self.inviteInfoNode {
if let result = inviteInfoNode.view.hitTest(self.view.convert(point, to: inviteInfoNode.view), with: event) {
return result
}
}
return super.hitTest(point, with: event)
}
}