Skip to content
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

Merged
merged 10 commits into from
Nov 21, 2023
Merged

Fix media item details layout on iPad #22042

merged 10 commits into from
Nov 21, 2023

Conversation

kean
Copy link
Contributor

@kean kean commented Nov 15, 2023

It's a production issue, hence I'm targeting trunk.

To test:

For all media types: images, video, documents, and audio

  • Verify that the preview for are displayed using reasonable size on all devices and device orientations
  • Verify that the previews are loaded quickly (now use .medium thumbnail size)
  • Verify that when you tap on a preview, it displays the selected media item fullscreen

Regression Notes

  1. Potential unintended areas of impact: Site Media Details
  2. What I did to test those areas of impact (or what existing automated tests I relied on): manual
  3. What automated tests I added (or what prevented me from doing so): n/a

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

UI Changes testing checklist:

  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • VoiceOver.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • iPhone and iPad.
  • Multi-tasking: Split view and Slide over. (iPad)

@kean kean added this to the 23.8 milestone Nov 15, 2023
@peril-wordpress-mobile
Copy link

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@kean kean requested a review from crazytonyli November 15, 2023 12:49
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 15, 2023

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr22042-bf9d392
Version23.7
Bundle IDorg.wordpress.alpha
Commitbf9d392
App Center BuildWPiOS - One-Offs #7894
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 15, 2023

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr22042-bf9d392
Version23.7
Bundle IDcom.jetpack.alpha
Commitbf9d392
App Center Buildjetpack-installable-builds #6917
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()

headerMaxHeightConstraint.constant = view.bounds.height * 0.75
Copy link
Contributor

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)

Copy link
Contributor Author

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))
Copy link
Contributor

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?

Copy link
Contributor Author

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")
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@wpmobilebot
Copy link
Contributor

1 Warning
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@kean kean enabled auto-merge November 21, 2023 19:42
@kean kean merged commit b6e761f into trunk Nov 21, 2023
@kean kean deleted the task/improve-media-item-view branch November 21, 2023 22:05
@kean kean mentioned this pull request Nov 28, 2023
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants