mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Hide ad better
This commit is contained in:
parent
e285f405d9
commit
ca6821c4f1
@ -4296,6 +4296,16 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func enumerateItemNodes(_ f: (ASDisplayNode) -> Bool) {
|
||||||
|
for itemNode in self.itemNodes {
|
||||||
|
if itemNode.index != nil {
|
||||||
|
if !f(itemNode) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public func forEachVisibleItemNode(_ f: (ASDisplayNode) -> Void) {
|
public func forEachVisibleItemNode(_ f: (ASDisplayNode) -> Void) {
|
||||||
for itemNode in self.itemNodes {
|
for itemNode in self.itemNodes {
|
||||||
|
@ -4963,12 +4963,22 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
|
|
||||||
self.chatDisplayNode.historyNode.contentPositionChanged = { [weak self] offset in
|
self.chatDisplayNode.historyNode.contentPositionChanged = { [weak self] offset in
|
||||||
guard let strongSelf = self else { return }
|
guard let strongSelf = self else { return }
|
||||||
|
|
||||||
|
var minOffsetForNavigation: CGFloat = 40.0
|
||||||
|
strongSelf.chatDisplayNode.historyNode.enumerateItemNodes { itemNode in
|
||||||
|
if let itemNode = itemNode as? ChatMessageBubbleItemNode {
|
||||||
|
if itemNode.item?.content.firstMessage.adAttribute != nil {
|
||||||
|
minOffsetForNavigation += itemNode.bounds.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
let offsetAlpha: CGFloat
|
let offsetAlpha: CGFloat
|
||||||
let plainInputSeparatorAlpha: CGFloat
|
let plainInputSeparatorAlpha: CGFloat
|
||||||
switch offset {
|
switch offset {
|
||||||
case let .known(offset):
|
case let .known(offset):
|
||||||
if offset < 40.0 {
|
if offset < minOffsetForNavigation {
|
||||||
offsetAlpha = 0.0
|
offsetAlpha = 0.0
|
||||||
} else {
|
} else {
|
||||||
offsetAlpha = 1.0
|
offsetAlpha = 1.0
|
||||||
|
@ -1972,6 +1972,9 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
|||||||
if dateHeaderAtBottom {
|
if dateHeaderAtBottom {
|
||||||
layoutInsets.top += layoutConstants.timestampHeaderHeight
|
layoutInsets.top += layoutConstants.timestampHeaderHeight
|
||||||
}
|
}
|
||||||
|
if isAd {
|
||||||
|
layoutInsets.top += 4.0
|
||||||
|
}
|
||||||
|
|
||||||
let layout = ListViewItemNodeLayout(contentSize: layoutSize, insets: layoutInsets)
|
let layout = ListViewItemNodeLayout(contentSize: layoutSize, insets: layoutInsets)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user