mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
UI fixes
This commit is contained in:
@@ -2611,6 +2611,8 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
let navigationButtonsSnapshotState: ChatHistoryNavigationButtons.SnapshotState
|
||||
let titleAccessoryPanelSnapshot: UIView?
|
||||
let navigationBarHeight: CGFloat
|
||||
let inputPanelNodeSnapshot: UIView?
|
||||
let inputPanelOverscrollNodeSnapshot: UIView?
|
||||
|
||||
fileprivate init(
|
||||
historySnapshotState: ChatHistoryListNode.SnapshotState,
|
||||
@@ -2618,7 +2620,9 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
avatarSnapshotState: ChatAvatarNavigationNode.SnapshotState?,
|
||||
navigationButtonsSnapshotState: ChatHistoryNavigationButtons.SnapshotState,
|
||||
titleAccessoryPanelSnapshot: UIView?,
|
||||
navigationBarHeight: CGFloat
|
||||
navigationBarHeight: CGFloat,
|
||||
inputPanelNodeSnapshot: UIView?,
|
||||
inputPanelOverscrollNodeSnapshot: UIView?
|
||||
) {
|
||||
self.historySnapshotState = historySnapshotState
|
||||
self.titleViewSnapshotState = titleViewSnapshotState
|
||||
@@ -2626,6 +2630,8 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
self.navigationButtonsSnapshotState = navigationButtonsSnapshotState
|
||||
self.titleAccessoryPanelSnapshot = titleAccessoryPanelSnapshot
|
||||
self.navigationBarHeight = navigationBarHeight
|
||||
self.inputPanelNodeSnapshot = inputPanelNodeSnapshot
|
||||
self.inputPanelOverscrollNodeSnapshot = inputPanelOverscrollNodeSnapshot
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2638,13 +2644,25 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
snapshot.frame = titleAccessoryPanelNode.frame
|
||||
titleAccessoryPanelSnapshot = snapshot
|
||||
}
|
||||
var inputPanelNodeSnapshot: UIView?
|
||||
if let inputPanelNode = self.inputPanelNode, let snapshot = inputPanelNode.view.snapshotView(afterScreenUpdates: false) {
|
||||
snapshot.frame = inputPanelNode.frame
|
||||
inputPanelNodeSnapshot = snapshot
|
||||
}
|
||||
var inputPanelOverscrollNodeSnapshot: UIView?
|
||||
if let inputPanelOverscrollNode = self.inputPanelOverscrollNode, let snapshot = inputPanelOverscrollNode.view.snapshotView(afterScreenUpdates: false) {
|
||||
snapshot.frame = inputPanelOverscrollNode.frame
|
||||
inputPanelOverscrollNodeSnapshot = snapshot
|
||||
}
|
||||
return SnapshotState(
|
||||
historySnapshotState: self.historyNode.prepareSnapshotState(),
|
||||
titleViewSnapshotState: titleViewSnapshotState,
|
||||
avatarSnapshotState: avatarSnapshotState,
|
||||
navigationButtonsSnapshotState: self.navigateButtons.prepareSnapshotState(),
|
||||
titleAccessoryPanelSnapshot: titleAccessoryPanelSnapshot,
|
||||
navigationBarHeight: self.navigationBar?.backgroundNode.bounds.height ?? 0.0
|
||||
navigationBarHeight: self.navigationBar?.backgroundNode.bounds.height ?? 0.0,
|
||||
inputPanelNodeSnapshot: inputPanelNodeSnapshot,
|
||||
inputPanelOverscrollNodeSnapshot: inputPanelOverscrollNodeSnapshot
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2684,6 +2702,27 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
navigationBar.backgroundNode.update(size: currentFrame.size, transition: .animated(duration: 0.5, curve: .spring))
|
||||
}
|
||||
}
|
||||
|
||||
if let inputPanelNode = self.inputPanelNode, let inputPanelNodeSnapshot = snapshotState.inputPanelNodeSnapshot {
|
||||
inputPanelNode.view.superview?.insertSubview(inputPanelNodeSnapshot, belowSubview: inputPanelNode.view)
|
||||
|
||||
inputPanelNodeSnapshot.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak inputPanelNodeSnapshot] _ in
|
||||
inputPanelNodeSnapshot?.removeFromSuperview()
|
||||
})
|
||||
inputPanelNodeSnapshot.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: -5.0), duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, additive: true)
|
||||
|
||||
if let inputPanelOverscrollNodeSnapshot = snapshotState.inputPanelOverscrollNodeSnapshot {
|
||||
inputPanelNode.view.superview?.insertSubview(inputPanelOverscrollNodeSnapshot, belowSubview: inputPanelNode.view)
|
||||
|
||||
inputPanelOverscrollNodeSnapshot.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak inputPanelOverscrollNodeSnapshot] _ in
|
||||
inputPanelOverscrollNodeSnapshot?.removeFromSuperview()
|
||||
})
|
||||
inputPanelOverscrollNodeSnapshot.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: -5.0), duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, additive: true)
|
||||
}
|
||||
|
||||
inputPanelNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3)
|
||||
inputPanelNode.layer.animatePosition(from: CGPoint(x: 0.0, y: 5.0), to: CGPoint(), duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring, additive: true)
|
||||
}
|
||||
}
|
||||
|
||||
private var preivousChatInputPanelOverscrollNodeTimestamp: Double = 0.0
|
||||
|
||||
Reference in New Issue
Block a user