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 2/2 - Integrate status and navigation to domain details #22311

Conversation

staskus
Copy link
Contributor

@staskus staskus commented Dec 29, 2023

Fixes ##22262

Continuation of #22294

Description

Use all-domains endpoint instead of sites/%d/domains to load information needed to display status and open domain details.

Solution

  1. Use DomainsService to fetch domains and filter to show domains for a specific site
  2. Cache fetched domains to preload them when opening All Domains
  3. Add loading and error views
  4. Add NavigationLink to open domain details web view
Simulator.Screen.Recording.-.iPhone.15.-.2023-12-29.at.12.50.56.mp4

To test:

  1. Check Menu -> Domains UI:
  • With an account that has a domain (domains)
  • With an account that only has a free domain
  1. Confirm Status indicator appears
  2. Confirm Status indicator matches the one on All Domains screen
  3. Confirm tapping on paid domains opens Domain Management

Regression Notes

  1. Potential unintended areas of impact

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

  3. 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)

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Dec 29, 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 Numberpr22311-4b10eba
Version23.9
Bundle IDorg.wordpress.alpha
Commit4b10eba
App Center BuildWPiOS - One-Offs #8321
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 29, 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 Numberpr22311-4b10eba
Version23.9
Bundle IDcom.jetpack.alpha
Commit4b10eba
App Center Buildjetpack-installable-builds #7345
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@staskus staskus requested a review from guarani December 29, 2023 13:20
@staskus staskus modified the milestones: Pending, 24.0 Dec 29, 2023
@staskus staskus mentioned this pull request Dec 29, 2023
13 tasks
@irfano irfano self-requested a review January 3, 2024 11:41
@irfano
Copy link
Member

irfano commented Jan 3, 2024

The status label and navigating to domain detail worked as expected. 🟢

A minor issue

The domain detail screen should have a title when navigating from Site Domains.

from All Domains from Site Domains
Simulator Screenshot - iPhone 15 Pro Max - 2024-01-03 at 14 18 43 Simulator Screenshot - iPhone 15 Pro Max - 2024-01-03 at 14 18 03

Touch area for the "Add a domain" button

This looks like unrelated to this PR. If so, I can open an issue for it.

Screen.Recording.2024-01-03.at.14.45.46.mov

Platform difference

When there is both a custom domain and credits, iOS shows a "Claim your free domain" button, while Android shows a card. I think Android's way is better. We can open an issue to match platforms later.

iOS Android

Other domains title

The title is changed on the design to "OTHER DOMAINS FOR STOP MAKING SENSE".

Color issue on Webview in dark mode

This is already existed on trunk, opened issue: #22324

@staskus
Copy link
Contributor Author

staskus commented Jan 3, 2024

@irfano, thanks for testing it!

The domain detail screen should have a title when navigating from Site Domains.

I'll fix it.

Touch area for the "Add a domain" button

Good catch. I will see what can be done with it. I would also expect the touch area to take the area of the whole row.

The title is changed on the design to "OTHER DOMAINS FOR STOP MAKING SENSE".

I'll fix it.

When there is both a custom domain and credits, iOS shows a "Claim your free domain" button, while Android shows a card. I think Android's way is better. We can open an issue to match platforms later

Good catch 👍 . It should be an easy fix.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jan 3, 2024

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

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.

The domain status label sometimes shows Activating when WP.com shows Active. /all-domains?resolve_status=true&no_wpcom=true returns "Activating" for that domain, which is unexpected since the domain wasn't registered recently. My best guess is that "Active" is the right status. I don't see this mismatch on all my domains, do you see it on any of yours?

Calypso has frontend logic for displaying the status here: https://github.com/Automattic/wp-calypso/blob/7b4243596a876949629fc5bfa2c7a7e8566478b8/client/lib/domains/resolve-domain-status.tsx#L56C17-L56C36

I'd need to spend more time on this to figure out how to handle this. We could address this issue separately to this PR since I see the same mismatch on the All Domains screen.


In the video attached to the PR, the domain changes from povilasstaskus.wordpress.com to povilasstaskus.wpcomstaging.com when you view the domain details web view (it then changes back after you buy the new domain). I didn't see this on my domains. Can you reproduce or could this be an issue that was resolved in a later commit?


If you want to address this separately, I can continue reviewing this PR tomorrow as I don't have time to finish it today.

@staskus
Copy link
Contributor Author

staskus commented Jan 4, 2024

Thanks for the review, @guarani !

The domain status label sometimes shows Activating when WP.com shows Active. /all-domains?resolve_status=true&no_wpcom=true returns "Activating" for that domain, which is unexpected since the domain wasn't registered recently. My best guess is that "Active" is the right status. I don't see this mismatch on all my domains, do you see it on any of yours?

Calypso has frontend logic for displaying the status here: https://github.com/Automattic/wp-calypso/blob/7b4243596a876949629fc5bfa2c7a7e8566478b8/client/lib/domains/resolve-domain-status.tsx#L56C17-L56C36

Yes, Calypso looks to have domain status-resolving logic within a client, which is strange to me. The backend through this endpoint resolves domain status as well fbhepr%2Skers%2Sjcpbz%2Sjc%2Qpbagrag%2Syvo%2Sqbznvaf%2Sqbznva%2Qfgnghf%2Qerfbyire%2Sqbznva%2Qfgnghf%2Qerfbyire.cuc%3Se%3Qsn1n97n3%23341-og . It could be activating if "pending_registration" flag exists. fbhepr%2Skers%2Sjcpbz%2Sjc%2Qpbagrag%2Syvo%2Sqbznvaf%2Sjcpbz%2Qqbznva.cuc%3Se%3Q59p4n8r9%231793-og.

I don't know why this mismatch happens as well, I didn't dig deep into domain management logic itself, it's complicated.

We could address this issue separately to this PR since I see the same mismatch on the All Domains screen.

Yes, I think it would be best to address it separately. It may not be addressable from the app. Maybe there're some differences between Calypso frontend and backend and how the status is resolved.

Can you reproduce or could this be an issue that was resolved in a later commit?

Oh yes, I see it now. I can reproduce it 🤔 .freeSiteAddress is different at different times it's checked.

It happens because domains Set contains multiple wpCom domains, one .wordPress.com, and one .wpcomstaging.com. We take .first as freeDomain and since Set doesn't guarantee an order, we get a different one each time.

This issue happens on a previous Site Domains view as well:

Switching.betwee.wpcomstagging.and.wordpress.MP4

If you want to address this separately, I can continue reviewing this PR tomorrow as I don't have time to finish it today.

I think domain statuses should be investigated separately, I'm not sure anything could be done in the scope of this PR.

@staskus
Copy link
Contributor Author

staskus commented Jan 4, 2024

Made fixes:

  • The domain detail screen should have a title when navigating from Site Domains
  • Touch area for the "Add a domain" button
  • The title is changed on the design to "OTHER DOMAINS FOR STOP MAKING SENSE".
  • When there is both a custom domain and credits, show a "Claim your free domain" card
  • .freeSiteAddress is different at different times it's checked

@staskus staskus requested a review from guarani January 4, 2024 09:45
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.

I re-tested and didn't find any issues and the code comments aren't blockers. Thanks for the patience on this one, @staskus 🙇

Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: This new domain state view has a very similar layout to the existing AllDomainsListEmptyView. Would it make sense to consolidate? I think DomainStateView would be fine to reuse.

AllDomainsListEmptyView DomainStateView

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 agree with you, good point. When I developed it, I admit I tried to reuse the on from All Domains view and it appeared with broken spacing within the Swift UI layout, no matter how much I tried to constrain it within HStacks and VStacks. I got frustrated and created a new SwiftUI view. But I can try the opposite way, reuse SwiftUI view within UIKit. Maybe it will appear correctly 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

Simulator.Screen.Recording.-.iPhone.15.-.2024-01-05.at.08.15.36.mp4

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

Choose a reason for hiding this comment

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

👏 It's great this level of test coverage!

@staskus staskus merged commit d5b97ca into task/22262-site-domains-modernize-ui Jan 5, 2024
3 of 17 checks passed
@staskus staskus deleted the task/22262-site-domains-modernize-ui-all-domains-endpoint branch January 5, 2024 08:17
@wpmobilebot
Copy link
Contributor

2 Warnings
⚠️ View files have been modified, but no screenshot is included in the pull request. Consider adding some for clarity.
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

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.

4 participants