Various fixes

This commit is contained in:
Ilya Laktyushin 2021-10-27 00:54:50 +04:00
parent ff158e66fd
commit 34dd524d72
2 changed files with 32 additions and 5 deletions

View File

@ -273,6 +273,12 @@ open class TabBarController: ViewController {
self.displayNodeDidLoad()
}
public func updateBackgroundAlpha(_ alpha: CGFloat, transition: ContainedViewLayoutTransition) {
let alpha = max(0.0, min(1.0, alpha))
transition.updateAlpha(node: self.tabBarControllerNode.tabBarNode.backgroundNode, alpha: alpha, delay: 0.15)
transition.updateAlpha(node: self.tabBarControllerNode.tabBarNode.separatorNode, alpha: alpha, delay: 0.15)
}
private func updateSelectedIndex() {
if !self.isNodeLoaded {
return

View File

@ -6612,10 +6612,19 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|> take(1))
}
}
private func updateNavigation(transition: ContainedViewLayoutTransition, additive: Bool) {
fileprivate func updateNavigation(transition: ContainedViewLayoutTransition, additive: Bool) {
let offsetY = self.scrollNode.view.contentOffset.y
if self.isSettings {
let bottomOffsetY = self.scrollNode.view.contentSize.height + self.scrollNode.view.contentInset.bottom - offsetY - self.scrollNode.frame.height
let backgroundAlpha: CGFloat = min(30.0, bottomOffsetY) / 30.0
if let tabBarController = self.controller?.parent as? TabBarController {
tabBarController.updateBackgroundAlpha(backgroundAlpha, transition: transition)
}
}
if self.state.isEditing || offsetY <= 50.0 || self.paneContainerNode.alpha.isZero {
if !self.scrollNode.view.bounces {
self.scrollNode.view.bounces = true
@ -7253,12 +7262,24 @@ public final class PeerInfoScreenImpl: ViewController, PeerInfoScreen {
super.displayNodeDidLoad()
}
public override func willMove(toParent viewController: UIViewController?) {
super.willMove(toParent: parent)
if self.isSettings, viewController == nil, let tabBarController = self.parent as? TabBarController {
tabBarController.updateBackgroundAlpha(1.0, transition: .immediate)
}
}
public override func didMove(toParent viewController: UIViewController?) {
super.didMove(toParent: viewController)
if self.isSettings && viewController == nil {
Queue.mainQueue().after(0.1) {
self.controllerNode.resetHeaderExpansion()
if self.isSettings {
if viewController == nil {
Queue.mainQueue().after(0.1) {
self.controllerNode.resetHeaderExpansion()
}
} else {
self.controllerNode.updateNavigation(transition: .immediate, additive: false)
}
}
}