mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Add debug logging to ui routing logic.
This commit is contained in:
parent
fc77a36a55
commit
8aca5bf4b5
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
"globals": {
|
"globals": {
|
||||||
"document": false,
|
"document": false,
|
||||||
|
"log": true,
|
||||||
"navigator": false,
|
"navigator": false,
|
||||||
"web3": true,
|
"web3": true,
|
||||||
"window": false
|
"window": false
|
||||||
|
@ -26,6 +26,8 @@ const firstTimeState = require('./app/scripts/first-time-state')
|
|||||||
const extension = require('./development/mockExtension')
|
const extension = require('./development/mockExtension')
|
||||||
const noop = function () {}
|
const noop = function () {}
|
||||||
|
|
||||||
|
const log = require('loglevel')
|
||||||
|
window.log = log
|
||||||
|
|
||||||
//
|
//
|
||||||
// Query String
|
// Query String
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
"iframe-stream": "^1.0.2",
|
"iframe-stream": "^1.0.2",
|
||||||
"inject-css": "^0.1.1",
|
"inject-css": "^0.1.1",
|
||||||
"jazzicon": "^1.2.0",
|
"jazzicon": "^1.2.0",
|
||||||
|
"loglevel": "^1.4.1",
|
||||||
"menu-droppo": "^1.1.0",
|
"menu-droppo": "^1.1.0",
|
||||||
"metamask-logo": "^2.1.2",
|
"metamask-logo": "^2.1.2",
|
||||||
"mississippi": "^1.2.0",
|
"mississippi": "^1.2.0",
|
||||||
|
@ -22,6 +22,10 @@ const configureStore = require('./development/uiStore')
|
|||||||
const states = require('./development/states')
|
const states = require('./development/states')
|
||||||
const Selector = require('./development/selector')
|
const Selector = require('./development/selector')
|
||||||
|
|
||||||
|
// logger
|
||||||
|
const log = require('loglevel')
|
||||||
|
window.log = log
|
||||||
|
|
||||||
// Query String
|
// Query String
|
||||||
const qs = require('qs')
|
const qs = require('qs')
|
||||||
let queryString = qs.parse(window.location.href.split('#')[1])
|
let queryString = qs.parse(window.location.href.split('#')[1])
|
||||||
|
@ -351,12 +351,14 @@ App.prototype.renderPrimary = function () {
|
|||||||
|
|
||||||
// notices
|
// notices
|
||||||
if (!props.noActiveNotices && !global.METAMASK_DEBUG) {
|
if (!props.noActiveNotices && !global.METAMASK_DEBUG) {
|
||||||
|
log.debug('rendering notice screen for unread notices.')
|
||||||
return h(NoticeScreen, {
|
return h(NoticeScreen, {
|
||||||
notice: props.lastUnreadNotice,
|
notice: props.lastUnreadNotice,
|
||||||
key: 'NoticeScreen',
|
key: 'NoticeScreen',
|
||||||
onConfirm: () => props.dispatch(actions.markNoticeRead(props.lastUnreadNotice)),
|
onConfirm: () => props.dispatch(actions.markNoticeRead(props.lastUnreadNotice)),
|
||||||
})
|
})
|
||||||
} else if (props.lostAccounts && props.lostAccounts.length > 0) {
|
} else if (props.lostAccounts && props.lostAccounts.length > 0) {
|
||||||
|
log.debug('rendering notice screen for lost accounts view.')
|
||||||
return h(NoticeScreen, {
|
return h(NoticeScreen, {
|
||||||
notice: generateLostAccountsNotice(props.lostAccounts),
|
notice: generateLostAccountsNotice(props.lostAccounts),
|
||||||
key: 'LostAccountsNotice',
|
key: 'LostAccountsNotice',
|
||||||
@ -365,18 +367,22 @@ App.prototype.renderPrimary = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (props.seedWords) {
|
if (props.seedWords) {
|
||||||
|
log.debug('rendering seed words')
|
||||||
return h(HDCreateVaultComplete, {key: 'HDCreateVaultComplete'})
|
return h(HDCreateVaultComplete, {key: 'HDCreateVaultComplete'})
|
||||||
}
|
}
|
||||||
|
|
||||||
// show initialize screen
|
// show initialize screen
|
||||||
if (!props.isInitialized || props.forgottenPassword) {
|
if (!props.isInitialized || props.forgottenPassword) {
|
||||||
// show current view
|
// show current view
|
||||||
|
log.debug('rendering an initialize screen')
|
||||||
switch (props.currentView.name) {
|
switch (props.currentView.name) {
|
||||||
|
|
||||||
case 'restoreVault':
|
case 'restoreVault':
|
||||||
|
log.debug('rendering restore vault screen')
|
||||||
return h(HDRestoreVaultScreen, {key: 'HDRestoreVaultScreen'})
|
return h(HDRestoreVaultScreen, {key: 'HDRestoreVaultScreen'})
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
log.debug('rendering menu screen')
|
||||||
return h(InitializeMenuScreen, {key: 'menuScreenInit'})
|
return h(InitializeMenuScreen, {key: 'menuScreenInit'})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -386,9 +392,11 @@ App.prototype.renderPrimary = function () {
|
|||||||
switch (props.currentView.name) {
|
switch (props.currentView.name) {
|
||||||
|
|
||||||
case 'restoreVault':
|
case 'restoreVault':
|
||||||
|
log.debug('rendering restore vault screen')
|
||||||
return h(HDRestoreVaultScreen, {key: 'HDRestoreVaultScreen'})
|
return h(HDRestoreVaultScreen, {key: 'HDRestoreVaultScreen'})
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
log.debug('rendering locked screen')
|
||||||
return h(UnlockScreen, {key: 'locked'})
|
return h(UnlockScreen, {key: 'locked'})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,36 +405,47 @@ App.prototype.renderPrimary = function () {
|
|||||||
switch (props.currentView.name) {
|
switch (props.currentView.name) {
|
||||||
|
|
||||||
case 'accounts':
|
case 'accounts':
|
||||||
|
log.debug('rendering accounts screen')
|
||||||
return h(AccountsScreen, {key: 'accounts'})
|
return h(AccountsScreen, {key: 'accounts'})
|
||||||
|
|
||||||
case 'accountDetail':
|
case 'accountDetail':
|
||||||
|
log.debug('rendering account detail screen')
|
||||||
return h(AccountDetailScreen, {key: 'account-detail'})
|
return h(AccountDetailScreen, {key: 'account-detail'})
|
||||||
|
|
||||||
case 'sendTransaction':
|
case 'sendTransaction':
|
||||||
|
log.debug('rendering send tx screen')
|
||||||
return h(SendTransactionScreen, {key: 'send-transaction'})
|
return h(SendTransactionScreen, {key: 'send-transaction'})
|
||||||
|
|
||||||
case 'newKeychain':
|
case 'newKeychain':
|
||||||
|
log.debug('rendering new keychain screen')
|
||||||
return h(NewKeyChainScreen, {key: 'new-keychain'})
|
return h(NewKeyChainScreen, {key: 'new-keychain'})
|
||||||
|
|
||||||
case 'confTx':
|
case 'confTx':
|
||||||
|
log.debug('rendering confirm tx screen')
|
||||||
return h(ConfirmTxScreen, {key: 'confirm-tx'})
|
return h(ConfirmTxScreen, {key: 'confirm-tx'})
|
||||||
|
|
||||||
case 'config':
|
case 'config':
|
||||||
|
log.debug('rendering config screen')
|
||||||
return h(ConfigScreen, {key: 'config'})
|
return h(ConfigScreen, {key: 'config'})
|
||||||
|
|
||||||
case 'import-menu':
|
case 'import-menu':
|
||||||
|
log.debug('rendering import screen')
|
||||||
return h(Import, {key: 'import-menu'})
|
return h(Import, {key: 'import-menu'})
|
||||||
|
|
||||||
case 'reveal-seed-conf':
|
case 'reveal-seed-conf':
|
||||||
|
log.debug('rendering reveal seed confirmation screen')
|
||||||
return h(RevealSeedConfirmation, {key: 'reveal-seed-conf'})
|
return h(RevealSeedConfirmation, {key: 'reveal-seed-conf'})
|
||||||
|
|
||||||
case 'info':
|
case 'info':
|
||||||
|
log.debug('rendering info screen')
|
||||||
return h(InfoScreen, {key: 'info'})
|
return h(InfoScreen, {key: 'info'})
|
||||||
|
|
||||||
case 'buyEth':
|
case 'buyEth':
|
||||||
|
log.debug('rendering buy ether screen')
|
||||||
return h(BuyView, {key: 'buyEthView'})
|
return h(BuyView, {key: 'buyEthView'})
|
||||||
|
|
||||||
case 'qr':
|
case 'qr':
|
||||||
|
log.debug('rendering show qr screen')
|
||||||
return h('div', {
|
return h('div', {
|
||||||
style: {
|
style: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
@ -454,6 +473,7 @@ App.prototype.renderPrimary = function () {
|
|||||||
])
|
])
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
log.debug('rendering default, account detail screen')
|
||||||
return h(AccountDetailScreen, {key: 'account-detail'})
|
return h(AccountDetailScreen, {key: 'account-detail'})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,9 @@ const configureStore = require('./app/store')
|
|||||||
const txHelper = require('./lib/tx-helper')
|
const txHelper = require('./lib/tx-helper')
|
||||||
module.exports = launchApp
|
module.exports = launchApp
|
||||||
|
|
||||||
|
const log = require('loglevel')
|
||||||
|
window.log = log
|
||||||
|
|
||||||
function launchApp (opts) {
|
function launchApp (opts) {
|
||||||
var accountManager = opts.accountManager
|
var accountManager = opts.accountManager
|
||||||
actions._setBackgroundConnection(accountManager)
|
actions._setBackgroundConnection(accountManager)
|
||||||
|
Loading…
Reference in New Issue
Block a user