diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-10-27 08:06:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-27 08:06:33 +0800 |
commit | 4ac198eebcf2ed8d57ecb8f1a67d36d448e5a4c3 (patch) | |
tree | c2b388389b032b92eb2c7e6e63ce06df212650b4 | |
parent | 19afb638194a11367250153a710d77011665132a (diff) | |
parent | 3deeb6df0b1335ed68a20734516f3bff790f84b1 (diff) | |
download | tangerine-wallet-browser-4ac198eebcf2ed8d57ecb8f1a67d36d448e5a4c3.tar tangerine-wallet-browser-4ac198eebcf2ed8d57ecb8f1a67d36d448e5a4c3.tar.gz tangerine-wallet-browser-4ac198eebcf2ed8d57ecb8f1a67d36d448e5a4c3.tar.bz2 tangerine-wallet-browser-4ac198eebcf2ed8d57ecb8f1a67d36d448e5a4c3.tar.lz tangerine-wallet-browser-4ac198eebcf2ed8d57ecb8f1a67d36d448e5a4c3.tar.xz tangerine-wallet-browser-4ac198eebcf2ed8d57ecb8f1a67d36d448e5a4c3.tar.zst tangerine-wallet-browser-4ac198eebcf2ed8d57ecb8f1a67d36d448e5a4c3.zip |
Merge pull request #2275 from MetaMask/version-debugging
Add OS Version and Browser Version to State Logs
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | app/scripts/platforms/extension.js | 9 | ||||
-rw-r--r-- | ui/app/config.js | 8 | ||||
-rw-r--r-- | ui/app/reducers.js | 39 |
4 files changed, 45 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 573627917..ee9548606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Add support for alternative ENS TLDs (Ethereum Name Service Top-Level Domains). - Lower minimum gas price to 0.1 GWEI. - Remove web3 injection message from production (thanks to @ChainsawBaby) +- Add additional debugging info to our state logs, specifically OS version and browser version. ## 3.11.2 2017-10-21 diff --git a/app/scripts/platforms/extension.js b/app/scripts/platforms/extension.js index 0afe04b74..2f47512eb 100644 --- a/app/scripts/platforms/extension.js +++ b/app/scripts/platforms/extension.js @@ -17,6 +17,15 @@ class ExtensionPlatform { return extension.runtime.getManifest().version } + getPlatformInfo (cb) { + try { + extension.runtime.getPlatformInfo((platform) => { + cb(null, platform) + }) + } catch (e) { + cb(e) + } + } } module.exports = ExtensionPlatform diff --git a/ui/app/config.js b/ui/app/config.js index 0fe232c07..c14fa1d28 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -113,7 +113,13 @@ ConfigScreen.prototype.render = function () { alignSelf: 'center', }, onClick (event) { - exportAsFile('MetaMask State Logs', window.logState()) + 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 e1a890535..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 @@ -41,17 +42,33 @@ function rootReducer (state, action) { return state } -window.logState = function () { - const state = window.METAMASK_CACHED_LOG_STATE - let version - try { - version = global.platform.getVersion() - } catch (e) { - version = 'unable to load version.' - } - state.version = version - const stateString = JSON.stringify(state, removeSeedWords, 2) - return stateString +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((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(null, stateString) + }) +} + +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) + } + }) } function removeSeedWords (key, value) { |