aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/selectors.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-12-07 08:19:45 +0800
committerDan <danjm.com@gmail.com>2017-12-07 08:19:45 +0800
commitbd5ce9461e5119c13ab8be29db5cdfc57228bac8 (patch)
tree1972f49872559ef55f07ea72e3ce39350e8e8d1f /ui/app/selectors.js
parent9db00fa507c04180f6425cc3b1e3187afa193ab8 (diff)
downloadtangerine-wallet-browser-bd5ce9461e5119c13ab8be29db5cdfc57228bac8.tar.gz
tangerine-wallet-browser-bd5ce9461e5119c13ab8be29db5cdfc57228bac8.tar.zst
tangerine-wallet-browser-bd5ce9461e5119c13ab8be29db5cdfc57228bac8.zip
User is automatically added to new UI if they meet conditions at time of login.
Diffstat (limited to 'ui/app/selectors.js')
-rw-r--r--ui/app/selectors.js18
1 files changed, 18 insertions, 0 deletions
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