-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
bug: clear MMKV on fresh install #15244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
@MarioAslau have you tested the upgrade path to make sure we are not flushing the store? |
app/components/Nav/App/App.tsx
Outdated
|
||
if (isFreshInstall) { | ||
// Clear all MMKV storage on fresh install to avoid leftovers of EXISTING_USER in case of phone migration | ||
await StorageWrapper.clearAll(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's verify that this clears all keys. Ex. default as well as the unique keys used to create MMKV instances
There are 3 conditions:
getFirstInstallTime -> will show the timestamp of when the app was first installed For a fresh install, both timestamps will be identical since the app bundle is created and modified at the same time.
To make sure that this condition is not true indefinitely until the user updates the app, we have the 3rd check.
|
|
app/core/Performance/Performance.ts
Outdated
* Checks if this is a fresh install with restored MMKV data from a backup. | ||
* If so, clears the MMKV storage to ensure a clean state. | ||
*/ | ||
static handleFreshInstallWithRestoredData = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to see tests for this function.
…om/MetaMask/metamask-mobile into bug/better-handle-phone-migrations
|
Description
When digging migration issue more. we've come to realise that MMKV causing the issue with the EXISTING_USER flag.
Solution:
Leveraging react-native-device-info, which has the getFirstInstallTime method and lastUpdateTime to check if it is a fresh install in App, if so, reset the flag.
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist