From b85f1b2b4aac6aa433c898330c2f933ea99e0d9d Mon Sep 17 00:00:00 2001 From: Jon Petersson Date: Wed, 20 Sep 2023 16:29:53 +0200 Subject: [PATCH] Improve notification banner transitions --- .../Notifications/UI/NotificationController.swift | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/ios/MullvadVPN/Notifications/UI/NotificationController.swift b/ios/MullvadVPN/Notifications/UI/NotificationController.swift index 14c133433b43..b29e3d2baeec 100644 --- a/ios/MullvadVPN/Notifications/UI/NotificationController.swift +++ b/ios/MullvadVPN/Notifications/UI/NotificationController.swift @@ -12,7 +12,6 @@ final class NotificationController: UIViewController { let bannerView: NotificationBannerView = { let bannerView = NotificationBannerView() bannerView.translatesAutoresizingMaskIntoConstraints = false - bannerView.isHidden = true bannerView.isAccessibilityElement = true return bannerView }() @@ -63,7 +62,6 @@ final class NotificationController: UIViewController { // avoid undesired horizontal expansion animation. view.layoutIfNeeded() - bannerView.isHidden = false hideBannerConstraint?.isActive = false showBannerConstraint?.isActive = true } else { @@ -71,13 +69,6 @@ final class NotificationController: UIViewController { hideBannerConstraint?.isActive = true } - let finish = { [weak self] in - if self?.lastNotification == nil { - self?.bannerView.isHidden = true - } - completion?() - } - if animated { let timing = UISpringTimingParameters( dampingRatio: 0.7, @@ -89,12 +80,12 @@ final class NotificationController: UIViewController { self.view.layoutIfNeeded() } animator.addCompletion { _ in - finish() + completion?() } animator.startAnimation() } else { view.layoutIfNeeded() - finish() + completion?() } }