diff options
author | brunobar79 <brunobar79@gmail.com> | 2018-08-08 15:00:39 +0800 |
---|---|---|
committer | brunobar79 <brunobar79@gmail.com> | 2018-08-08 15:00:39 +0800 |
commit | c6b7e460b536a6fcff4e4328b1007f677720b585 (patch) | |
tree | 7107eeb7fc05507906e1096811d7920fae5ef0f4 /ui | |
parent | 2e0916d8ff17c89147005d22e8c100113aaf3360 (diff) | |
download | tangerine-wallet-browser-c6b7e460b536a6fcff4e4328b1007f677720b585.tar tangerine-wallet-browser-c6b7e460b536a6fcff4e4328b1007f677720b585.tar.gz tangerine-wallet-browser-c6b7e460b536a6fcff4e4328b1007f677720b585.tar.bz2 tangerine-wallet-browser-c6b7e460b536a6fcff4e4328b1007f677720b585.tar.lz tangerine-wallet-browser-c6b7e460b536a6fcff4e4328b1007f677720b585.tar.xz tangerine-wallet-browser-c6b7e460b536a6fcff4e4328b1007f677720b585.tar.zst tangerine-wallet-browser-c6b7e460b536a6fcff4e4328b1007f677720b585.zip |
code review changes
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/components/modals/qr-scanner/qr-scanner.component.js | 25 | ||||
-rw-r--r-- | ui/lib/webcam-utils.js | 7 |
2 files changed, 20 insertions, 12 deletions
diff --git a/ui/app/components/modals/qr-scanner/qr-scanner.component.js b/ui/app/components/modals/qr-scanner/qr-scanner.component.js index b18d51351..cf03c9097 100644 --- a/ui/app/components/modals/qr-scanner/qr-scanner.component.js +++ b/ui/app/components/modals/qr-scanner/qr-scanner.component.js @@ -4,6 +4,7 @@ import { BrowserQRCodeReader } from '@zxing/library' import adapter from 'webrtc-adapter' // eslint-disable-line import/no-nodejs-modules, no-unused-vars import Spinner from '../../spinner' import WebcamUtils from '../../../../lib/webcam-utils' +import PageContainerFooter from '../../page-container/page-container-footer/page-container-footer.component'; export default class QrScanner extends Component { static propTypes = { @@ -104,9 +105,19 @@ export default class QrScanner extends Component { // To parse other type of links // For ex. EIP-681 (https://eips.ethereum.org/EIPS/eip-681) + + // Ethereum address links - fox ex. ethereum:0x.....1111 if (content.split('ethereum:').length > 1) { + type = 'address' values = {'address': content.split('ethereum:')[1] } + + // Regular ethereum addresses - fox ex. 0x.....1111 + } else if (content.substring(0, 2).toLowerCase() === '0x') { + + type = 'address' + values = {'address': content } + } return {type, values} } @@ -169,14 +180,12 @@ export default class QrScanner extends Component { <div className={'qr-scanner__error'}> {msg} </div> - <div className={'qr-scanner__footer'}> - <button className="btn-default btn--large" onClick={this.stopAndClose}> - CANCEL - </button> - <button className="btn-primary btn--large" onClick={this.tryAgain}> - TRY AGAIN - </button> - </div> + <PageContainerFooter + onCancel={this.stopAndClose} + onSubmit={this.tryAgain} + cancelText={this.context.t('cancel')} + submitText={this.context.t('tryAgain')} + /> </div> ) } diff --git a/ui/lib/webcam-utils.js b/ui/lib/webcam-utils.js index 9b507cd99..eb717b23a 100644 --- a/ui/lib/webcam-utils.js +++ b/ui/lib/webcam-utils.js @@ -2,16 +2,15 @@ import DetectRTC from 'detectrtc' const { ENVIRONMENT_TYPE_POPUP } = require('../../app/scripts/lib/enums') -const { getEnvironmentType } = require('../../app/scripts/lib/util') +const { getEnvironmentType, getPlatform } = require('../../app/scripts/lib/util') +const { PLATFORM_BRAVE, PLATFORM_FIREFOX } = require('../../app/scripts/lib/enums') class WebcamUtils { static checkStatus () { return new Promise((resolve, reject) => { const isPopup = getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP - const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1 - const isBrave = !!window.chrome.ipcRenderer - const isFirefoxOrBrave = isFirefox || isBrave + const isFirefoxOrBrave = getPlatform() === (PLATFORM_FIREFOX || PLATFORM_BRAVE) try { DetectRTC.load(_ => { if (DetectRTC.hasWebcam) { |