mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Adds checkFeatureToggle util.
This commit is contained in:
parent
bbe893a0d8
commit
49f76d27a9
@ -2,6 +2,7 @@ const inherits = require('util').inherits
|
|||||||
const Component = require('react').Component
|
const Component = require('react').Component
|
||||||
const connect = require('react-redux').connect
|
const connect = require('react-redux').connect
|
||||||
const h = require('react-hyperscript')
|
const h = require('react-hyperscript')
|
||||||
|
const { checkFeatureToggle } = require('../lib/feature-toggle-utils')
|
||||||
const actions = require('./actions')
|
const actions = require('./actions')
|
||||||
// init
|
// init
|
||||||
const InitializeMenuScreen = require('./first-time/init-menu')
|
const InitializeMenuScreen = require('./first-time/init-menu')
|
||||||
@ -334,11 +335,8 @@ App.prototype.renderPrimary = function () {
|
|||||||
|
|
||||||
case 'sendTransaction':
|
case 'sendTransaction':
|
||||||
log.debug('rendering send tx screen')
|
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
|
? SendTransactionScreen2
|
||||||
: SendTransactionScreen
|
: SendTransactionScreen
|
||||||
|
|
||||||
|
11
ui/lib/feature-toggle-utils.js
Normal file
11
ui/lib/feature-toggle-utils.js
Normal file
@ -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,
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user