Browse Source

Merge pull request #631 from NastiaS/minorFixesBranch

adding skip to onboarding if server fails
master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
60e563ecca
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 44
      src/components/Onboarding/steps/GenuineCheck.js
  2. 2
      src/reducers/onboarding.js

44
src/components/Onboarding/steps/GenuineCheck.js

@ -82,10 +82,12 @@ class GenuineCheck extends PureComponent<StepProps, State> {
if (!item.pass) { if (!item.pass) {
this.setState(INITIAL_STATE) this.setState(INITIAL_STATE)
this.props.updateGenuineCheck({ this.props.updateGenuineCheck({
isGenuineFail: true, displayErrorScreen: true,
recoveryStepPass: false,
pinStepPass: false, pinStepPass: false,
recoveryStepPass: false,
isGenuineFail: false,
isDeviceGenuine: false, isDeviceGenuine: false,
genuineCheckUnavailable: null,
}) })
} }
} }
@ -116,6 +118,7 @@ class GenuineCheck extends PureComponent<StepProps, State> {
isGenuineFail: true, isGenuineFail: true,
isDeviceGenuine: false, isDeviceGenuine: false,
genuineCheckUnavailable: null, genuineCheckUnavailable: null,
displayErrorScreen: true,
}) })
}) })
} }
@ -125,12 +128,13 @@ class GenuineCheck extends PureComponent<StepProps, State> {
this.props.updateGenuineCheck({ this.props.updateGenuineCheck({
isDeviceGenuine: false, isDeviceGenuine: false,
genuineCheckUnavailable: error, genuineCheckUnavailable: error,
displayErrorScreen: false,
}) })
}) })
} }
redoGenuineCheck = () => { redoGenuineCheck = () => {
this.props.updateGenuineCheck({ isGenuineFail: false }) this.props.updateGenuineCheck({ displayErrorScreen: false })
} }
contactSupport = () => { contactSupport = () => {
@ -153,7 +157,7 @@ class GenuineCheck extends PureComponent<StepProps, State> {
const { genuine } = onboarding const { genuine } = onboarding
const { cachedPinStepButton, cachedRecoveryStepButton, isGenuineCheckModalOpened } = this.state const { cachedPinStepButton, cachedRecoveryStepButton, isGenuineCheckModalOpened } = this.state
if (genuine.isGenuineFail) { if (genuine.displayErrorScreen) {
return this.renderGenuineFail() return this.renderGenuineFail()
} }
@ -225,17 +229,22 @@ class GenuineCheck extends PureComponent<StepProps, State> {
</GenuineSuccessText> </GenuineSuccessText>
</Box> </Box>
) : genuine.genuineCheckUnavailable ? ( ) : genuine.genuineCheckUnavailable ? (
<Box horizontal align="center" flow={1} color={colors.alertRed}> <Box align="center" flow={1} color={colors.alertRed}>
<IconCross size={16} />
<Box ff="Open Sans|Regular" fontSize={4} style={{ maxWidth: '200px' }}>
<TranslatedError error={genuine.genuineCheckUnavailable} />
<FakeLink <FakeLink
color="alertRed" ff="Open Sans|Regular"
fontSize={4}
underline underline
onClick={this.handleOpenGenuineCheckModal} onClick={this.handleOpenGenuineCheckModal}
> >
{t('app:common.retry')} {t('app:common.retry')}
</FakeLink> </FakeLink>
<Box horizontal justify="center">
<Box justifyContent="center">
<IconCross size={12} />
</Box>
<Box ff="Open Sans|Regular" fontSize={2} ml={1}>
<TranslatedError error={genuine.genuineCheckUnavailable} />
</Box>
</Box> </Box>
</Box> </Box>
) : ( ) : (
@ -252,6 +261,21 @@ class GenuineCheck extends PureComponent<StepProps, State> {
</CardWrapper> </CardWrapper>
</Box> </Box>
</StepContainerInner> </StepContainerInner>
{genuine.genuineCheckUnavailable ? (
<OnboardingFooterWrapper>
<Button padded outlineGrey onClick={() => prevStep()}>
{t('app:common.back')}
</Button>
<Box horizontal ml="auto">
<Button padded disabled={false} onClick={() => nextStep()} mx={2}>
{t('app:common.skipThisStep')}
</Button>
<Button padded onClick={nextStep} disabled primary>
{t('app:common.continue')}
</Button>
</Box>
</OnboardingFooterWrapper>
) : (
<OnboardingFooter <OnboardingFooter
horizontal horizontal
align="center" align="center"
@ -261,6 +285,8 @@ class GenuineCheck extends PureComponent<StepProps, State> {
prevStep={prevStep} prevStep={prevStep}
isContinueDisabled={!genuine.isDeviceGenuine} isContinueDisabled={!genuine.isDeviceGenuine}
/> />
)}
<GenuineCheckModal <GenuineCheckModal
isOpened={isGenuineCheckModalOpened} isOpened={isGenuineCheckModalOpened}
onClose={this.handleCloseGenuineCheckModal} onClose={this.handleCloseGenuineCheckModal}

2
src/reducers/onboarding.js

@ -24,6 +24,7 @@ export type OnboardingState = {
isGenuineFail: boolean, isGenuineFail: boolean,
isDeviceGenuine: boolean, isDeviceGenuine: boolean,
genuineCheckUnavailable: ?Error, genuineCheckUnavailable: ?Error,
displayErrorScreen: boolean,
}, },
isLedgerNano: boolean | null, isLedgerNano: boolean | null,
flowType: string, flowType: string,
@ -38,6 +39,7 @@ const state: OnboardingState = {
isGenuineFail: false, isGenuineFail: false,
isDeviceGenuine: false, isDeviceGenuine: false,
genuineCheckUnavailable: null, genuineCheckUnavailable: null,
displayErrorScreen: false,
}, },
isLedgerNano: null, isLedgerNano: null,
flowType: '', flowType: '',

Loading…
Cancel
Save