Fix loading indicator never disappearing when presenting gallery from status with >4 attachments

This commit is contained in:
Shadowfacts 2024-04-02 21:16:09 -04:00
parent 69ee3bb4f0
commit 490d48c635
2 changed files with 11 additions and 4 deletions

View File

@ -109,8 +109,6 @@ class GalleryPresentationAnimationController: NSObject, UIViewControllerAnimated
itemViewController.addContent() itemViewController.addContent()
transitionContext.completeTransition(true) transitionContext.completeTransition(true)
to.presentationAnimationCompleted()
} }
animator.startAnimation() animator.startAnimation()
@ -132,8 +130,6 @@ class GalleryPresentationAnimationController: NSObject, UIViewControllerAnimated
} }
animator.addCompletion { _ in animator.addCompletion { _ in
transitionContext.completeTransition(!transitionContext.transitionWasCancelled) transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
to.presentationAnimationCompleted()
} }
animator.startAnimation() animator.startAnimation()
} }

View File

@ -68,6 +68,17 @@ public class GalleryViewController: UIPageViewController {
setViewControllers([makeItemVC(index: initialItemIndex)], direction: .forward, animated: false) setViewControllers([makeItemVC(index: initialItemIndex)], direction: .forward, animated: false)
} }
public override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if animated {
// Wait until the transition is no longer in-progress, otherwise things will just get deferred again.
DispatchQueue.main.async {
self.presentationAnimationCompleted()
}
}
}
public override func viewWillDisappear(_ animated: Bool) { public override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated) super.viewWillDisappear(animated)