From aa833a09281960bfc0af5032034021c25c26a7fd Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Mon, 15 Jan 2018 17:53:44 -0330 Subject: [PATCH] [NewUI] Place all users of extension into old UI (disable auto adding). (#2946) * Place all users of extension into old UI (disable auto adding). * Fix lint errors. --- app/scripts/popup.js | 10 ++++++--- ui/app/select-app.js | 53 +++++++++++++++++++++++++------------------- yarn.lock | 42 +++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 26 deletions(-) diff --git a/app/scripts/popup.js b/app/scripts/popup.js index 97a29fb1a..1a2e425dc 100644 --- a/app/scripts/popup.js +++ b/app/scripts/popup.js @@ -26,11 +26,15 @@ const container = document.getElementById('app-content') startPopup({ container, connectionStream }, (err, store) => { if (err) return displayCriticalError(err) - const { isMascara, identities = {}, featureFlags = {} } = store.getState().metamask - const firstTime = Object.keys(identities).length === 0 + // Code commented out until we begin auto adding users to NewUI + // const { isMascara, identities = {}, featureFlags = {} } = store.getState().metamask + // const firstTime = Object.keys(identities).length === 0 + const { isMascara, featureFlags = {} } = store.getState().metamask let betaUIState = featureFlags.betaUI - const useBetaCss = isMascara || firstTime || betaUIState + // Code commented out until we begin auto adding users to NewUI + // const useBetaCss = isMascara || firstTime || betaUIState + const useBetaCss = isMascara || betaUIState let css = useBetaCss ? NewMetaMaskUiCss() : OldMetaMaskUiCss() let deleteInjectedCss = injectCss(css) diff --git a/ui/app/select-app.js b/ui/app/select-app.js index ac6867aeb..193c98353 100644 --- a/ui/app/select-app.js +++ b/ui/app/select-app.js @@ -9,13 +9,13 @@ const { setFeatureFlag, setNetworkEndpoints } = require('./actions') const { BETA_UI_NETWORK_TYPE } = require('../../app/scripts/config').enums function mapStateToProps (state) { - return { - betaUI: state.metamask.featureFlags.betaUI, - autoAdd: autoAddToBetaUI(state), - isUnlocked: state.metamask.isUnlocked, - isMascara: state.metamask.isMascara, - firstTime: Object.keys(state.metamask.identities).length === 0, - } + return { + betaUI: state.metamask.featureFlags.betaUI, + autoAdd: autoAddToBetaUI(state), + isUnlocked: state.metamask.isUnlocked, + isMascara: state.metamask.isMascara, + firstTime: Object.keys(state.metamask.identities).length === 0, + } } function mapDispatchToProps (dispatch) { @@ -34,28 +34,35 @@ module.exports = connect(mapStateToProps, mapDispatchToProps)(SelectedApp) inherits(SelectedApp, Component) function SelectedApp () { - Component.call(this) + Component.call(this) } SelectedApp.prototype.componentWillReceiveProps = function (nextProps) { - const { - isUnlocked, - setFeatureFlagWithModal, - setFeatureFlagWithoutModal, - isMascara, - firstTime, - } = this.props - - if (isMascara || firstTime) { - setFeatureFlagWithoutModal() - } else if (!isUnlocked && nextProps.isUnlocked && (nextProps.autoAdd)) { - setFeatureFlagWithModal() - } + // Code commented out until we begin auto adding users to NewUI + const { + // isUnlocked, + // setFeatureFlagWithModal, + setFeatureFlagWithoutModal, + isMascara, + // firstTime, + } = this.props + + // if (isMascara || firstTime) { + if (isMascara) { + setFeatureFlagWithoutModal() + } + // } else if (!isUnlocked && nextProps.isUnlocked && (nextProps.autoAdd)) { + // setFeatureFlagWithModal() + // } } SelectedApp.prototype.render = function () { - const { betaUI, isMascara, firstTime } = this.props + // Code commented out until we begin auto adding users to NewUI + // const { betaUI, isMascara, firstTime } = this.props + // const Selected = betaUI || isMascara || firstTime ? App : OldApp + + const { betaUI, isMascara } = this.props + const Selected = betaUI || isMascara ? App : OldApp - const Selected = betaUI || isMascara || firstTime ? App : OldApp return h(Selected) } diff --git a/yarn.lock b/yarn.lock index f9c705843..41e718157 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2363,6 +2363,10 @@ commander@^2.5.0, commander@^2.6.0, commander@^2.9.0, commander@~2.12.1: version "2.12.2" resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.2.tgz#0f5946c427ed9ec0d91a46bb9def53e54650e555" +commander@~2.13.0: + version "2.13.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" + commondir@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-0.0.1.tgz#89f00fdcd51b519c578733fec563e6a6da7f5be2" @@ -5006,6 +5010,15 @@ gulp-autoprefixer@^4.0.0: through2 "^2.0.0" vinyl-sourcemaps-apply "^0.2.0" +gulp-babel@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/gulp-babel/-/gulp-babel-7.0.0.tgz#7b93c975159f7a0553e4263b4a55100ccc239b28" + dependencies: + gulp-util "^3.0.0" + replace-ext "0.0.1" + through2 "^2.0.0" + vinyl-sourcemaps-apply "^0.2.0" + gulp-cli@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/gulp-cli/-/gulp-cli-2.0.0.tgz#7f049ad298ed388cda9bd813b5d7062407d62cad" @@ -5128,6 +5141,18 @@ gulp-stylelint@^4.0.0: stylelint "^8.0.0" through2 "^2.0.3" +gulp-uglify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-3.0.0.tgz#0df0331d72a0d302e3e37e109485dddf33c6d1ca" + dependencies: + gulplog "^1.0.0" + has-gulplog "^0.1.0" + lodash "^4.13.1" + make-error-cause "^1.1.1" + through2 "^2.0.0" + uglify-js "^3.0.5" + vinyl-sourcemaps-apply "^0.2.0" + gulp-util@^3.0, gulp-util@^3.0.0, gulp-util@^3.0.2, gulp-util@^3.0.7, gulp-util@^3.0.8, gulp-util@~3.0.0: version "3.0.8" resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f" @@ -6912,6 +6937,16 @@ ltgt@~2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.0.tgz#b65ba5fcb349a29924c8e333f7c6a5562f2e4842" +make-error-cause@^1.1.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/make-error-cause/-/make-error-cause-1.2.2.tgz#df0388fcd0b37816dff0a5fb8108939777dcbc9d" + dependencies: + make-error "^1.2.0" + +make-error@^1.2.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.2.tgz#8762ffad2444dd8ff1f7c819629fa28e24fea1c4" + make-iterator@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.0.tgz#57bef5dc85d23923ba23767324d8e8f8f3d9694b" @@ -10836,6 +10871,13 @@ uglify-js@^2.6, uglify-js@^2.8.27: optionalDependencies: uglify-to-browserify "~1.0.0" +uglify-js@^3.0.5: + version "3.3.7" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.3.7.tgz#28463e7c7451f89061d2b235e30925bf5625e14d" + dependencies: + commander "~2.13.0" + source-map "~0.6.1" + uglify-to-browserify@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"