-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix media item details layout on iPad #22042
Conversation
Generated by 🚫 dangerJS |
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
override func viewDidLayoutSubviews() { | ||
super.viewDidLayoutSubviews() | ||
|
||
headerMaxHeightConstraint.constant = view.bounds.height * 0.75 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to update the constant here? Can we create the constraint as something like:
headerMaxHeightConstraint = headerView.heightAnchor.constraintTo(lessOrEqualThan: view.heightAnchor, multiplier: 0.75)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot multiplier
was a thing. Unfortunately, it doesn't seem to work in this case maybe because the constraint system doesn't receive an updated view.height value until after the viewDidLayoutSubviews
is completed, which is too late. You can reproduce it by running it on iPad and rotating the device from portrait to landscape.
@@ -247,7 +226,7 @@ class MediaItemViewController: UITableViewController { | |||
if isSharing { | |||
let indicator = UIActivityIndicatorView() | |||
indicator.startAnimating() | |||
indicator.frame = CGRect(origin: .zero, size: CGSize(width: 44, height: 44)) | |||
indicator.frame = CGRect(origin: .zero, size: CGSize(width: 43, height: 44)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 What's this change for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to make sure the activity indicator has the same button (see the video). It's not great, but I couldn't quickly find a better solution and moved to other tasks.
Untitled.mp4
private func setupAccessibility() { | ||
accessibilityTraits = .button | ||
accessibilityLabel = NSLocalizedString("Preview media", comment: "Accessibility label for media item preview for user's viewing an item in their media library") | ||
accessibilityHint = NSLocalizedString("Tap to view media in full screen", comment: "Accessibility hint for media item preview for user's viewing an item in their media library") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use reverse DNS keys? See p91TBi-aJl-p2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
override func layoutSubviews() { | ||
super.layoutSubviews() | ||
|
||
videoIconView.center = center |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Seeing this view is centered differently to loadingIndicator and errorView, I'm guessing it's because PlayIconView
doesn't support auto layout? If that's the case, maybe adding a comment here could avoid confusing why this view is done differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, but PlayIconView does not use Auto Layout and it loses its default frame if you use it with constraint. I left a comment why it frame-based layout.
Generated by 🚫 Danger |
It's a production issue, hence I'm targeting
trunk
.To test:
For all media types: images, video, documents, and audio
.medium
thumbnail size)Regression Notes
PR submission checklist:
RELEASE-NOTES.txt
if necessary.UI Changes testing checklist: