mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-28 00:20:19 +00:00
Fixed overlay presentation when keyboard window is about to be hidden or appears to remain on the screen when it actually doesn't.
Added keyboard-awareness to tab bar on iPad.
This commit is contained in:
parent
06b1bc2bdd
commit
b34f174520
@ -2,7 +2,7 @@ import Foundation
|
|||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
|
|
||||||
private func isViewVisibleInHierarchy(_ view: UIView) -> Bool {
|
private func isViewVisibleInHierarchy(_ view: UIView, _ initial: Bool = true) -> Bool {
|
||||||
guard let window = view.window else {
|
guard let window = view.window else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -12,7 +12,11 @@ private func isViewVisibleInHierarchy(_ view: UIView) -> Bool {
|
|||||||
if view.superview === window {
|
if view.superview === window {
|
||||||
return true
|
return true
|
||||||
} else if let superview = view.superview {
|
} else if let superview = view.superview {
|
||||||
return isViewVisibleInHierarchy(superview)
|
if initial && view.frame.minY >= superview.frame.height {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
return isViewVisibleInHierarchy(superview, false)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ final class TabBarControllerNode: ASDisplayNode {
|
|||||||
|
|
||||||
func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||||
let update = {
|
let update = {
|
||||||
let tabBarHeight: CGFloat
|
var tabBarHeight: CGFloat
|
||||||
let bottomInset: CGFloat = layout.insets(options: []).bottom
|
let bottomInset: CGFloat = layout.insets(options: []).bottom
|
||||||
if !layout.safeInsets.left.isZero {
|
if !layout.safeInsets.left.isZero {
|
||||||
tabBarHeight = 34.0 + bottomInset
|
tabBarHeight = 34.0 + bottomInset
|
||||||
@ -44,6 +44,10 @@ final class TabBarControllerNode: ASDisplayNode {
|
|||||||
tabBarHeight = 49.0 + bottomInset
|
tabBarHeight = 49.0 + bottomInset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let inputHeight = layout.inputHeight, layout.metrics.widthClass == .regular {
|
||||||
|
tabBarHeight += inputHeight
|
||||||
|
}
|
||||||
|
|
||||||
transition.updateFrame(node: self.tabBarNode, frame: CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - tabBarHeight), size: CGSize(width: layout.size.width, height: tabBarHeight)))
|
transition.updateFrame(node: self.tabBarNode, frame: CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - tabBarHeight), size: CGSize(width: layout.size.width, height: tabBarHeight)))
|
||||||
self.tabBarNode.updateLayout(size: layout.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: bottomInset, transition: transition)
|
self.tabBarNode.updateLayout(size: layout.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: bottomInset, transition: transition)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user