Phase out extra warning screen.

This commit is contained in:
Kevin Serrano 2016-10-25 13:24:03 -07:00
parent 16e2f029d8
commit 678301a20e
No known key found for this signature in database
GPG Key ID: 7CC862A58D2889B4
20 changed files with 8 additions and 205 deletions

View File

@ -39,7 +39,6 @@ module.exports = class KeyringController extends EventEmitter {
isInitialized: !!this.configManager.getVault(),
isUnlocked: !!this.key,
isConfirmed: true, // AUDIT this.configManager.getConfirmed(),
isEthConfirmed: this.configManager.getShouldntShowWarning(),
unconfTxs: this.configManager.unconfirmedTxs(),
transactions: this.configManager.getTxList(),
unconfMsgs: messageManager.unconfirmedMsgs(),

View File

@ -368,21 +368,6 @@ ConfigManager.prototype.getConversionDate = function () {
return (('conversionDate' in data) && data.conversionDate) || 'N/A'
}
ConfigManager.prototype.setShouldntShowWarning = function () {
var data = this.getData()
if (data.isEthConfirmed) {
data.isEthConfirmed = !data.isEthConfirmed
} else {
data.isEthConfirmed = true
}
this.setData(data)
}
ConfigManager.prototype.getShouldntShowWarning = function () {
var data = this.getData()
return ('isEthConfirmed' in data) && data.isEthConfirmed
}
ConfigManager.prototype.getShapeShiftTxList = function () {
var data = this.getData()
var shapeShiftTxList = data.shapeShiftTxList ? data.shapeShiftTxList : []

View File

@ -103,7 +103,6 @@ IdentityStore.prototype.getState = function () {
isUnlocked: this._isUnlocked(),
seedWords: seedWords,
isConfirmed: configManager.getConfirmed(),
isEthConfirmed: configManager.getShouldntShowWarning(),
unconfTxs: configManager.unconfirmedTxs(),
transactions: configManager.getTxList(),
unconfMsgs: messageManager.unconfirmedMsgs(),

View File

@ -54,7 +54,6 @@ module.exports = class MetamaskController {
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),
setGasMultiplier: this.setGasMultiplier.bind(this),
@ -334,15 +333,6 @@ module.exports = class MetamaskController {
}, 300000)
}
agreeToEthWarning (cb) {
try {
this.configManager.setShouldntShowWarning()
cb()
} catch (e) {
cb(e)
}
}
// called from popup
setRpcTarget (rpcTarget) {
this.configManager.setRpcTarget(rpcTarget)

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,6 @@
"metamask": {
"isInitialized": true,
"isUnlocked": true,
"isEthConfirmed": true,
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {
"0x0abdd95cafcabec9b3e99dcd09fc4b441037cb80": {
@ -116,4 +115,4 @@
"scrollToBottom": true
},
"identities": {}
}
}

View File

@ -161,7 +161,6 @@
"network": "166",
"seedWords": null,
"isConfirmed": true,
"isEthConfirmed": true,
"unconfMsgs": {},
"messages": [],
"provider": {

View File

@ -2,7 +2,6 @@
"metamask": {
"isInitialized": true,
"isUnlocked": false,
"isEthConfirmed": true,
"currentDomain": "example.com",
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {},

View File

@ -2,7 +2,6 @@
"metamask": {
"isInitialized": true,
"isUnlocked": true,
"isEthConfirmed": true,
"currentDomain": "example.com",
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {
@ -403,4 +402,4 @@
"warning": null
},
"identities": {}
}
}

View File

@ -2,7 +2,6 @@
"metamask": {
"isInitialized": false,
"isUnlocked": false,
"isEthConfirmed": false,
"currentDomain": "example.com",
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {},
@ -36,4 +35,4 @@
"warning": null
},
"identities": {}
}
}

View File

@ -2,7 +2,6 @@
"metamask": {
"isInitialized": true,
"isUnlocked": true,
"isEthConfirmed": false,
"currentDomain": "example.com",
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {
@ -73,4 +72,4 @@
"detailView": {}
},
"identities": {}
}
}

View File

@ -2,7 +2,6 @@
"metamask": {
"isInitialized": true,
"isUnlocked": true,
"isEthConfirmed": true,
"currentDomain": "example.com",
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {
@ -345,4 +344,4 @@
"isSubLoading": false
},
"identities": {}
}
}

View File

@ -1,35 +0,0 @@
{
"metamask": {
"isInitialized": false,
"isUnlocked": false,
"currentDomain": "example.com",
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {},
"unconfTxs": {},
"accounts": {},
"transactions": [],
"network": "2",
"seedWords": null,
"isConfirmed": false,
"isEthConfirmed": false,
"unconfMsgs": {},
"messages": [],
"provider": {
"type": "testnet"
}
},
"appState": {
"menuOpen": false,
"currentView": {
"name": "EthStoreWarning"
},
"accountDetail": {
"subview": "transactions"
},
"currentDomain": "127.0.0.1:9966",
"transForward": true,
"isLoading": false,
"warning": null
},
"identities": {}
}

View File

@ -5,7 +5,7 @@ QUnit.test('agree to terms', function (assert) {
var app = $('iframe').contents().find('#app-content .mock-app-root')
app.find('.markdown').prop('scrollTop', 100000000)
debugger;
wait().then(function() {
app.find('button').click()
}).then(function() {
@ -22,4 +22,3 @@ QUnit.test('agree to terms', function (assert) {
// Wait for view to transition:
})

View File

@ -30,7 +30,6 @@ function mapStateToProps (state) {
network: state.metamask.network,
unconfTxs: valuesFor(state.metamask.unconfTxs),
unconfMsgs: valuesFor(state.metamask.unconfMsgs),
isEthWarningConfirmed: state.metamask.isEthConfirmed,
shapeShiftTxList: state.metamask.shapeShiftTxList,
}
}

View File

@ -61,10 +61,6 @@ var actions = {
showPrivateKey: showPrivateKey,
SAVE_ACCOUNT_LABEL: 'SAVE_ACCOUNT_LABEL',
saveAccountLabel: saveAccountLabel,
AGREE_TO_ETH_WARNING: 'AGREE_TO_ETH_WARNING',
agreeToEthWarning: agreeToEthWarning,
SHOW_ETH_WARNING: 'SHOW_ETH_WARNING',
showEthWarning: showEthWarning,
// tx conf screen
COMPLETED_TX: 'COMPLETED_TX',
TRANSACTION_ERROR: 'TRANSACTION_ERROR',
@ -596,25 +592,6 @@ function showSendPage () {
}
}
function agreeToEthWarning () {
return (dispatch) => {
background.agreeToEthWarning((err) => {
if (err) {
return dispatch(actions.showEthWarning(err.message))
}
dispatch({
type: actions.AGREE_TO_ETH_WARNING,
})
})
}
}
function showEthWarning () {
return {
type: actions.SHOW_ETH_WARNING,
}
}
function buyEth (address, amount) {
return (dispatch) => {
background.buyEth(address, amount)

View File

@ -25,7 +25,6 @@ const MenuDroppo = require('menu-droppo')
const DropMenuItem = require('./components/drop-menu-item')
const NetworkIndicator = require('./components/network')
const Tooltip = require('./components/tooltip')
const EthStoreWarning = require('./eth-store-warning')
const BuyView = require('./components/buy-button-subview')
const QrView = require('./components/qr-code')
module.exports = connect(mapStateToProps)(App)
@ -38,7 +37,6 @@ function mapStateToProps (state) {
// state from plugin
isLoading: state.appState.isLoading,
isConfirmed: state.metamask.isConfirmed,
isEthConfirmed: state.metamask.isEthConfirmed,
isInitialized: state.metamask.isInitialized,
isUnlocked: state.metamask.isUnlocked,
currentView: state.appState.currentView,
@ -421,9 +419,6 @@ App.prototype.renderPrimary = function () {
// show current view
switch (props.currentView.name) {
case 'EthStoreWarning':
return h(EthStoreWarning, {key: 'ethWarning'})
case 'accounts':
return h(AccountsScreen, {key: 'accounts'})

View File

@ -1,89 +0,0 @@
const connect = require('react-redux').connect
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
const actions = require('./actions')
module.exports = connect(mapStateToProps)(EthStoreWarning)
inherits(EthStoreWarning, Component)
function EthStoreWarning () {
Component.call(this)
}
function mapStateToProps (state) {
return {
selectedAccount: state.metamask.selectedAccount,
}
}
EthStoreWarning.prototype.render = function () {
return (
h('.flex-column', {
key: 'ethWarning',
style: {
paddingTop: '25px',
marginRight: '30px',
marginLeft: '30px',
alignItems: 'center',
},
}, [
h('.warning', {
style: {
margin: '10px 10px 10px 10px',
},
},
`MetaMask is currently in beta; use
caution in storing large
amounts of ether.
`),
h('i.fa.fa-exclamation-triangle.fa-4', {
style: {
fontSize: '152px',
color: '#AEAEAE',
textAlign: 'center',
},
}),
h('.flex-row', {
style: {
marginTop: '25px',
marginBottom: '10px',
},
}, [
h('input', {
type: 'checkbox',
onChange: this.toggleShowWarning.bind(this),
}),
h('.warning', {
style: {
fontSize: '11px',
},
}, 'Don\'t show me this message again'),
]),
h('.flex-row', {
style: {
width: '100%',
justifyContent: 'space-around',
},
}, [
h('button', {
onClick: this.toAccounts.bind(this),
},
'Continue to MetaMask'),
]),
])
)
}
EthStoreWarning.prototype.toggleShowWarning = function () {
this.props.dispatch(actions.agreeToEthWarning())
}
EthStoreWarning.prototype.toAccounts = function () {
this.props.dispatch(actions.showAccountDetail(this.props.account))
}

View File

@ -29,13 +29,10 @@ function reduceApp (state, action) {
name: 'createVaultComplete',
seedWords,
}
var ethStoreWarning = {
name: 'EthStoreWarning',
}
var appState = extend({
menuOpen: false,
currentView: seedWords ? seedConfView : !state.metamask.isEthConfirmed ? ethStoreWarning : defaultView,
currentView: seedWords ? seedConfView : defaultView,
accountDetail: {
subview: 'transactions',
},

View File

@ -10,7 +10,6 @@ function reduceMetamask (state, action) {
var metamaskState = extend({
isInitialized: false,
isUnlocked: false,
isEthConfirmed: false,
rpcTarget: 'https://rawtestrpc.metamask.io/',
identities: {},
unconfTxs: {},
@ -34,11 +33,6 @@ function reduceMetamask (state, action) {
isConfirmed: true,
})
case actions.AGREE_TO_ETH_WARNING:
return extend(metamaskState, {
isEthConfirmed: !metamaskState.isEthConfirmed,
})
case actions.UNLOCK_METAMASK:
return extend(metamaskState, {
isUnlocked: true,