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

Site Domains: Modernize UI 1/2 #22294

Merged
merged 29 commits into from
Jan 5, 2024
Merged

Conversation

staskus
Copy link
Contributor

@staskus staskus commented Dec 27, 2023

Partially implements #22262
Figma rvVgXupiyONUcJMgPSoMFj-fi-3518_13838

Modernize Site Domains UI and re-use elements from All Domains.

Second PR: #22311, I think it's the best to test on second PR

Issue

All Domains uses /all-domains/ endpoint while Site Domains uses sites/%d/domains endpoint which produces a bit different data:

  • Most notably, sites/%d/domains does not include status (Active/Verifying/Expired..) which is shown on All Domains view. Determining status involves quite a lot of logic (fbhepr%2Skers%2Sjcpbz%2Sjc%2Qpbagrag%2Syvo%2Sqbznvaf%2Sqbznva%2Qfgnghf%2Qerfbyire%2Sqbznva%2Qfgnghf%2Qerfbyire.cuc%3Se%3Qsn1n97n3%23ertvfgrerq_qbznva_fgnghf-og) therefore we cannot and shouldn't do it on the frontend site.
  • All Domains entities include site_slug which is needed to open domain management.

I decided to only focus on UI updates in the scope of this PR, which means that I'm not including the endpoint changes to include "Status" and opening of domain management. I will do it in another PR (#22311).

Solution

  1. Create SiteDomainsViewModel and move data loading logic there
  2. Build free domain, and other domain sections, reusing AllDomainsListCardView.ViewModel
  3. Create PrimaryDomainView badge
  4. Update SiteDomainsView to use a new ViewMode and reuse AllDomainsListCardView
  5. To have consistent spacing between cards I created rows that look like InsetGroupStyle instead of using this style directly, since spacing is only supported from iOS17
Simulator Screenshot - iPhone 15 - 2023-12-27 at 10 07 39
Simulator.Screen.Recording.-.iPhone.15.-.2023-12-27.at.10.04.58.mp4

To test:

Can be tested together with #22311

  1. Check Menu -> Domains UI:
  • With an account that has a domain (domains)
  • With an account that only has a free domain
  1. Confirm UI updates after purchasing the domain
  2. Confirm UI appears correctly in dark mode
  3. Confirm UI appears correctly with increased font sizes
  4. Confirm UI appears correctly in a horizontal mode

Regression Notes

  1. Potential unintended areas of impact

Breaking existing SiteDomains behavior

  1. What I did to test those areas of impact (or what existing automated tests I relied on)

Manual testing

  1. What automated tests I added (or what prevented me from doing so)

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)

@staskus staskus added this to the 24.0 milestone Dec 27, 2023
@staskus staskus changed the title Site Domains: Modernize UI Site Domains: Modernize UI 1/2 Dec 27, 2023
@staskus staskus marked this pull request as draft December 27, 2023 15:29
@staskus
Copy link
Contributor Author

staskus commented Dec 27, 2023

There are issues with spacing between cards on <iOS 16, since it doesn't yet support listSectionSpacing(spacing). Looks to be frustratingly hard to achieve consistent spacing without it.

listRowSpacing is supported on iOS15+ while listSectionSpacing is only supported from  iOS17+ which makes it hard to control it
@staskus staskus marked this pull request as ready for review December 28, 2023 10:04
@staskus
Copy link
Contributor Author

staskus commented Dec 28, 2023

❌ /usr/local/var/buildkite-agent/builds/MV-MKE-X64-015/automattic/wordpress-ios/WordPress/Classes/ViewRelated/Domains/Views/SiteDomainsView.swift:33:10: value of type 'some View' has no member 'listRowSpacing

CI fails with this spacing method as well. Requires Xcode 15.

I will comment this line out for now, we can re-enable it when we update to Xcode 15. The view looks different only in the case when we have more than one domain which is a rarer case. Trying to hack SwiftUI views is not worth it.

With spacing Without spacing (Until we update to Xcode 15)
image image

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Dec 28, 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 Numberpr22294-da9b6bc
Version23.9
Bundle IDorg.wordpress.alpha
Commitda9b6bc
App Center BuildWPiOS - One-Offs #8322
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 Dec 28, 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 Numberpr22294-da9b6bc
Version23.9
Bundle IDcom.jetpack.alpha
Commitda9b6bc
App Center Buildjetpack-installable-builds #7346
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

Combine domainsList and all-domains to show a more comprehensive site domains list that is equivalent to All Domains view
@staskus staskus requested a review from guarani December 29, 2023 07:24
Copy link
Contributor

@guarani guarani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested via #22311 (review) 👍

@peril-wordpress-mobile
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 4 days Please, make sure to get it merged by then or assign it to a later expiring milestone
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@staskus staskus enabled auto-merge January 5, 2024 08:30
@wpmobilebot
Copy link
Contributor

2 Warnings
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ This PR is assigned to the milestone 24.0. This milestone is due in less than 4 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@staskus staskus merged commit 8ea15cd into trunk Jan 5, 2024
23 checks passed
@staskus staskus deleted the task/22262-site-domains-modernize-ui branch January 5, 2024 09:15
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