aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers
diff options
context:
space:
mode:
authorDan Finlay <542863+danfinlay@users.noreply.github.com>2019-02-26 03:10:13 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2019-02-26 03:10:13 +0800
commitf507f2a92710285679123c9429a37c9e330c7cac (patch)
tree30225a55e9d8fc273304f4e2548413a08f008aef /app/scripts/controllers
parentfdc7eb211340b3af035a7f7c023155a8f1b1675d (diff)
downloadtangerine-wallet-browser-f507f2a92710285679123c9429a37c9e330c7cac.tar
tangerine-wallet-browser-f507f2a92710285679123c9429a37c9e330c7cac.tar.gz
tangerine-wallet-browser-f507f2a92710285679123c9429a37c9e330c7cac.tar.bz2
tangerine-wallet-browser-f507f2a92710285679123c9429a37c9e330c7cac.tar.lz
tangerine-wallet-browser-f507f2a92710285679123c9429a37c9e330c7cac.tar.xz
tangerine-wallet-browser-f507f2a92710285679123c9429a37c9e330c7cac.tar.zst
tangerine-wallet-browser-f507f2a92710285679123c9429a37c9e330c7cac.zip
Feature Flag + Mobile Sync (#5955)
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r--app/scripts/controllers/preferences.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js
index 565f4f292..584b6bc51 100644
--- a/app/scripts/controllers/preferences.js
+++ b/app/scripts/controllers/preferences.js
@@ -18,7 +18,9 @@ class PreferencesController {
* @property {object} store.assetImages Contains assets objects related to assets added
* @property {boolean} store.useBlockie The users preference for blockie identicons within the UI
* @property {object} store.featureFlags A key-boolean map, where keys refer to features and booleans to whether the
- * user wishes to see that feature
+ * user wishes to see that feature.
+ *
+ * Feature flags can be set by the global function `setPreference(feature, enabled)`, and so should not expose any sensitive behavior.
* @property {object} store.knownMethodData Contains all data methods known by the user
* @property {string} store.currentLocale The preferred language locale key
* @property {string} store.selectedAddress A hex string that matches the currently selected address in the app
@@ -33,6 +35,11 @@ class PreferencesController {
tokens: [],
suggestedTokens: {},
useBlockie: false,
+
+ // WARNING: Do not use feature flags for security-sensitive things.
+ // Feature flag toggling is available in the global namespace
+ // for convenient testing of pre-release features, and should never
+ // perform sensitive operations.
featureFlags: {},
knownMethodData: {},
currentLocale: opts.initLangCode,
@@ -52,6 +59,10 @@ class PreferencesController {
this.store = new ObservableStore(initState)
this.openPopup = opts.openPopup
this._subscribeProviderType()
+
+ global.setPreference = (key, value) => {
+ return this.setFeatureFlag(key, value)
+ }
}
// PUBLIC METHODS