Fix navigation transition

This commit is contained in:
Ali 2022-11-28 17:25:47 +04:00
parent 88aa22a8e4
commit 9fed6f0734
3 changed files with 29 additions and 2 deletions

View File

@ -413,8 +413,8 @@ official_apple_pay_merchants = [
"merchant.org.telegram.Best2pay.test",
"merchant.psbank.test.telegramios",
"merchant.psbank.prod.telegramios",
"merchant.org.telegram.billinenet.test",
"merchant.org.telegram.portmone.test",
#"merchant.org.telegram.billinenet.test",
#"merchant.org.telegram.portmone.test",
]
official_bundle_ids = [

View File

@ -1574,6 +1574,7 @@ open class NavigationBar: ASDisplayNode {
}
public var intrinsicCanTransitionInline: Bool = true
public var shouldTransitionInline: (() -> Bool)?
public var passthroughTouches = true
@ -1581,6 +1582,11 @@ open class NavigationBar: ASDisplayNode {
if let contentNode = self.contentNode, case .replacement = contentNode.mode {
return false
} else {
if let shouldTransitionInline = self.shouldTransitionInline {
if !shouldTransitionInline() {
return false
}
}
return self.intrinsicCanTransitionInline
}
}

View File

@ -8950,6 +8950,21 @@ public final class PeerInfoScreenImpl: ViewController, PeerInfoScreen, KeyShortc
}
if self.chatLocation.peerId != nil {
/*self.navigationBar?.shouldTransitionInline = { [weak self] in
guard let strongSelf = self else {
return false
}
if strongSelf.navigationItem.leftBarButtonItem != nil {
return false
}
if strongSelf.controllerNode.scrollNode.view.contentOffset.y > .ulpOfOne {
return false
}
if strongSelf.controllerNode.headerNode.isAvatarExpanded {
return false
}
return false
}*/
self.navigationBar?.makeCustomTransitionNode = { [weak self] other, isInteractive in
guard let strongSelf = self else {
return nil
@ -9386,9 +9401,11 @@ private final class PeerInfoNavigationTransitionNode: ASDisplayNode, CustomNavig
private var previousContentNode: ASDisplayNode?
private var previousContentNodeFrame: CGRect?
private var previousContentNodeAlpha: CGFloat = 1.0
private var previousSecondaryContentNode: ASDisplayNode?
private var previousSecondaryContentNodeFrame: CGRect?
private var previousSecondaryContentNodeAlpha: CGFloat = 1.0
private var previousTitleNode: (ASDisplayNode, PortalView)?
private var previousStatusNode: (ASDisplayNode, ASDisplayNode)?
@ -9476,12 +9493,14 @@ private final class PeerInfoNavigationTransitionNode: ASDisplayNode, CustomNavig
if let contentNode = bottomNavigationBar.contentNode {
self.previousContentNode = contentNode
self.previousContentNodeFrame = contentNode.view.convert(contentNode.view.bounds, to: bottomNavigationBar.view)
self.previousContentNodeAlpha = contentNode.alpha
self.addSubnode(contentNode)
}
if let secondaryContentNode = bottomNavigationBar.secondaryContentNode {
self.previousSecondaryContentNode = secondaryContentNode
self.previousSecondaryContentNodeFrame = secondaryContentNode.view.convert(secondaryContentNode.view.bounds, to: bottomNavigationBar.view)
self.previousSecondaryContentNodeAlpha = secondaryContentNode.alpha
self.addSubnode(secondaryContentNode)
}
@ -9682,11 +9701,13 @@ private final class PeerInfoNavigationTransitionNode: ASDisplayNode, CustomNavig
if let previousContentNode = self.previousContentNode, let previousContentNodeFrame = self.previousContentNodeFrame {
previousContentNode.frame = previousContentNodeFrame
previousContentNode.alpha = self.previousContentNodeAlpha
bottomNavigationBar.insertSubnode(previousContentNode, belowSubnode: bottomNavigationBar.stripeNode)
}
if let previousSecondaryContentNode = self.previousSecondaryContentNode, let previousSecondaryContentNodeFrame = self.previousSecondaryContentNodeFrame {
previousSecondaryContentNode.frame = previousSecondaryContentNodeFrame
previousSecondaryContentNode.alpha = self.previousSecondaryContentNodeAlpha
bottomNavigationBar.clippingNode.addSubnode(previousSecondaryContentNode)
}
}