1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Re-enable disclaimer screen. Rename variables to reflect role more clearly.

This commit is contained in:
Kevin Serrano 2016-11-14 16:49:16 -08:00
parent 92edc63d6e
commit 7de6b12aad
No known key found for this signature in database
GPG Key ID: 7CC862A58D2889B4
30 changed files with 49 additions and 49 deletions

View File

@ -55,7 +55,7 @@ module.exports = class KeyringController extends EventEmitter {
seedWords: this.configManager.getSeedWords(), seedWords: this.configManager.getSeedWords(),
isInitialized: (!!wallet || !!vault), isInitialized: (!!wallet || !!vault),
isUnlocked: !!this.key, isUnlocked: !!this.key,
isConfirmed: true, // AUDIT this.configManager.getConfirmed(), isDisclaimerConfirmed: this.configManager.getConfirmedDisclaimer(), // AUDIT this.configManager.getConfirmedDisclaimer(),
unconfTxs: this.configManager.unconfirmedTxs(), unconfTxs: this.configManager.unconfirmedTxs(),
transactions: this.configManager.getTxList(), transactions: this.configManager.getTxList(),
unconfMsgs: messageManager.unconfirmedMsgs(), unconfMsgs: messageManager.unconfirmedMsgs(),

View File

@ -313,15 +313,15 @@ ConfigManager.prototype._emitUpdates = function (state) {
}) })
} }
ConfigManager.prototype.setConfirmed = function (confirmed) { ConfigManager.prototype.setConfirmedDisclaimer = function (confirmed) {
var data = this.getData() var data = this.getData()
data.isConfirmed = confirmed data.isDisclaimerConfirmed = confirmed
this.setData(data) this.setData(data)
} }
ConfigManager.prototype.getConfirmed = function () { ConfigManager.prototype.getConfirmedDisclaimer = function () {
var data = this.getData() var data = this.getData()
return ('isConfirmed' in data) && data.isConfirmed return ('isDisclaimerConfirmed' in data) && data.isDisclaimerConfirmed
} }
ConfigManager.prototype.setTOSHash = function (hash) { ConfigManager.prototype.setTOSHash = function (hash) {

View File

@ -102,7 +102,7 @@ IdentityStore.prototype.getState = function () {
isInitialized: !!configManager.getWallet() && !seedWords, isInitialized: !!configManager.getWallet() && !seedWords,
isUnlocked: this._isUnlocked(), isUnlocked: this._isUnlocked(),
seedWords: seedWords, seedWords: seedWords,
isConfirmed: configManager.getConfirmed(), isDisclaimerConfirmed: configManager.getConfirmedDisclaimer(),
unconfTxs: configManager.unconfirmedTxs(), unconfTxs: configManager.unconfirmedTxs(),
transactions: configManager.getTxList(), transactions: configManager.getTxList(),
unconfMsgs: messageManager.unconfirmedMsgs(), unconfMsgs: messageManager.unconfirmedMsgs(),

View File

@ -278,7 +278,7 @@ module.exports = class MetamaskController {
agreeToDisclaimer (cb) { agreeToDisclaimer (cb) {
try { try {
this.configManager.setConfirmed(true) this.configManager.setConfirmedDisclaimer(true)
cb() cb()
} catch (e) { } catch (e) {
cb(e) cb(e)
@ -287,7 +287,7 @@ module.exports = class MetamaskController {
resetDisclaimer () { resetDisclaimer () {
try { try {
this.configManager.setConfirmed(false) this.configManager.setConfirmedDisclaimer(false)
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -136,7 +136,7 @@
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc", "selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"network": "1", "network": "1",
"seedWords": null, "seedWords": null,
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"provider": { "provider": {

View File

@ -102,7 +102,7 @@
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc", "selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"network": "2", "network": "2",
"seedWords": null, "seedWords": null,
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"provider": { "provider": {

View File

@ -60,7 +60,7 @@
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc", "selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"network": "2", "network": "2",
"seedWords": null, "seedWords": null,
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"provider": { "provider": {

View File

@ -91,7 +91,7 @@
"transactions": [], "transactions": [],
"selectedAddress": "0x0abdd95cafcabec9b3e99dcd09fc4b441037cb80", "selectedAddress": "0x0abdd95cafcabec9b3e99dcd09fc4b441037cb80",
"network": "2", "network": "2",
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"shapeShiftTxList": [], "shapeShiftTxList": [],

View File

@ -59,7 +59,7 @@
"transactions": [], "transactions": [],
"selectedAddress": "0x843963b837841dad3b0f5969ff271108776616df", "selectedAddress": "0x843963b837841dad3b0f5969ff271108776616df",
"network": "2", "network": "2",
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"provider": { "provider": {

View File

@ -10,7 +10,7 @@
"transactions": [], "transactions": [],
"network": "2", "network": "2",
"seedWords": null, "seedWords": null,
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"provider": { "provider": {

View File

@ -160,7 +160,7 @@
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", "selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"network": "166", "network": "166",
"seedWords": null, "seedWords": null,
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"provider": { "provider": {

View File

@ -57,7 +57,7 @@
"selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc", "selectedAddress": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
"network": "2", "network": "2",
"seedWords": null, "seedWords": null,
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"provider": { "provider": {

View File

@ -11,7 +11,7 @@
"network": null, "network": null,
"accounts": {}, "accounts": {},
"transactions": [], "transactions": [],
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"shapeShiftTxList": [], "shapeShiftTxList": [],

View File

@ -55,7 +55,7 @@
}, },
"transactions": [], "transactions": [],
"network": "2", "network": "2",
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"provider": { "provider": {

View File

@ -14,7 +14,7 @@
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", "selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"network": "1473186153102", "network": "1473186153102",
"seedWords": null, "seedWords": null,
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"shapeShiftTxList": [], "shapeShiftTxList": [],

View File

@ -10,7 +10,7 @@
"transactions": [], "transactions": [],
"network": "2", "network": "2",
"seedWords": null, "seedWords": null,
"isConfirmed": false, "isDisclaimerConfirmed": false,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"provider": { "provider": {

File diff suppressed because one or more lines are too long

View File

@ -354,7 +354,7 @@
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", "selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"network": "1471904489432", "network": "1471904489432",
"seedWords": null, "seedWords": null,
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": { "unconfMsgs": {
"1472076978535283": { "1472076978535283": {
"id": 1472076978535283, "id": 1472076978535283,

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"metamask":{"isInitialized":true,"isUnlocked":true,"currentDomain":"example.com","rpcTarget":"https://rawtestrpc.metamask.io/","identities":{"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825":{"name":"Wallet 1","address":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","mayBeFauceting":false},"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb":{"name":"Wallet 2","address":"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb","mayBeFauceting":false},"0x2f8d4a878cfa04a6e60d46362f5644deab66572d":{"name":"Wallet 3","address":"0x2f8d4a878cfa04a6e60d46362f5644deab66572d","mayBeFauceting":false}},"unconfTxs":{"1467868023090690":{"id":1467868023090690,"txParams":{"data":"0xa9059cbb0000000000000000000000008deb4d106090c3eb8f1950f727e87c4f884fb06f0000000000000000000000000000000000000000000000000000000000000064","from":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","value":"0x16345785d8a0000","to":"0xbeb0ed3034c4155f3d16a64a5c5e7c8d4ea9e9c9","origin":"MetaMask","metamaskId":1467868023090690,"metamaskNetworkId":"2"},"time":1467868023090,"status":"unconfirmed","containsDelegateCall":false}},"accounts":{"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825":{"code":"0x","balance":"0x38326dc32cf80800","nonce":"0x10000c","address":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"},"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb":{"code":"0x","balance":"0x15e578bd8e9c8000","nonce":"0x100000","address":"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb"},"0x2f8d4a878cfa04a6e60d46362f5644deab66572d":{"code":"0x","nonce":"0x100000","balance":"0x2386f26fc10000","address":"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"}},"transactions":[],"selectedAddress":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","network":"2","seedWords":null,"isConfirmed":true,"unconfMsgs":{},"messages":[],"provider":{"type":"testnet"},"selectedAccount":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"},"appState":{"menuOpen":false,"currentView":{"name":"confTx","context":0},"accountDetail":{"subview":"transactions"},"currentDomain":"extensions","transForward":true,"isLoading":false,"warning":null},"identities":{}} {"metamask":{"isInitialized":true,"isUnlocked":true,"currentDomain":"example.com","rpcTarget":"https://rawtestrpc.metamask.io/","identities":{"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825":{"name":"Wallet 1","address":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","mayBeFauceting":false},"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb":{"name":"Wallet 2","address":"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb","mayBeFauceting":false},"0x2f8d4a878cfa04a6e60d46362f5644deab66572d":{"name":"Wallet 3","address":"0x2f8d4a878cfa04a6e60d46362f5644deab66572d","mayBeFauceting":false}},"unconfTxs":{"1467868023090690":{"id":1467868023090690,"txParams":{"data":"0xa9059cbb0000000000000000000000008deb4d106090c3eb8f1950f727e87c4f884fb06f0000000000000000000000000000000000000000000000000000000000000064","from":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","value":"0x16345785d8a0000","to":"0xbeb0ed3034c4155f3d16a64a5c5e7c8d4ea9e9c9","origin":"MetaMask","metamaskId":1467868023090690,"metamaskNetworkId":"2"},"time":1467868023090,"status":"unconfirmed","containsDelegateCall":false}},"accounts":{"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825":{"code":"0x","balance":"0x38326dc32cf80800","nonce":"0x10000c","address":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"},"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb":{"code":"0x","balance":"0x15e578bd8e9c8000","nonce":"0x100000","address":"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb"},"0x2f8d4a878cfa04a6e60d46362f5644deab66572d":{"code":"0x","nonce":"0x100000","balance":"0x2386f26fc10000","address":"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"}},"transactions":[],"selectedAddress":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","network":"2","seedWords":null,"isDisclaimerConfirmed":true,"unconfMsgs":{},"messages":[],"provider":{"type":"testnet"},"selectedAccount":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"},"appState":{"menuOpen":false,"currentView":{"name":"confTx","context":0},"accountDetail":{"subview":"transactions"},"currentDomain":"extensions","transForward":true,"isLoading":false,"warning":null},"identities":{}}

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@
"accounts": {}, "accounts": {},
"transactions": [], "transactions": [],
"seedWords": null, "seedWords": null,
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"shapeShiftTxList": [], "shapeShiftTxList": [],

View File

@ -48,7 +48,7 @@
"transactions": [], "transactions": [],
"network": "2", "network": "2",
"seedWords": null, "seedWords": null,
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"shapeShiftTxList": [], "shapeShiftTxList": [],

View File

@ -49,7 +49,7 @@
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825", "selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"network": "1", "network": "1",
"seedWords": null, "seedWords": null,
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"shapeShiftTxList": [], "shapeShiftTxList": [],

View File

@ -45,7 +45,7 @@
"transactions": [], "transactions": [],
"network": "2", "network": "2",
"seedWords": "debris dizzy just program just float decrease vacant alarm reduce speak stadium", "seedWords": "debris dizzy just program just float decrease vacant alarm reduce speak stadium",
"isConfirmed": true, "isDisclaimerConfirmed": true,
"unconfMsgs": {}, "unconfMsgs": {},
"messages": [], "messages": [],
"provider": { "provider": {

View File

@ -100,31 +100,31 @@ describe('config-manager', function() {
describe('confirmation', function() { describe('confirmation', function() {
describe('#getConfirmed', function() { describe('#getConfirmedDisclaimer', function() {
it('should return false if no previous key exists', function() { it('should return false if no previous key exists', function() {
var result = configManager.getConfirmed() var result = configManager.getConfirmedDisclaimer()
assert.ok(!result) assert.ok(!result)
}) })
}) })
describe('#setConfirmed', function() { describe('#setConfirmedDisclaimer', function() {
it('should make getConfirmed return true once set', function() { it('should make getConfirmedDisclaimer return true once set', function() {
assert.equal(configManager.getConfirmed(), false) assert.equal(configManager.getConfirmedDisclaimer(), false)
configManager.setConfirmed(true) configManager.setConfirmedDisclaimer(true)
var result = configManager.getConfirmed() var result = configManager.getConfirmedDisclaimer()
assert.equal(result, true) assert.equal(result, true)
}) })
it('should be able to set false', function() { it('should be able to set false', function() {
configManager.setConfirmed(false) configManager.setConfirmedDisclaimer(false)
var result = configManager.getConfirmed() var result = configManager.getConfirmedDisclaimer()
assert.equal(result, false) assert.equal(result, false)
}) })
it('should persist to local storage', function() { it('should persist to local storage', function() {
configManager.setConfirmed(true) configManager.setConfirmedDisclaimer(true)
var data = configManager.getData() var data = configManager.getData()
assert.equal(data.isConfirmed, true) assert.equal(data.isDisclaimerConfirmed, true)
}) })
}) })
}) })
@ -153,7 +153,7 @@ describe('config-manager', function() {
rpcTarget: 'foobar' rpcTarget: 'foobar'
}, },
} }
configManager.setConfirmed(true) configManager.setConfirmedDisclaimer(true)
configManager.setConfig(testConfig) configManager.setConfig(testConfig)
var testWallet = { var testWallet = {
@ -164,7 +164,7 @@ describe('config-manager', function() {
var result = configManager.getData() var result = configManager.getData()
assert.equal(result.wallet.name, testWallet.name, 'wallet name is set') assert.equal(result.wallet.name, testWallet.name, 'wallet name is set')
assert.equal(result.config.provider.rpcTarget, testConfig.provider.rpcTarget) assert.equal(result.config.provider.rpcTarget, testConfig.provider.rpcTarget)
assert.equal(configManager.getConfirmed(), true) assert.equal(configManager.getConfirmedDisclaimer(), true)
testConfig.provider.type = 'something else!' testConfig.provider.type = 'something else!'
configManager.setConfig(testConfig) configManager.setConfig(testConfig)
@ -173,7 +173,7 @@ describe('config-manager', function() {
assert.equal(result.wallet.name, testWallet.name, 'wallet name is set') assert.equal(result.wallet.name, testWallet.name, 'wallet name is set')
assert.equal(result.config.provider.rpcTarget, testConfig.provider.rpcTarget) assert.equal(result.config.provider.rpcTarget, testConfig.provider.rpcTarget)
assert.equal(result.config.provider.type, testConfig.provider.type) assert.equal(result.config.provider.type, testConfig.provider.type)
assert.equal(configManager.getConfirmed(), true) assert.equal(configManager.getConfirmedDisclaimer(), true)
}) })
}) })

View File

@ -39,7 +39,7 @@ function mapStateToProps (state) {
return { return {
// state from plugin // state from plugin
isLoading: state.appState.isLoading, isLoading: state.appState.isLoading,
isConfirmed: state.metamask.isConfirmed, isDisclaimerConfirmed: state.metamask.isDisclaimerConfirmed,
isInitialized: state.metamask.isInitialized, isInitialized: state.metamask.isInitialized,
isUnlocked: state.metamask.isUnlocked, isUnlocked: state.metamask.isUnlocked,
currentView: state.appState.currentView, currentView: state.appState.currentView,
@ -323,7 +323,7 @@ App.prototype.renderBackButton = function (style, justArrow = false) {
App.prototype.renderBackToInitButton = function () { App.prototype.renderBackToInitButton = function () {
var props = this.props var props = this.props
var button = null var button = null
if (!props.isConfirmed) return button if (!props.isDisclaimerConfirmed) return button
if (!props.isUnlocked) { if (!props.isUnlocked) {
if (props.currentView.name === 'InitMenu') { if (props.currentView.name === 'InitMenu') {
@ -356,7 +356,7 @@ App.prototype.renderBackToInitButton = function () {
App.prototype.renderPrimary = function () { App.prototype.renderPrimary = function () {
var props = this.props var props = this.props
if (!props.isConfirmed) { if (!props.isDisclaimerConfirmed) {
return h(DisclaimerScreen, {key: 'disclaimerScreen'}) return h(DisclaimerScreen, {key: 'disclaimerScreen'})
} }

View File

@ -30,7 +30,7 @@ function reduceMetamask (state, action) {
case actions.AGREE_TO_DISCLAIMER: case actions.AGREE_TO_DISCLAIMER:
return extend(metamaskState, { return extend(metamaskState, {
isConfirmed: true, isDisclaimerConfirmed: true,
}) })
case actions.UNLOCK_METAMASK: case actions.UNLOCK_METAMASK: