Domain selector for paid domains: UI integration #8663
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of #8558
Description
For a user to choose a paid domain from WPCOM, I wanted to reuse the pre-existing
DomainSelectorclasses/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 displayDomainSuggestionViewProperties, and add a protocolDomainSelectorDataProviderfor an implementation to return a generic domain suggestion type. There are two implementations,FreeDomainSelectorDataProviderthat returns[FreeDomainSuggestionViewModel]andPaidDomainSelectorDataProviderthat returns[PaidDomainSuggestionViewModel].FreeDomainSuggestionViewModel/PaidDomainSuggestionViewModelcan then be used to display a domain row.To integrate the paid domain selector into the domain settings flow, I created a coordinator
DomainSettingsCoordinatorto navigate to the paid domain selector hosting controllerPaidDomainSelectorHostingControllerwhen 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:
Testing instructions
Prerequisite: a WC store with a WPCOM plan is required
DomainrowAdd a domain--> domain selector with paid domains should be shown, and each domain should have price infoContinue--> a message about the selected domain should be shown in the consoleScreenshots
RELEASE-NOTES.txtif necessary.