mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
clear qr code data before scanning
This commit is contained in:
parent
71ef4d85da
commit
af97ba103c
@ -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 () {
|
||||
|
@ -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'})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user