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

Hiding dashboard cards: make quick start cards personalizable #20393

Merged
merged 3 commits into from
May 31, 2023
Merged

Hiding dashboard cards: make quick start cards personalizable #20393

merged 3 commits into from
May 31, 2023

Conversation

kean
Copy link
Contributor

@kean kean commented Mar 23, 2023

Related issue: #20296

Previous PRs (dependencies):

  1. Hiding dashboard cards: generalize logic for storing preferences #20365
  2. Hiding dashboard cards: add Personalize Home Tab screen #20369
  3. Hiding dashboard cards: add context menus #20384

I can't set the previous PR #20385 as a target because it only exists in my fork. If you want to review only the changes from this PR, see the following diff.

Add personalization support for "Next steps" and "Get to know the app" cards. Previously, tapping "Remove next steps" on the Home tab worked by removing all active tours and setting quickStartType to .undefined. And now it's just a matter of setting a flag in the personalization service introduced in #20365. It allows the user to continue the tour or revisit a completed one.

Changes:

  • Add "Next steps" and "Get to know the app" cards to the Personalize Home Tab screen.
  • Update the design of the context menu for the quick start card (use a context menu instead of an action sheet)
  • Add unit test to make sure all personalizable cards have a predefined UserDefaults key and titles for menus to catch regressions in case someone make an existing card personalizable without updating the other places

Testing

Prerequisites:

  • Feature Flag "Personalize Home Tab" enabled

Test 1

  • Install the app (fresh install)
  • Log in and select "Not sure, show me around" on the "What would you like to focus on first" page
  • Complete one of the Quick Start steps
  • On the Home tab, open the context menu for the "Get to know the app" card
  • Verify that the context menu uses the new design (context menu instead of an action sheet)
  • Tap "Hide this"
  • Verify that the "Get to know the app" card was removed from the Home tab
  • Tap "Personalize Home Tab" at the bottom of the Home tab
  • Verify that the "Get to know the app" switch is displayed and it's disabled
  • Toggle the switch and close the screen
  • Verify that the "Get to know the app" is again displayed on the Home tab
  • Verify that the Quick Start is restarted from the previous state
  • Try going through one of the next steps and verify that it works

Test 2

  • Repeat test 1, but instead of completing only one step, complete all of them
  • Verify that you can still show/hide the "Get to know the app" card at any time to revisit the completed steps

Test 3

  • Repeat tests 1 and 2 for the "Next steps" card. An easy way to enable it is by using the "Enable Quick Start for New Site" button from the Debug menu.

Test 4

  • Install the app (fresh install)
  • Login and tap "Skip" on the "What would you like to focus on first" page to make sure no Quick Start guides are added
  • Tap "Personalize Home Tab" at the bottom of the Home tab
  • Verify that neither the "Next steps" nor "Get to know the app" cards are displayed in the list

Screenshots

Screenshot 2023-03-23 at 7 56 16 PM Screenshot 2023-03-23 at 7 56 31 PM

Regression Notes

  1. Potential unintended areas of impact:
    Anything that's related to the quick start guides ("Next steps" or "What would you like to focus on first")
  2. What I did to test those areas of impact (or what existing automated tests I relied on):
    I performed manual testing and verified that the guides still work
  3. What automated tests I added (or what prevented me from doing so)
    I covered new changes with unit tests (making sure that the switch is displayed in the "Personalize Home Tab" screen)

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.

@kean kean changed the title Feature/personalize home tab onboarding cards Hiding dashboard cards: make quick start cards personalizable Mar 23, 2023
@@ -78,7 +78,7 @@ final class BlogDashboardPersonalizeCardCell: DashboardCollectionViewCell {
}
WPAnalytics.track(.dashboardCardItemTapped, properties: ["type": DashboardCard.personalize.rawValue], blog: blog)
let viewController = UIHostingController(rootView: NavigationView {
BlogDashboardPersonalizationView(viewModel: .init(service: .init(siteID: siteID)))
BlogDashboardPersonalizationView(viewModel: .init(service: .init(siteID: siteID), quickStartType: blog.quickStartType))
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 considered injecting the entire blog, but it would've made it harder to unit-test and create previews for this screen. I don't expect more parameters to be needed.

Copy link
Contributor

@staskus staskus Mar 31, 2023

Choose a reason for hiding this comment

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

Got it! Thanks for including the diff for an easier review.

The injection of quickStartType was the only question mark for me. However, although at first sight it did catch my attention, I think this approach is more correct even beyond the argument of making it easier to write unit-tests and create previews. We make BlogDashboardPersonalizationViewModel depend on only what it needs to depend on. Due to business requirements, a quick start does require special handling.

I don't expect more parameters to be needed.

Yes, it doesn't look to be needed for the existing cards. In the future, who knows. If more and more custom behaviour would be needed, we could consider some different approach which wouldn't require injecting all the different dependencies into personalization VM and maybe would be handled by some configuration of each card.

@kean kean marked this pull request as ready for review March 30, 2023 11:34
@staskus staskus self-requested a review March 30, 2023 15:35
Copy link
Contributor

@staskus staskus left a comment

Choose a reason for hiding this comment

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

👍 The functionality works well.

I reviewed the code as well, I get the injection of quick start.

Since this PR comes with the changes of many different PRs, I will approve it once it only contains the changes it needs.

@kean I know it's inconvenient, so just ping me once that happens.

@kean
Copy link
Contributor Author

kean commented Apr 3, 2023

Hey, @staskus. I rebased it and added a convenience API for setting the card menu, as you suggested on Friday.

@staskus
Copy link
Contributor

staskus commented Apr 3, 2023

Hey, @staskus. I rebased it and added a convenience API for setting the card menu, as you suggested on Friday.

@kean thanks!

Copy link
Contributor

@staskus staskus left a comment

Choose a reason for hiding this comment

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

👍 Thank you for the changes, looks good.

I ran CI.

cc @guarani if you sill want to take a look. Otherwise, I'll merge it.

@kean kean closed this May 30, 2023
@kean kean reopened this May 30, 2023
@kean
Copy link
Contributor Author

kean commented May 30, 2023

Hey, @staskus / @guarani. I rebased this PR and ran a quick test to ensure it still works.

@staskus
Copy link
Contributor

staskus commented May 31, 2023

@kean Thanks! Looks good to me 👍. Let's wait for CI builds to finish running and merge this change.

cc: @guarani, @momo-ozawa

@momo-ozawa
Copy link
Contributor

Thanks for your work @kean! Let's target the 22.6 milestone. I've created a separate issue for updating release notes #20775

@momo-ozawa momo-ozawa added this to the 22.6 milestone May 31, 2023
@guarani
Copy link
Contributor

guarani commented May 31, 2023

Nice to see this land! I'll skip testing since it looks like others have already, but let me know if you'd like me to.

@kean kean merged commit d6713d8 into wordpress-mobile:trunk May 31, 2023
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