diff options
author | brunobar79 <brunobar79@gmail.com> | 2018-08-04 07:36:01 +0800 |
---|---|---|
committer | brunobar79 <brunobar79@gmail.com> | 2018-08-04 07:36:01 +0800 |
commit | af97ba103cea6e9f5e114d916f920b28d96d4e8a (patch) | |
tree | 4bf08b7cdf21a8641cc445ae27268b3f8f784744 /ui | |
parent | 71ef4d85da50c50f767e20623fd30c014ba16ecf (diff) | |
download | tangerine-wallet-browser-af97ba103cea6e9f5e114d916f920b28d96d4e8a.tar tangerine-wallet-browser-af97ba103cea6e9f5e114d916f920b28d96d4e8a.tar.gz tangerine-wallet-browser-af97ba103cea6e9f5e114d916f920b28d96d4e8a.tar.bz2 tangerine-wallet-browser-af97ba103cea6e9f5e114d916f920b28d96d4e8a.tar.lz tangerine-wallet-browser-af97ba103cea6e9f5e114d916f920b28d96d4e8a.tar.xz tangerine-wallet-browser-af97ba103cea6e9f5e114d916f920b28d96d4e8a.tar.zst tangerine-wallet-browser-af97ba103cea6e9f5e114d916f920b28d96d4e8a.zip |
clear qr code data before scanning
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/components/modals/qr-scanner/qr-scanner.component.js | 3 | ||||
-rw-r--r-- | ui/lib/webcam-utils.js | 45 |
2 files changed, 25 insertions, 23 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 5ca19ccd8..b18d51351 100644 --- a/ui/app/components/modals/qr-scanner/qr-scanner.component.js +++ b/ui/app/components/modals/qr-scanner/qr-scanner.component.js @@ -28,6 +28,9 @@ export default class QrScanner extends Component { this.codeReader = null this.permissionChecker = null this.needsToReinit = false + + // Clear pre-existing qr code data before scanning + this.props.qrCodeDetected(null) } componentDidMount () { diff --git a/ui/lib/webcam-utils.js b/ui/lib/webcam-utils.js index b1609ff4a..9b507cd99 100644 --- a/ui/lib/webcam-utils.js +++ b/ui/lib/webcam-utils.js @@ -8,29 +8,28 @@ class WebcamUtils { static checkStatus () { return new Promise((resolve, reject) => { - reject({type: 'UNKNOWN_ERROR'}) - // 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 - // try { - // DetectRTC.load(_ => { - // if (DetectRTC.hasWebcam) { - // let environmentReady = true - // if ((isFirefoxOrBrave && isPopup) || (isPopup && !DetectRTC.isWebsiteHasWebcamPermissions)) { - // environmentReady = false - // } - // resolve({ - // permissions: DetectRTC.isWebsiteHasWebcamPermissions, - // environmentReady, - // }) - // } else { - // reject({type: 'NO_WEBCAM_FOUND'}) - // } - // }) - // } catch (e) { - // reject({type: 'UNKNOWN_ERROR'}) - // } + 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 + try { + DetectRTC.load(_ => { + if (DetectRTC.hasWebcam) { + let environmentReady = true + if ((isFirefoxOrBrave && isPopup) || (isPopup && !DetectRTC.isWebsiteHasWebcamPermissions)) { + environmentReady = false + } + resolve({ + permissions: DetectRTC.isWebsiteHasWebcamPermissions, + environmentReady, + }) + } else { + reject({type: 'NO_WEBCAM_FOUND'}) + } + }) + } catch (e) { + reject({type: 'UNKNOWN_ERROR'}) + } }) } } |