diff options
author | Dan J Miller <danjm.com@gmail.com> | 2017-12-21 02:22:50 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@users.noreply.github.com> | 2017-12-21 02:22:50 +0800 |
commit | bccbf14b39ab2b1670c9c30b276404fe4f949cd7 (patch) | |
tree | 64ca0324e8695a85460158aade2a7bd135dcb419 /ui/app/select-app.js | |
parent | 109e4e5d96e31b52fcfdb22620bff113107d000c (diff) | |
download | tangerine-wallet-browser-bccbf14b39ab2b1670c9c30b276404fe4f949cd7.tar tangerine-wallet-browser-bccbf14b39ab2b1670c9c30b276404fe4f949cd7.tar.gz tangerine-wallet-browser-bccbf14b39ab2b1670c9c30b276404fe4f949cd7.tar.bz2 tangerine-wallet-browser-bccbf14b39ab2b1670c9c30b276404fe4f949cd7.tar.lz tangerine-wallet-browser-bccbf14b39ab2b1670c9c30b276404fe4f949cd7.tar.xz tangerine-wallet-browser-bccbf14b39ab2b1670c9c30b276404fe4f949cd7.tar.zst tangerine-wallet-browser-bccbf14b39ab2b1670c9c30b276404fe4f949cd7.zip |
[NewUI] Hide UI toggle in mascara (#2772)
* Hides old-UI on mascara.
* Improve code clarity in select-app.js
Diffstat (limited to 'ui/app/select-app.js')
-rw-r--r-- | ui/app/select-app.js | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/ui/app/select-app.js b/ui/app/select-app.js index 3ea93ced3..a51182f47 100644 --- a/ui/app/select-app.js +++ b/ui/app/select-app.js @@ -12,35 +12,40 @@ function mapStateToProps (state) { betaUI: state.metamask.featureFlags.betaUI, autoAdd: autoAddToBetaUI(state), isUnlocked: state.metamask.isUnlocked, + isMascara: state.metamask.isMascara, } } function mapDispatchToProps (dispatch) { return { - setFeatureFlagToBeta: () => dispatch(setFeatureFlag('betaUI', true)), + setFeatureFlagWithModal: () => dispatch(setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL')), + setFeatureFlagWithoutModal: () => dispatch(setFeatureFlag('betaUI', true)), } } module.exports = connect(mapStateToProps, mapDispatchToProps)(SelectedApp) inherits(SelectedApp, Component) function SelectedApp () { - this.state = { - autoAdd: false, - } Component.call(this) } SelectedApp.prototype.componentWillReceiveProps = function (nextProps) { - const { isUnlocked, setFeatureFlagToBeta } = this.props + const { + isUnlocked, + setFeatureFlagWithModal, + setFeatureFlagWithoutModal, + isMascara, + } = this.props - if (!isUnlocked && nextProps.isUnlocked && nextProps.autoAdd) { - this.setState({ autoAdd: nextProps.autoAdd }) - setFeatureFlagToBeta() + if (isMascara) { + setFeatureFlagWithoutModal() + } else if (!isUnlocked && nextProps.isUnlocked && (nextProps.autoAdd)) { + setFeatureFlagWithModal() } } SelectedApp.prototype.render = function () { - const { betaUI } = this.props - const Selected = betaUI ? App : OldApp + const { betaUI, isMascara } = this.props + const Selected = betaUI || isMascara ? App : OldApp return h(Selected) } |