[PR #1784] [MERGED] Account switching fixes #3124

Closed
opened 2025-11-26 23:28:36 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1784
Author: @mpbw2
Created: 2/17/2022
Status: Merged
Merged: 2/17/2022
Merged by: @mpbw2

Base: accountswitchingHead: accountswitching-fixes


📝 Commits (1)

📊 Changes

22 files changed (+171 additions, -78 deletions)

View changed files

📝 src/App/App.xaml.cs (+21 -3)
📝 src/App/Models/AppOptions.cs (+2 -0)
📝 src/App/Pages/Accounts/HomePage.xaml (+4 -2)
📝 src/App/Pages/Accounts/HomePage.xaml.cs (+9 -8)
📝 src/App/Pages/Accounts/HomePageViewModel.cs (+8 -1)
📝 src/App/Pages/Accounts/LoginPage.xaml (+14 -3)
📝 src/App/Pages/Accounts/LoginPage.xaml.cs (+17 -12)
📝 src/App/Pages/Accounts/LoginPageViewModel.cs (+8 -0)
📝 src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs (+6 -6)
📝 src/App/Utilities/AppHelpers.cs (+7 -2)
📝 src/Core/Abstractions/IPolicyService.cs (+5 -5)
📝 src/Core/Abstractions/IStateService.cs (+3 -2)
📝 src/Core/Abstractions/IVaultTimeoutService.cs (+3 -1)
src/Core/Enums/VaultTimeoutAction.cs (+8 -0)
📝 src/Core/Models/Domain/Account.cs (+3 -1)
📝 src/Core/Services/PolicyService.cs (+10 -10)
📝 src/Core/Services/StateMigrationService.cs (+2 -1)
📝 src/Core/Services/StateService.cs (+20 -10)
📝 src/Core/Services/TokenService.cs (+2 -1)
📝 src/Core/Services/VaultTimeoutService.cs (+14 -7)

...and 2 more files

📄 Description

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

A multitude of fixes, things I missed, etc. See code changes for details.

Code changes

  • AppOptions.cs: Added HideAccountSwitcher bool to control this asynchronously when constructing a page
  • HomePage.*: Replaced "Close" ToolbarItem with a "Cancel" button since there doesn't appear to be a way to alternate with the avatar (only shown when running as iOS extension), hide account switcher based on AppOptions in constructor (so it works in iOS now)
  • LoginPage.*: Replaced "Close" ToolbarItem with a "Cancel" button since there doesn't appear to be a way to alternate with the avatar (only shown during normal (not vault-timeout) login flow), added disabled Entry visual state for text color when disabling email field (when logging back in after logout via vault timeout), hide account switcher based on AppOptions in constructor (so it works in iOS now)
  • App.xaml.cs: Added support for going directly to appropriate login page (login or SSO login instead of Home) when logging back in after vault timeout (left TODO for SSO flow handling which is not complete)
  • PolicyService.cs (and all references to it): Added proper support for userId (missed this in the OG pass)
  • VaultTimeoutAction (and all references to it): Converted from string to enum (was going to save this for later until I realized migration would be much easier before account switching is released)
  • Account.cs: Added OrgIdentifier to AccountProfile for use with the SSO login flow after logout via vault timeout
  • StateService.cs: Removed text status for active account since it was becoming messy (and expensive) to discern "what I am" vs. "what I will be" upon selection. 2 points in favor: 1) current screen of active user acts as "where I am", so no need to tell them twice, and 2) the modified appearance in the menu acts as another visual enforcement of the active account at a glance
  • VaultTimeoutService.cs: Added handy IsLoggedOutByTimeoutAsync bool to reduce noise

Screenshots

Screen Shot 2022-02-17 at 11 55 14 AM

Testing requirements

Continued testing of account switching as a whole

Before you submit

  • I have added unit tests where it makes sense to do so (encouraged but not required)
  • This change requires a documentation update (notify the documentation team)
  • This change has particular deployment requirements (notify the DevOps team)

🔄 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/1784 **Author:** [@mpbw2](https://github.com/mpbw2) **Created:** 2/17/2022 **Status:** ✅ Merged **Merged:** 2/17/2022 **Merged by:** [@mpbw2](https://github.com/mpbw2) **Base:** `accountswitching` ← **Head:** `accountswitching-fixes` --- ### 📝 Commits (1) - [`0d96c9d`](https://github.com/bitwarden/android/commit/0d96c9deed9cbab8ee9056ea535c98418029bf78) accountswitching fixes ### 📊 Changes **22 files changed** (+171 additions, -78 deletions) <details> <summary>View changed files</summary> 📝 `src/App/App.xaml.cs` (+21 -3) 📝 `src/App/Models/AppOptions.cs` (+2 -0) 📝 `src/App/Pages/Accounts/HomePage.xaml` (+4 -2) 📝 `src/App/Pages/Accounts/HomePage.xaml.cs` (+9 -8) 📝 `src/App/Pages/Accounts/HomePageViewModel.cs` (+8 -1) 📝 `src/App/Pages/Accounts/LoginPage.xaml` (+14 -3) 📝 `src/App/Pages/Accounts/LoginPage.xaml.cs` (+17 -12) 📝 `src/App/Pages/Accounts/LoginPageViewModel.cs` (+8 -0) 📝 `src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs` (+6 -6) 📝 `src/App/Utilities/AppHelpers.cs` (+7 -2) 📝 `src/Core/Abstractions/IPolicyService.cs` (+5 -5) 📝 `src/Core/Abstractions/IStateService.cs` (+3 -2) 📝 `src/Core/Abstractions/IVaultTimeoutService.cs` (+3 -1) ➕ `src/Core/Enums/VaultTimeoutAction.cs` (+8 -0) 📝 `src/Core/Models/Domain/Account.cs` (+3 -1) 📝 `src/Core/Services/PolicyService.cs` (+10 -10) 📝 `src/Core/Services/StateMigrationService.cs` (+2 -1) 📝 `src/Core/Services/StateService.cs` (+20 -10) 📝 `src/Core/Services/TokenService.cs` (+2 -1) 📝 `src/Core/Services/VaultTimeoutService.cs` (+14 -7) _...and 2 more files_ </details> ### 📄 Description ## Type of change - [X] Bug fix - [X] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> A multitude of fixes, things I missed, etc. See code changes for details. ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> * **AppOptions.cs:** Added `HideAccountSwitcher` bool to control this asynchronously when constructing a page * **HomePage.*:** Replaced "Close" ToolbarItem with a "Cancel" button since there doesn't appear to be a way to alternate with the avatar (only shown when running as iOS extension), hide account switcher based on AppOptions in constructor (so it works in iOS now) * **LoginPage.*:** Replaced "Close" ToolbarItem with a "Cancel" button since there doesn't appear to be a way to alternate with the avatar (only shown during normal (not vault-timeout) login flow), added disabled Entry visual state for text color when disabling email field (when logging back in after logout via vault timeout), hide account switcher based on AppOptions in constructor (so it works in iOS now) * **App.xaml.cs:** Added support for going directly to appropriate login page (login or SSO login instead of Home) when logging back in after vault timeout (left TODO for SSO flow handling which is not complete) * **PolicyService.cs (and all references to it):** Added proper support for userId (missed this in the OG pass) * **VaultTimeoutAction (and all references to it):** Converted from string to enum (was going to save this for later until I realized migration would be much easier before account switching is released) * **Account.cs:** Added `OrgIdentifier` to `AccountProfile` for use with the SSO login flow after logout via vault timeout * **StateService.cs:** Removed text status for active account since it was becoming messy (and expensive) to discern "what I am" vs. "what I will be" upon selection. 2 points in favor: 1) current screen of active user acts as "where I am", so no need to tell them twice, and 2) the modified appearance in the menu acts as another visual enforcement of the active account at a glance * **VaultTimeoutService.cs:** Added handy `IsLoggedOutByTimeoutAsync` bool to reduce noise ## Screenshots <!--Required for any UI changes. Delete if not applicable--> <img width="765" alt="Screen Shot 2022-02-17 at 11 55 14 AM" src="https://user-images.githubusercontent.com/59324545/154531708-b7f4df44-737a-4841-bcc6-71614d6ad10d.png"> ## Testing requirements <!--What functionality requires testing by QA? This includes testing new behavior and regression testing--> Continued testing of account switching as a whole ## Before you submit - [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required) - [ ] This change requires a **documentation update** (notify the documentation team) - [ ] This change has particular **deployment requirements** (notify the DevOps team) --- <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 2025-11-26 23:28:36 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#3124