Skip to content

[PM-34126] feat: Add card scan screen#6721

Draft
SaintPatrck wants to merge 2 commits intocard-scanner/2-text-analysis-pipelinefrom
card-scanner/3-card-scan-screen
Draft

[PM-34126] feat: Add card scan screen#6721
SaintPatrck wants to merge 2 commits intocard-scanner/2-text-analysis-pipelinefrom
card-scanner/3-card-scan-screen

Conversation

@SaintPatrck
Copy link
Contributor

🎟️ Tracking

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

📔 Objective

Add the card scan screen with camera integration for credit card scanning:

  • CardScanManager: Shared result channel between scanner and consumer, located in ui module (cardscanner/manager/)
  • CardScanResult: Sealed class wrapping CardScanData for success/error states
  • CardScanViewModel: State management with duplicate-scan guarding and DeferredBackgroundEvent
  • CardScanScreen: Composable with camera preview, overlay, and close button
  • CardScanNavigation: Type-safe route and navigation helper
  • CardScanner feature flag: Gated behind card-scanner-mobile FlagKey
  • BitwardenComposeTest: Added cardTextAnalyzer parameter to setContent

Includes ViewModel, Screen, and Manager tests.

Add the complete text analysis pipeline for credit card scanning:
- CardNumberUtils: sanitize, Luhn validation, brand detection
- CardDataParser: interface and implementation for OCR text parsing
- CardTextAnalyzer: ML Kit-based camera frame analysis
- CardScanOverlay: camera overlay composable
- CardScanData: data class for parsed card fields
- FakeCardTextAnalyzer: test fixture
- LocalProviders: composition local for CardTextAnalyzer
Add the card scanner screen with camera integration:
- CardScanManager: shared result channel between scanner and consumer
- CardScanViewModel: state management for scan screen
- CardScanScreen: composable with camera preview and overlay
- CardScanNavigation: route and navigation helper
- CardScanner feature flag gated behind card-scanner-mobile
@SaintPatrck SaintPatrck added the ai-review-vnext Request a Claude code review using the vNext workflow label Mar 26, 2026
@github-actions github-actions bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:feature Change Type - Feature Development labels Mar 26, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 26, 2026

Overall Assessment: APPROVE

This PR adds the card scan screen with camera integration for credit card scanning across 14 files. The implementation closely mirrors the established QR code scanner pattern, introducing a CardScanManager for result communication, a CardScanViewModel with duplicate-scan guarding via DeferredBackgroundEvent, and a CardScanScreen composable with dark-mode overlay. The feature is properly gated behind the card-scanner-mobile feature flag, and no sensitive card data is persisted to disk.

Code Review Details

No findings requiring action were identified. The code follows established codebase patterns, handles sensitive data appropriately in memory, and includes comprehensive test coverage for the ViewModel, Screen, and Manager layers.

@codecov
Copy link

codecov bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 84.84848% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.65%. Comparing base (d776756) to head (be951b7).

Files with missing lines Patch % Lines
...den/ui/vault/feature/cardscanner/CardScanScreen.kt 88.33% 6 Missing and 1 partial ⚠️
...ui/vault/feature/cardscanner/CardScanNavigation.kt 0.00% 6 Missing ⚠️
.../ui/vault/feature/cardscanner/CardScanViewModel.kt 92.30% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                          Coverage Diff                           @@
##           card-scanner/2-text-analysis-pipeline    #6721   +/-   ##
======================================================================
  Coverage                                  85.65%   85.65%           
======================================================================
  Files                                        950      955    +5     
  Lines                                      60493    60592   +99     
  Branches                                    8592     8597    +5     
======================================================================
+ Hits                                       51813    51898   +85     
- Misses                                      5673     5685   +12     
- Partials                                    3007     3009    +2     
Flag Coverage Δ
app-data 17.86% <0.00%> (-0.03%) ⬇️
app-ui-auth-tools 20.85% <0.00%> (-0.02%) ⬇️
app-ui-platform 15.58% <0.00%> (-0.03%) ⬇️
app-ui-vault 26.93% <80.80%> (+0.10%) ⬆️
authenticator 6.51% <0.00%> (-0.02%) ⬇️
lib-core-network-bridge 4.23% <0.00%> (-0.01%) ⬇️
lib-data-ui 1.04% <7.07%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@github-actions
Copy link
Contributor

Logo
Checkmarx One – Scan Summary & Details013433e3-fa79-4f97-a54c-a30963be03a6

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review-vnext Request a Claude code review using the vNext workflow app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant