|
|
@ -3,15 +3,19 @@ |
|
|
|
import React, { Component } from 'react' |
|
|
|
import invariant from 'invariant' |
|
|
|
import { connect } from 'react-redux' |
|
|
|
import { Trans } from 'react-i18next' |
|
|
|
import type { Account, CryptoCurrency } from '@ledgerhq/live-common/lib/types' |
|
|
|
import { getCryptoCurrencyIcon } from '@ledgerhq/live-common/lib/react' |
|
|
|
|
|
|
|
import logger from 'logger' |
|
|
|
import getAddress from 'commands/getAddress' |
|
|
|
import { createCancelablePolling } from 'helpers/promise' |
|
|
|
import { standardDerivation } from 'helpers/derivations' |
|
|
|
import { isSegwitAccount } from 'helpers/bip32' |
|
|
|
|
|
|
|
import DeviceInteraction from 'components/DeviceInteraction' |
|
|
|
import getAddress from 'commands/getAddress' |
|
|
|
import Text from 'components/base/Text' |
|
|
|
|
|
|
|
import IconUsb from 'icons/Usb' |
|
|
|
|
|
|
|
import type { Device } from 'types/common' |
|
|
@ -23,6 +27,7 @@ export const WrongAppOpened = createCustomErrorClass('WrongAppOpened') |
|
|
|
export const WrongDeviceForAccount = createCustomErrorClass('WrongDeviceForAccount') |
|
|
|
|
|
|
|
const usbIcon = <IconUsb size={36} /> |
|
|
|
const Bold = props => <Text ff="Open Sans|Bold" {...props} /> |
|
|
|
|
|
|
|
const mapStateToProps = state => ({ |
|
|
|
device: getCurrentDevice(state), |
|
|
@ -79,11 +84,17 @@ class EnsureDeviceAppInteraction extends Component<{ |
|
|
|
return address |
|
|
|
}) |
|
|
|
|
|
|
|
renderOpenAppTitle = ({ device }) => { |
|
|
|
renderOpenAppTitle = () => { |
|
|
|
const { account, currency } = this.props |
|
|
|
const cur = account ? account.currency : currency |
|
|
|
invariant(cur, 'No currency given') |
|
|
|
return `Open the ${cur.name} app on your ${device ? `${device.product} ` : 'device'}` |
|
|
|
return ( |
|
|
|
<Trans i18nKey="deviceConnect:step2.open" parent="div"> |
|
|
|
{'Open the '} |
|
|
|
<strong>{cur.name}</strong> |
|
|
|
{' app on your device'} |
|
|
|
</Trans> |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
render() { |
|
|
@ -95,16 +106,18 @@ class EnsureDeviceAppInteraction extends Component<{ |
|
|
|
steps={[ |
|
|
|
{ |
|
|
|
id: 'device', |
|
|
|
title: 'Connect your device', |
|
|
|
title: ( |
|
|
|
<Trans i18nKey="app:deviceConnect.step1.connect" parent="div"> |
|
|
|
{'Connect and unlock your '} |
|
|
|
<Bold>{'Ledger device'}</Bold> |
|
|
|
</Trans> |
|
|
|
), |
|
|
|
icon: usbIcon, |
|
|
|
desc: 'Because it is required', |
|
|
|
minMs: 300, |
|
|
|
run: this.connectInteractionHandler, |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 'address', |
|
|
|
title: this.renderOpenAppTitle, |
|
|
|
desc: 'To be able to retriev your Bitcoins', |
|
|
|
icon: Icon ? <Icon size={24} /> : null, |
|
|
|
run: this.openAppInteractionHandler, |
|
|
|
}, |
|
|
|