aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorDan Finlay <somniac@me.com>2016-10-12 07:13:21 +0800
committerGitHub <noreply@github.com>2016-10-12 07:13:21 +0800
commitbbaf79f576443f6325d6c32d119f020a61bffa67 (patch)
treebdf23c55a77a3181dd5cc1230f389bd15106d11d /app/scripts/metamask-controller.js
parent0182f8a4e91b8a9b0951967d2c075955bfb4f24f (diff)
parent39f2118d314b4d12a4ebfdebd736e40d9474fad3 (diff)
downloadtangerine-wallet-browser-bbaf79f576443f6325d6c32d119f020a61bffa67.tar
tangerine-wallet-browser-bbaf79f576443f6325d6c32d119f020a61bffa67.tar.gz
tangerine-wallet-browser-bbaf79f576443f6325d6c32d119f020a61bffa67.tar.bz2
tangerine-wallet-browser-bbaf79f576443f6325d6c32d119f020a61bffa67.tar.lz
tangerine-wallet-browser-bbaf79f576443f6325d6c32d119f020a61bffa67.tar.xz
tangerine-wallet-browser-bbaf79f576443f6325d6c32d119f020a61bffa67.tar.zst
tangerine-wallet-browser-bbaf79f576443f6325d6c32d119f020a61bffa67.zip
Merge pull request #702 from MetaMask/tos
Terms of Service UI Update
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js38
1 files changed, 37 insertions, 1 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 03082013a..550531d6e 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -22,10 +22,15 @@ module.exports = class MetamaskController {
this.idStore.setStore(this.ethStore)
this.messageManager = messageManager
this.publicConfigStore = this.initPublicConfigStore()
+
var currentFiat = this.configManager.getCurrentFiat() || 'USD'
this.configManager.setCurrentFiat(currentFiat)
this.configManager.updateConversionRate()
+
+ this.checkTOSChange()
+
this.scheduleConversionInterval()
+
}
getState () {
@@ -45,8 +50,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 +269,27 @@ module.exports = class MetamaskController {
// config
//
+ setTOSHash (hash) {
+ try {
+ this.configManager.setTOSHash(hash)
+ } catch (e) {
+ console.error('Error in setting terms of service hash.')
+ }
+ }
+
+ checkTOSChange () {
+ try {
+ const storedHash = this.configManager.getTOSHash() || 0
+ if (storedHash !== global.newTOSHash) {
+ this.resetDisclaimer()
+ this.setTOSHash(global.newTOSHash)
+ }
+ } catch (e) {
+ console.error('Error in checking TOS change.')
+ }
+
+ }
+
agreeToDisclaimer (cb) {
try {
this.configManager.setConfirmed(true)
@@ -270,6 +299,14 @@ module.exports = class MetamaskController {
}
}
+ resetDisclaimer () {
+ try {
+ this.configManager.setConfirmed(false)
+ } catch (e) {
+ console.error(e)
+ }
+ }
+
setCurrentFiat (fiat, cb) {
try {
this.configManager.setCurrentFiat(fiat)
@@ -341,4 +378,3 @@ module.exports = class MetamaskController {
this.configManager.createShapeShiftTx(depositAddress, depositType)
}
}
-