aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2016-10-12 07:19:13 +0800
committerGitHub <noreply@github.com>2016-10-12 07:19:13 +0800
commit229d95956bc36ec413533df00389f8c5127e050b (patch)
treeb97f0021958fbcf8ed93ac9c44e3d24eaf50f4e4 /app/scripts/metamask-controller.js
parent97970e803d55fc8a578a3a9e6d6f3ab19c332b4b (diff)
parentd67a5031c7f2b4cd14d3d27f3769a31769012f54 (diff)
downloadtangerine-wallet-browser-229d95956bc36ec413533df00389f8c5127e050b.tar
tangerine-wallet-browser-229d95956bc36ec413533df00389f8c5127e050b.tar.gz
tangerine-wallet-browser-229d95956bc36ec413533df00389f8c5127e050b.tar.bz2
tangerine-wallet-browser-229d95956bc36ec413533df00389f8c5127e050b.tar.lz
tangerine-wallet-browser-229d95956bc36ec413533df00389f8c5127e050b.tar.xz
tangerine-wallet-browser-229d95956bc36ec413533df00389f8c5127e050b.tar.zst
tangerine-wallet-browser-229d95956bc36ec413533df00389f8c5127e050b.zip
Merge branch 'master' into i#495CustomGasField
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)
}
}
-