diff options
author | bitpshr <mail@bitpshr.net> | 2018-10-30 06:44:04 +0800 |
---|---|---|
committer | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-11-06 07:07:09 +0800 |
commit | d4171ccea51db04aa40320de8770e22203d4d6c2 (patch) | |
tree | ab73afd0a1d33fba8dff335cdbb728d1f1a6d28b /app/scripts/inpage.js | |
parent | cc1bab6ebbef8d8219f83039fdc3baca6de718fd (diff) | |
download | tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.tar tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.tar.gz tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.tar.bz2 tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.tar.lz tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.tar.xz tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.tar.zst tangerine-wallet-browser-d4171ccea51db04aa40320de8770e22203d4d6c2.zip |
Disable approval caching
Diffstat (limited to 'app/scripts/inpage.js')
-rw-r--r-- | app/scripts/inpage.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index a60d19480..29811c216 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -35,6 +35,11 @@ var inpageProvider = new MetamaskInpageProvider(metamaskStream) // set a high max listener count to avoid unnecesary warnings inpageProvider.setMaxListeners(100) +// set up a listener for when MetaMask is locked +window.addEventListener('metamasksetlocked', () => { + isEnabled = false +}) + // augment the provider with its enable method inpageProvider.enable = function () { return new Promise((resolve, reject) => { @@ -101,7 +106,11 @@ inpageProvider._metamask = new Proxy({ if (typeof detail.error !== 'undefined') { reject(detail.error) } else { - resolve(!!detail.isApproved) + if (!detail.caching) { + resolve(!!detail.isApproved) + } else { + resolve(isEnabled) + } } }) window.postMessage({ type: 'ETHEREUM_IS_APPROVED' }, '*') |