aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-10-06 10:34:01 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-10-09 08:48:09 +0800
commit49f76d27a9967cbeff0ba5b3d41277c558999472 (patch)
tree33acbd312cdb634ef3b2e7c22336d7404dc912ca /ui
parentbbe893a0d8d759ba750ba78ff8aed0f0876a43ff (diff)
downloadtangerine-wallet-browser-49f76d27a9967cbeff0ba5b3d41277c558999472.tar
tangerine-wallet-browser-49f76d27a9967cbeff0ba5b3d41277c558999472.tar.gz
tangerine-wallet-browser-49f76d27a9967cbeff0ba5b3d41277c558999472.tar.bz2
tangerine-wallet-browser-49f76d27a9967cbeff0ba5b3d41277c558999472.tar.lz
tangerine-wallet-browser-49f76d27a9967cbeff0ba5b3d41277c558999472.tar.xz
tangerine-wallet-browser-49f76d27a9967cbeff0ba5b3d41277c558999472.tar.zst
tangerine-wallet-browser-49f76d27a9967cbeff0ba5b3d41277c558999472.zip
Adds checkFeatureToggle util.
Diffstat (limited to 'ui')
-rw-r--r--ui/app/app.js6
-rw-r--r--ui/lib/feature-toggle-utils.js11
2 files changed, 13 insertions, 4 deletions
diff --git a/ui/app/app.js b/ui/app/app.js
index ac017da05..fb57775b6 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -2,6 +2,7 @@ const inherits = require('util').inherits
const Component = require('react').Component
const connect = require('react-redux').connect
const h = require('react-hyperscript')
+const { checkFeatureToggle } = require('../lib/feature-toggle-utils')
const actions = require('./actions')
// init
const InitializeMenuScreen = require('./first-time/init-menu')
@@ -334,11 +335,8 @@ App.prototype.renderPrimary = function () {
case 'sendTransaction':
log.debug('rendering send tx screen')
- // Below param and ternary operator used for feature toggle
- // Remove before merged to master
- const windowParam = window.location.search.substr(1).split('=')
- const SendComponentToRender = windowParam[0] === "ft" && windowParam[1] === "send-v2"
+ const SendComponentToRender = checkFeatureToggle('send-v2')
? SendTransactionScreen2
: SendTransactionScreen
diff --git a/ui/lib/feature-toggle-utils.js b/ui/lib/feature-toggle-utils.js
new file mode 100644
index 000000000..f4ff446d3
--- /dev/null
+++ b/ui/lib/feature-toggle-utils.js
@@ -0,0 +1,11 @@
+function checkFeatureToggle(name) {
+ const queryPairMap = window.location.search.substr(1).split('&')
+ .map(pair => pair.split('='))
+ .reduce((pairs, [key, value]) => ({...pairs, [key]: value }), {})
+ const featureToggles = queryPairMap['ft'] ? queryPairMap['ft'].split(',') : []
+ return Boolean(featureToggles.find(ft => ft === name))
+}
+
+module.exports = {
+ checkFeatureToggle,
+} \ No newline at end of file