aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2018-06-05 05:21:46 +0800
committerDan Finlay <dan@danfinlay.com>2018-06-05 05:21:46 +0800
commitfd1ce4d741cc5992cc5d3d6109dc46cddf871ec2 (patch)
tree36eebb0cadf2434bbb18e64eb0b6a6abb9bfa35e /app/scripts/controllers
parent8fcaa2cf56936388ef8dfc528ecbd2354adb201e (diff)
downloadtangerine-wallet-browser-fd1ce4d741cc5992cc5d3d6109dc46cddf871ec2.tar
tangerine-wallet-browser-fd1ce4d741cc5992cc5d3d6109dc46cddf871ec2.tar.gz
tangerine-wallet-browser-fd1ce4d741cc5992cc5d3d6109dc46cddf871ec2.tar.bz2
tangerine-wallet-browser-fd1ce4d741cc5992cc5d3d6109dc46cddf871ec2.tar.lz
tangerine-wallet-browser-fd1ce4d741cc5992cc5d3d6109dc46cddf871ec2.tar.xz
tangerine-wallet-browser-fd1ce4d741cc5992cc5d3d6109dc46cddf871ec2.tar.zst
tangerine-wallet-browser-fd1ce4d741cc5992cc5d3d6109dc46cddf871ec2.zip
Begin adding unconfigured notifier
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r--app/scripts/controllers/preferences.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js
index 38e93dea8..f822f61c5 100644
--- a/app/scripts/controllers/preferences.js
+++ b/app/scripts/controllers/preferences.js
@@ -1,6 +1,8 @@
const ObservableStore = require('obs-store')
const normalizeAddress = require('eth-sig-util').normalize
const extend = require('xtend')
+const BugNotifier = require('../lib/bug-notifier')
+const notifier = new BugNotifier()
class PreferencesController {
@@ -30,6 +32,7 @@ class PreferencesController {
identities: {},
lostIdentities: {},
}, opts.initState)
+
this.store = new ObservableStore(initState)
}
// PUBLIC METHODS
@@ -108,17 +111,27 @@ class PreferencesController {
*/
syncAddresses (addresses) {
let { identities, lostIdentities } = this.store.getState()
-
Object.keys(identities).forEach((identity) => {
if (!addresses.includes(identity)) {
delete identities[identity]
lostIdentities[identity] = identities[identity]
-
- // TODO: Report the bug to Sentry including the now-lost identity.
- alert('Error 4486: MetaMask has encountered a very strange error. Please open a support issue immediately at support@metamask.io.')
}
})
+ // Identities are no longer present.
+ if (Object.keys(lostIdentities).length > 0) {
+
+ // timeout to prevent blocking the thread:
+ setTimeout(() => {
+ alert('Error 4486: MetaMask has encountered a very strange error. Please open a support issue immediately at support@metamask.io.')
+ }, 10)
+
+ // Notify our servers:
+ const uri =
+ notifier.notify(uri, { accounts: Object.keys(lostIdentities) })
+ .catch(log.error)
+ }
+
this.store.updateState({ identities, lostIdentities })
this.addAddresses(addresses)