change factory reset flow

This commit is contained in:
Michele Balistreri 2024-10-10 10:28:30 +02:00
parent 0f6f0da6d5
commit d2a23a2c45
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
1 changed files with 9 additions and 1 deletions

View File

@ -273,6 +273,14 @@ const Main = () => {
setStep(Step.Discovery); setStep(Step.Discovery);
} }
const cancelFactoryReset = () => {
if (walletKey.current) {
setStep(Step.Home);
} else {
setStep(Step.Discovery);
}
}
const pinDisplayCounter = () => { const pinDisplayCounter = () => {
return pinCounter == PIN_MAX_RETRY ? -1 : pinCounter; return pinCounter == PIN_MAX_RETRY ? -1 : pinCounter;
} }
@ -294,7 +302,7 @@ const Main = () => {
{step == Step.LoadSuccess && <InfoScreen icon="check-circle" title="Congratulations!" message="You've successfully protected your wallet. Remember to keep your seed phrase safe, it's your responsibility!" onPressFunc={toHome}></InfoScreen>} {step == Step.LoadSuccess && <InfoScreen icon="check-circle" title="Congratulations!" message="You've successfully protected your wallet. Remember to keep your seed phrase safe, it's your responsibility!" onPressFunc={toHome}></InfoScreen>}
{step == Step.Authentication && <Dialpad pinRetryCounter={pinDisplayCounter()} prompt={"Enter PIN"} onCancelFunc={cancel} onNextFunc={authenticate}></Dialpad>} {step == Step.Authentication && <Dialpad pinRetryCounter={pinDisplayCounter()} prompt={"Enter PIN"} onCancelFunc={cancel} onNextFunc={authenticate}></Dialpad>}
{step == Step.Home && <HomeScreen pinRequired={pinRef.current ? false : true} pinRetryCounter={pinDisplayCounter()} walletKey={walletKey.current} onPressFunc={login} onCancelFunc={cancel} onFactoryResetFunc={startFactoryReset}></HomeScreen>} {step == Step.Home && <HomeScreen pinRequired={pinRef.current ? false : true} pinRetryCounter={pinDisplayCounter()} walletKey={walletKey.current} onPressFunc={login} onCancelFunc={cancel} onFactoryResetFunc={startFactoryReset}></HomeScreen>}
{step == Step.FactoryReset && <FactoryResetScreen pinRetryCounter={pinDisplayCounter()} onPressFunc={connectCard} onCancelFunc={cancel}></FactoryResetScreen>} {step == Step.FactoryReset && <FactoryResetScreen pinRetryCounter={pinDisplayCounter()} onPressFunc={connectCard} onCancelFunc={cancelFactoryReset}></FactoryResetScreen>}
<NFCModal isVisible={isModalVisible} onChangeFunc={stopNFC}></NFCModal> <NFCModal isVisible={isModalVisible} onChangeFunc={stopNFC}></NFCModal>
</ImageBackground> </ImageBackground>
); );