Skip to content

Conversation

@SaintPatrck
Copy link
Contributor

@SaintPatrck SaintPatrck commented Sep 23, 2025

🎟️ Tracking

PM-26095

📔 Objective

This commit introduces a new screen that allows users to select an account when importing items via the Credential Exchange Framework (CXF).

When a Credential Exchange import request is received the user is prompted to confirm which account to export items from.

Should the user choose to close the screen, the export process will be cancelled and the user returned to the requesting application.

Key changes include:

  • Added SelectAccountScreen.kt for the UI of the account selection.
  • Added SelectAccountViewModel.kt to manage the state and logic for account selection.
  • Included AccountSelectionListItem.kt to model the items displayed in the account list.
  • Implemented SelectAccountHandlers.kt to manage user interactions on the screen.
  • Added unit tests for the new screen (SelectAccountScreenTest.kt) and view model (SelectAccountViewModelTest.kt).
  • Added new string resources for the account selection screen.
  • Updated BitwardenComposeTest.kt and LocalManagerProvider.kt to include CredentialExchangeCompletionManager.

📸 Screenshots

image

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@github-actions
Copy link
Contributor

github-actions bot commented Sep 23, 2025

Logo
Checkmarx One – Scan Summary & Details6f01c6d5-8169-4cba-93f1-ddf34371ca3b

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

@codecov
Copy link

codecov bot commented Sep 23, 2025

Codecov Report

❌ Patch coverage is 88.46154% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.28%. Comparing base (cc685b2) to head (0795385).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...re/exportitems/component/AccountSummaryListItem.kt 84.90% 5 Missing and 3 partials ⚠️
...xportitems/selectaccount/SelectAccountViewModel.kt 91.66% 4 Missing and 2 partials ⚠️
...e/exportitems/selectaccount/SelectAccountScreen.kt 90.74% 4 Missing and 1 partial ⚠️
...ui/vault/feature/vault/util/UserStateExtensions.kt 57.14% 1 Missing and 2 partials ⚠️
...ature/exportitems/component/ExportItemsScaffold.kt 92.30% 0 Missing and 1 partial ⚠️
...ms/selectaccount/handlers/SelectAccountHandlers.kt 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5932      +/-   ##
==========================================
+ Coverage   84.26%   84.28%   +0.01%     
==========================================
  Files         713      717       +4     
  Lines       53690    53899     +209     
  Branches     7401     7416      +15     
==========================================
+ Hits        45244    45429     +185     
- Misses       5851     5864      +13     
- Partials     2595     2606      +11     

☔ 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 cxf/app/export-select-account branch from 46c1b67 to 5877d24 Compare September 23, 2025 21:51
Base automatically changed from cxf/app/export-special-circumstance to main September 23, 2025 22:13
@SaintPatrck SaintPatrck force-pushed the cxf/app/export-select-account branch from 5877d24 to 5effc5c Compare September 24, 2025 00:36
@SaintPatrck SaintPatrck marked this pull request as draft September 24, 2025 16:17
@SaintPatrck SaintPatrck force-pushed the cxf/app/export-select-account branch 3 times, most recently from 5946e5c to b7037f6 Compare September 24, 2025 16:53
@SaintPatrck SaintPatrck marked this pull request as ready for review September 24, 2025 17:08
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ExportItemsScaffold(
Copy link
Collaborator

@david-livefront david-livefront Sep 24, 2025

Choose a reason for hiding this comment

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

Does this buy us much?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you mean.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it worth the custom component to wrap the toolbar?

Copy link
Contributor Author

@SaintPatrck SaintPatrck Sep 24, 2025

Choose a reason for hiding this comment

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

Ah... buy us much. Got it.

It saves us from duplicating everything but the title and nav icon in every screen. Plus it makes the screens easier to consume (as a lowly human 🤖 ).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry about the typo... I fixed it 😄

Fair enough, carry on

* - "First" -> "FI"
* - name is `null`, email is "test@bitwarden.com" -> "TE"
*/
val UserState.Account.initials: String
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't this already exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not as an extension of UserState.Account. The other one is an extension of AccountSummary.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmmm, it looks like this exists for the AccountSummary not the UserState.Account.

Do we need more data than the AccountSummary provides?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we need different data entirely.

data class AccountSelectionListItem(
    val userId: String,
    val isItemRestricted: Boolean,
    val avatarColorHex: String,
    val initials: String,
    val email: String,
) : Parcelable

compared to the heavier

@Parcelize
data class AccountSummary(
    val userId: String,
    val name: String?,
    val email: String,
    val avatarColorHex: String,
    val environmentLabel: String,
    val isActive: Boolean,
    val isLoggedIn: Boolean,
    val isVaultUnlocked: Boolean,
) : Parcelable {

    // other stuff omitted

}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good!

@SaintPatrck SaintPatrck force-pushed the cxf/app/export-select-account branch from b7037f6 to b55f0cf Compare September 24, 2025 18:50
This commit introduces a new screen that allows users to select an account when importing items via the Credential Exchange Framework (CXF).

When a Credential Exchange import request is received the user is prompted to confirm which account to export items from.

Should the user choose to close the screen, the export process will be cancelled and the user returned to the requesting application.

Key changes include:
- Added `SelectAccountScreen.kt` for the UI of the account selection.
- Added `SelectAccountViewModel.kt` to manage the state and logic for account selection.
- Added `ExportItemsScaffold` a reusable scaffold for the export items screens.
- Included `AccountSelectionListItem.kt` to model the items displayed in the account list.
- Implemented `SelectAccountHandlers.kt` to manage user interactions on the screen.
- Added unit tests for the new screen (`SelectAccountScreenTest.kt`) and view model (`SelectAccountViewModelTest.kt`).
- Added new string resources for the account selection screen.
- Updated `BitwardenComposeTest.kt` and `LocalManagerProvider.kt` to include `CredentialExchangeCompletionManager`.
@SaintPatrck SaintPatrck added this pull request to the merge queue Sep 24, 2025
Merged via the queue into main with commit 3edd5bd Sep 24, 2025
9 checks passed
@SaintPatrck SaintPatrck deleted the cxf/app/export-select-account branch September 24, 2025 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants