Browse Source

Merge branch 'develop' into checkbox

master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
43d77e8c4b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/components/AccountPage/AccountBalanceSummaryHeader.js
  2. 3
      src/components/AccountPage/index.js
  3. 11
      src/components/Onboarding/OnboardingBreadcrumb.js
  4. 96
      src/components/Onboarding/steps/GenuineCheck/GenuineCheckErrorPage.js
  5. 25
      src/components/Onboarding/steps/GenuineCheck/index.js
  6. 20
      src/helpers/devices/getDeviceInfo.js
  7. 4
      static/i18n/en/errors.yml
  8. 20
      static/i18n/en/onboarding.yml

4
src/components/AccountPage/AccountBalanceSummaryHeader.js

@ -28,7 +28,7 @@ type OwnProps = {
totalBalance: number,
sinceBalance: number,
refBalance: number,
accountId: string, // eslint-disable-line
accountId: string,
}
type Props = OwnProps & {
@ -57,6 +57,7 @@ class AccountBalanceSummaryHeader extends PureComponent<Props> {
render() {
const {
account,
accountId,
t,
counterValue,
selectedTimeRange,
@ -76,6 +77,7 @@ class AccountBalanceSummaryHeader extends PureComponent<Props> {
unit={account.unit}
>
<FormattedVal
key={accountId}
animateTicker
disableRounding
alwaysShowSign={false}

3
src/components/AccountPage/index.js

@ -68,8 +68,7 @@ class AccountPage extends PureComponent<Props> {
}
return (
// `key` forces re-render account page when going an another account (skip animations)
<Box key={account.id}>
<Box>
<TrackPage
category="Account"
currency={account.currency.id}

11
src/components/Onboarding/OnboardingBreadcrumb.js

@ -21,10 +21,17 @@ type Props = {
function OnboardingBreadcrumb(props: Props) {
const { onboarding, t } = props
const { stepName, genuine } = onboarding
const isInitializedFlow = onboarding.flowType === 'initializedDevice'
const filteredSteps = onboarding.steps
const regularFilteredSteps = onboarding.steps
.filter(step => !step.external)
.map(step => ({ ...step, label: t(step.label) })) // TODO: translate
.map(step => ({ ...step, label: t(step.label) }))
const alreadyInitializedSteps = onboarding.steps
.filter(step => !step.external && step.name !== 'writeSeed' && step.name !== 'selectPIN')
.map(step => ({ ...step, label: t(step.label) }))
const filteredSteps = isInitializedFlow ? alreadyInitializedSteps : regularFilteredSteps
const stepIndex = findIndex(filteredSteps, s => s.name === stepName)
const genuineStepIndex = findIndex(filteredSteps, s => s.name === 'genuineCheck')

96
src/components/Onboarding/steps/GenuineCheck/GenuineCheckErrorPage.js

@ -1,6 +1,6 @@
// @flow
import React, { Fragment } from 'react'
import React, { PureComponent, Fragment } from 'react'
import { i } from 'helpers/staticPath'
import type { T } from 'types/common'
@ -12,54 +12,80 @@ import TrackPage from 'analytics/TrackPage'
import { Title, Description, OnboardingFooterWrapper } from '../../helperComponents'
export function GenuineCheckErrorPage({
redoGenuineCheck,
contactSupport,
onboarding,
t,
}: {
type Props = {
t: T,
redoGenuineCheck: () => void,
contactSupport: () => void,
onboarding: OnboardingState,
t: T,
}) {
return (
<Box sticky pt={50}>
}
class GenuineCheckErrorPage extends PureComponent<Props, *> {
trackErrorPage = (page: string) => {
const { onboarding } = this.props
return (
<TrackPage
category="Onboarding"
name="Genuine Check Error Page"
name={`Genuine Check Error Page - ${page}`}
flowType={onboarding.flowType}
deviceType={onboarding.isLedgerNano ? 'Nano S' : 'Blue'}
/>
<Box grow alignItems="center" justifyContent="center">
{onboarding.isLedgerNano ? (
)
}
renderErrorPage = () => {
const { onboarding, t } = this.props
return (
<Fragment>
{onboarding.genuine.isGenuineFail ? (
<Fragment>
<Title>{t('onboarding:genuineCheck.errorPage.ledgerNano.title')}</Title>
<Description>{t('onboarding:genuineCheck.errorPage.ledgerNano.desc')}</Description>
<Box mt={5} mr={7}>
<img alt="" src={i('nano-error-onb.svg')} />
</Box>
{this.trackErrorPage('Not Genuine')}
<Title>{t('onboarding:genuineCheck.errorPage.title.isGenuineFail')}</Title>
<Description>{t('onboarding:genuineCheck.errorPage.desc.isGenuineFail')}</Description>
</Fragment>
) : !onboarding.genuine.pinStepPass ? (
<Fragment>
{this.trackErrorPage('PIN Step')}
<Title>{t('onboarding:genuineCheck.errorPage.title.pinFailed')}</Title>
<Description>{t('onboarding:genuineCheck.errorPage.desc.pinFailed')}</Description>
</Fragment>
) : (
<Fragment>
<Title>{t('onboarding:genuineCheck.errorPage.ledgerBlue.title')}</Title>
<Description pb={5}>
{t('onboarding:genuineCheck.errorPage.ledgerBlue.desc')}
{this.trackErrorPage('Recovery Phase Step')}
<Title>{t('onboarding:genuineCheck.errorPage.title.recoveryPhraseFailed')}</Title>
<Description>
{t('onboarding:genuineCheck.errorPage.desc.recoveryPhraseFailed')}
</Description>
<Box alignItems="center">
<img alt="" src={i('blue-error-onb.svg')} />
</Box>
</Fragment>
)}
<Box mt={5} mr={7}>
{onboarding.isLedgerNano ? (
<img alt="" src={i('nano-error-onb.svg')} />
) : (
<img alt="" src={i('blue-error-onb.svg')} />
)}
</Box>
</Fragment>
)
}
render() {
const { redoGenuineCheck, contactSupport, t } = this.props
return (
<Box sticky pt={50}>
<Box grow alignItems="center" justifyContent="center">
{this.renderErrorPage()}
</Box>
<OnboardingFooterWrapper>
<Button outlineGrey onClick={() => redoGenuineCheck()}>
{t('app:common.back')}
</Button>
<Button danger onClick={() => contactSupport()} ml="auto">
{t('onboarding:genuineCheck.buttons.contactSupport')}
</Button>
</OnboardingFooterWrapper>
</Box>
<OnboardingFooterWrapper>
<Button outlineGrey onClick={() => redoGenuineCheck()}>
{t('app:common.back')}
</Button>
<Button danger onClick={() => contactSupport()} ml="auto">
{t('onboarding:genuineCheck.buttons.contactSupport')}
</Button>
</OnboardingFooterWrapper>
</Box>
)
)
}
}
export default GenuineCheckErrorPage

25
src/components/Onboarding/steps/GenuineCheck/index.js

@ -26,7 +26,7 @@ import {
GenuineCheckCardWrapper,
} from '../../helperComponents'
import { GenuineCheckErrorPage } from './GenuineCheckErrorPage'
import GenuineCheckErrorPage from './GenuineCheckErrorPage'
import {
GenuineCheckUnavailableFooter,
GenuineCheckUnavailableMessage,
@ -81,14 +81,8 @@ class GenuineCheck extends PureComponent<StepProps, State> {
}
if (!item.pass) {
this.setState(INITIAL_STATE)
this.props.updateGenuineCheck({
displayErrorScreen: true,
pinStepPass: false,
recoveryStepPass: false,
isGenuineFail: false,
isDeviceGenuine: false,
genuineCheckUnavailable: null,
})
}
}
@ -137,7 +131,15 @@ class GenuineCheck extends PureComponent<StepProps, State> {
}
redoGenuineCheck = () => {
this.props.updateGenuineCheck({ displayErrorScreen: false })
this.setState(INITIAL_STATE)
this.props.updateGenuineCheck({
displayErrorScreen: false,
pinStepPass: false,
recoveryStepPass: false,
isGenuineFail: false,
isDeviceGenuine: false,
genuineCheckUnavailable: null,
})
}
contactSupport = () => {
@ -146,6 +148,11 @@ class GenuineCheck extends PureComponent<StepProps, State> {
shell.openExternal(contactSupportUrl)
}
handlePrevStep = () => {
const { prevStep, onboarding, jumpStep } = this.props
onboarding.flowType === 'initializedDevice' ? jumpStep('selectDevice') : prevStep()
}
renderGenuineFail = () => (
<GenuineCheckErrorPage
redoGenuineCheck={this.redoGenuineCheck}
@ -275,7 +282,7 @@ class GenuineCheck extends PureComponent<StepProps, State> {
<OnboardingFooter
t={t}
nextStep={nextStep}
prevStep={prevStep}
prevStep={this.handlePrevStep}
isContinueDisabled={!genuine.isDeviceGenuine}
/>
)}

20
src/helpers/devices/getDeviceInfo.js

@ -16,13 +16,6 @@ export type DeviceInfo = {
fullVersion: string,
}
// prettier-ignore
const DETECT_CLUBCOIN = [
[0xe0, 0x04, 0x00, 0x00, Buffer.from([0x31, 0x10, 0x00, 0x02])],
[0xe0, 0x50, 0x00, 0x00, Buffer.from([0xe4, 0x6c, 0x4c, 0x71, 0x8b, 0xc8, 0x7f, 0xb7])],
[0xe0, 0x51, 0x80, 0x00, Buffer.from([0x41, 0x04, 0xc9, 0x8c, 0xa0, 0x99, 0x53, 0x47, 0x2b, 0x36, 0x06, 0x1e, 0x0e, 0x40, 0xc9, 0x3d, 0x50, 0x52, 0x34, 0x09, 0x0e, 0xfd, 0x74, 0xf1, 0xd7, 0xa2, 0x93, 0xe8, 0x28, 0x15, 0x9a, 0x97, 0x71, 0x1b, 0x33, 0xd1, 0x8a, 0xfc, 0x17, 0xad, 0x15, 0x6e, 0xae, 0xd9, 0x9c, 0xf4, 0x3b, 0x20, 0xe1, 0x5d, 0x64, 0xaf, 0x39, 0xa5, 0x51, 0x3b, 0x4e, 0x3c, 0x5f, 0x43, 0x17, 0xe6, 0x42, 0x70, 0x2f, 0x05, 0x47, 0x30, 0x45, 0x02, 0x21, 0x00, 0xf1, 0xd2, 0xb8, 0x34, 0x99, 0x4a, 0x0c, 0x1f, 0x25, 0xea, 0x20, 0xcf, 0x33, 0xe3, 0x2b, 0xd0, 0x6b, 0xcf, 0x7c, 0x42, 0x4a, 0x02, 0xee, 0xe8, 0xf6, 0x96, 0x99, 0x20, 0xe1, 0xe8, 0xc2, 0xb3, 0x02, 0x20, 0x63, 0x2d, 0x19, 0xbd, 0x30, 0xab, 0x20, 0x76, 0x18, 0x78, 0x78, 0xae, 0xaa, 0x0f, 0x4d, 0x48, 0x04, 0x01, 0x32, 0x79, 0xd0, 0x16, 0xde, 0xca, 0x66, 0x93, 0xf3, 0x7b, 0x4e, 0x50, 0x7f, 0x43])],
]
const PROVIDERS = {
'': 1,
das: 2,
@ -32,19 +25,8 @@ const PROVIDERS = {
export default async (transport: Transport<*>): Promise<DeviceInfo> => {
const res = await getFirmwareInfo(transport)
let { seVersion } = res
const { seVersion } = res
const { targetId, mcuVersion, flags } = res
if (seVersion === '1.2') {
try {
for (let i = 0; i < DETECT_CLUBCOIN.length; i++) {
const instructions = DETECT_CLUBCOIN[i]
await transport.send(...instructions)
}
seVersion = '1.2.0-club'
} catch (e) {
seVersion = '1.2.0'
}
}
const parsedVersion =
seVersion.match(/([0-9]+.[0-9])+(.[0-9]+)?((?!-osu)-([a-z]+))?(-osu)?/) || []
const isOSU = typeof parsedVersion[5] !== 'undefined'

4
static/i18n/en/errors.yml

@ -78,8 +78,8 @@ TimeoutError:
title: Oops, a time out occurred
description: It took too long for the server to respond.
TransportStatusError:
title: '{{message}}'
description:
title: 'Something went wrong. Please replug your device.'
description: '{{message}}'
UserRefusedOnDevice:
title: Transaction refused on device
description: Please retry or contact Ledger Support in case of doubt.

20
static/i18n/en/onboarding.yml

@ -107,18 +107,14 @@ genuineCheck:
genuineCheck: Check now
contactSupport: Contact us
errorPage:
ledgerNano:
title: Oops, something went wrong...
#PIN: Didn't choose your own PIN code?
#recoveryPhrase: Didn't save your own recovery phrase?
#Genuine: Oops, your device does not seem genuine...
desc: Go back to the security checklist or request Ledger Support assistance
#PIN: Never use a device supplied with a PIN code. If your device was provided with a PIN code, please contact us.
#recoveryPhrase: Only save a recovery phrase that is displayed on your device. Please contact us in case of doubt. Otherwise, go back to the security checklist.
#Genuine: Your device did not pass the authenticity test required to connect to Ledger’s secure server. Please contact Ledger Support to get assistance.
ledgerBlue:
title: Oops, something went wrong...
desc: Go back to the security checklist or request Ledger Support assistance
title:
pinFailed: "Didn't choose your own PIN code?"
recoveryPhraseFailed: "Didn't save your own recovery phrase?"
isGenuineFail: Oops, your device does not seem genuine...
desc:
pinFailed: Never use a device supplied with a PIN code. If your device was provided with a PIN code, please contact us.
recoveryPhraseFailed: Only save a recovery phrase that is displayed on your device. Please contact us in case of doubt. Otherwise, go back to the security checklist.
isGenuineFail: Your device did not pass the authenticity test required to connect to Ledger’s secure server. Please contact Ledger Support to get assistance.
setPassword:
title: Password lock (optional)
desc: Set a password to prevent unauthorized access to Ledger Live data stored on your computer, including account names, balances, transactions and public addresses.

Loading…
Cancel
Save