aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/preferences.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-06-07 03:10:43 +0800
committerDan <danjm.com@gmail.com>2018-06-07 03:10:43 +0800
commitae55e8a3c122a3f6d91e28153124bfb6a13ded84 (patch)
treeb23043409b2877bce4096d411f3c3273a610b146 /app/scripts/controllers/preferences.js
parentaee9247faab984734d2f0278baaf768e2a7926d2 (diff)
parent1fb408f62eb081311937420bb42da6c835510590 (diff)
downloadtangerine-wallet-browser-ae55e8a3c122a3f6d91e28153124bfb6a13ded84.tar.gz
tangerine-wallet-browser-ae55e8a3c122a3f6d91e28153124bfb6a13ded84.tar.zst
tangerine-wallet-browser-ae55e8a3c122a3f6d91e28153124bfb6a13ded84.zip
Merge branch 'develop' into i3725-refactor-send-component-
Diffstat (limited to 'app/scripts/controllers/preferences.js')
-rw-r--r--app/scripts/controllers/preferences.js20
1 files changed, 5 insertions, 15 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js
index 2fe009f9a..8411e3a28 100644
--- a/app/scripts/controllers/preferences.js
+++ b/app/scripts/controllers/preferences.js
@@ -1,9 +1,7 @@
const ObservableStore = require('obs-store')
const normalizeAddress = require('eth-sig-util').normalize
const extend = require('xtend')
-const notifier = require('../lib/bug-notifier')
-const log = require('loglevel')
-const { version } = require('../../manifest.json')
+
class PreferencesController {
@@ -34,8 +32,7 @@ class PreferencesController {
lostIdentities: {},
}, opts.initState)
- this.getFirstTimeInfo = opts.getFirstTimeInfo || null
- this.notifier = opts.notifier || notifier
+ this.diagnostics = opts.diagnostics
this.store = new ObservableStore(initState)
}
@@ -128,17 +125,9 @@ class PreferencesController {
if (Object.keys(newlyLost).length > 0) {
// Notify our servers:
- const uri = 'https://diagnostics.metamask.io/v1/orphanedAccounts'
- const firstTimeInfo = this.getFirstTimeInfo ? this.getFirstTimeInfo() : {}
- this.notifier.notify(uri, {
- accounts: Object.keys(newlyLost),
- metadata: {
- version,
- firstTimeInfo,
- },
- })
- .catch(log.error)
+ if (this.diagnostics) this.diagnostics.reportOrphans(newlyLost)
+ // store lost accounts
for (let key in newlyLost) {
lostIdentities[key] = newlyLost[key]
}
@@ -258,6 +247,7 @@ class PreferencesController {
* @return {Promise<string>}
*/
setAccountLabel (account, label) {
+ if (!account) throw new Error('setAccountLabel requires a valid address, got ' + String(account))
const address = normalizeAddress(account)
const {identities} = this.store.getState()
identities[address] = identities[address] || {}