[PR #6623] [MERGED] PM-33266: Allow the VaultUnlockViewModel and VaultViewModel to safely initialize without a UserState #63996

Closed
opened 2026-05-12 03:29:29 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/6623
Author: @david-livefront
Created: 3/6/2026
Status: Merged
Merged: 3/9/2026
Merged by: @david-livefront

Base: mainHead: PM-33266-crashlytics-bug


📝 Commits (1)

  • 674ac07 PM-33266: Allow the VaultUnlockViewModel and VaultViewModel to safely initialize without a UserState

📊 Changes

5 files changed (+92 additions, -16 deletions)

View changed files

📝 app/src/main/kotlin/com/x8bit/bitwarden/data/auth/repository/model/UserState.kt (+30 -1)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModel.kt (+13 -6)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt (+15 -7)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModelTest.kt (+18 -2)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModelTest.kt (+16 -0)

📄 Description

🎟️ Tracking

PM-33266

📔 Objective

This PR addresses a race-condition that I believe occurs when a user is logged-out and the app switches to the next available user but the next user is also about to be logged-out automatically (possibly an expired refresh token). During this time we attempt to display the VaultScreen or VaultUnlockScreen which will crash if the ViewModel constructor is called and the UserState is not present.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/6623 **Author:** [@david-livefront](https://github.com/david-livefront) **Created:** 3/6/2026 **Status:** ✅ Merged **Merged:** 3/9/2026 **Merged by:** [@david-livefront](https://github.com/david-livefront) **Base:** `main` ← **Head:** `PM-33266-crashlytics-bug` --- ### 📝 Commits (1) - [`674ac07`](https://github.com/bitwarden/android/commit/674ac0721f7dd34b7b84c27e3a682e968c7d15be) PM-33266: Allow the VaultUnlockViewModel and VaultViewModel to safely initialize without a UserState ### 📊 Changes **5 files changed** (+92 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/auth/repository/model/UserState.kt` (+30 -1) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModel.kt` (+13 -6) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt` (+15 -7) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModelTest.kt` (+18 -2) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModelTest.kt` (+16 -0) </details> ### 📄 Description ## 🎟️ Tracking [PM-33266](https://bitwarden.atlassian.net/browse/PM-33266) ## 📔 Objective This PR addresses a race-condition that I believe occurs when a user is logged-out and the app switches to the next available user but the next user is also about to be logged-out automatically (possibly an expired refresh token). During this time we attempt to display the VaultScreen or VaultUnlockScreen which will crash if the ViewModel constructor is called and the UserState is not present. [PM-33266]: https://bitwarden.atlassian.net/browse/PM-33266?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-12 03:29:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#63996