[PR #1674] [MERGED] move splash screen logic to OnResignActivation #3047

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

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1674
Author: @jlf0dev
Created: 12/7/2021
Status: Merged
Merged: 12/7/2021
Merged by: @jlf0dev

Base: masterHead: bug/ios-background-crash


📝 Commits (1)

  • 7058288 move splash screen logic to OnResignActivation

📊 Changes

1 file changed (+8 additions, -10 deletions)

View changed files

📝 src/iOS/AppDelegate.cs (+8 -10)

📄 Description

Type of change

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

Objective

iOS will occasionally crash while backgrounding or killing the application. This was due to us referencing a KeyWindow object that becomes null during backgrounding. If the timing was off we would get a null pointer exception.

This fix moves all the logic for backgrounding to OnResignActivation, which is called right before we move to the background. KeyWindow shouldn't be null yet and we can handle the splash screen without timing issues.

This opens up an old task: https://app.asana.com/0/1169444489336079/1201190971681077/f

We might eventually need to refactor how we accomplish this, as KeyWindow is deprecated in iOS 15.

Code changes

  • src/iOS/AppDelegate.cs: Move splash screen logic to OnResignActivation

Testing requirements

  • Testing around backgrounding and killing of app. Splash screen should show when backgrounding and there should be no crash.

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/1674 **Author:** [@jlf0dev](https://github.com/jlf0dev) **Created:** 12/7/2021 **Status:** ✅ Merged **Merged:** 12/7/2021 **Merged by:** [@jlf0dev](https://github.com/jlf0dev) **Base:** `master` ← **Head:** `bug/ios-background-crash` --- ### 📝 Commits (1) - [`7058288`](https://github.com/bitwarden/android/commit/705828881ea0919e963864078c61dfef25ab8c30) move splash screen logic to OnResignActivation ### 📊 Changes **1 file changed** (+8 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `src/iOS/AppDelegate.cs` (+8 -10) </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--> iOS will occasionally crash while backgrounding or killing the application. This was due to us referencing a `KeyWindow` object that becomes null during backgrounding. If the timing was off we would get a null pointer exception. This fix moves all the logic for backgrounding to OnResignActivation, which is called right before we move to the background. `KeyWindow` shouldn't be null yet and we can handle the splash screen without timing issues. This opens up an old task: https://app.asana.com/0/1169444489336079/1201190971681077/f We might eventually need to refactor how we accomplish this, as `KeyWindow` is deprecated in iOS 15. ## 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--> * **src/iOS/AppDelegate.cs:** Move splash screen logic to OnResignActivation ## Testing requirements <!--What functionality requires testing by QA? This includes testing new behavior and regression testing--> - Testing around backgrounding and killing of app. Splash screen should show when backgrounding and there should be no crash. ## 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:37 -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#3047