aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-07-24 09:27:51 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-07-24 09:27:51 +0800
commitf7ad978474f42eb96f4f6c79376391504cf228c1 (patch)
treebe472127595385f8c8558213a58b7d1a470ad760 /app/scripts/metamask-controller.js
parent02091486094dcc818096ce13a22cdc140a2e8347 (diff)
downloadtangerine-wallet-browser-f7ad978474f42eb96f4f6c79376391504cf228c1.tar
tangerine-wallet-browser-f7ad978474f42eb96f4f6c79376391504cf228c1.tar.gz
tangerine-wallet-browser-f7ad978474f42eb96f4f6c79376391504cf228c1.tar.bz2
tangerine-wallet-browser-f7ad978474f42eb96f4f6c79376391504cf228c1.tar.lz
tangerine-wallet-browser-f7ad978474f42eb96f4f6c79376391504cf228c1.tar.xz
tangerine-wallet-browser-f7ad978474f42eb96f4f6c79376391504cf228c1.tar.zst
tangerine-wallet-browser-f7ad978474f42eb96f4f6c79376391504cf228c1.zip
camera working back and forth
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index bcc7075c2..62d707432 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -380,6 +380,9 @@ module.exports = class MetamaskController extends EventEmitter {
// TREZOR
unlockTrezorAccount: nodeify(this.unlockTrezorAccount, this),
+ // QR code scanner
+ scanQrCode: nodeify(this.scanQrCode, this),
+
// vault management
submitPassword: nodeify(this.submitPassword, this),
@@ -653,7 +656,26 @@ module.exports = class MetamaskController extends EventEmitter {
const { identities } = this.preferencesController.store.getState()
return { ...keyState, identities }
- }
+ }
+
+ scanQrCode () {
+ return new Promise((resolve, reject) => {
+ console.log('QR-SCANNER: intializing QR code scanner feature (MM controller)')
+ // Tell contentscript to inject the QR reader
+ this.platform.sendMessage('qr-code-scanner-init')
+ console.log('QR-SCANNER: message to initialize has been sent (MM controller)')
+ // Wait for the scanner to send something back
+ this.platform.addMessageListener(({ action, data }) => {
+ console.log('QR-SCANNER: message received (MM controller)', action, data)
+ if (action && action === 'qr-code-scanner-data') {
+ const normalizedAddress = data.replace('ethereum:', '')
+ console.log('QR-SCANNER: resolving promise!', normalizedAddress)
+ return Promise.resolve(normalizedAddress)
+ }
+ })
+ console.log('QR-SCANNER: now listening (MM controller)')
+ })
+ }
//