File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ import {
34
34
EXISTING_USER ,
35
35
LAST_APP_VERSION ,
36
36
} from '../../../constants/storage' ;
37
- import { getVersion } from 'react-native-device-info' ;
37
+ import { getVersion , getFirstInstallTime , getLastUpdateTime } from 'react-native-device-info' ;
38
38
import { Authentication } from '../../../core/' ;
39
39
import Device from '../../../util/device' ;
40
40
import SDKConnect from '../../../core/SDKConnect/SDKConnect' ;
@@ -922,6 +922,15 @@ const App: React.FC = () => {
922
922
923
923
useEffect ( ( ) => {
924
924
async function startApp ( ) {
925
+ const firstInstallTime = await getFirstInstallTime ( ) ;
926
+ const lastUpdateTime = await getLastUpdateTime ( ) ;
927
+ const isFreshInstall = firstInstallTime === lastUpdateTime ;
928
+
929
+ if ( isFreshInstall ) {
930
+ // Clear all MMKV storage on fresh install to avoid leftovers of EXISTING_USER in case of phone migration
931
+ await StorageWrapper . clearAll ( ) ;
932
+ }
933
+
925
934
const existingUser = await StorageWrapper . getItem ( EXISTING_USER ) ;
926
935
if ( ! existingUser ) {
927
936
// List of chainIds to add (as hex strings)
You can’t perform that action at this time.
0 commit comments