diff --git a/src/core/Core.tsx b/src/core/Core.tsx index f6e88834c..12db17aac 100644 --- a/src/core/Core.tsx +++ b/src/core/Core.tsx @@ -114,6 +114,11 @@ export const Core = () => { }, }) + const handleUpdatePin = (newPin: string) => { + editPin(newPin) + setState({ ...state, hasPin: true }) + } + if (state.hasKeys && state.hasPin && !unlocked) { return ( @@ -156,7 +161,7 @@ export const Core = () => { }), }} createPin={createPin} - editPin={editPin} + editPin={handleUpdatePin} setWalletIsDeployed={setWalletIsDeployed} balancesScreenProps={{ fetcher: rifWalletServicesFetcher }} sendScreenProps={{ rnsResolver }} diff --git a/src/navigation/rootNavigator/index.tsx b/src/navigation/rootNavigator/index.tsx index 85b08ddc4..e7365da1c 100644 --- a/src/navigation/rootNavigator/index.tsx +++ b/src/navigation/rootNavigator/index.tsx @@ -59,7 +59,7 @@ interface Props { rifWalletServicesSocket: IRifWalletServicesSocket keyManagementProps: CreateKeysProps createPin: (newPin: string) => Promise - editPin: (newPin: string) => Promise + editPin: (newPin: string) => void setWalletIsDeployed: (address: string, value?: boolean) => void balancesScreenProps: Screens.BalancesScreenProps activityScreenProps: Screens.ActivityScreenProps diff --git a/src/screens/changePin/ChangePinScreen.tsx b/src/screens/changePin/ChangePinScreen.tsx index bfe6ed2de..ee2f22814 100644 --- a/src/screens/changePin/ChangePinScreen.tsx +++ b/src/screens/changePin/ChangePinScreen.tsx @@ -1,6 +1,9 @@ import React, { useState, useRef } from 'react' import { PinManager } from '../../components/PinManager' -import { RootStackScreenProps } from 'navigation/rootNavigator/types' +import { + rootStackRouteNames, + RootStackScreenProps, +} from 'navigation/rootNavigator/types' import { TouchableOpacity, View, StyleSheet } from 'react-native' import { Arrow } from '../../components/icons' import { MediumText } from '../../components' @@ -18,7 +21,6 @@ const ChangePinScreen: React.FC< confirmPin: '', }) const isSubmitting = useRef(false) - const [confirmPinTitle, setConfirmPinTitle] = useState('Confirm new PIN') const [pinError, setPinError] = useState('') const [resetPin, setResetPin] = useState(0) @@ -26,13 +28,8 @@ const ChangePinScreen: React.FC< if (!isSubmitting.current) { isSubmitting.current = true try { - editPin(pinSteps.current.pin).then(() => { - setConfirmPinTitle('PIN confirmed') - - setTimeout(() => { - navigation.goBack() - }, 2500) - }) + editPin(pinSteps.current.pin) + navigation.navigate(rootStackRouteNames.Home) } catch (error) { setPinError( 'An error occurred while saving the new PIN. Please try again.', @@ -80,7 +77,7 @@ const ChangePinScreen: React.FC< diff --git a/src/screens/index.ts b/src/screens/index.ts index d91e69478..957f978eb 100644 --- a/src/screens/index.ts +++ b/src/screens/index.ts @@ -40,5 +40,5 @@ export { } from './accounts/AccountsScreen' export { ProfileCreateScreen } from './profile/ProfileCreateScreen' export { ProfileDetailsScreen } from './profile/ProfileDetailsScreen' -export { default as BitcoinReceiveScreen } from './receive/BitcoinReceiveScreen' +export { BitcoinReceiveScreen } from './receive/BitcoinReceiveScreen' export { FeedbackScreen } from './feedback/FeedbackScreen' diff --git a/src/screens/receive/BitcoinReceiveScreen.tsx b/src/screens/receive/BitcoinReceiveScreen.tsx index d217b6df6..7e9b9a973 100644 --- a/src/screens/receive/BitcoinReceiveScreen.tsx +++ b/src/screens/receive/BitcoinReceiveScreen.tsx @@ -5,7 +5,7 @@ import { getDomains } from '../../storage/DomainsStore' import { ReceiveScreen } from './ReceiveScreen' import { shortAddress } from '../../lib/utils' -const BitcoinReceiveScreen: React.FC = ({ +export const BitcoinReceiveScreen: React.FC = ({ route: { params: { network }, }, @@ -40,5 +40,3 @@ const BitcoinReceiveScreen: React.FC = ({ ) } - -export default BitcoinReceiveScreen diff --git a/src/storage/MainStorage.ts b/src/storage/MainStorage.ts index d0e545f96..bdaccbcac 100644 --- a/src/storage/MainStorage.ts +++ b/src/storage/MainStorage.ts @@ -35,7 +35,7 @@ export const hasKeys = () => MainStorage.has(keyManagement) export const getKeys = () => MainStorage.get(keyManagement) export const saveKeys = (keysValue: string) => MainStorage.set(keyManagement, keysValue) -export const deleteKeys = MainStorage.deleteAll +export const deleteKeys = () => MainStorage.delete(keyManagement) // keyVerificationReminder functions export const hasKeyVerificationReminder = () =>