Fix gallery buttons changing position during dismiss animation

Closes #554
This commit is contained in:
Shadowfacts 2024-12-26 17:25:31 -05:00
parent 5ce9892a9b
commit 4ea61542a0
2 changed files with 8 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import AVFoundation
@MainActor
protocol GalleryItemViewControllerDelegate: AnyObject {
func isGalleryBeingPresented() -> Bool
func isGalleryBeingDismissed() -> Bool
func addPresentationAnimationCompletion(_ block: @escaping () -> Void)
func galleryItemClose(_ item: GalleryItemViewController)
func galleryItemApplicationActivities(_ item: GalleryItemViewController) -> [UIActivity]?
@ -376,6 +377,9 @@ class GalleryItemViewController: UIViewController {
}
private func updateTopControlsInsets() {
guard delegate?.isGalleryBeingDismissed() != true else {
return
}
let notchedDeviceTopInsets: [CGFloat] = [
44, // iPhone X, Xs, Xs Max, 11 Pro, 11 Pro Max
48, // iPhone XR, 11

View File

@ -139,6 +139,10 @@ extension GalleryViewController: GalleryItemViewControllerDelegate {
isBeingPresented
}
func isGalleryBeingDismissed() -> Bool {
isBeingDismissed
}
func addPresentationAnimationCompletion(_ block: @escaping () -> Void) {
presentationAnimationCompletionHandlers.append(block)
}