Fix compose attachment gallery dismiss animation on iPad

This commit is contained in:
Shadowfacts 2025-02-03 15:56:40 -05:00
parent 25e4e35b1f
commit da4787946d
2 changed files with 8 additions and 3 deletions

View File

@ -64,7 +64,12 @@ struct AttachmentsGalleryDataSource: GalleryDataSource {
}
func galleryContentTransitionSourceView(forItemAt index: Int) -> UIView? {
collectionView.cellForItem(at: IndexPath(item: index, section: 0))
if let cell = collectionView.cellForItem(at: IndexPath(item: index, section: 0)) as? HostingCollectionViewCell {
// Use the hostView, because otherwise, the animation's changes to the source view opacity get clobbered by SwiftUI
cell.hostView
} else {
nil
}
}
private func fetchImageAndGIFData(assetID id: String) async -> (UIImage, Data?)? {

View File

@ -363,7 +363,7 @@ private final class IntrinsicContentSizeCollectionView: UICollectionView {
}
#if os(visionOS)
private class HostingCollectionViewCell: UICollectionViewCell {
final class HostingCollectionViewCell: UICollectionViewCell {
private(set) var hostView: UIView?
func setView<V: View>(_ view: V) {
@ -382,7 +382,7 @@ private class HostingCollectionViewCell: UICollectionViewCell {
}
#else
@available(iOS, obsoleted: 16.0)
private class HostingCollectionViewCell: UICollectionViewCell {
final class HostingCollectionViewCell: UICollectionViewCell {
weak var containingViewController: UIViewController?
@available(iOS, obsoleted: 16.0)