Skip to content

Conversation

@jaclync
Copy link
Contributor

@jaclync jaclync commented Jan 17, 2023

Part of #8558

Description

For a user to choose a paid domain from WPCOM, I wanted to reuse the pre-existing DomainSelector classes/structs for the free domain selector in the store creation flow. However, a challenge surfaced since the schema of a free domain and paid domain is quite different. For a free domain, we just need to know the domain name. In order to purchase a paid domain, we need to know other info about the domain like the WPCOM product ID. It doesn't make sense to create a protocol for different domain suggestion types, since they are so different. I decided to make the domain suggestion type generic with a protocol for UI display DomainSuggestionViewProperties, and add a protocol DomainSelectorDataProvider for an implementation to return a generic domain suggestion type. There are two implementations, FreeDomainSelectorDataProvider that returns [FreeDomainSuggestionViewModel] and PaidDomainSelectorDataProvider that returns [PaidDomainSuggestionViewModel]. FreeDomainSuggestionViewModel/PaidDomainSuggestionViewModel can then be used to display a domain row.

To integrate the paid domain selector into the domain settings flow, I created a coordinator DomainSettingsCoordinator to navigate to the paid domain selector hosting controller PaidDomainSelectorHostingController when the user taps to add a domain. Sorry for the larger size of the PR than I hoped, it's harder to test the integration otherwise 🙇🏻‍♀️

Please note that there are a few other UI subtasks #8558 for this screen:

  • Attributed price info
  • Don't show support action in the navigation bar
  • Update header text

Testing instructions

Prerequisite: a WC store with a WPCOM plan is required

  • Log in if needed, and continue with a WPCOM store
  • Go to the Menu tab
  • Tap on the settings CTA
  • Tap the Domain row
  • Tap Add a domain --> domain selector with paid domains should be shown, and each domain should have price info
  • Feel free to search for other domains --> each domain should have price info
  • Select a domain and tap Continue --> a message about the selected domain should be shown in the console

  • @jaclync tests that the free domain selector works as before for store creation

Screenshots

paid domains free domains
Simulator Screen Shot - iPhone 14 Pro Max - 2023-01-17 at 15 27 41 Simulator Screen Shot - iPhone 14 Pro Max - 2023-01-17 at 15 29 05

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

…stion for both free and paid use cases. Show paid domain selector from domain settings with a coordinator.
@jaclync jaclync added type: task An internally driven task. status: feature-flagged Behind a feature flag. Milestone is not strongly held. labels Jan 17, 2023
@jaclync jaclync added this to the 12.0 milestone Jan 17, 2023
@jaclync jaclync mentioned this pull request Jan 17, 2023
35 tasks
@wpmobilebot
Copy link
Collaborator

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8663-452f171 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

Base automatically changed from feat/8558-domain-selector-yosemite to trunk January 18, 2023 02:23
@selanthiraiyan selanthiraiyan self-assigned this Jan 18, 2023
Copy link
Contributor

@selanthiraiyan selanthiraiyan left a comment

Choose a reason for hiding this comment

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

This works as described. 🎉

Great work using generics. 🏅

🚀


Not directly related to this PR

Prerequisite: a WC store with a WPCOM plan is required

I created a store from the mobile app to satisfy this Prerequisite

Tap the Domain row

  • After creating a store from the mobile app, I navigated to the settings screen and I couldn't see the Domain row in settings.
  • I had to logout and login again to see the Domain row.
  • To debug, I created a breakpoint and validated that stores.sessionManager.defaultSite?.isWordPressComStore was false.

@jaclync
Copy link
Contributor Author

jaclync commented Jan 18, 2023

Not directly related to this PR

Prerequisite: a WC store with a WPCOM plan is required

I created a store from the mobile app to satisfy this Prerequisite

Tap the Domain row

  • After creating a store from the mobile app, I navigated to the settings screen and I couldn't see the Domain row in settings.
  • I had to logout and login again to see the Domain row.
  • To debug, I created a breakpoint and validated that stores.sessionManager.defaultSite?.isWordPressComStore was false.

Thanks for reporting this! I think this might be related to the Jetpack issue p1669881159192899/1667224844.942809-slack-CDLH4C1UZ where some fields of a newly created site in me/sites API response aren't up to date 😞 I haven't tested this flow but will test this more later, added a subtask to #8558 and will address the issue if it's easily reproducible.

@jaclync jaclync merged commit 0e465a6 into trunk Jan 18, 2023
@jaclync jaclync deleted the feat/8558-paid-domain-selector branch January 18, 2023 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: feature-flagged Behind a feature flag. Milestone is not strongly held. type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants