diff options
author | bitpshr <mail@bitpshr.net> | 2018-10-18 06:38:31 +0800 |
---|---|---|
committer | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-11-06 07:07:09 +0800 |
commit | 84874a639d217da36926869fa3cb235c05725cf5 (patch) | |
tree | 63f44fd5e63bd5e483e18ab46fc312298e431915 /app/scripts/controllers/provider-approval.js | |
parent | 573139b9357ccd97eb6b866721fafc93ceb080b6 (diff) | |
download | tangerine-wallet-browser-84874a639d217da36926869fa3cb235c05725cf5.tar tangerine-wallet-browser-84874a639d217da36926869fa3cb235c05725cf5.tar.gz tangerine-wallet-browser-84874a639d217da36926869fa3cb235c05725cf5.tar.bz2 tangerine-wallet-browser-84874a639d217da36926869fa3cb235c05725cf5.tar.lz tangerine-wallet-browser-84874a639d217da36926869fa3cb235c05725cf5.tar.xz tangerine-wallet-browser-84874a639d217da36926869fa3cb235c05725cf5.tar.zst tangerine-wallet-browser-84874a639d217da36926869fa3cb235c05725cf5.zip |
Add isUnlocked provider hook
Diffstat (limited to 'app/scripts/controllers/provider-approval.js')
-rw-r--r-- | app/scripts/controllers/provider-approval.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/scripts/controllers/provider-approval.js b/app/scripts/controllers/provider-approval.js index a44d2b3ab..c9680cb46 100644 --- a/app/scripts/controllers/provider-approval.js +++ b/app/scripts/controllers/provider-approval.js @@ -9,7 +9,7 @@ class ProviderApprovalController { * * @param {Object} [config] - Options to configure controller */ - constructor ({ closePopup, openPopup, platform, preferencesController, publicConfigStore } = {}) { + constructor ({ closePopup, openPopup, keyringController, platform, preferencesController, publicConfigStore } = {}) { this.store = new ObservableStore() this.closePopup = closePopup this.openPopup = openPopup @@ -17,6 +17,7 @@ class ProviderApprovalController { this.publicConfigStore = publicConfigStore this.approvedOrigins = {} this.preferencesController = preferencesController + this.keyringController = keyringController platform && platform.addMessageListener && platform.addMessageListener(({ action, origin }) => { if (!action) { return } switch (action) { @@ -26,6 +27,8 @@ class ProviderApprovalController { case 'init-status-request': this.handleProviderStatusRequest(origin) break + case 'init-unlock-request': + this.handleUnlockRequest() case 'init-privacy-request': this.handlePrivacyStatusRequest() } @@ -56,6 +59,11 @@ class ProviderApprovalController { this.platform && this.platform.sendMessage({ action: 'answer-status-request', isEnabled }, { active: true }) } + handleUnlockRequest() { + const isUnlocked = this.keyringController.memStore.getState().isUnlocked + this.platform && this.platform.sendMessage({ action: 'answer-unlock-request', isUnlocked }, { active: true }) + } + handlePrivacyStatusRequest () { const privacyMode = this.preferencesController.getFeatureFlags().privacyMode if (!privacyMode) { |