From d4171ccea51db04aa40320de8770e22203d4d6c2 Mon Sep 17 00:00:00 2001
From: bitpshr <mail@bitpshr.net>
Date: Mon, 29 Oct 2018 23:44:04 +0100
Subject: Disable approval caching

---
 app/scripts/contentscript.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'app/scripts/contentscript.js')

diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js
index 2c2efda1c..fa8b3207f 100644
--- a/app/scripts/contentscript.js
+++ b/app/scripts/contentscript.js
@@ -142,7 +142,7 @@ function listenForProviderRequest () {
     }
   })
 
-  extension.runtime.onMessage.addListener(({ action = '', isApproved, isUnlocked }) => {
+  extension.runtime.onMessage.addListener(({ action = '', isApproved, caching, isUnlocked }) => {
     switch (action) {
       case 'approve-provider-request':
         isEnabled = true
@@ -152,11 +152,15 @@ function listenForProviderRequest () {
         injectScript(`window.dispatchEvent(new CustomEvent('ethereumprovider', { detail: { error: 'User rejected provider access' }}))`)
         break
       case 'answer-is-approved':
-        injectScript(`window.dispatchEvent(new CustomEvent('ethereumisapproved', { detail: { isApproved: ${isApproved}}}))`)
+        injectScript(`window.dispatchEvent(new CustomEvent('ethereumisapproved', { detail: { isApproved: ${isApproved}, caching: ${caching}}}))`)
         break
       case 'answer-is-unlocked':
         injectScript(`window.dispatchEvent(new CustomEvent('metamaskisunlocked', { detail: { isUnlocked: ${isUnlocked}}}))`)
         break
+      case 'metamask-set-locked':
+        isEnabled = false
+        injectScript(`window.dispatchEvent(new CustomEvent('metamasksetlocked', { detail: {}}))`)
+        break
     }
   })
 }
-- 
cgit