Fix Live Text control reappearing when swiping between gallery pages with controls hidden
Closes #431
This commit is contained in:
parent
fe9ad83ddc
commit
7ae741cd83
|
@ -16,7 +16,7 @@ protocol LargeImageContentView: UIView {
|
||||||
var animationImage: UIImage? { get }
|
var animationImage: UIImage? { get }
|
||||||
var activityItemsForSharing: [Any] { get }
|
var activityItemsForSharing: [Any] { get }
|
||||||
var owner: LargeImageViewController? { get set }
|
var owner: LargeImageViewController? { get set }
|
||||||
func setControlsVisible(_ controlsVisible: Bool)
|
func setControlsVisible(_ controlsVisible: Bool, animated: Bool)
|
||||||
func grayscaleStateChanged()
|
func grayscaleStateChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,13 +75,11 @@ class LargeImageImageContentView: UIImageView, LargeImageContentView {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func setControlsVisible(_ controlsVisible: Bool) {
|
func setControlsVisible(_ controlsVisible: Bool, animated: Bool) {
|
||||||
#if !targetEnvironment(macCatalyst)
|
#if !targetEnvironment(macCatalyst)
|
||||||
if #available(iOS 16.0, *),
|
if #available(iOS 16.0, *),
|
||||||
let analysisInteraction {
|
let analysisInteraction {
|
||||||
// note: passing animated: true here doesn't seem to do anything by itself as of iOS 16.2 (20C5032e)
|
analysisInteraction.setSupplementaryInterfaceHidden(!controlsVisible, animated: animated)
|
||||||
// so the LargeImageViewController handles animating, but we still need to pass true here otherwise it doesn't animate
|
|
||||||
analysisInteraction.setSupplementaryInterfaceHidden(!controlsVisible, animated: true)
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -138,7 +136,7 @@ class LargeImageGifContentView: GIFImageView, LargeImageContentView {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func setControlsVisible(_ controlsVisible: Bool) {
|
func setControlsVisible(_ controlsVisible: Bool, animated: Bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func grayscaleStateChanged() {
|
func grayscaleStateChanged() {
|
||||||
|
@ -189,7 +187,7 @@ class LargeImageGifvContentView: GifvAttachmentView, LargeImageContentView {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func setControlsVisible(_ controlsVisible: Bool) {
|
func setControlsVisible(_ controlsVisible: Bool, animated: Bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func grayscaleStateChanged() {
|
func grayscaleStateChanged() {
|
||||||
|
|
|
@ -282,13 +282,17 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate, LargeIma
|
||||||
self.controlsVisible = controlsVisible
|
self.controlsVisible = controlsVisible
|
||||||
if animated {
|
if animated {
|
||||||
UIView.animate(withDuration: 0.2) {
|
UIView.animate(withDuration: 0.2) {
|
||||||
self.contentView.setControlsVisible(controlsVisible)
|
// note: the value of animated: is passed to ImageAnalysisInteractino.setSupplementaryInterfaceHidden which (as of iOS 17.0.2 (21A350)):
|
||||||
|
// - does not animate with animated:false when wrapped in a UIView.animate block
|
||||||
|
// - does not animate with animated:true unless also wrapped in a UIView.animate block
|
||||||
|
self.contentView.setControlsVisible(controlsVisible, animated: true)
|
||||||
self.updateControlsView()
|
self.updateControlsView()
|
||||||
}
|
}
|
||||||
if controlsVisible && !descriptionTextView.isHidden {
|
if controlsVisible && !descriptionTextView.isHidden {
|
||||||
descriptionTextView.flashScrollIndicators()
|
descriptionTextView.flashScrollIndicators()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
contentView.setControlsVisible(controlsVisible, animated: false)
|
||||||
updateControlsView()
|
updateControlsView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue