diff options
author | kumavis <kumavis@users.noreply.github.com> | 2018-08-17 23:56:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-17 23:56:34 +0800 |
commit | 9268c4ed548be9d44a47757a36a3f210f8de3787 (patch) | |
tree | 63c7260de8abdf4b77d9cc6369b2d3dd4df7bd33 /ui/app/components/send/send.component.js | |
parent | ef7e638dda63a715c796c210dadbe82430537b6a (diff) | |
parent | d636cc35523f52f630162a1b342b5267b6cd246e (diff) | |
download | tangerine-wallet-browser-9268c4ed548be9d44a47757a36a3f210f8de3787.tar tangerine-wallet-browser-9268c4ed548be9d44a47757a36a3f210f8de3787.tar.gz tangerine-wallet-browser-9268c4ed548be9d44a47757a36a3f210f8de3787.tar.bz2 tangerine-wallet-browser-9268c4ed548be9d44a47757a36a3f210f8de3787.tar.lz tangerine-wallet-browser-9268c4ed548be9d44a47757a36a3f210f8de3787.tar.xz tangerine-wallet-browser-9268c4ed548be9d44a47757a36a3f210f8de3787.tar.zst tangerine-wallet-browser-9268c4ed548be9d44a47757a36a3f210f8de3787.zip |
Merge pull request #5079 from MetaMask/v4.9.3
Version 4.9.3
Diffstat (limited to 'ui/app/components/send/send.component.js')
-rw-r--r-- | ui/app/components/send/send.component.js | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/ui/app/components/send/send.component.js b/ui/app/components/send/send.component.js index 6f1b20c55..0d8ffd179 100644 --- a/ui/app/components/send/send.component.js +++ b/ui/app/components/send/send.component.js @@ -38,12 +38,30 @@ export default class SendTransactionScreen extends PersistentForm { updateAndSetGasTotal: PropTypes.func, updateSendErrors: PropTypes.func, updateSendTokenBalance: PropTypes.func, + scanQrCode: PropTypes.func, + qrCodeDetected: PropTypes.func, + qrCodeData: PropTypes.object, }; static contextTypes = { t: PropTypes.func, }; + 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 }) + // Clean up QR code data after handling + this.props.qrCodeDetected(null) + } + } + } + } + updateGas ({ to: updatedToAddress, amount: value } = {}) { const { amount, @@ -158,6 +176,16 @@ 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() + + // Clear the queryString param after showing the modal + const cleanUrl = location.href.split('?')[0] + history.pushState({}, null, `${cleanUrl}`) + window.location.hash = '#send' + } } componentWillUnmount () { @@ -170,7 +198,10 @@ export default class SendTransactionScreen extends PersistentForm { return ( <div className="page-container"> <SendHeader history={history}/> - <SendContent updateGas={(updateData) => this.updateGas(updateData)}/> + <SendContent + updateGas={(updateData) => this.updateGas(updateData)} + scanQrCode={_ => this.props.scanQrCode()} + /> <SendFooter history={history}/> </div> ) |