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

Enable site creation for WP users with no sites #22415

Merged
merged 21 commits into from
Feb 2, 2024

Conversation

alpavanoglu
Copy link
Contributor

@alpavanoglu alpavanoglu commented Jan 18, 2024

Fixes: #22368
Refs: pcdRpT-5mv-p2

Testing Steps

Main Functionality

  1. Install WordPress and login with an account with no sites.
  2. ✅ (Regression) Expect the "My Site" tab to appear after login with an option to create a site ("Add new site").
  3. "Add new site" > "Create WordPress.com site" and proceed until domain selection screen.
  4. ✅ Search for a domain and select one. Verify that Plan selection screen does not appear.
  5. ✅ Tap on "Done". Verify a site is created, and after the flow is dismissed, jetpack feature removal overlay appears.
  6. ✅ After dismissing the overlay, Quick start flow should not appear.
  7. Tap the ••• button on top right in My Site screen.
  8. Tap "Add new site"
  9. ✅ Verify that the Jetpack migration screen appears this time as the user has a site at this point.

Regression for Jetpack

  1. Install Jetpack and login with an account with no sites.
  2. ✅ (Regression) Expect the "My Site" tab to appear after login with an option to create a site ("Add new site").
  3. ✅ "Add new site" > "Create WordPress.com site" and proceed until domain selection screen.
  4. ✅ Search for a domain and select one. Verify that Plan selection screen appears.
  5. Complete the flow.
  6. ✅ Quick start flow should appear.
  7. Tap on "Show me around" and expect the quick start to function normally.

Regression Notes

  1. Potential unintended areas of impact
    Quick start may appear and highlight features that aren't available on WordPress app.

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

  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)

@dangermattic
Copy link
Collaborator

dangermattic commented Jan 18, 2024

2 Warnings
⚠️ View files have been modified, but no screenshot is included in the pull request. Consider adding some for clarity.
⚠️ This PR is assigned to the milestone 24.2. 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

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jan 18, 2024

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 Numberpr22415-6ee4ae9
Version24.1
Bundle IDorg.wordpress.alpha
Commit6ee4ae9
App Center BuildWPiOS - One-Offs #8651
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 Jan 18, 2024

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 Numberpr22415-6ee4ae9
Version24.1
Bundle IDcom.jetpack.alpha
Commit6ee4ae9
App Center Buildjetpack-installable-builds #7679
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@alpavanoglu alpavanoglu marked this pull request as draft January 18, 2024 13:42
@alpavanoglu alpavanoglu marked this pull request as ready for review January 18, 2024 19:53
Copy link
Contributor

@hassaanelgarem hassaanelgarem left a comment

Choose a reason for hiding this comment

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

There are two acceptance criteria mentioned in the issue #22368 that are not met.

  • Features removal modal should be shown right after site creation.
  • Plan sales should be disabled on the WordPress app.

Features removal modal should be shown right after site creation.

Reproduction steps:

  • Fresh install the app
  • Sign up
  • Choose to create a new site
  • Notice that a fullscreen modal is shown, after dismissing it, the site creation flow is shown. The fullscreen modal should be shown after site creation is complete not before.
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-01-19.at.02.20.42.mp4

Plan sales should be disabled on the WordPress app.

Plans and domains are being promoted inside the WordPress app.

Domains Plans
Simulator Screenshot - iPhone 15 Pro - 2024-01-19 at 02 14 35 Simulator Screenshot - iPhone 15 Pro - 2024-01-19 at 02 14 41

@@ -11,6 +11,7 @@
* [**] Block Editor: Media uploads that failed due to lack of internet connectivity automatically retry once a connection is re-established [https://github.com/wordpress-mobile/WordPress-iOS/pull/22238]
* [**] Block Editor: Manually retrying a single failed media upload will retry all failed media uploads in a post [https://github.com/wordpress-mobile/WordPress-iOS/pull/22240]
* [*] [internal] Drop iOS 14 Support: Remove deprecated UIDocumentPickerViewController API [#22286]
* [**] Site creation is re-enabled for WordPress users with no sites. [#22415]
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this should be marked internal?

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 am really not sure. If you think that makes more sense I'll do that.

@hassaanelgarem
Copy link
Contributor

@alpavanoglu FYI, looks like the tests are failing to build

@mokagio
Copy link
Contributor

mokagio commented Jan 22, 2024

I'm going to bump this to the next release because we'll be code freezing 24.1 today and this hasn't been approved yet.

If these changes cannot wait two weeks and it's important that it makes it into this release, let me know and we'll organize a new beta once ready.

@mokagio mokagio modified the milestones: 24.1, 24.2 Jan 22, 2024
Copy link
Contributor

@hassaanelgarem hassaanelgarem left a comment

Choose a reason for hiding this comment

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

Notice that a fullscreen modal is shown, after dismissing it, the site creation flow is shown. The fullscreen modal should be shown after site creation is complete not before.

@alpavanoglu I am still seeing the modal before the site creation flow starts. I also see the compliance popover. After the site creation flow is done, I see another feature removal modal.

Plans and domains are being promoted inside the WordPress app.

Domains are still being promoted inside the app. If I choose a paid domain, the step passes normally, but I end up with a free domain.

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-01-22.at.03.40.42.mp4

)
let overlayViewController = JetpackFullscreenOverlayViewController(with: viewModel)
let navigationViewController = UINavigationController(rootViewController: overlayViewController)
JetpackFeaturesRemovalCoordinator.presentOverlay(
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there's a need to manually trigger an overlay.
Correctly configuring MySiteViewController.willDisplayPostSignupFlow before triggering the site creation flow should stop the overlay from being presented at the wrong time and should then automatically be displayed after the site is created.

@@ -7,7 +7,7 @@ final class SiteCreationWizardLauncher {
}()

let steps: [SiteCreationStep] = {
if RemoteFeatureFlag.plansInSiteCreation.enabled() {
if RemoteFeatureFlag.plansInSiteCreation.enabled() && !AppConfiguration.isWordPress {
Copy link
Contributor

Choose a reason for hiding this comment

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

[Nit] I think this is more readable:

Suggested change
if RemoteFeatureFlag.plansInSiteCreation.enabled() && !AppConfiguration.isWordPress {
if RemoteFeatureFlag.plansInSiteCreation.enabled() && AppConfiguration.isJetpack {

Copy link
Contributor

@hassaanelgarem hassaanelgarem left a comment

Choose a reason for hiding this comment

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

I've left some comments and suggestions.
I've also applied one of the suggestions and a change related to the compliance popover and pushed it to this branch: suggestion/alp-site-creation-pr

I haven't done proper testing on that branch, but here's the happy scenario:

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-01-31.at.02.17.03.mp4

@@ -255,6 +255,10 @@ final class SiteAssemblyWizardContent: UIViewController {

self.errorStateViewController = errorStateViewController
}

private func shouldPresentJetpackFeaturesRemovalOverlay() -> Bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this should be removed?

@@ -281,7 +281,7 @@ final class DomainSelectionViewController: CollapsableHeaderViewController {
let type: DomainsServiceRemote.DomainSuggestionType
switch domainSelectionType {
case .siteCreation:
type = RemoteFeatureFlag.plansInSiteCreation.enabled() ? .freeAndPaid : .wordPressDotComAndDotBlogSubdomains
type = (RemoteFeatureFlag.plansInSiteCreation.enabled() && AppConfiguration.isJetpack) ? .freeAndPaid : .wordPressDotComAndDotBlogSubdomains
Copy link
Contributor

Choose a reason for hiding this comment

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

This line feels clunky. What do you think about splitting into two lines? Or extracting the isEnabled logic to a computed variable?

Comment on lines 309 to 312
dismissTapped(viaDone: true) { [blog, weak self] in
RootViewCoordinator.shared.isSiteCreationActive = false
RootViewCoordinator.sharedPresenter.showBlogDetails(for: blog)
RootViewCoordinator.shared.reloadUIIfNeeded(blog: blog)
Copy link
Contributor

Choose a reason for hiding this comment

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

Moving the reload trigger outside the completion fixes the glitch of showing an invalid state for a split second before reloading.

Suggested change
dismissTapped(viaDone: true) { [blog, weak self] in
RootViewCoordinator.shared.isSiteCreationActive = false
RootViewCoordinator.sharedPresenter.showBlogDetails(for: blog)
RootViewCoordinator.shared.reloadUIIfNeeded(blog: blog)
RootViewCoordinator.shared.isSiteCreationActive = false
RootViewCoordinator.shared.reloadUIIfNeeded(blog: blog)
dismissTapped(viaDone: true) { [blog, weak self] in
RootViewCoordinator.sharedPresenter.showBlogDetails(for: blog)

launchSiteCreation: { [weak self] in self?.launchSiteCreationFromNoSites() },
launchSiteCreation: {
[weak self] in self?.launchSiteCreationFromNoSites()
RootViewCoordinator.shared.isSiteCreationActive = true
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm worried we're not setting for all possible flows of starting site creation. Can you double check? 🙏

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've added the call to all the places that present SiteCreationWizardLauncher.ui.

Comment on lines 83 to 84
complianceCoordinator = CompliancePopoverCoordinator()
complianceCoordinator?.presentIfNeeded()
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it makes sense to show this popover during sign-up. Can we maintain the current behavior of showing it from My Site, and avoid showing it at the wrong time?

Copy link
Contributor

Choose a reason for hiding this comment

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

I've created a branch with an alternate solution for the compliance popover issue.
Check suggestion/alp-site-creation-pr

@@ -268,6 +268,7 @@ private extension SiteAssemblyWizardContent {

func dismissTapped(viaDone: Bool = false, completion: (() -> Void)? = nil) {
// TODO : using viaDone, capture analytics event via #10335
RootViewCoordinator.shared.isSiteCreationActive = false
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 added this as a safety measure. I left the one below in place regardless as we need to set the state before reloading the UI.

Copy link
Contributor

@hassaanelgarem hassaanelgarem left a comment

Choose a reason for hiding this comment

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

Thanks on working on the fixes @alpavanoglu!
The happy scenario works as expected 🚀

I did however notice the following:

  • Install the WP app
  • Sign up
  • Tap on "Create a new site"
  • Cancel the flow
  • We land on My Site, but the features removal overlay is never shown and the UI is never reloaded even though it should.

The following flow works as expected:

  • Install the WP app
  • Sign up
  • Tap on "Not right now"
  • The overlay is shown and the UI is reloaded.

I would expect both flows to behave the same.

@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

Generated by 🚫 dangerJS

@alpavanoglu
Copy link
Contributor Author

To resolve the issue Hassaan raised above, I added a force-reload on Site creation cancellation only for WordPress app with an account with 0 blogs to o minimize regression possibilities.

I tested the following cases again:

  1. Sign up -> Create a site -> Complete the flow.
  2. Sign up -> Not now
  3. Sign up -> Create a site -> Cancel

At the end of each of these cases, Jetpack Migration Overlay appears as expected.

Copy link
Contributor

@hassaanelgarem hassaanelgarem left a comment

Choose a reason for hiding this comment

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

Works as expected 🚀
Left one comment on the code.

@@ -110,6 +110,7 @@ class SiteIntentViewController: CollapsableHeaderViewController {
@objc
private func closeButtonTapped(_ sender: Any) {
SiteCreationAnalyticsHelper.trackSiteIntentCanceled()
RootViewCoordinator.shared.reloadPostSiteCreationCancellationIfNeeded()
Copy link
Contributor

Choose a reason for hiding this comment

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

Right now we always reload the UI if some conditions are met, even if the UI shouldn't be reloaded.
I think we can just do this:

Suggested change
RootViewCoordinator.shared.reloadPostSiteCreationCancellationIfNeeded()
RootViewCoordinator.shared.isSiteCreationActive = false
RootViewCoordinator.shared.reloadUIIfNeeded(blog: blog)

We can either pass a nil value for the blog or fetch the current blog for consistency. There shouldn't be a need for the isWordPress or blog count condition.

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 this but reloadUIIfNeeded does not reload still. iirc guard newUIType != oldUIType was falling into else. That's why I force the reload. However we don't reload in any case. The new function checks if the user has blogs and is on WordPress app. Since this function is only invoked from SiteIntentViewController, and that can only happen if the user has specifically 0 blogs and taps "close" on the first site creation screen, it will run on this very specific case and nothing else. Not on Jetpack app, not if the user has already a site.

Copy link
Contributor

Choose a reason for hiding this comment

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

@alpavanoglu I tried it locally and it works as expected:

Screen.Recording.2.mov

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 tested it and it does work indeed. Perhaps I mistakenly tried the same account and the overlay was already shown once. I pushed the changes

Copy link
Contributor

@hassaanelgarem hassaanelgarem left a comment

Choose a reason for hiding this comment

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

🚀

@salimbraksa
Copy link
Contributor

salimbraksa commented Feb 2, 2024

Tap on "Done". Verify a site is created, and after the flow is dismissed, jetpack feature removal overlay appears.

Maybe I'm missing something but the features removal overlay didnt appear the site was created.

Other than that, the rest of the steps worked as described in the Test Instructions.

trim.EE0DEAB7-D38F-4057-99A8-7D1864099F46.MOV

@hassaanelgarem
Copy link
Contributor

Maybe I'm missing something but the features removal overlay didnt appear the site was created.

@salimbraksa was it a fresh install?

@salimbraksa
Copy link
Contributor

was it a fresh install?

@hassaanelgarem No, it wasn't, but I tried signing out and login again, assuming that may reset the catch.

I clean installed the app and everything worked as expected. cc @alpavanoglu

@alpavanoglu alpavanoglu merged commit 5354a08 into trunk Feb 2, 2024
22 checks passed
@alpavanoglu alpavanoglu deleted the task/reenable-site-creation-wp branch February 2, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Site Creation: Re-enable site creation on the WordPress app
6 participants