Call completions immediately if the previous WebViewController was deallocated because the iPad was rotated. Issue #1757

This commit is contained in:
Maurice Parker 2020-01-30 18:48:51 -07:00
parent df3c78b1c6
commit a0f429448f
1 changed files with 9 additions and 4 deletions

View File

@ -93,11 +93,16 @@ class ImageTransition: NSObject, UIViewControllerAnimatedTransitioning {
animations: {
imageView.frame = self.originFrame
}, completion: { _ in
self.webViewController?.showClickedImage() {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
imageView.removeFromSuperview()
transitionContext.completeTransition(true)
if let controller = self.webViewController {
controller.showClickedImage() {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
imageView.removeFromSuperview()
transitionContext.completeTransition(true)
}
}
} else {
imageView.removeFromSuperview()
transitionContext.completeTransition(true)
}
})
}