[PR #4479] [MERGED] PM-14333 Complete fix for crash caused by spannable text creation #4980

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

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/4479
Author: @dseverns-livefront
Created: 12/15/2024
Status: Merged
Merged: 12/20/2024
Merged by: @dseverns-livefront

Base: mainHead: PM-14333-add-back-functionalitity


📝 Commits (5)

  • 4d41a46 PM-14333 update annotated strings using resources to all be formatted strings so if the full string is not translated but the spanned words are they will be highlighted and functional
  • e0e80f4 rework to use single string resource and create annotated string from that
  • f8d6ca4 PR suggestions and inline comments plus another test
  • c32911d move test string to test source set
  • 4c9423f update new annotated string to use this method

📊 Changes

15 files changed (+384 additions, -545 deletions)

View changed files

📝 app/build.gradle.kts (+1 -0)
📝 app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/checkemail/CheckEmailScreen.kt (+14 -42)
📝 app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordguidance/MasterPasswordGuidanceScreen.kt (+6 -33)
📝 app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/newdevicenotice/NewDeviceNoticeEmailAccessScreen.kt (+5 -9)
📝 app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationScreen.kt (+13 -32)
app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/StringResExtensions.kt (+174 -0)
📝 app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/Text.kt (+0 -154)
📝 app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/importlogins/ImportLoginsScreen.kt (+22 -73)
📝 app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/importlogins/components/ImportLoginsInstructionStep.kt (+4 -11)
📝 app/src/main/res/values/strings.xml (+18 -32)
📝 app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/checkemail/CheckEmailScreenTest.kt (+0 -15)
app/src/test/java/com/x8bit/bitwarden/ui/platform/base/util/ClickableAnnotatedStringTest.kt (+0 -136)
app/src/test/java/com/x8bit/bitwarden/ui/platform/base/util/StringRestExtensionsTest.kt (+103 -0)
📝 app/src/test/java/com/x8bit/bitwarden/ui/util/ComposeTestHelpers.kt (+15 -8)
app/src/test/res/values/strings_for_tests_only.xml (+9 -0)

📄 Description

🎟️ Tracking

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

📔 Objective

  • This completes the work started in https://bitwarden.atlassian.net/browse/PM-15976 fix, with that change we are avoiding the crash, but not trying to apply a span style on a non existing index. This change updates our string resources and how we are applying the spans to better support the case where there is translation for the high lighted string but not for the full string where its to be added.

Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation 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/4479 **Author:** [@dseverns-livefront](https://github.com/dseverns-livefront) **Created:** 12/15/2024 **Status:** ✅ Merged **Merged:** 12/20/2024 **Merged by:** [@dseverns-livefront](https://github.com/dseverns-livefront) **Base:** `main` ← **Head:** `PM-14333-add-back-functionalitity` --- ### 📝 Commits (5) - [`4d41a46`](https://github.com/bitwarden/android/commit/4d41a4650c9f1afc93044ac217f022abb12193ef) PM-14333 update annotated strings using resources to all be formatted strings so if the full string is not translated but the spanned words are they will be highlighted and functional - [`e0e80f4`](https://github.com/bitwarden/android/commit/e0e80f4212e8f87d63af719a269a1beb2a27aa2c) rework to use single string resource and create annotated string from that - [`f8d6ca4`](https://github.com/bitwarden/android/commit/f8d6ca43f879ea83ab6287ba9c27e8619c2c9bbf) PR suggestions and inline comments plus another test - [`c32911d`](https://github.com/bitwarden/android/commit/c32911d7694d1d180fda46e1a14386a60215788b) move test string to test source set - [`4c9423f`](https://github.com/bitwarden/android/commit/4c9423fef0e700bb608fea6e75dbe23628d55724) update new annotated string to use this method ### 📊 Changes **15 files changed** (+384 additions, -545 deletions) <details> <summary>View changed files</summary> 📝 `app/build.gradle.kts` (+1 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/checkemail/CheckEmailScreen.kt` (+14 -42) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/masterpasswordguidance/MasterPasswordGuidanceScreen.kt` (+6 -33) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/newdevicenotice/NewDeviceNoticeEmailAccessScreen.kt` (+5 -9) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationScreen.kt` (+13 -32) ➕ `app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/StringResExtensions.kt` (+174 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/platform/base/util/Text.kt` (+0 -154) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/importlogins/ImportLoginsScreen.kt` (+22 -73) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/importlogins/components/ImportLoginsInstructionStep.kt` (+4 -11) 📝 `app/src/main/res/values/strings.xml` (+18 -32) 📝 `app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/checkemail/CheckEmailScreenTest.kt` (+0 -15) ➖ `app/src/test/java/com/x8bit/bitwarden/ui/platform/base/util/ClickableAnnotatedStringTest.kt` (+0 -136) ➕ `app/src/test/java/com/x8bit/bitwarden/ui/platform/base/util/StringRestExtensionsTest.kt` (+103 -0) 📝 `app/src/test/java/com/x8bit/bitwarden/ui/util/ComposeTestHelpers.kt` (+15 -8) ➕ `app/src/test/res/values/strings_for_tests_only.xml` (+9 -0) </details> ### 📄 Description ## 🎟️ Tracking https://bitwarden.atlassian.net/browse/PM-14333 <!-- Paste the link to the Jira or GitHub issue or otherwise describe / point to where this change is coming from. --> ## 📔 Objective - This completes the work started in https://bitwarden.atlassian.net/browse/PM-15976 fix, with that change we are avoiding the crash, but not trying to apply a span style on a non existing index. This change updates our string resources and how we are applying the spans to better support the case where there is translation for the high lighted string but not for the full string where its to be added. <!-- Describe what the purpose of this PR is, for example what bug you're fixing or new feature you're adding. --> <!-- 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 - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation 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-26 23:52:24 -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#4980