mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Reaction improvements
This commit is contained in:
@@ -1693,7 +1693,7 @@ public final class ControlledTransition {
|
||||
self.curve = curve
|
||||
}
|
||||
|
||||
func merge(with other: NativeAnimator) {
|
||||
func merge(with other: NativeAnimator, forceRestart: Bool) {
|
||||
var removeAnimationIndices: [Int] = []
|
||||
for i in 0 ..< self.animations.count {
|
||||
let animation = self.animations[i]
|
||||
@@ -1703,7 +1703,7 @@ public final class ControlledTransition {
|
||||
let otherAnimation = other.animations[j]
|
||||
|
||||
if animation.layer === otherAnimation.layer && animation.path == otherAnimation.path {
|
||||
if animation.toValue == otherAnimation.toValue {
|
||||
if animation.toValue == otherAnimation.toValue && !forceRestart {
|
||||
removeAnimationIndices.append(i)
|
||||
} else {
|
||||
removeOtherAnimationIndices.append(j)
|
||||
@@ -1932,9 +1932,9 @@ public final class ControlledTransition {
|
||||
}
|
||||
}
|
||||
|
||||
public func merge(with other: ControlledTransition) {
|
||||
public func merge(with other: ControlledTransition, forceRestart: Bool) {
|
||||
if let animator = self.animator as? NativeAnimator, let otherAnimator = other.animator as? NativeAnimator {
|
||||
animator.merge(with: otherAnimator)
|
||||
animator.merge(with: otherAnimator, forceRestart: forceRestart)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public final class ContextExtractedContentContainingNode: ASDisplayNode {
|
||||
public var updateAbsoluteRect: ((CGRect, CGSize) -> Void)?
|
||||
public var applyAbsoluteOffset: ((CGPoint, ContainedViewLayoutTransitionCurve, Double) -> Void)?
|
||||
public var applyAbsoluteOffsetSpring: ((CGFloat, Double, CGFloat) -> Void)?
|
||||
public var layoutUpdated: ((CGSize) -> Void)?
|
||||
public var layoutUpdated: ((CGSize, ListViewItemUpdateAnimation) -> Void)?
|
||||
public var updateDistractionFreeMode: ((Bool) -> Void)?
|
||||
public var requestDismiss: (() -> Void)?
|
||||
|
||||
|
||||
@@ -2665,6 +2665,12 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
|
||||
if !abs(updatedApparentHeight - previousApparentHeight).isZero {
|
||||
let currentAnimation = node.animationForKey("apparentHeight")
|
||||
if let currentAnimation = currentAnimation, let toFloat = currentAnimation.to as? CGFloat, toFloat.isEqual(to: updatedApparentHeight) {
|
||||
/*node.addApparentHeightAnimation(updatedApparentHeight, duration: insertionAnimationDuration * UIView.animationDurationFactor(), beginAt: timestamp, update: { [weak node] progress, currentValue in
|
||||
if let node = node {
|
||||
node.animateFrameTransition(progress, currentValue)
|
||||
}
|
||||
})
|
||||
node.addTransitionOffsetAnimation(0.0, duration: insertionAnimationDuration * UIView.animationDurationFactor(), beginAt: timestamp)*/
|
||||
} else {
|
||||
node.apparentHeight = previousApparentHeight
|
||||
node.animateFrameTransition(0.0, previousApparentHeight)
|
||||
@@ -2733,7 +2739,7 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
|
||||
}
|
||||
|
||||
for itemNode in self.itemNodes {
|
||||
itemNode.beginPendingControlledTransitions(beginAt: timestamp)
|
||||
itemNode.beginPendingControlledTransitions(beginAt: timestamp, forceRestart: false)
|
||||
}
|
||||
|
||||
if hadInserts, let reorderNode = self.reorderNode, reorderNode.supernode != nil {
|
||||
|
||||
@@ -481,16 +481,16 @@ open class ListViewItemNode: ASDisplayNode, AccessibilityFocusableNode {
|
||||
self.pendingControlledTransitions.append(transition)
|
||||
}
|
||||
|
||||
func beginPendingControlledTransitions(beginAt: Double) {
|
||||
func beginPendingControlledTransitions(beginAt: Double, forceRestart: Bool) {
|
||||
for transition in self.pendingControlledTransitions {
|
||||
self.addControlledTransition(transition: transition, beginAt: beginAt)
|
||||
self.addControlledTransition(transition: transition, beginAt: beginAt, forceRestart: forceRestart)
|
||||
}
|
||||
self.pendingControlledTransitions.removeAll()
|
||||
}
|
||||
|
||||
func addControlledTransition(transition: ControlledTransition, beginAt: Double) {
|
||||
func addControlledTransition(transition: ControlledTransition, beginAt: Double, forceRestart: Bool) {
|
||||
for controlledTransition in self.controlledTransitions {
|
||||
transition.merge(with: controlledTransition.transition)
|
||||
transition.merge(with: controlledTransition.transition, forceRestart: forceRestart)
|
||||
}
|
||||
self.controlledTransitions.append(ControlledTransitionContext(transition: transition, beginAt: beginAt))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user