Prevent live text button from showing below gallery bottom controls
This commit is contained in:
parent
64c377c663
commit
fabb5cd257
@ -82,6 +82,10 @@ class AttachmentWrapperGalleryContentViewController: UIViewController, GalleryCo
|
||||
}
|
||||
}
|
||||
|
||||
func setInsetForBottomControls(_ inset: CGFloat) {
|
||||
wrapped.setInsetForBottomControls(inset)
|
||||
}
|
||||
|
||||
func galleryContentDidAppear() {
|
||||
wrapped.galleryContentDidAppear()
|
||||
}
|
||||
|
@ -107,6 +107,13 @@ open class ImageGalleryContentViewController: UIViewController, GalleryContentVi
|
||||
analysisInteraction.setSupplementaryInterfaceHidden(!visible, animated: animated)
|
||||
}
|
||||
}
|
||||
|
||||
public func setInsetForBottomControls(_ inset: CGFloat) {
|
||||
if #available(iOS 16.0, macCatalyst 17.0, *),
|
||||
let analysisInteraction {
|
||||
analysisInteraction.supplementaryInterfaceContentInsets = UIEdgeInsets(top: 0, left: 0, bottom: inset, right: 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 16.0, macCatalyst 17.0, *)
|
||||
|
@ -31,6 +31,14 @@ public class LoadingGalleryContentViewController: UIViewController, GalleryConte
|
||||
wrapped?.presentationAnimation ?? .fade
|
||||
}
|
||||
|
||||
public var hideControlsOnZoom: Bool {
|
||||
wrapped?.hideControlsOnZoom ?? true
|
||||
}
|
||||
|
||||
public var showBelowSafeArea: Bool {
|
||||
wrapped?.showBelowSafeArea ?? true
|
||||
}
|
||||
|
||||
public init(caption: String?, provider: @escaping () async -> (any GalleryContentViewController)?) {
|
||||
self.fallbackCaption = caption
|
||||
self.provider = provider
|
||||
@ -105,6 +113,10 @@ public class LoadingGalleryContentViewController: UIViewController, GalleryConte
|
||||
wrapped?.setControlsVisible(visible, animated: animated, dueToUserInteraction: dueToUserInteraction)
|
||||
}
|
||||
|
||||
public func setInsetForBottomControls(_ inset: CGFloat) {
|
||||
wrapped?.setInsetForBottomControls(inset)
|
||||
}
|
||||
|
||||
public func galleryContentDidAppear() {
|
||||
wrapped?.galleryContentDidAppear()
|
||||
}
|
||||
@ -113,4 +125,8 @@ public class LoadingGalleryContentViewController: UIViewController, GalleryConte
|
||||
wrapped?.galleryContentWillDisappear()
|
||||
}
|
||||
|
||||
public func galleryShouldBeginInteractiveDismiss() -> Bool {
|
||||
wrapped?.galleryShouldBeginInteractiveDismiss() ?? true
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ public protocol GalleryContentViewController: UIViewController {
|
||||
|
||||
func shouldHideControls() -> Bool
|
||||
func setControlsVisible(_ visible: Bool, animated: Bool, dueToUserInteraction: Bool)
|
||||
func setInsetForBottomControls(_ inset: CGFloat)
|
||||
func galleryContentDidAppear()
|
||||
func galleryContentWillDisappear()
|
||||
func galleryShouldBeginInteractiveDismiss() -> Bool
|
||||
@ -59,6 +60,9 @@ public extension GalleryContentViewController {
|
||||
func setControlsVisible(_ visible: Bool, animated: Bool, dueToUserInteraction: Bool) {
|
||||
}
|
||||
|
||||
func setInsetForBottomControls(_ inset: CGFloat) {
|
||||
}
|
||||
|
||||
func galleryContentDidAppear() {
|
||||
}
|
||||
|
||||
|
@ -391,6 +391,17 @@ class GalleryItemViewController: UIViewController {
|
||||
scrollView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: bottomInset, right: 0)
|
||||
scrollView.verticalScrollIndicatorInsets = UIEdgeInsets(top: 0, left: 0, bottom: bottomIndicatorInset, right: 0)
|
||||
|
||||
let contentBottomControlsInset: CGFloat
|
||||
if content.showBelowSafeArea,
|
||||
controlsVisible,
|
||||
let bottomControlsView {
|
||||
let contentFrameInSelf = content.view.convert(content.view.bounds, to: view)
|
||||
contentBottomControlsInset = max(0, contentFrameInSelf.maxY - bottomControlsView.frame.minY - view.safeAreaInsets.bottom)
|
||||
} else {
|
||||
contentBottomControlsInset = 0
|
||||
}
|
||||
content.setInsetForBottomControls(contentBottomControlsInset)
|
||||
|
||||
centerContent()
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user