[PR #4916] [MERGED] PM-19131 - Custom hidden fields not working properly if TOTP also configured #5312

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

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/4916
Author: @phil-livefront
Created: 3/25/2025
Status: Merged
Merged: 4/1/2025
Merged by: @phil-livefront

Base: mainHead: phil/PM-19131-Custom-hidden-fields-not-working-properly-if-TOTP-also-configured


📝 Commits (10+)

  • bc76e46 PM-19131 - moved isVisible logic for hidden custom fields to be managed on view side vs model side
  • c0707ae Revert "PM-19131 - moved isVisible logic for hidden custom fields to be managed on view side vs model side"
  • c51f61c WIP
  • b0729e8 WIP
  • f698d09 WIP
  • 66dae19 WIP
  • 29838b1 Revert "WIP"
  • 3926fbc Revert "WIP"
  • a4fb50d revert previous changes and go back to hash solution
  • 932eced clean up

📊 Changes

5 files changed (+79 additions, -20 deletions)

View changed files

📝 app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt (+9 -0)
📝 app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensions.kt (+22 -3)
📝 app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreenTest.kt (+13 -0)
📝 app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModelTest.kt (+7 -0)
📝 app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt (+28 -17)

📄 Description

🎟️ Tracking

PM-19131

📔 Objective

  • Previously, the isVisible property on custom hidden fields was being reset every time the TOTP clock updated (once per second). This caused a UX issue where a visible hidden field would incorrectly revert to a hidden state on each tick.

  • The initial fix attempted to preserve visibility state by comparing against the previousState. However, FieldView via the SDK does not have a unique id property, and matching by name proved unreliable since multiple custom fields can share the same name.

  • To address this, the visibility state is now managed locally in the view using rememberSaveable, allowing the UI to persist visibility independently of the model.

  • This pattern is likely a better fit for view-driven state, such as isVisible and could also be extended to other field types (like password) to avoid similar issues and reduce model-driven UI state churn. Happy to have a convo about that.

📸 Screenshots

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/4916 **Author:** [@phil-livefront](https://github.com/phil-livefront) **Created:** 3/25/2025 **Status:** ✅ Merged **Merged:** 4/1/2025 **Merged by:** [@phil-livefront](https://github.com/phil-livefront) **Base:** `main` ← **Head:** `phil/PM-19131-Custom-hidden-fields-not-working-properly-if-TOTP-also-configured` --- ### 📝 Commits (10+) - [`bc76e46`](https://github.com/bitwarden/android/commit/bc76e46185c07a9ecbf273f6a1fdf7451e01458c) PM-19131 - moved isVisible logic for hidden custom fields to be managed on view side vs model side - [`c0707ae`](https://github.com/bitwarden/android/commit/c0707ae08c8ca7fad11406cbc75fbcbc33388ca6) Revert "PM-19131 - moved isVisible logic for hidden custom fields to be managed on view side vs model side" - [`c51f61c`](https://github.com/bitwarden/android/commit/c51f61c5859247eb324e181078ffbf1855f064fc) WIP - [`b0729e8`](https://github.com/bitwarden/android/commit/b0729e8cd28ef48f114ea1a6dc26aa69af8ea927) WIP - [`f698d09`](https://github.com/bitwarden/android/commit/f698d09b43ccf0193ce6174c6ff2aa7004a157ee) WIP - [`66dae19`](https://github.com/bitwarden/android/commit/66dae199c8766b12fb5efae12d788387f270fd5b) WIP - [`29838b1`](https://github.com/bitwarden/android/commit/29838b19e06c94c600856a989c2ea8fbf9f8c5db) Revert "WIP" - [`3926fbc`](https://github.com/bitwarden/android/commit/3926fbca7f233e285e03ccf600b0fb9d46a3c108) Revert "WIP" - [`a4fb50d`](https://github.com/bitwarden/android/commit/a4fb50d3d88438b112c15f000e84b5f5c17be2d0) revert previous changes and go back to hash solution - [`932eced`](https://github.com/bitwarden/android/commit/932eced64e0e7880b2fd39514d46cba769ffcbd0) clean up ### 📊 Changes **5 files changed** (+79 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt` (+9 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensions.kt` (+22 -3) 📝 `app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreenTest.kt` (+13 -0) 📝 `app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModelTest.kt` (+7 -0) 📝 `app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt` (+28 -17) </details> ### 📄 Description ## 🎟️ Tracking [PM-19131](https://bitwarden.atlassian.net/browse/PM-19131) ## 📔 Objective - Previously, the isVisible property on custom hidden fields was being reset every time the TOTP clock updated (once per second). This caused a UX issue where a visible hidden field would incorrectly revert to a hidden state on each tick. - The initial fix attempted to preserve visibility state by comparing against the `previousState`. However, `FieldView` via the SDK does not have a unique id property, and matching by name proved unreliable since multiple custom fields can share the same name. - To address this, the visibility state is now managed locally in the view using rememberSaveable, allowing the UI to persist visibility independently of the model. - This pattern is likely a better fit for view-driven state, such as `isVisible` and could also be extended to other field types (like password) to avoid similar issues and reduce model-driven UI state churn. Happy to have a convo about that. ## 📸 Screenshots <!-- Required for any UI changes; delete if not applicable. Use fixed width images for better display. --> ## ⏰ 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 [PM-19131]: https://bitwarden.atlassian.net/browse/PM-19131?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- <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:57:44 -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#5312