Fix double gestures in attachments gallery

This commit is contained in:
Shadowfacts 2020-03-17 21:56:29 -04:00
parent ae416bb604
commit 4018d39312
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 8 additions and 2 deletions

View File

@ -67,7 +67,9 @@ class GalleryViewController: UIPageViewController, UIPageViewControllerDataSourc
self.pages = attachments.map { self.pages = attachments.map {
switch $0.kind { switch $0.kind {
case .image: case .image:
return LoadingLargeImageViewController(attachment: $0) let vc = LoadingLargeImageViewController(attachment: $0)
vc.shrinkGestureEnabled = false
return vc
case .video, .audio: case .video, .audio:
let vc = AVPlayerViewController() let vc = AVPlayerViewController()
vc.player = AVPlayer(url: $0.url) vc.player = AVPlayer(url: $0.url)

View File

@ -33,6 +33,8 @@ class LoadingLargeImageViewController: UIViewController, LargeImageAnimatableVie
} }
} }
var shrinkGestureEnabled = true
var animationSourceInfo: LargeImageViewController.SourceInfo? var animationSourceInfo: LargeImageViewController.SourceInfo?
var animationImage: UIImage? { animationSourceInfo?.image ?? largeImageVC?.image } var animationImage: UIImage? { animationSourceInfo?.image ?? largeImageVC?.image }
var animationGifData: Data? { largeImageVC?.gifData } var animationGifData: Data? { largeImageVC?.gifData }
@ -91,7 +93,9 @@ class LoadingLargeImageViewController: UIViewController, LargeImageAnimatableVie
} }
} }
dismissInteractionController = LargeImageInteractionController(viewController: self) if shrinkGestureEnabled {
dismissInteractionController = LargeImageInteractionController(viewController: self)
}
} }
override func didMove(toParent parent: UIViewController?) { override func didMove(toParent parent: UIViewController?) {