aboutsummaryrefslogtreecommitdiffstats
path: root/ui/lib
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-08-04 07:36:01 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-08-04 07:36:01 +0800
commitaf97ba103cea6e9f5e114d916f920b28d96d4e8a (patch)
tree4bf08b7cdf21a8641cc445ae27268b3f8f784744 /ui/lib
parent71ef4d85da50c50f767e20623fd30c014ba16ecf (diff)
downloadtangerine-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/lib')
-rw-r--r--ui/lib/webcam-utils.js45
1 files changed, 22 insertions, 23 deletions
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'})
+ }
})
}
}