From f7ad978474f42eb96f4f6c79376391504cf228c1 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Mon, 23 Jul 2018 21:27:51 -0400 Subject: camera working back and forth --- ui/app/components/send/send.component.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ui/app/components/send/send.component.js') diff --git a/ui/app/components/send/send.component.js b/ui/app/components/send/send.component.js index 6f1b20c55..5e967251d 100644 --- a/ui/app/components/send/send.component.js +++ b/ui/app/components/send/send.component.js @@ -38,12 +38,19 @@ export default class SendTransactionScreen extends PersistentForm { updateAndSetGasTotal: PropTypes.func, updateSendErrors: PropTypes.func, updateSendTokenBalance: PropTypes.func, + scanQrCode: PropTypes.func, }; static contextTypes = { t: PropTypes.func, }; + scanQrCode = async () => { + const scannedAddress = await this.props.scanQrCode() + console.log('QR-SCANNER: Got address (UI)', scannedAddress) + this.updateGas({ to: scannedAddress }) + } + updateGas ({ to: updatedToAddress, amount: value } = {}) { const { amount, @@ -170,7 +177,10 @@ export default class SendTransactionScreen extends PersistentForm { return (
- this.updateGas(updateData)}/> + this.updateGas(updateData)} + scanQrCode={_ => this.scanQrCode()} + />
) -- cgit From d5929e5c42e230fc0a52337f86b5850e68516563 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Mon, 23 Jul 2018 22:10:57 -0400 Subject: added qr code scanner icon in send transaction --- ui/app/components/send/send.component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app/components/send/send.component.js') diff --git a/ui/app/components/send/send.component.js b/ui/app/components/send/send.component.js index 5e967251d..6c439cd21 100644 --- a/ui/app/components/send/send.component.js +++ b/ui/app/components/send/send.component.js @@ -47,7 +47,7 @@ export default class SendTransactionScreen extends PersistentForm { scanQrCode = async () => { const scannedAddress = await this.props.scanQrCode() - console.log('QR-SCANNER: Got address (UI)', scannedAddress) + this.props.updateSendTo(scannedAddress) this.updateGas({ to: scannedAddress }) } -- cgit From 74fd6d1d1227d7a9e49623b73ee85985d79a1e46 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Tue, 24 Jul 2018 20:32:20 -0400 Subject: working without injection --- ui/app/components/send/send.component.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'ui/app/components/send/send.component.js') diff --git a/ui/app/components/send/send.component.js b/ui/app/components/send/send.component.js index 6c439cd21..fb7eef329 100644 --- a/ui/app/components/send/send.component.js +++ b/ui/app/components/send/send.component.js @@ -39,16 +39,26 @@ export default class SendTransactionScreen extends PersistentForm { updateSendErrors: PropTypes.func, updateSendTokenBalance: PropTypes.func, scanQrCode: PropTypes.func, + qrCodeData: PropTypes.object, }; static contextTypes = { t: PropTypes.func, }; - scanQrCode = async () => { - const scannedAddress = await this.props.scanQrCode() - this.props.updateSendTo(scannedAddress) - this.updateGas({ to: scannedAddress }) + componentWillReceiveProps (nextProps) { + if (nextProps.qrCodeData) { + if (nextProps.qrCodeData.type === 'address') { + const scannedAddress = nextProps.qrCodeData.values.address.toLowerCase() + const currentAddress = this.props.to && this.props.to.toLowerCase() + if (currentAddress !== scannedAddress) { + this.props.updateSendTo(scannedAddress) + this.updateGas({ to: scannedAddress }) + + // Here we should clear props.qrCodeData + } + } + } } updateGas ({ to: updatedToAddress, amount: value } = {}) { @@ -179,7 +189,7 @@ export default class SendTransactionScreen extends PersistentForm { this.updateGas(updateData)} - scanQrCode={_ => this.scanQrCode()} + scanQrCode={_ => this.props.scanQrCode()} /> -- cgit From edb154749d468299166e41e56d23beb781817cbc Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Mon, 30 Jul 2018 22:57:05 -0400 Subject: send to fullscreen if no permission from popup --- ui/app/components/send/send.component.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ui/app/components/send/send.component.js') diff --git a/ui/app/components/send/send.component.js b/ui/app/components/send/send.component.js index fb7eef329..8305a288e 100644 --- a/ui/app/components/send/send.component.js +++ b/ui/app/components/send/send.component.js @@ -175,6 +175,11 @@ export default class SendTransactionScreen extends PersistentForm { address, }) this.updateGas() + + // Show QR Scanner modal if ?scan=true + if (window.location.search === '?scan=true') { + this.props.scanQrCode() + } } componentWillUnmount () { -- cgit From 710b4e294f66fe6e623fa145cc99be5b79c8210e Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Tue, 31 Jul 2018 18:30:40 -0400 Subject: added crossbrowser support and error handling --- ui/app/components/send/send.component.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ui/app/components/send/send.component.js') diff --git a/ui/app/components/send/send.component.js b/ui/app/components/send/send.component.js index 8305a288e..80b50fad4 100644 --- a/ui/app/components/send/send.component.js +++ b/ui/app/components/send/send.component.js @@ -179,6 +179,11 @@ export default class SendTransactionScreen extends PersistentForm { // Show QR Scanner modal if ?scan=true if (window.location.search === '?scan=true') { this.props.scanQrCode() + + // Clear the queryString param after showing the modal + const cleanUrl = location.href.split('?')[0] + history.pushState({}, null, `${cleanUrl}`) + window.location.hash = '#send' } } -- cgit From e9a0feb9e909d59b9945fd367231cc4e47327873 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Fri, 3 Aug 2018 20:11:46 -0400 Subject: fixed issue with input --- ui/app/components/send/send.component.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ui/app/components/send/send.component.js') diff --git a/ui/app/components/send/send.component.js b/ui/app/components/send/send.component.js index 80b50fad4..0d8ffd179 100644 --- a/ui/app/components/send/send.component.js +++ b/ui/app/components/send/send.component.js @@ -39,6 +39,7 @@ export default class SendTransactionScreen extends PersistentForm { updateSendErrors: PropTypes.func, updateSendTokenBalance: PropTypes.func, scanQrCode: PropTypes.func, + qrCodeDetected: PropTypes.func, qrCodeData: PropTypes.object, }; @@ -54,8 +55,8 @@ export default class SendTransactionScreen extends PersistentForm { if (currentAddress !== scannedAddress) { this.props.updateSendTo(scannedAddress) this.updateGas({ to: scannedAddress }) - - // Here we should clear props.qrCodeData + // Clean up QR code data after handling + this.props.qrCodeDetected(null) } } } -- cgit