diff --git a/dist/BUNDLE_ID b/dist/BUNDLE_ID index 57b9a94f..ff6cb655 100644 --- a/dist/BUNDLE_ID +++ b/dist/BUNDLE_ID @@ -1 +1 @@ -019a2ff9-adc8-7f97-92c1-ec6d92db39a3 \ No newline at end of file +019a3577-44d5-7927-8015-e5a30263640e \ No newline at end of file diff --git a/package.json b/package.json index ab7da135..6c437717 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minibits_wallet", - "version": "0.3.2-beta.4", + "version": "0.3.2-beta.5", "private": true, "scripts": { "android:clean": "cd android && ./gradlew clean", diff --git a/src/screens/ImportBackupScreen.tsx b/src/screens/ImportBackupScreen.tsx index 2386bd6f..3e15907f 100644 --- a/src/screens/ImportBackupScreen.tsx +++ b/src/screens/ImportBackupScreen.tsx @@ -43,7 +43,6 @@ export const ImportBackupScreen = observer(function ImportBackupScreen({ route } const { mintsStore, proofsStore, - userSettingsStore, contactsStore, walletProfileStore, walletStore, @@ -65,7 +64,6 @@ export const ImportBackupScreen = observer(function ImportBackupScreen({ route } mintsStore: MintsStoreSnapshot, contactsStore: ContactsStoreSnapshot, } | undefined>(undefined) // type tbd - const [profileToRecover, setProfileToRecover] = useState(undefined) const [isLoading, setIsLoading] = useState(false) const [error, setError] = useState() const [statusMessage, setStatusMessage] = useState() @@ -155,8 +153,8 @@ export const ImportBackupScreen = observer(function ImportBackupScreen({ route } const onConfirmBackup = async function () { try { - if(!backup) { - throw new AppError(Err.VALIDATION_ERROR, 'Missing backup.') + if(!backup || !seedHashRef.current) { + throw new AppError(Err.VALIDATION_ERROR, 'Missing backup or seed.') } LayoutAnimation.easeInEaseOut() @@ -244,18 +242,18 @@ export const ImportBackupScreen = observer(function ImportBackupScreen({ route } mnemonic } - // update seed to the provided one - keys.SEED = seed - // In case there is a profile linked to provided seedHash, - // it's address is recovered to the current profile. - // As we regenerate ecash from provided seed, it is linked to current profile as well. + // it's address, avatar and seed is recovered to the current profile. await walletProfileStore.recover( keys.walletId, seedHashRef.current, ) - await KeyChain.saveWalletKeys(keys) + // update seed to the provided one + const keysCopy = { ...keys } + keysCopy.SEED = seed + + await KeyChain.saveWalletKeys(keysCopy) walletStore.cleanCachedWalletKeys() if(!mintsStore.mintExists(MINIBITS_MINT_URL)) { @@ -369,26 +367,13 @@ export const ImportBackupScreen = observer(function ImportBackupScreen({ route } } /> )} - {isValidMnemonic && isValidBackup && profileToRecover && ( - } - style={$item} - /> - } - /> - )} {isValidMnemonic && isValidBackup && ( } style={$item} /> diff --git a/src/screens/RecoverWalletAddressScreen.tsx b/src/screens/RecoverWalletAddressScreen.tsx index 504932e7..1896bb3a 100644 --- a/src/screens/RecoverWalletAddressScreen.tsx +++ b/src/screens/RecoverWalletAddressScreen.tsx @@ -29,7 +29,7 @@ export const RecoverWalletAddressScreen = observer(function RecoverWalletAddress }, }) - const { walletProfileStore, userSettingsStore, walletStore, authStore } = useStores() + const { walletProfileStore, walletStore } = useStores() const mnemonicInputRef = useRef(null) const seedRef = useRef(null) @@ -119,16 +119,13 @@ export const RecoverWalletAddressScreen = observer(function RecoverWalletAddress seedHashRef.current ) - userSettingsStore.setIsOnboarded(true) - setStatusMessage(translate('recovery_completed')) await delay(1000) setStatusMessage('') setIsLoading(false) - navigation.dispatch( - StackActions.popToTop() - ) + //@ts-ignore + navigation.navigate('Tabs') } catch (e: any) { handleError(e) } diff --git a/src/screens/SeedRecoveryScreen.tsx b/src/screens/SeedRecoveryScreen.tsx index 4e7f5dae..76f4c9be 100644 --- a/src/screens/SeedRecoveryScreen.tsx +++ b/src/screens/SeedRecoveryScreen.tsx @@ -454,18 +454,18 @@ export const SeedRecoveryScreen = observer(function SeedRecoveryScreen({ route } mnemonic } - // update seed to the provided one - keys.SEED = seed - // In case there is a profile linked to provided seedHash, - // it's address is recovered to the current profile. - // As we regenerate ecash from provided seed, it is linked to current profile as well. + // it's address, avatar and seed is recovered to the current profile. await walletProfileStore.recover( keys.walletId, seedHashRef.current, ) - await KeyChain.saveWalletKeys(keys) + // update seed to the provided one + const keysCopy = { ...keys } + keysCopy.SEED = seed + + await KeyChain.saveWalletKeys(keysCopy) walletStore.cleanCachedWalletKeys() if(!mintsStore.mintExists(MINIBITS_MINT_URL)) { @@ -578,7 +578,7 @@ return (