From bd5ce9461e5119c13ab8be29db5cdfc57228bac8 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 6 Dec 2017 20:49:45 -0330 Subject: User is automatically added to new UI if they meet conditions at time of login. --- ui/app/selectors.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'ui/app/selectors.js') diff --git a/ui/app/selectors.js b/ui/app/selectors.js index a5f9a75d8..8aea7864a 100644 --- a/ui/app/selectors.js +++ b/ui/app/selectors.js @@ -24,6 +24,7 @@ const selectors = { getSendAmount, getSelectedTokenToFiatRate, getSelectedTokenContract, + autoAddToBetaUI, } module.exports = selectors @@ -158,3 +159,20 @@ function getSelectedTokenContract (state) { ? global.eth.contract(abi).at(selectedToken.address) : null } + +function autoAddToBetaUI (state) { + const autoAddTransactionThreshold = 12 + const autoAddAccountsThreshold = 2 + const autoAddTokensThreshold = 1 + + const numberOfTransactions = state.metamask.selectedAddressTxList.length + const numberOfAccounts = Object.keys(state.metamask.accounts).length + const numberOfTokensAdded = state.metamask.tokens.length + + const userPassesThreshold = (numberOfTransactions > autoAddTransactionThreshold) && + (numberOfAccounts > autoAddAccountsThreshold) && + (numberOfTokensAdded > autoAddTokensThreshold) + const userIsNotInBeta = !state.metamask.featureFlags.betaUI + + return userIsNotInBeta && userPassesThreshold +} \ No newline at end of file -- cgit v1.2.3