aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-10-13 04:03:15 +0800
committerGitHub <noreply@github.com>2016-10-13 04:03:15 +0800
commit88a68f732ee068d5f230708927207e3f84c43ad0 (patch)
tree5d0b967a582a7ef6e189834fccba5ede7e73101e /app/scripts
parenta1c3c944cf534fff8bfb9560347a03ba2a2bda00 (diff)
parentd67a5031c7f2b4cd14d3d27f3769a31769012f54 (diff)
downloadtangerine-wallet-browser-88a68f732ee068d5f230708927207e3f84c43ad0.tar
tangerine-wallet-browser-88a68f732ee068d5f230708927207e3f84c43ad0.tar.gz
tangerine-wallet-browser-88a68f732ee068d5f230708927207e3f84c43ad0.tar.bz2
tangerine-wallet-browser-88a68f732ee068d5f230708927207e3f84c43ad0.tar.lz
tangerine-wallet-browser-88a68f732ee068d5f230708927207e3f84c43ad0.tar.xz
tangerine-wallet-browser-88a68f732ee068d5f230708927207e3f84c43ad0.tar.zst
tangerine-wallet-browser-88a68f732ee068d5f230708927207e3f84c43ad0.zip
Merge branch 'master' into i695-dapp-reload
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/config.js3
-rw-r--r--app/scripts/lib/config-manager.js11
-rw-r--r--app/scripts/lib/idStore.js2
-rw-r--r--app/scripts/metamask-controller.js38
4 files changed, 52 insertions, 2 deletions
diff --git a/app/scripts/config.js b/app/scripts/config.js
index b7e72eb64..e40b5e104 100644
--- a/app/scripts/config.js
+++ b/app/scripts/config.js
@@ -2,7 +2,8 @@ const MAINET_RPC_URL = 'https://mainnet.infura.io/metamask'
const TESTNET_RPC_URL = 'https://morden.infura.io/metamask'
const DEFAULT_RPC_URL = TESTNET_RPC_URL
-global.METAMASK_DEBUG = false
+global.METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
+global.TOS_HASH = 'GULP_TOS_HASH'
module.exports = {
network: {
diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js
index 715efb42e..ecc9bc5f7 100644
--- a/app/scripts/lib/config-manager.js
+++ b/app/scripts/lib/config-manager.js
@@ -277,6 +277,17 @@ ConfigManager.prototype.getConfirmed = function () {
return ('isConfirmed' in data) && data.isConfirmed
}
+ConfigManager.prototype.setTOSHash = function (hash) {
+ var data = this.getData()
+ data.TOSHash = hash
+ this.setData(data)
+}
+
+ConfigManager.prototype.getTOSHash = function () {
+ var data = this.getData()
+ return ('TOSHash' in data) && data.TOSHash
+}
+
ConfigManager.prototype.setCurrentFiat = function (currency) {
var data = this.getData()
data.fiatCurrency = currency
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js
index 89c0c3abc..6837a1e8d 100644
--- a/app/scripts/lib/idStore.js
+++ b/app/scripts/lib/idStore.js
@@ -60,6 +60,8 @@ IdentityStore.prototype.createNewVault = function (password, entropy, cb) {
this.configManager.setShowSeedWords(true)
var seedWords = this._idmgmt.getSeed()
+ this._loadIdentities()
+
cb(null, seedWords)
})
}
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)
}
}
-