[PR #6810] [MERGED] [PM-35352] [PM-21264] Group card numbers in vault item display #55101

Closed
opened 2026-05-01 21:03:33 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/6810
Author: @Cooperr06
Created: 4/19/2026
Status: Merged
Merged: 4/28/2026
Merged by: @david-livefront

Base: mainHead: PM-21264/card-number-grouping


📝 Commits (7)

  • fe43f16 [PM-21264] Group card numbers in vault item display (#5138)
  • 361913c Merge branch 'main' into PM-21264/card-number-grouping
  • ee50813 [PM-21264] Add missing coverage for card number formatting paths (#5138)
  • 8ef6fe6 Merge branch 'main' into PM-21264/card-number-grouping
  • 8b138d3 [PM-21264] Refactor card number spacing helpers and align formatter tests (#5138)
  • eceb52c [PM-21264] style: Improve formatting of card number spacing logic (#5138)
  • 12c1278 [PM-21264] fix: Improve formatting of card number spacing logic and add comprehensive tests (#5138)

📊 Changes

6 files changed (+187 additions, -3 deletions)

View changed files

📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt (+2 -1)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensions.kt (+2 -1)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/util/CardNumberUtils.kt (+61 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModelTest.kt (+14 -1)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensionsTest.kt (+33 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/util/CardNumberUtilsTest.kt (+75 -0)

📄 Description

🎟️ Tracking

https://github.com/bitwarden/android/issues/5138

📔 Objective

This PR implements brand-aware card number formatting in the vault item detail view to resolve the inconsistency between the Android app and other Bitwarden platforms.

Changes:

  • Formatting Logic: Added formatCardNumber utility to handle brand-specific spacing:
    • Amex: 4-6-5 grouping.
    • Diners Club (14-digit): 4-6-4 grouping.
    • Standard: Default 4-4-4-4 grouping for other brands.
  • UI Integration: Applied the formatting in CipherViewExtensions.kt so users see the grouped numbers in the item detail screen.
  • Clipboard Compatibility: Updated VaultItemViewModel.kt to ensure that clicking "Copy Number" still copies only the raw digits (no spaces). This maintains compatibility with web forms that may not handle spaces correctly.
  • Unit Tests: Added comprehensive tests in CardNumberUtilsTest.kt to verify formatting across multiple card brands.

📸 Screenshots

Before

Screenshot_20260419_185755

After

Default Card Number

Screenshot_20260419_185628

American Express Card Number

Screenshot_20260419_185603

Diners Club Card Number

Screenshot_20260419_185644

🔄 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/6810 **Author:** [@Cooperr06](https://github.com/Cooperr06) **Created:** 4/19/2026 **Status:** ✅ Merged **Merged:** 4/28/2026 **Merged by:** [@david-livefront](https://github.com/david-livefront) **Base:** `main` ← **Head:** `PM-21264/card-number-grouping` --- ### 📝 Commits (7) - [`fe43f16`](https://github.com/bitwarden/android/commit/fe43f1649ccb102478c876bcaa039ef5c0b08060) [PM-21264] Group card numbers in vault item display (#5138) - [`361913c`](https://github.com/bitwarden/android/commit/361913c2dab555a16667ba83b74df574c6bf031b) Merge branch 'main' into PM-21264/card-number-grouping - [`ee50813`](https://github.com/bitwarden/android/commit/ee50813b5888feef00078e732a2f13029eef4559) [PM-21264] Add missing coverage for card number formatting paths (#5138) - [`8ef6fe6`](https://github.com/bitwarden/android/commit/8ef6fe628173e8c2deb411fd2a3dfb51b133702c) Merge branch 'main' into PM-21264/card-number-grouping - [`8b138d3`](https://github.com/bitwarden/android/commit/8b138d3517eecf1ad2902dc1067976a246d0da2e) [PM-21264] Refactor card number spacing helpers and align formatter tests (#5138) - [`eceb52c`](https://github.com/bitwarden/android/commit/eceb52c04d32e2a8f3055b21406786aeea090c61) [PM-21264] style: Improve formatting of card number spacing logic (#5138) - [`12c1278`](https://github.com/bitwarden/android/commit/12c1278dd18dcf2ca75c2085ca3da726fb1063df) [PM-21264] fix: Improve formatting of card number spacing logic and add comprehensive tests (#5138) ### 📊 Changes **6 files changed** (+187 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt` (+2 -1) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensions.kt` (+2 -1) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/util/CardNumberUtils.kt` (+61 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModelTest.kt` (+14 -1) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensionsTest.kt` (+33 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/util/CardNumberUtilsTest.kt` (+75 -0) </details> ### 📄 Description ## 🎟️ Tracking https://github.com/bitwarden/android/issues/5138 ## 📔 Objective This PR implements brand-aware card number formatting in the vault item detail view to resolve the inconsistency between the Android app and other Bitwarden platforms. **Changes**: - **Formatting Logic**: Added formatCardNumber utility to handle brand-specific spacing: - **Amex**: 4-6-5 grouping. - **Diners Club (14-digit)**: 4-6-4 grouping. - **Standard**: Default 4-4-4-4 grouping for other brands. - **UI Integration**: Applied the formatting in CipherViewExtensions.kt so users see the grouped numbers in the item detail screen. - **Clipboard Compatibility**: Updated VaultItemViewModel.kt to ensure that clicking "Copy Number" still copies only the raw digits (no spaces). This maintains compatibility with web forms that may not handle spaces correctly. - **Unit Tests**: Added comprehensive tests in CardNumberUtilsTest.kt to verify formatting across multiple card brands. ## 📸 Screenshots ### Before <img width="1080" height="2400" alt="Screenshot_20260419_185755" src="https://github.com/user-attachments/assets/d52f0194-dcac-4391-a417-83e330b6a8de" /> ### After #### Default Card Number <img width="1080" height="2400" alt="Screenshot_20260419_185628" src="https://github.com/user-attachments/assets/3eb2657d-6417-4adb-bb22-a38bad6742bb" /> #### American Express Card Number <img width="1080" height="2400" alt="Screenshot_20260419_185603" src="https://github.com/user-attachments/assets/c79d892d-832e-40f7-b512-f46968cb6ad4" /> #### Diners Club Card Number <img width="1080" height="2400" alt="Screenshot_20260419_185644" src="https://github.com/user-attachments/assets/29184a51-5267-475c-b2f8-6412f8ffc273" /> --- <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-01 21:03:33 -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#55101