From 147b81068a643074a1fd7aa3e0488263a64961ad Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 4 Oct 2017 09:56:18 -0700 Subject: Include OS version --- ui/app/reducers.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ui/app') diff --git a/ui/app/reducers.js b/ui/app/reducers.js index 6a2f44534..99cbda8aa 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -44,7 +44,9 @@ function rootReducer (state, action) { window.logState = function () { let state = window.METAMASK_CACHED_LOG_STATE const version = global.platform.getVersion() + const platform = global.platform.getPlatformInfo() state.version = version + state.platform = platform let stateString = JSON.stringify(state, removeSeedWords, 2) return stateString } -- cgit v1.2.3 From 2f135c2e68ae58e009212be862bf2318b55a1180 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 4 Oct 2017 09:56:40 -0700 Subject: Include browser version --- ui/app/reducers.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ui/app') diff --git a/ui/app/reducers.js b/ui/app/reducers.js index 99cbda8aa..6307998c2 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -44,9 +44,11 @@ function rootReducer (state, action) { window.logState = function () { let state = window.METAMASK_CACHED_LOG_STATE const version = global.platform.getVersion() + const browser = global.navigator.userAgent() const platform = global.platform.getPlatformInfo() state.version = version state.platform = platform + state.browser = browser let stateString = JSON.stringify(state, removeSeedWords, 2) return stateString } -- cgit v1.2.3 From e64c64a0492aba377db6ef2c406bdb0bd1d10469 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 4 Oct 2017 10:00:07 -0700 Subject: change global to window --- ui/app/reducers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/reducers.js b/ui/app/reducers.js index 6307998c2..1224b4e92 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -44,7 +44,7 @@ function rootReducer (state, action) { window.logState = function () { let state = window.METAMASK_CACHED_LOG_STATE const version = global.platform.getVersion() - const browser = global.navigator.userAgent() + const browser = window.navigator.userAgent() const platform = global.platform.getPlatformInfo() state.version = version state.platform = platform -- cgit v1.2.3 From 3d80565339f02e1fa3e4bc0f8aaedbeea663a712 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 4 Oct 2017 10:55:10 -0700 Subject: Configured for callback-required function.' --- ui/app/config.js | 4 +++- ui/app/reducers.js | 17 +++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'ui/app') diff --git a/ui/app/config.js b/ui/app/config.js index 0fe232c07..9ba00b3dd 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -113,7 +113,9 @@ ConfigScreen.prototype.render = function () { alignSelf: 'center', }, onClick (event) { - exportAsFile('MetaMask State Logs', window.logState()) + window.logState((result) => { + exportAsFile('MetaMask State Logs', result) + }) }, }, 'Download State Logs'), ]), diff --git a/ui/app/reducers.js b/ui/app/reducers.js index 1224b4e92..385cafdfa 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -41,16 +41,17 @@ function rootReducer (state, action) { return state } -window.logState = function () { +window.logState = function (cb) { let state = window.METAMASK_CACHED_LOG_STATE const version = global.platform.getVersion() - const browser = window.navigator.userAgent() - const platform = global.platform.getPlatformInfo() - state.version = version - state.platform = platform - state.browser = browser - let stateString = JSON.stringify(state, removeSeedWords, 2) - return stateString + const browser = window.navigator.userAgent + return global.platform.getPlatformInfo((platform) => { + state.version = version + state.platform = platform + state.browser = browser + let stateString = JSON.stringify(state, removeSeedWords, 2) + return cb(stateString) + }) } function removeSeedWords (key, value) { -- cgit v1.2.3 From b158d7fea03a34cc48677d272b2a411b6bbe67ab Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 4 Oct 2017 11:00:52 -0700 Subject: Rename to maintain API --- ui/app/config.js | 2 +- ui/app/reducers.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'ui/app') diff --git a/ui/app/config.js b/ui/app/config.js index 9ba00b3dd..75c3bcf13 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -113,7 +113,7 @@ ConfigScreen.prototype.render = function () { alignSelf: 'center', }, onClick (event) { - window.logState((result) => { + window.logStateString((result) => { exportAsFile('MetaMask State Logs', result) }) }, diff --git a/ui/app/reducers.js b/ui/app/reducers.js index 385cafdfa..8ffd572c0 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -41,7 +41,7 @@ function rootReducer (state, action) { return state } -window.logState = function (cb) { +window.logStateString = function (cb) { let state = window.METAMASK_CACHED_LOG_STATE const version = global.platform.getVersion() const browser = window.navigator.userAgent @@ -54,6 +54,12 @@ window.logState = function (cb) { }) } +window.logState() = function () { + return window.logStateString((result) => { + return result + }) +} + function removeSeedWords (key, value) { return key === 'seedWords' ? undefined : value } -- cgit v1.2.3 From 52aee7aa9ed468186c3125d79d910df3a30dfed3 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 4 Oct 2017 11:07:16 -0700 Subject: Further adjustment to maintain API --- ui/app/reducers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/app') diff --git a/ui/app/reducers.js b/ui/app/reducers.js index 8ffd572c0..e7669b932 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -54,9 +54,9 @@ window.logStateString = function (cb) { }) } -window.logState() = function () { +window.logState = function () { return window.logStateString((result) => { - return result + console.log(result) }) } -- cgit v1.2.3 From bb9c2b3563938832e4b35b6623ef724017093fcb Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 4 Oct 2017 11:14:30 -0700 Subject: lint --- ui/app/reducers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/reducers.js b/ui/app/reducers.js index e7669b932..0af7ee81c 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -48,7 +48,7 @@ window.logStateString = function (cb) { return global.platform.getPlatformInfo((platform) => { state.version = version state.platform = platform - state.browser = browser + state.browser = browser let stateString = JSON.stringify(state, removeSeedWords, 2) return cb(stateString) }) -- cgit v1.2.3 From 24a55cf7770a6154fe723cf13cdc9998e1759f3b Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 10 Oct 2017 08:36:15 -0700 Subject: Make the function callback friendly. --- ui/app/config.js | 8 ++++++-- ui/app/reducers.js | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'ui/app') diff --git a/ui/app/config.js b/ui/app/config.js index 75c3bcf13..c14fa1d28 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -113,8 +113,12 @@ ConfigScreen.prototype.render = function () { alignSelf: 'center', }, onClick (event) { - window.logStateString((result) => { - exportAsFile('MetaMask State Logs', result) + window.logStateString((err, result) => { + if (err) { + state.dispatch(actions.displayWarning('Error in retrieving state logs.')) + } else { + exportAsFile('MetaMask State Logs', result) + } }) }, }, 'Download State Logs'), diff --git a/ui/app/reducers.js b/ui/app/reducers.js index 0af7ee81c..3d0a58f81 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -45,12 +45,15 @@ window.logStateString = function (cb) { let state = window.METAMASK_CACHED_LOG_STATE const version = global.platform.getVersion() const browser = window.navigator.userAgent - return global.platform.getPlatformInfo((platform) => { + return global.platform.getPlatformInfo((err, platform) => { + if (err) { + return cb(err) + } state.version = version state.platform = platform state.browser = browser let stateString = JSON.stringify(state, removeSeedWords, 2) - return cb(stateString) + return cb(null, stateString) }) } -- cgit v1.2.3 From 3deeb6df0b1335ed68a20734516f3bff790f84b1 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 26 Oct 2017 16:40:13 -0700 Subject: Add option to copy directly to clipboard. --- ui/app/reducers.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'ui/app') diff --git a/ui/app/reducers.js b/ui/app/reducers.js index 3d0a58f81..05136f70f 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -1,4 +1,5 @@ const extend = require('xtend') +const copyToClipboard = require('copy-to-clipboard') // // Sub-Reducers take in the complete state and return their sub-state @@ -57,9 +58,16 @@ window.logStateString = function (cb) { }) } -window.logState = function () { - return window.logStateString((result) => { - console.log(result) +window.logState = function (toClipboard) { + return window.logStateString((err, result) => { + if (err) { + console.error(err.message) + } else if (toClipboard) { + copyToClipboard(result) + console.log('State log copied') + } else { + console.log(result) + } }) } -- cgit v1.2.3 From 0bfa10e501f47197996002447a216f278d7e6eb5 Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Mon, 30 Oct 2017 20:04:44 +0100 Subject: Remove warning message when show import page Fixes: https://github.com/MetaMask/metamask-extension/issues/1192 --- ui/app/accounts/import/index.js | 1 + ui/app/reducers/app.js | 1 + 2 files changed, 2 insertions(+) (limited to 'ui/app') diff --git a/ui/app/accounts/import/index.js b/ui/app/accounts/import/index.js index 97b387229..46260c3e7 100644 --- a/ui/app/accounts/import/index.js +++ b/ui/app/accounts/import/index.js @@ -72,6 +72,7 @@ AccountImportSubview.prototype.render = function () { } }), onChange: (opt) => { + props.dispatch(actions.showImportPage()) this.setState({ type: opt.value }) }, }), diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 6f08c6dc4..8558d6dca 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -122,6 +122,7 @@ function reduceApp (state, action) { name: 'import-menu', }, transForward: true, + warning: null, }) case actions.SHOW_INFO_PAGE: -- cgit v1.2.3 From 657449916556d3e8db24dbfbf0355e84a9ea0b09 Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Mon, 30 Oct 2017 20:08:10 +0100 Subject: Use const and fix lint warnings --- ui/app/reducers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/app') diff --git a/ui/app/reducers.js b/ui/app/reducers.js index 05136f70f..70b7e71dc 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -43,7 +43,7 @@ function rootReducer (state, action) { } window.logStateString = function (cb) { - let state = window.METAMASK_CACHED_LOG_STATE + const state = window.METAMASK_CACHED_LOG_STATE const version = global.platform.getVersion() const browser = window.navigator.userAgent return global.platform.getPlatformInfo((err, platform) => { @@ -53,7 +53,7 @@ window.logStateString = function (cb) { state.version = version state.platform = platform state.browser = browser - let stateString = JSON.stringify(state, removeSeedWords, 2) + const stateString = JSON.stringify(state, removeSeedWords, 2) return cb(null, stateString) }) } -- cgit v1.2.3