diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2016-10-06 18:24:28 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2016-10-06 18:24:28 +0800 |
commit | 4ea3246912306ac52d520b8c34180392c0afcba7 (patch) | |
tree | 732f30368593762b976925509890307a66ad7aa5 /app/scripts | |
parent | db068134047f1553b926e9b949cb6a6e7100c7be (diff) | |
download | tangerine-wallet-browser-4ea3246912306ac52d520b8c34180392c0afcba7.tar tangerine-wallet-browser-4ea3246912306ac52d520b8c34180392c0afcba7.tar.gz tangerine-wallet-browser-4ea3246912306ac52d520b8c34180392c0afcba7.tar.bz2 tangerine-wallet-browser-4ea3246912306ac52d520b8c34180392c0afcba7.tar.lz tangerine-wallet-browser-4ea3246912306ac52d520b8c34180392c0afcba7.tar.xz tangerine-wallet-browser-4ea3246912306ac52d520b8c34180392c0afcba7.tar.zst tangerine-wallet-browser-4ea3246912306ac52d520b8c34180392c0afcba7.zip |
Add controller functions for storing and checking TOS hashes.
Diffstat (limited to 'app/scripts')
-rw-r--r-- | app/scripts/metamask-controller.js | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 03082013a..0a37bf292 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -25,6 +25,7 @@ module.exports = class MetamaskController { var currentFiat = this.configManager.getCurrentFiat() || 'USD' this.configManager.setCurrentFiat(currentFiat) this.configManager.updateConversionRate() + this.configManager.setTOSHash(0) this.scheduleConversionInterval() } @@ -45,8 +46,11 @@ module.exports = class MetamaskController { setProviderType: this.setProviderType.bind(this), useEtherscanProvider: this.useEtherscanProvider.bind(this), agreeToDisclaimer: this.agreeToDisclaimer.bind(this), + resetDisclaimer: this.resetDisclaimer.bind(this), setCurrentFiat: this.setCurrentFiat.bind(this), agreeToEthWarning: this.agreeToEthWarning.bind(this), + setTOSHash: this.setTOSHash.bind(this), + checkTOSChange: this.checkTOSChange.bind(this), // forward directly to idStore createNewVault: idStore.createNewVault.bind(idStore), @@ -261,6 +265,26 @@ module.exports = class MetamaskController { // config // + setTOSHash (hash, cb) { + try { + this.configManager.setTOSHash(hash) + cb(this.configManager.getTOSHash()) + } catch (e) { + cb(null, e) + } + } + + checkTOSChange (newHash, cb) { + try { + var currentHash = this.configManager.getTOSHash() + var change = !(currentHash === newHash) + cb(change) + } catch (e) { + cb(null, e) + } + + } + agreeToDisclaimer (cb) { try { this.configManager.setConfirmed(true) @@ -270,6 +294,14 @@ module.exports = class MetamaskController { } } + resetDisclaimer () { + try { + this.configManager.setConfirmed(false) + } catch (e) { + console.error(e) + } + } + setCurrentFiat (fiat, cb) { try { this.configManager.setCurrentFiat(fiat) @@ -304,6 +336,8 @@ module.exports = class MetamaskController { } } + + // called from popup setRpcTarget (rpcTarget) { this.configManager.setRpcTarget(rpcTarget) @@ -341,4 +375,3 @@ module.exports = class MetamaskController { this.configManager.createShapeShiftTx(depositAddress, depositType) } } - |