[PR #5640] [MERGED] Refactor Autofill Hint Logic and Add Card Autofill Support #5931

Closed
opened 2025-11-27 00:17:15 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/5640
Author: @SaintPatrck
Created: 8/4/2025
Status: Merged
Merged: 8/7/2025
Merged by: @SaintPatrck

Base: mainHead: improve-card-autofill


📝 Commits (1)

  • 1063d6a Refactor Autofill Hint Logic and Add Card Autofill Support

📊 Changes

12 files changed (+935 additions, -201 deletions)

View changed files

📝 app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/builder/FilledDataBuilderImpl.kt (+45 -9)
app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/model/AutofillHint.kt (+15 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/model/AutofillView.kt (+14 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/util/HtmlInfoExtensions.kt (+91 -33)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/util/StringExtensions.kt (+10 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/util/ViewNodeExtensions.kt (+144 -63)
app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/util/ViewStructureUtils.kt (+137 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingViewModel.kt (+45 -16)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/autofill/builder/FilledDataBuilderTest.kt (+106 -2)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/autofill/util/HtmlInfoExtensionsTest.kt (+0 -6)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/autofill/util/ViewNodeExtensionsTest.kt (+327 -72)
📝 ui/src/main/res/values/strings.xml (+1 -0)

📄 Description

🎟️ Tracking

PM-24561
PM-24562
PM-24563

📔 Objective

This commit refactors the autofill hint detection logic in ViewNodeExtensions.kt and introduces support for new autofill hints related to credit card information.

Key changes include:

  • Introduced a new AutofillHint enum to represent various autofill field types.
  • Added regular expressions to detect hints for cardholder name, card number, expiration month, expiration year, expiration date, and security code from HTML attributes.
  • Updated ViewNode.supportedAutofillHint to use the new AutofillHint enum and prioritize explicit hints over inferred ones.
  • Modified ViewNode.isPasswordField and ViewNode.isUsernameField to be properties and utilize the new hint logic.
  • Added new AutofillView.Card subtypes: ExpirationDate and CardholderName.
  • Updated FilledDataBuilderImpl.kt to handle the new card-related AutofillView types.
  • Added String.matchesAnyExpressions extension function.
  • Included corresponding unit tests for the changes in ViewNodeExtensionsTest.kt.

📸 Screenshots

https://github.com/user-attachments/assets/709fed43-8f3d-4054-af62-f31d2e6e85df

https://github.com/user-attachments/assets/441861e1-e839-4dd1-a543-1919334c80e2

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

🔄 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/5640 **Author:** [@SaintPatrck](https://github.com/SaintPatrck) **Created:** 8/4/2025 **Status:** ✅ Merged **Merged:** 8/7/2025 **Merged by:** [@SaintPatrck](https://github.com/SaintPatrck) **Base:** `main` ← **Head:** `improve-card-autofill` --- ### 📝 Commits (1) - [`1063d6a`](https://github.com/bitwarden/android/commit/1063d6ae5f19867506d6a9cebf2eeeaa73f38187) Refactor Autofill Hint Logic and Add Card Autofill Support ### 📊 Changes **12 files changed** (+935 additions, -201 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/builder/FilledDataBuilderImpl.kt` (+45 -9) ➕ `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/model/AutofillHint.kt` (+15 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/model/AutofillView.kt` (+14 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/util/HtmlInfoExtensions.kt` (+91 -33) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/util/StringExtensions.kt` (+10 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/util/ViewNodeExtensions.kt` (+144 -63) ➕ `app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/util/ViewStructureUtils.kt` (+137 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingViewModel.kt` (+45 -16) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/autofill/builder/FilledDataBuilderTest.kt` (+106 -2) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/autofill/util/HtmlInfoExtensionsTest.kt` (+0 -6) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/autofill/util/ViewNodeExtensionsTest.kt` (+327 -72) 📝 `ui/src/main/res/values/strings.xml` (+1 -0) </details> ### 📄 Description ## 🎟️ Tracking PM-24561 PM-24562 PM-24563 ## 📔 Objective This commit refactors the autofill hint detection logic in `ViewNodeExtensions.kt` and introduces support for new autofill hints related to credit card information. Key changes include: - Introduced a new `AutofillHint` enum to represent various autofill field types. - Added regular expressions to detect hints for cardholder name, card number, expiration month, expiration year, expiration date, and security code from HTML attributes. - Updated `ViewNode.supportedAutofillHint` to use the new `AutofillHint` enum and prioritize explicit hints over inferred ones. - Modified `ViewNode.isPasswordField` and `ViewNode.isUsernameField` to be properties and utilize the new hint logic. - Added new `AutofillView.Card` subtypes: `ExpirationDate` and `CardholderName`. - Updated `FilledDataBuilderImpl.kt` to handle the new card-related `AutofillView` types. - Added `String.matchesAnyExpressions` extension function. - Included corresponding unit tests for the changes in `ViewNodeExtensionsTest.kt`. ## 📸 Screenshots https://github.com/user-attachments/assets/709fed43-8f3d-4054-af62-f31d2e6e85df https://github.com/user-attachments/assets/441861e1-e839-4dd1-a543-1919334c80e2 ## ⏰ 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 <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+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 --- <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-27 00:17:15 -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#5931