Fix large image controls being positioned incorrectly on notched-devices

when opening via a context menu preview.

The constraints for the top controls were being set only once, but when
showing a large image in the contxt menu preview window, the top inset
safe area is 0 and didn't become 44 (the value for notched devices)
until the preview was expanded.

Fixes #86
This commit is contained in:
Shadowfacts 2020-01-26 18:26:58 -05:00
parent 20c602f911
commit 8c7bebcce8
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 7 additions and 12 deletions

View File

@ -37,8 +37,6 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate {
@IBOutlet weak var bottomControlsView: UIView!
@IBOutlet weak var descriptionLabel: UILabel!
var initializedTopControlsConstrains = false
var image: UIImage?
var gifData: Data?
var imageDescription: String?
@ -120,8 +118,6 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate {
centerImage()
if !initializedTopControlsConstrains {
initializedTopControlsConstrains = true
if view.safeAreaInsets.top == 44 {
// running on iPhone X style notched device
let notchWidth: CGFloat = 209
@ -131,7 +127,6 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate {
closeButtonTrailingConstraint.constant = offset
}
}
}
func imageForDismissalAnimation() -> UIImage? {
return sourceInfo?.image ?? image