[PR #1690] [MERGED] Fix by workaround crash on LabelRenderer and when changing themes #1689 #3056

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

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1690
Author: @fedemkr
Created: 12/14/2021
Status: Merged
Merged: 12/16/2021
Merged by: @fedemkr

Base: masterHead: bug/labelrenderer-crash-update-text-color


📝 Commits (1)

  • 8653e72 Fix by workaround crash on LabelRenderer and when changing themes #1689

📊 Changes

2 files changed (+104 additions, -67 deletions)

View changed files

📝 src/App/Utilities/ThemeManager.cs (+60 -39)
📝 src/iOS.Core/Renderers/CustomLabelRenderer.cs (+44 -28)

📄 Description

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Fix crash on iOS LabelRenderer when changing themes on password generator screen and password generator history. These are workarounds only

I think this may need to be further tested and check what happens on certain scenarios before going to PRD. I saw that when the app is supposed to crash, but now it doesn't because of the try...catch, there are certain elements that don't update the style, so maybe I could spend more time in it trying to make everything work correctly

Code changes

  • CustomLabelRenderer.cs: Added try...catch when calling base so that we can ignore the exception if it happens, it's the only workardound I could find so far (already submitted PR on Xamarin Forms to fix this https://github.com/xamarin/Xamarin.Forms/pull/14982)
  • ThemeManager.cs: Sometimes the app crashes when closing a view when coming from background having changed the theme, so I've added a try...catch as a workaround here as well.

Screenshots

Testing requirements

Scenario 1:

  • Go to a cypher -> Edit -> tap on the icon for regenerate password
  • Put the app on background
  • Change light/dark mode
  • Go back to the app
  • Without waiting the password label to be updated tap on Select
  • The app crashes, and now it shouldn't

Scenario 2:

  • Go to Password generator -> Password history (on the toolbar menu three dots)
  • Put the app on background
  • Change light/dark mode
  • Go back to the app
  • The app crashes, and now it shouldn't (sometimes it doesn't crash, it needs a few attempts)

Before you submit

  • I have added unit tests where it makes sense to do so (encouraged but not required)
  • This change requires a documentation update (notify the documentation team)
  • This change has particular deployment requirements (notify the DevOps team)

🔄 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/1690 **Author:** [@fedemkr](https://github.com/fedemkr) **Created:** 12/14/2021 **Status:** ✅ Merged **Merged:** 12/16/2021 **Merged by:** [@fedemkr](https://github.com/fedemkr) **Base:** `master` ← **Head:** `bug/labelrenderer-crash-update-text-color` --- ### 📝 Commits (1) - [`8653e72`](https://github.com/bitwarden/android/commit/8653e7255485ff790ea5ee40be5ff4323c0d79fa) Fix by workaround crash on LabelRenderer and when changing themes #1689 ### 📊 Changes **2 files changed** (+104 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `src/App/Utilities/ThemeManager.cs` (+60 -39) 📝 `src/iOS.Core/Renderers/CustomLabelRenderer.cs` (+44 -28) </details> ### 📄 Description ## Type of change - [X] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> Fix crash on iOS LabelRenderer when changing themes on password generator screen and password generator history. These are **workarounds** only I think this may need to be further tested and check what happens on certain scenarios before going to PRD. I saw that when the app is supposed to crash, but now it doesn't because of the try...catch, there are certain elements that don't update the style, so maybe I could spend more time in it trying to make everything work correctly ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> * **CustomLabelRenderer.cs:** Added try...catch when calling base so that we can ignore the exception if it happens, it's the only workardound I could find so far (already submitted PR on Xamarin Forms to fix this https://github.com/xamarin/Xamarin.Forms/pull/14982) * **ThemeManager.cs:** Sometimes the app crashes when closing a view when coming from background having changed the theme, so I've added a try...catch as a workaround here as well. ## Screenshots <!--Required for any UI changes. Delete if not applicable--> ## Testing requirements <!--What functionality requires testing by QA? This includes testing new behavior and regression testing--> Scenario 1: - Go to a cypher -> Edit -> tap on the icon for regenerate password - Put the app on background - Change light/dark mode - Go back to the app - Without waiting the password label to be updated tap on Select - The app crashes, and now it shouldn't Scenario 2: - Go to Password generator -> Password history (on the toolbar menu three dots) - Put the app on background - Change light/dark mode - Go back to the app - The app crashes, and now it shouldn't (sometimes it doesn't crash, it needs a few attempts) ## Before you submit - [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required) - [ ] This change requires a **documentation update** (notify the documentation team) - [ ] This change has particular **deployment requirements** (notify the DevOps team) --- <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:27:45 -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#3056