[PR #2232] [MERGED] [EC-830] Fix state checking when watch app had already been installed before #3445

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

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/2232
Author: @fedemkr
Created: 12/12/2022
Status: Merged
Merged: 12/13/2022
Merged by: @fedemkr

Base: masterHead: bug/EC-830-watch-wrong-initial-state


📝 Commits (1)

  • 6bc72f9 EC-830 Fix state checking when watch app had already been installed before, so reset it if first run.

📊 Changes

4 files changed (+37 additions, -0 deletions)

View changed files

📝 src/watchOS/bitwarden/bitwarden WatchKit Extension/Services/CryptoService.swift (+4 -0)
📝 src/watchOS/bitwarden/bitwarden WatchKit Extension/Services/EnvironmentService.swift (+5 -0)
📝 src/watchOS/bitwarden/bitwarden WatchKit Extension/Services/StateService.swift (+26 -0)
📝 src/watchOS/bitwarden/bitwarden WatchKit Extension/ViewModels/CipherListViewModel.swift (+2 -0)

📄 Description

Type of change

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

Objective

Fix bug that the state was being held between app installations. So we need to clear the state (anything on the Keychain) on new installation.

Code changes

  • StateService: Added checkIntegrity() method that will check if the app has already been run and if not will reset the state and the keychain related items. The HAS_RUN_BEFORE_KEY is saved on the UserDefaults so it's cleared when the app is uninstalled.
  • CipherListViewModel: Added call to check the integrity of the state through the StateService
  • CryptoService: Added method to clear the key
  • EnvironmentService: Added clear method to clear keychain related items

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If 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/2232 **Author:** [@fedemkr](https://github.com/fedemkr) **Created:** 12/12/2022 **Status:** ✅ Merged **Merged:** 12/13/2022 **Merged by:** [@fedemkr](https://github.com/fedemkr) **Base:** `master` ← **Head:** `bug/EC-830-watch-wrong-initial-state` --- ### 📝 Commits (1) - [`6bc72f9`](https://github.com/bitwarden/android/commit/6bc72f961c5d5ccb3fa491b7cc990e1ee9785c30) EC-830 Fix state checking when watch app had already been installed before, so reset it if first run. ### 📊 Changes **4 files changed** (+37 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/watchOS/bitwarden/bitwarden WatchKit Extension/Services/CryptoService.swift` (+4 -0) 📝 `src/watchOS/bitwarden/bitwarden WatchKit Extension/Services/EnvironmentService.swift` (+5 -0) 📝 `src/watchOS/bitwarden/bitwarden WatchKit Extension/Services/StateService.swift` (+26 -0) 📝 `src/watchOS/bitwarden/bitwarden WatchKit Extension/ViewModels/CipherListViewModel.swift` (+2 -0) </details> ### 📄 Description ## Type of change - [ ] Bug fix - [X] 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 bug that the state was being held between app installations. So we need to clear the state (anything on the Keychain) on new installation. ## 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--> * **StateService:** Added `checkIntegrity()` method that will check if the app has already been run and if not will reset the state and the keychain related items. The `HAS_RUN_BEFORE_KEY` is saved on the `UserDefaults` so it's cleared when the app is uninstalled. * **CipherListViewModel:** Added call to check the integrity of the state through the `StateService` * **CryptoService:** Added method to clear the key * **EnvironmentService:** Added clear method to clear keychain related items ## Before you submit - Please check for formatting errors (`dotnet format --verify-no-changes`) (required) - Please add **unit tests** where it makes sense to do so (encouraged but not required) - If this change requires a **documentation update** - notify the documentation team - If 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:32:52 -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#3445