From 22b055ac69fe1ed10aa130541c85928a6d8fbfb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Mon, 28 May 2018 16:04:39 +0200 Subject: [PATCH 1/2] Take QRCode component from vault + use live-common URIScheme --- package.json | 2 +- src/components/CurrentAddress/index.js | 25 +- src/components/CurrentAddressForAccount.js | 2 +- src/components/QRCodeCameraPickerCanvas.js | 239 +++++++++++++++++++ src/components/RecipientAddress/index.js | 42 ++-- src/components/base/Input/index.js | 1 + src/components/modals/Send/01-step-amount.js | 14 +- yarn.lock | 33 +-- 8 files changed, 302 insertions(+), 56 deletions(-) create mode 100644 src/components/QRCodeCameraPickerCanvas.js diff --git a/package.json b/package.json index 52bcc28d..fabbcf28 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "moment": "^2.22.1", "object-path": "^0.11.4", "qrcode": "^1.2.0", + "qrcode-reader": "^1.0.4", "qs": "^6.5.1", "raven": "^2.5.0", "raven-js": "^3.24.2", @@ -74,7 +75,6 @@ "react-i18next": "^7.6.0", "react-mortal": "^3.2.0", "react-motion": "^0.5.2", - "react-qr-reader": "^2.1.0", "react-redux": "^5.0.7", "react-router": "^4.2.0", "react-router-dom": "^4.2.2", diff --git a/src/components/CurrentAddress/index.js b/src/components/CurrentAddress/index.js index 1b95a372..da14bb32 100644 --- a/src/components/CurrentAddress/index.js +++ b/src/components/CurrentAddress/index.js @@ -3,6 +3,8 @@ import React, { PureComponent } from 'react' import { Trans, translate } from 'react-i18next' import styled from 'styled-components' +import { encodeURIScheme } from '@ledgerhq/live-common/lib/helpers/currencies' +import type { Account } from '@ledgerhq/live-common/lib/types' import noop from 'lodash/noop' @@ -111,14 +113,14 @@ const FooterButton = ({ ) type Props = { - accountName?: string, + account: Account, address: string, + amount?: number, addressVerified?: boolean, - amount?: string, - onCopy: Function, - onPrint: Function, - onShare: Function, - onVerify: Function, + onCopy: () => void, + onPrint: () => void, + onShare: () => void, + onVerify: () => void, t: T, withBadge: boolean, withFooter: boolean, @@ -142,7 +144,7 @@ class CurrentAddress extends PureComponent { render() { const { - accountName, + account: { name: accountName, currency }, address, addressVerified, amount, @@ -164,7 +166,14 @@ class CurrentAddress extends PureComponent { {withQRCode && ( - + )}