Skip to content

[PM-32122] Add cookie acquisition navigation#6529

Merged
SaintPatrck merged 4 commits intomainfrom
cookie-vending/p11-t12_navigation
Feb 18, 2026
Merged

[PM-32122] Add cookie acquisition navigation#6529
SaintPatrck merged 4 commits intomainfrom
cookie-vending/p11-t12_navigation

Conversation

@SaintPatrck
Copy link
Contributor

@SaintPatrck SaintPatrck commented Feb 12, 2026

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-32122

📔 Objective

Add cookie acquisition as a top-level destination in the outer NavHost (alongside root navigation and debug menu) so it can overlay the app without interfering with the state-based navigation in RootNavScreen.

MainViewModel monitors the cookie acquisition request flow combined with user/vault state and emits a one-shot NavigateToCookieAcquisition event when conditions are met. Dismissal is handled by the child CookieAcquisitionViewModel via a NavigateBack event (implementing BackgroundEvent to survive Custom Tab lifecycle transitions), which triggers popBackStack through an onDismiss callback.

Wire the AuthCallback deeplink so cookie results from the browser are delivered back to the auth repository's cookie callback result flow.

Add debug menu controls for triggering cookie acquisition manually during development.

🧪 Testing

  1. Log in and unlock the vault
  2. Open the debug menu and tap "Trigger cookie acquisition"
  3. Verify the cookie acquisition screen slides up
  4. Tap "Launch browser" — verify custom tab opens
  5. Simulate the deeplink callback: adb shell am start -a android.intent.action.VIEW -d "bitwarden://sso_cookie_vendor?cookie=value&d=1" — verify the screen auto-dismisses
  6. Tap "Continue without syncing" — verify the screen dismisses
  7. Tap "Why am I seeing this?" — verify help URL opens

📸 Screenshots

Screen_recording_20260212_160150.mp4

@SaintPatrck SaintPatrck requested review from a team and david-livefront as code owners February 12, 2026 20:53
@github-actions github-actions bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context labels Feb 12, 2026
@SaintPatrck SaintPatrck marked this pull request as draft February 12, 2026 20:53
@SaintPatrck SaintPatrck changed the title [PM-32122] Add cookie acquisition screen and navigation [PM-32122] Add cookie acquisition navigation Feb 12, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

Logo
Checkmarx One – Scan Summary & Detailsf4d52e35-c51f-41b5-882d-840269be597b

Great job! No new security vulnerabilities introduced in this pull request

@SaintPatrck SaintPatrck force-pushed the cookie-vending/p11-t12_navigation branch from 1490522 to 480eeb4 Compare February 17, 2026 20:51
@SaintPatrck SaintPatrck changed the base branch from main to cookie-vending/p10-t11_cookie-acquisition-screen February 17, 2026 20:52
Base automatically changed from cookie-vending/p10-t11_cookie-acquisition-screen to main February 17, 2026 21:34
@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

❌ Patch coverage is 93.87755% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.38%. Comparing base (f6f630f) to head (6c97fc5).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...n/ui/platform/feature/debugmenu/DebugMenuScreen.kt 80.00% 2 Missing ⚠️
...ature/cookieacquisition/CookieAcquisitionScreen.kt 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6529      +/-   ##
==========================================
+ Coverage   86.37%   86.38%   +0.01%     
==========================================
  Files         802      799       -3     
  Lines       56993    57000       +7     
  Branches     8245     8253       +8     
==========================================
+ Hits        49227    49239      +12     
+ Misses       4901     4895       -6     
- Partials     2865     2866       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SaintPatrck SaintPatrck force-pushed the cookie-vending/p11-t12_navigation branch 3 times, most recently from 17fab33 to 839639c Compare February 17, 2026 22:22
@SaintPatrck SaintPatrck added the ai-review Request a Claude code review label Feb 17, 2026
@claude
Copy link
Contributor

claude bot commented Feb 17, 2026

Claude finished @SaintPatrck's task in 4m 26s —— View job


Code Review: PM-32122 Add cookie acquisition navigation

Reviewed commit: 6c97fc58b | Base: main

Overview

This PR adds cookie acquisition as a top-level destination in the outer NavHost, wires MainViewModel to monitor cookie acquisition readiness, handles deeplink callbacks for cookie results, and adds debug menu controls.

Review Summary

No issues found. This is a clean, well-structured implementation that follows established codebase patterns.

Key Observations

Architecture -- Cookie acquisition is correctly placed as a top-level NavHost destination (alongside root navigation and debug menu), preventing interference with the state-based navigation in RootNavScreen. This mirrors the existing debugMenuDestination pattern.

Navigation safety -- The BackHandler in CookieAcquisitionScreen correctly routes back through the ViewModel (ContinueWithoutSyncingClick) to clear the pending cookie request before dismissing. Without this, MainViewModel's combine flow would immediately re-navigate since the conditions would remain true. launchSingleTop = true on navigateToCookieAcquisition() provides additional protection against duplicate destinations.

Reactive flow design -- The combine(userStateFlow, cookieAcquisitionRequestFlow) pattern in MainViewModel with distinctUntilChanged().filter { it } correctly gates navigation to fire only when conditions transition to true, preventing repeated events on state re-emissions.

BackgroundEvent on NavigateBack -- CookieAcquisitionEvent.NavigateBack correctly implements BackgroundEvent since the cookie callback result can arrive while the screen is not in RESUMED state (returning from a Custom Tab browser session). The EventsEffect lifecycle filter would otherwise drop this event.

Deeplink isolation -- Cookie callbacks (bitwarden://sso_cookie_vendor) and SSO callbacks (bitwarden://sso-callback) use distinct URI hosts, so there is no ambiguity in AuthCallbackViewModel's when dispatch.

Test coverage -- Comprehensive tests cover the positive navigation case, negative (null request) case, BackHandler behavior, NavigateBack event propagation, cookie callback routing in AuthCallbackViewModel, and debug menu trigger.

Prior Review Feedback

All feedback from previous review rounds has been addressed: onSplashScreenRemoved() moved inside the composable lambda, comment text corrected, unused suppressions removed, and onDismissCalled assignment removed from test setUp.


Reviewed by Claude (automated review)

@SaintPatrck SaintPatrck marked this pull request as ready for review February 17, 2026 22:27
* Navigate back, dismissing the cookie acquisition screen.
*
* Implements [BackgroundEvent] because the cookie callback result may arrive while
* the screen is not resumed (e.g. returning from a Custom Tab browser session).
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

// fadeIn instead.
// The MigrateToMyItemsGraphRoute and ResetPasswordRoute animation
// should stay but due to an issue when combining certain animations,
// we are just using a fadeIn instead.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these changes needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. Leftover from experimenting with declaring acquisition destination in the RootNav. Extracted to #6553.

// We skip the first 2 events because they are the default appTheme and appLanguage
awaitItem()
awaitItem()
skipItems(2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

SaintPatrck and others added 3 commits February 18, 2026 08:11
Add cookie acquisition as a top-level destination in the outer NavHost
(alongside root navigation and debug menu) so it can overlay the app
without interfering with the state-based navigation in RootNavScreen.

MainViewModel monitors the cookie acquisition request flow combined
with user/vault state and emits a one-shot NavigateToCookieAcquisition
event when conditions are met. Dismissal is handled by the child
CookieAcquisitionViewModel via a NavigateBack event (implementing
BackgroundEvent to survive Custom Tab lifecycle transitions), which
triggers popBackStack through an onDismiss callback.

Wire the AuthCallback deeplink so cookie results from the browser are
delivered back to the auth repository's cookie callback result flow.

Add debug menu controls for triggering cookie acquisition manually
during development.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit moves the call to `onSplashScreenRemoved()` inside the `composableWithSlideTransitions` block for the `CookieAcquisitionRoute`.

This change ensures that the splash screen is only hidden when the cookie acquisition screen is actually being composed, improving the visual flow and preventing the splash screen from being dismissed prematurely.
@SaintPatrck SaintPatrck force-pushed the cookie-vending/p11-t12_navigation branch from 839639c to 7fb9d1b Compare February 18, 2026 13:20
…okieacquisition/CookieAcquisitionNavigation.kt

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
@SaintPatrck
Copy link
Contributor Author

Thanks @david-livefront

@SaintPatrck SaintPatrck added this pull request to the merge queue Feb 18, 2026
Merged via the queue into main with commit 1a69362 Feb 18, 2026
16 checks passed
@SaintPatrck SaintPatrck deleted the cookie-vending/p11-t12_navigation branch February 18, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants