diff --git a/submodules/Display/Source/CAAnimationUtils.swift b/submodules/Display/Source/CAAnimationUtils.swift index 6240ea033e..9add13d39d 100644 --- a/submodules/Display/Source/CAAnimationUtils.swift +++ b/submodules/Display/Source/CAAnimationUtils.swift @@ -132,7 +132,7 @@ public extension CALayer { return animation } else if duration == 0.5 { - let animation = makeSpringAnimation(keyPath) + let animation = makeSpringAnimation(keyPath, duration: duration) animation.fromValue = from animation.toValue = to animation.isRemovedOnCompletion = removeOnCompletion @@ -297,12 +297,7 @@ public extension CALayer { } func springAnimation(from: AnyObject, to: AnyObject, keyPath: String, duration: Double, delay: Double = 0.0, initialVelocity: CGFloat = 0.0, damping: CGFloat = 88.0, removeOnCompletion: Bool = true, additive: Bool = false) -> CABasicAnimation { - let animation: CABasicAnimation - if #available(iOS 9.0, *) { - animation = makeSpringBounceAnimation(keyPath, initialVelocity, damping) - } else { - animation = makeSpringAnimation(keyPath) - } + let animation = makeSpringBounceAnimation(keyPath, initialVelocity, damping) animation.fromValue = from animation.toValue = to animation.isRemovedOnCompletion = removeOnCompletion @@ -328,12 +323,7 @@ public extension CALayer { } func animateSpring(from: AnyObject, to: AnyObject, keyPath: String, duration: Double, delay: Double = 0.0, initialVelocity: CGFloat = 0.0, damping: CGFloat = 88.0, removeOnCompletion: Bool = true, additive: Bool = false, completion: ((Bool) -> Void)? = nil) { - let animation: CABasicAnimation - if #available(iOS 9.0, *) { - animation = makeSpringBounceAnimation(keyPath, initialVelocity, damping) - } else { - animation = makeSpringAnimation(keyPath) - } + let animation = makeSpringBounceAnimation(keyPath, initialVelocity, damping) animation.fromValue = from animation.toValue = to animation.isRemovedOnCompletion = removeOnCompletion diff --git a/submodules/Display/Source/ListView.swift b/submodules/Display/Source/ListView.swift index cdd8b31a34..bf3f593a34 100644 --- a/submodules/Display/Source/ListView.swift +++ b/submodules/Display/Source/ListView.swift @@ -3246,7 +3246,7 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel case let .Spring(duration): headerNodesTransition = (.animated(duration: duration, curve: .spring), false, -completeOffset) animationCurve = .spring - let springAnimation = makeSpringAnimation("sublayerTransform") + let springAnimation = makeSpringAnimation("sublayerTransform", duration: duration) springAnimation.fromValue = NSValue(caTransform3D: CATransform3DMakeTranslation(0.0, -completeOffset, 0.0)) springAnimation.toValue = NSValue(caTransform3D: CATransform3DIdentity) springAnimation.isRemovedOnCompletion = true @@ -3327,7 +3327,7 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel }) } - let springAnimation = makeSpringAnimation("sublayerTransform") + let springAnimation = makeSpringAnimation("sublayerTransform", duration: duration) springAnimation.fromValue = NSValue(caTransform3D: CATransform3DMakeTranslation(0.0, -completeOffset, 0.0)) springAnimation.toValue = NSValue(caTransform3D: CATransform3DIdentity) springAnimation.isRemovedOnCompletion = true @@ -3576,7 +3576,7 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel case let .Spring(duration): animationCurve = .spring animationDuration = duration - let springAnimation = makeSpringAnimation("sublayerTransform") + let springAnimation = makeSpringAnimation("sublayerTransform", duration: duration) springAnimation.fromValue = NSValue(caTransform3D: CATransform3DMakeTranslation(0.0, -offset, 0.0)) springAnimation.toValue = NSValue(caTransform3D: CATransform3DIdentity) springAnimation.isRemovedOnCompletion = true @@ -3595,7 +3595,7 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel springAnimation.speed = speed * Float(springAnimation.duration / duration) } - let reverseSpringAnimation = makeSpringAnimation("sublayerTransform") + let reverseSpringAnimation = makeSpringAnimation("sublayerTransform", duration: duration) reverseSpringAnimation.fromValue = NSValue(caTransform3D: CATransform3DMakeTranslation(0.0, offset, 0.0)) reverseSpringAnimation.toValue = NSValue(caTransform3D: CATransform3DIdentity) reverseSpringAnimation.isRemovedOnCompletion = true diff --git a/submodules/Display/Source/ListViewAnimation.swift b/submodules/Display/Source/ListViewAnimation.swift index 137c0fd16f..3ee91fdd68 100644 --- a/submodules/Display/Source/ListViewAnimation.swift +++ b/submodules/Display/Source/ListViewAnimation.swift @@ -89,7 +89,7 @@ extension CGSize { } private let springAnimationIn: CABasicAnimation = { - let animation = makeSpringAnimation("") + let animation = makeSpringAnimation("", duration: 0.5) return animation }() diff --git a/submodules/Display/Source/UIKitUtils.swift b/submodules/Display/Source/UIKitUtils.swift index 229b9b77f0..c3906905e4 100644 --- a/submodules/Display/Source/UIKitUtils.swift +++ b/submodules/Display/Source/UIKitUtils.swift @@ -8,8 +8,8 @@ public extension UIView { } } -public func makeSpringAnimation(_ keyPath: String) -> CABasicAnimation { - return makeSpringAnimationImpl(keyPath) +public func makeSpringAnimation(_ keyPath: String, duration: Double) -> CABasicAnimation { + return makeSpringAnimationImpl(keyPath, duration) } public func makeSpringBounceAnimation(_ keyPath: String, _ initialVelocity: CGFloat, _ damping: CGFloat) -> CABasicAnimation { diff --git a/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift b/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift index 5aaaa4e792..f4d5396a52 100644 --- a/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift +++ b/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift @@ -376,11 +376,15 @@ public class GlassBackgroundView: UIView { nativeView.frame = CGRect(origin: CGPoint(), size: size) nativeContainerView.frame = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: max(size.height, 400.0))) } else { - transition.containedViewLayoutTransition.animateView { + /*transition.containedViewLayoutTransition.animateView { nativeView.layer.cornerRadius = cornerRadius nativeView.frame = CGRect(origin: CGPoint(), size: size) nativeContainerView.frame = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: max(size.height, 400.0))) - } + }*/ + nativeView.layer.cornerRadius = cornerRadius + transition.setFrame(view: nativeView, frame: CGRect(origin: CGPoint(), size: size)) + transition.setFrame(view: nativeContainerView, frame: CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: max(size.height, 400.0)))) + //nativeView.layer.animateFrame(from: previousFrame, to: CGRect(origin: CGPoint(), size: size), duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring) } } diff --git a/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIKitUtils.h b/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIKitUtils.h index c65fd7a175..a270bd765f 100644 --- a/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIKitUtils.h +++ b/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIKitUtils.h @@ -3,7 +3,7 @@ double animationDurationFactorImpl(); -CABasicAnimation * _Nonnull makeSpringAnimationImpl(NSString * _Nonnull keyPath); +CABasicAnimation * _Nonnull makeSpringAnimationImpl(NSString * _Nonnull keyPath, double duration); CABasicAnimation * _Nonnull make26SpringAnimationImpl(NSString * _Nonnull keyPath, double duration); CABasicAnimation * _Nonnull makeSpringBounceAnimationImpl(NSString * _Nonnull keyPath, CGFloat initialVelocity, CGFloat damping); CGFloat springAnimationValueAtImpl(CABasicAnimation * _Nonnull animation, CGFloat t); diff --git a/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIKitUtils.m b/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIKitUtils.m index a3f7bc1e81..0a4588ec7c 100644 --- a/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIKitUtils.m +++ b/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIKitUtils.m @@ -50,7 +50,11 @@ double animationDurationFactorImpl() { @end -CABasicAnimation * _Nonnull makeSpringAnimationImpl(NSString * _Nonnull keyPath) { +CABasicAnimation * _Nonnull makeSpringAnimationImpl(NSString * _Nonnull keyPath, double duration) { + if (@available(iOS 26.0, *)) { + return make26SpringAnimationImpl(keyPath, duration); + } + CASpringAnimation *springAnimation = [CASpringAnimation animationWithKeyPath:keyPath]; springAnimation.mass = 3.0f; springAnimation.stiffness = 1000.0f;