From cfb90f36143c11f0254fb6bab8369a594b83d9c0 Mon Sep 17 00:00:00 2001 From: Peter <> Date: Wed, 28 Aug 2019 16:01:19 +0400 Subject: [PATCH] Use propertyanimator if available --- .../ContextUI/Sources/ContextController.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/submodules/ContextUI/Sources/ContextController.swift b/submodules/ContextUI/Sources/ContextController.swift index 6e7a6cc673..6c2b964ccf 100644 --- a/submodules/ContextUI/Sources/ContextController.swift +++ b/submodules/ContextUI/Sources/ContextController.swift @@ -325,6 +325,17 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi self.dimNode.alpha = 1.0 self.dimNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2 * animationDurationFactor) + + if #available(iOS 10.0, *) { + if let propertyAnimator = self.propertyAnimator { + let propertyAnimator = propertyAnimator as? UIViewPropertyAnimator + propertyAnimator?.stopAnimation(true) + } + self.propertyAnimator = UIViewPropertyAnimator(duration: 0.2 * animationDurationFactor, curve: .easeInOut, animations: { [weak self] in + self?.effectView.effect = makeCustomZoomBlurEffect() + }) + } + if let _ = self.propertyAnimator { if #available(iOSApplicationExtension 10.0, iOS 10.0, *) { self.displayLinkAnimator = DisplayLinkAnimator(duration: 0.25 * animationDurationFactor, from: 0.0, to: 1.0, update: { [weak self] value in @@ -399,6 +410,10 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi } if #available(iOS 10.0, *) { + if let propertyAnimator = self.propertyAnimator { + let propertyAnimator = propertyAnimator as? UIViewPropertyAnimator + propertyAnimator?.stopAnimation(true) + } self.propertyAnimator = UIViewPropertyAnimator(duration: 0.2, curve: .easeInOut, animations: { [weak self] in self?.effectView.effect = nil })