mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-01 04:08:07 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
21d32ca109
@ -195,6 +195,7 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
|
|||||||
private final var lastContentOffset: CGPoint = CGPoint()
|
private final var lastContentOffset: CGPoint = CGPoint()
|
||||||
private final var lastContentOffsetTimestamp: CFAbsoluteTime = 0.0
|
private final var lastContentOffsetTimestamp: CFAbsoluteTime = 0.0
|
||||||
private final var ignoreScrollingEvents: Bool = false
|
private final var ignoreScrollingEvents: Bool = false
|
||||||
|
public final var globalIgnoreScrollingEvents: Bool = false
|
||||||
|
|
||||||
private let infiniteScrollSize: CGFloat
|
private let infiniteScrollSize: CGFloat
|
||||||
|
|
||||||
@ -939,6 +940,9 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
|
|||||||
if self.ignoreScrollingEvents || scroller !== self.scroller {
|
if self.ignoreScrollingEvents || scroller !== self.scroller {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if self.globalIgnoreScrollingEvents {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
/*let timestamp = CACurrentMediaTime()
|
/*let timestamp = CACurrentMediaTime()
|
||||||
if !self.previousDidScrollTimestamp.isZero {
|
if !self.previousDidScrollTimestamp.isZero {
|
||||||
|
|||||||
@ -3443,6 +3443,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final class SnapshotState {
|
final class SnapshotState {
|
||||||
|
let backgroundNode: WallpaperBackgroundNode
|
||||||
fileprivate let historySnapshotState: ChatHistoryListNode.SnapshotState
|
fileprivate let historySnapshotState: ChatHistoryListNode.SnapshotState
|
||||||
let titleViewSnapshotState: ChatTitleView.SnapshotState?
|
let titleViewSnapshotState: ChatTitleView.SnapshotState?
|
||||||
let avatarSnapshotState: ChatAvatarNavigationNode.SnapshotState?
|
let avatarSnapshotState: ChatAvatarNavigationNode.SnapshotState?
|
||||||
@ -3453,6 +3454,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
let inputPanelOverscrollNodeSnapshot: UIView?
|
let inputPanelOverscrollNodeSnapshot: UIView?
|
||||||
|
|
||||||
fileprivate init(
|
fileprivate init(
|
||||||
|
backgroundNode: WallpaperBackgroundNode,
|
||||||
historySnapshotState: ChatHistoryListNode.SnapshotState,
|
historySnapshotState: ChatHistoryListNode.SnapshotState,
|
||||||
titleViewSnapshotState: ChatTitleView.SnapshotState?,
|
titleViewSnapshotState: ChatTitleView.SnapshotState?,
|
||||||
avatarSnapshotState: ChatAvatarNavigationNode.SnapshotState?,
|
avatarSnapshotState: ChatAvatarNavigationNode.SnapshotState?,
|
||||||
@ -3462,6 +3464,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
inputPanelNodeSnapshot: UIView?,
|
inputPanelNodeSnapshot: UIView?,
|
||||||
inputPanelOverscrollNodeSnapshot: UIView?
|
inputPanelOverscrollNodeSnapshot: UIView?
|
||||||
) {
|
) {
|
||||||
|
self.backgroundNode = backgroundNode
|
||||||
self.historySnapshotState = historySnapshotState
|
self.historySnapshotState = historySnapshotState
|
||||||
self.titleViewSnapshotState = titleViewSnapshotState
|
self.titleViewSnapshotState = titleViewSnapshotState
|
||||||
self.avatarSnapshotState = avatarSnapshotState
|
self.avatarSnapshotState = avatarSnapshotState
|
||||||
@ -3493,6 +3496,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
inputPanelOverscrollNodeSnapshot = snapshot
|
inputPanelOverscrollNodeSnapshot = snapshot
|
||||||
}
|
}
|
||||||
return SnapshotState(
|
return SnapshotState(
|
||||||
|
backgroundNode: self.backgroundNode,
|
||||||
historySnapshotState: self.historyNode.prepareSnapshotState(),
|
historySnapshotState: self.historyNode.prepareSnapshotState(),
|
||||||
titleViewSnapshotState: titleViewSnapshotState,
|
titleViewSnapshotState: titleViewSnapshotState,
|
||||||
avatarSnapshotState: avatarSnapshotState,
|
avatarSnapshotState: avatarSnapshotState,
|
||||||
@ -3505,7 +3509,14 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func animateFromSnapshot(_ snapshotState: SnapshotState, completion: @escaping () -> Void) {
|
func animateFromSnapshot(_ snapshotState: SnapshotState, completion: @escaping () -> Void) {
|
||||||
self.historyNode.animateFromSnapshot(snapshotState.historySnapshotState, completion: completion)
|
let previousBackgroundNode = snapshotState.backgroundNode
|
||||||
|
self.backgroundNode.supernode?.insertSubnode(previousBackgroundNode, belowSubnode: self.backgroundNode)
|
||||||
|
|
||||||
|
self.historyNode.animateFromSnapshot(snapshotState.historySnapshotState, completion: { [weak previousBackgroundNode] in
|
||||||
|
previousBackgroundNode?.removeFromSupernode()
|
||||||
|
|
||||||
|
completion()
|
||||||
|
})
|
||||||
self.navigateButtons.animateFromSnapshot(snapshotState.navigationButtonsSnapshotState)
|
self.navigateButtons.animateFromSnapshot(snapshotState.navigationButtonsSnapshotState)
|
||||||
|
|
||||||
if let titleAccessoryPanelSnapshot = snapshotState.titleAccessoryPanelSnapshot {
|
if let titleAccessoryPanelSnapshot = snapshotState.titleAccessoryPanelSnapshot {
|
||||||
|
|||||||
@ -3789,15 +3789,16 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let snapshotView = self.view.snapshotView(afterScreenUpdates: false)!
|
let snapshotView = self.view//.snapshotView(afterScreenUpdates: false)!
|
||||||
|
self.globalIgnoreScrollingEvents = true
|
||||||
|
|
||||||
snapshotView.frame = self.view.bounds
|
//snapshotView.frame = self.view.bounds
|
||||||
if let sublayers = self.layer.sublayers {
|
/*if let sublayers = self.layer.sublayers {
|
||||||
for sublayer in sublayers {
|
for sublayer in sublayers {
|
||||||
sublayer.isHidden = true
|
sublayer.isHidden = true
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
self.view.addSubview(snapshotView)
|
//self.view.addSubview(snapshotView)
|
||||||
|
|
||||||
let overscrollView = self.overscrollView
|
let overscrollView = self.overscrollView
|
||||||
if let overscrollView = overscrollView {
|
if let overscrollView = overscrollView {
|
||||||
@ -3835,6 +3836,10 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
snapshotParentView.frame = self.view.frame
|
snapshotParentView.frame = self.view.frame
|
||||||
|
|
||||||
snapshotState.snapshotView.frame = snapshotParentView.bounds
|
snapshotState.snapshotView.frame = snapshotParentView.bounds
|
||||||
|
|
||||||
|
snapshotState.snapshotView.clipsToBounds = true
|
||||||
|
snapshotState.snapshotView.layer.sublayerTransform = CATransform3DMakeRotation(CGFloat.pi, 0.0, 0.0, 1.0)
|
||||||
|
|
||||||
self.view.superview?.insertSubview(snapshotParentView, belowSubview: self.view)
|
self.view.superview?.insertSubview(snapshotParentView, belowSubview: self.view)
|
||||||
|
|
||||||
snapshotParentView.layer.animatePosition(from: CGPoint(x: 0.0, y: 0.0), to: CGPoint(x: 0.0, y: -self.view.bounds.height - snapshotState.snapshotBottomInset - snapshotTopInset), duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, additive: true, completion: { [weak snapshotParentView] _ in
|
snapshotParentView.layer.animatePosition(from: CGPoint(x: 0.0, y: 0.0), to: CGPoint(x: 0.0, y: -self.view.bounds.height - snapshotState.snapshotBottomInset - snapshotTopInset), duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, additive: true, completion: { [weak snapshotParentView] _ in
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user