From 86e1403230fc12272038389add577c19ba968902 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 4 Feb 2025 19:32:29 -0500 Subject: [PATCH] Fix live text button being behind edit attachment description text view --- ...AttachmentWrapperGalleryContentViewController.swift | 10 ++++++++++ .../Content/ImageGalleryContentViewController.swift | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Packages/ComposeUI/Sources/ComposeUI/Views/Attachments/AttachmentWrapperGalleryContentViewController.swift b/Packages/ComposeUI/Sources/ComposeUI/Views/Attachments/AttachmentWrapperGalleryContentViewController.swift index ffc5fe3d..6ad00d69 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/Views/Attachments/AttachmentWrapperGalleryContentViewController.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/Views/Attachments/AttachmentWrapperGalleryContentViewController.swift @@ -76,6 +76,16 @@ class AttachmentWrapperGalleryContentViewController: UIViewController, GalleryCo if !visible { editDescriptionViewController.textView?.resignFirstResponder() } + if #available(iOS 16.0, macCatalyst 17.0, *), + let wrapped = wrapped as? ImageGalleryContentViewController, + let interaction = wrapped.analysisInteraction { + if visible { + let bottom = editDescriptionViewController.view.bounds.height - editDescriptionViewController.view.keyboardLayoutGuide.layoutFrame.height + interaction.supplementaryInterfaceContentInsets = UIEdgeInsets(top: 0, left: 0, bottom: bottom, right: 0) + } else { + interaction.supplementaryInterfaceContentInsets = .zero + } + } } func galleryContentDidAppear() { diff --git a/Packages/GalleryVC/Sources/GalleryVC/Content/ImageGalleryContentViewController.swift b/Packages/GalleryVC/Sources/GalleryVC/Content/ImageGalleryContentViewController.swift index e24895af..a992ed9a 100644 --- a/Packages/GalleryVC/Sources/GalleryVC/Content/ImageGalleryContentViewController.swift +++ b/Packages/GalleryVC/Sources/GalleryVC/Content/ImageGalleryContentViewController.swift @@ -25,7 +25,7 @@ open class ImageGalleryContentViewController: UIViewController, GalleryContentVi private static let analyzer = ImageAnalyzer() private var _analysisInteraction: AnyObject? @available(iOS 16.0, macCatalyst 17.0, *) - private var analysisInteraction: ImageAnalysisInteraction? { _analysisInteraction as? ImageAnalysisInteraction } + public var analysisInteraction: ImageAnalysisInteraction? { _analysisInteraction as? ImageAnalysisInteraction } public init(image: UIImage, caption: String?, gifController: GIFController?) { self.caption = caption