aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/actions.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r--ui/app/actions.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index e79f4373e..745b8779e 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -237,6 +237,11 @@ var actions = {
SET_USE_BLOCKIE: 'SET_USE_BLOCKIE',
setUseBlockie,
+
+ // Feature Flags
+ setFeatureFlag,
+ updateFeatureFlags,
+ UPDATE_FEATURE_FLAGS: 'UPDATE_FEATURE_FLAGS',
}
module.exports = actions
@@ -1506,6 +1511,30 @@ function updateTokenExchangeRate (token = '') {
}
}
+function setFeatureFlag (feature, activated) {
+ return (dispatch) => {
+ dispatch(actions.showLoadingIndication())
+ return new Promise((resolve, reject) => {
+ background.setFeatureFlag(feature, activated, (err, updatedFeatureFlags) => {
+ dispatch(actions.hideLoadingIndication())
+ if (err) {
+ dispatch(actions.displayWarning(err.message))
+ reject(err)
+ }
+ dispatch(actions.updateFeatureFlags(updatedFeatureFlags))
+ resolve(updatedFeatureFlags)
+ })
+ })
+ }
+}
+
+function updateFeatureFlags (updatedFeatureFlags) {
+ return {
+ type: actions.UPDATE_FEATURE_FLAGS,
+ value: updatedFeatureFlags,
+ }
+}
+
// Call Background Then Update
//
// A function generator for a common pattern wherein: