[PR #2724] [MERGED] [PM-3222] Migration of data from LiteDB to shared pref storage #23150

Closed
opened 2026-04-16 23:18:07 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/2724
Author: @mpbw2
Created: 8/25/2023
Status: Merged
Merged: 8/30/2023
Merged by: @mpbw2

Base: masterHead: feature/pref-migration


📝 Commits (4)

  • d5d47df Migration of data from LiteDB to shared pref storage
  • b5179d1 Merge branch 'master' into feature/pref-migration
  • 3590e7a Merge branch 'master' into feature/pref-migration
  • 64c4da7 tweaks

📊 Changes

10 files changed (+373 additions, -87 deletions)

View changed files

📝 src/App/Pages/BaseContentPage.cs (+6 -0)
📝 src/App/Services/MobileStorageService.cs (+40 -29)
📝 src/Core/Abstractions/IAppIdService.cs (+0 -1)
📝 src/Core/Abstractions/ICipherService.cs (+0 -1)
📝 src/Core/Abstractions/IStateService.cs (+2 -4)
📝 src/Core/Constants.cs (+3 -3)
📝 src/Core/Services/AppIdService.cs (+1 -6)
📝 src/Core/Services/CipherService.cs (+4 -19)
📝 src/Core/Services/StateMigrationService.cs (+310 -2)
📝 src/Core/Services/StateService.cs (+7 -22)

📄 Description

Type of change

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

Objective

This change performs data migration out of LiteDB and into shared preferences. It also changes the mobile storage service to default to saving anything new to shared pref storage, and requires specifying keys for LiteDB storage.

Code changes

  • StateMigrationService: Added a 5to6 migration block for global and account-specific state values
  • MobileStorageService.cs: Added a set of LiteDB storage keys to check against when accessing storage. Also added an inline litedb-to-pref migration on the getter to cover for values that can't be handled cleanly via StateMigration (accountBiometricIntegrityValid_{userId}_{systemBioIntegrityState}) and as a catch-all to prevent anything sneaking into liteDB during the transition.
  • BaseContentPage.cs: Prevent saving last active time without a userId to prevent the orphaned value from re-appearing in storage
  • Constants.cs: Adjusted key names and removed NeverDomainsKey
  • AppIdService: Removed anonymousAppId getter since appId is already anonymous
  • CipherService: Name changes to sync with Constants and removal of SaveNeverDomainAsync method
  • StateService: Name changes to sync with Constants and removal of NeverDomains getter/setter

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/2724 **Author:** [@mpbw2](https://github.com/mpbw2) **Created:** 8/25/2023 **Status:** ✅ Merged **Merged:** 8/30/2023 **Merged by:** [@mpbw2](https://github.com/mpbw2) **Base:** `master` ← **Head:** `feature/pref-migration` --- ### 📝 Commits (4) - [`d5d47df`](https://github.com/bitwarden/android/commit/d5d47dfa8b051bb82a6935ee181e9d3fb820ed6d) Migration of data from LiteDB to shared pref storage - [`b5179d1`](https://github.com/bitwarden/android/commit/b5179d153680f96fefe028d6a5a65fce38ba914b) Merge branch 'master' into feature/pref-migration - [`3590e7a`](https://github.com/bitwarden/android/commit/3590e7a995a0e47d4852b4dd378522671b593979) Merge branch 'master' into feature/pref-migration - [`64c4da7`](https://github.com/bitwarden/android/commit/64c4da7311519a18c8afbe9b2f1c97fa2ba2963a) tweaks ### 📊 Changes **10 files changed** (+373 additions, -87 deletions) <details> <summary>View changed files</summary> 📝 `src/App/Pages/BaseContentPage.cs` (+6 -0) 📝 `src/App/Services/MobileStorageService.cs` (+40 -29) 📝 `src/Core/Abstractions/IAppIdService.cs` (+0 -1) 📝 `src/Core/Abstractions/ICipherService.cs` (+0 -1) 📝 `src/Core/Abstractions/IStateService.cs` (+2 -4) 📝 `src/Core/Constants.cs` (+3 -3) 📝 `src/Core/Services/AppIdService.cs` (+1 -6) 📝 `src/Core/Services/CipherService.cs` (+4 -19) 📝 `src/Core/Services/StateMigrationService.cs` (+310 -2) 📝 `src/Core/Services/StateService.cs` (+7 -22) </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--> This change performs data migration out of LiteDB and into shared preferences. It also changes the mobile storage service to default to saving anything new to shared pref storage, and requires specifying keys for LiteDB storage. ## 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--> * **StateMigrationService:** Added a 5to6 migration block for global and account-specific state values * **MobileStorageService.cs:** Added a set of LiteDB storage keys to check against when accessing storage. Also added an inline litedb-to-pref migration on the getter to cover for values that can't be handled cleanly via StateMigration (`accountBiometricIntegrityValid_{userId}_{systemBioIntegrityState}`) and as a catch-all to prevent anything sneaking into liteDB during the transition. * **BaseContentPage.cs:** Prevent saving last active time without a userId to prevent the orphaned value from re-appearing in storage * **Constants.cs:** Adjusted key names and removed `NeverDomainsKey` * **AppIdService:** Removed `anonymousAppId` getter since `appId` is already anonymous * **CipherService:** Name changes to sync with `Constants` and removal of `SaveNeverDomainAsync` method * **StateService:** Name changes to sync with `Constants` and removal of `NeverDomains` getter/setter ## 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 2026-04-16 23:18:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#23150