-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Hiding dashboard cards: make quick start cards personalizable #20393
Conversation
@@ -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)) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
Hey, @staskus. I rebased it and added a convenience API for setting the card menu, as you suggested on Friday. |
@kean thanks! |
There was a problem hiding this 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 Thanks! Looks good to me 👍. Let's wait for CI builds to finish running and merge this change. cc: @guarani, @momo-ozawa |
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. |
Related issue: #20296
Previous PRs (dependencies):
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:
Testing
Prerequisites:
Test 1
Test 2
Test 3
Test 4
Screenshots
Regression Notes
Anything that's related to the quick start guides ("Next steps" or "What would you like to focus on first")
I performed manual testing and verified that the guides still work
I covered new changes with unit tests (making sure that the switch is displayed in the "Personalize Home Tab" screen)
PR submission checklist:
RELEASE-NOTES.txt
if necessary.