visionOS: Don't use gallery VC transition

This commit is contained in:
Shadowfacts 2024-02-04 11:52:48 -05:00
parent bdec14c463
commit e156a97861
3 changed files with 18 additions and 0 deletions

View File

@ -6,6 +6,7 @@
// Copyright © 2018 Shadowfacts. All rights reserved. // Copyright © 2018 Shadowfacts. All rights reserved.
// //
#if !os(visionOS)
import UIKit import UIKit
extension UIViewController: UIViewControllerTransitioningDelegate { extension UIViewController: UIViewControllerTransitioningDelegate {
@ -34,3 +35,4 @@ extension UIViewController: UIViewControllerTransitioningDelegate {
return nil return nil
} }
} }
#endif

View File

@ -470,6 +470,17 @@ class CustomAlertActionButton: UIControl {
} }
} }
#if os(visionOS)
extension CustomAlertController: UIViewControllerTransitioningDelegate {
func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return CustomAlertPresentationAnimation()
}
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return CustomAlertDismissAnimation()
}
}
#else
extension CustomAlertController { extension CustomAlertController {
override func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { override func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return CustomAlertPresentationAnimation() return CustomAlertPresentationAnimation()
@ -479,6 +490,7 @@ extension CustomAlertController {
return CustomAlertDismissAnimation() return CustomAlertDismissAnimation()
} }
} }
#endif
class CustomAlertPresentationAnimation: NSObject, UIViewControllerAnimatedTransitioning { class CustomAlertPresentationAnimation: NSObject, UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {

View File

@ -129,13 +129,17 @@ extension TuskerNavigationDelegate {
func showLoadingLargeImage(url: URL, cache: ImageCache, description: String?, animatingFrom sourceView: UIImageView) { func showLoadingLargeImage(url: URL, cache: ImageCache, description: String?, animatingFrom sourceView: UIImageView) {
let vc = LoadingLargeImageViewController(url: url, cache: cache, imageDescription: description) let vc = LoadingLargeImageViewController(url: url, cache: cache, imageDescription: description)
vc.animationSourceView = sourceView vc.animationSourceView = sourceView
#if !os(visionOS)
vc.transitioningDelegate = self vc.transitioningDelegate = self
#endif
present(vc, animated: true) present(vc, animated: true)
} }
func gallery(attachments: [Attachment], sourceViews: [UIImageView?], startIndex: Int) -> GalleryViewController { func gallery(attachments: [Attachment], sourceViews: [UIImageView?], startIndex: Int) -> GalleryViewController {
let vc = GalleryViewController(attachments: attachments, sourceViews: sourceViews, startIndex: startIndex) let vc = GalleryViewController(attachments: attachments, sourceViews: sourceViews, startIndex: startIndex)
#if !os(visionOS)
vc.transitioningDelegate = self vc.transitioningDelegate = self
#endif
return vc return vc
} }