aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/app/components/modals/qr-scanner/qr-scanner.component.js3
-rw-r--r--ui/lib/webcam-utils.js45
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'})
+ }
})
}
}