[PM-33519] feat: Rewire upgrade CTAs to use conditional routing#6796
[PM-33519] feat: Rewire upgrade CTAs to use conditional routing#6796SaintPatrck wants to merge 2 commits intopremium-upgrade/PM-33518-upgrade-available-flowfrom
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: REQUEST CHANGES This PR rewires premium upgrade CTAs across six ViewModels (Vault, VaultItem, VaultItemListing, VaultAddEdit, AddEditSend, Search) to conditionally route to the in-app Code Review Details
|
| onNavigateToAddEditSendItem: (route: AddEditSendRoute) -> Unit, | ||
| onNavigateToViewSendItem: (route: ViewSendRoute) -> Unit, | ||
| onNavigateToSearch: (searchType: SearchType) -> Unit, | ||
| onNavigateToPlan: () -> Unit = {}, |
There was a problem hiding this comment.
Details and fix
All other Screen composables in this PR define onNavigateToPlan as a required parameter (no default). This is the only one with = {}, which deviates from the codebase pattern where navigation callbacks are required parameters. If a future caller omits this, the premium upgrade button silently does nothing instead of producing a compile error.
This also masks a missing screen test: every other affected screen (SearchScreenTest, AddEditSendScreenTest, VaultAddEditScreenTest, VaultItemScreenTest) has a test for the NavigateToPlanModal event, but VaultItemListingScreenTest does not.
| onNavigateToPlan: () -> Unit = {}, | |
| onNavigateToPlan: () -> Unit, |
After removing the default, add a corresponding test in VaultItemListingScreenTest:
@Test
fun `NavigateToPlanModal event should invoke onNavigateToPlan`() {
mutableEventFlow.tryEmit(VaultItemListingEvent.NavigateToPlanModal)
assertTrue(onNavigateToPlanCalled)
}|
Great job! No new security vulnerabilities introduced in this pull request |
5d1322c to
65f09c8
Compare
e2c75cb to
6dc994e
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## premium-upgrade/PM-33518-upgrade-available-flow #6796 +/- ##
===================================================================================
- Coverage 85.81% 85.59% -0.23%
===================================================================================
Files 859 830 -29
Lines 62519 61564 -955
Branches 8602 8602
===================================================================================
- Hits 53652 52693 -959
- Misses 5898 5905 +7
+ Partials 2969 2966 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
65f09c8 to
698c16d
Compare
6dc994e to
9461811
Compare
| val baseUrl = environmentRepo.environment.environmentUrlData.baseWebVaultUrlOrDefault | ||
| val url = "$baseUrl/#/settings/subscription/premium?callToAction=upgradeToPremium" | ||
| sendEvent(SearchEvent.NavigateToUrl(url = url)) | ||
| if (premiumStateManager.isInAppUpgradeAvailableFlow.value) { |
There was a problem hiding this comment.
I am not seeing a scenario here we actually observer this flow. Will we need to do that in a future PR?
If not, maybe just make it a function?
9461811 to
4d26c19
Compare

🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-33519
📔 Objective
Rewire all existing premium upgrade CTAs across the app to conditionally route to either the in-app PlanScreen (modal) or the external web vault URL based on
isInAppUpgradeAvailableFlow.Stacked on PM-33518 PR (upgrade available flow)
Changes
PremiumStateManagerinto ViewModels that have upgrade CTAs: VaultViewModel, VaultItemViewModel, VaultItemListingViewModel, VaultAddEditViewModel, AddEditSendViewModel, SearchViewModelNavigateToPlanModalevent andonNavigateToPlancallback to affected screens and navigation graphsonNavigateToPlanthrough VaultUnlockedNavigation, VaultGraphNavigation, SendGraphNavigation, and all affected screen destinations