diff --git a/CHANGELOG.md b/CHANGELOG.md index e06195956681..4b6226b850a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ## 7.7.9 Tue Apr 28 2020 - [#8446](https://github.com/MetaMask/metamask-extension/pull/8446): Fix popup not opening - [#8449](https://github.com/MetaMask/metamask-extension/pull/8449): Skip adding history entry for empty txMeta diffs +- [#8447](https://github.com/MetaMask/metamask-extension/pull/8447): Delete Dai/Sai migration notification ## 7.7.8 Wed Mar 11 2020 - [#8176](https://github.com/MetaMask/metamask-extension/pull/8176): Handle and set gas estimation when max mode is clicked diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 73c59555eb46..052229bfe1ea 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -1,13 +1,4 @@ { - "migrateSai": { - "message": "A message from Maker: The new Multi-Collateral Dai token has been released. Your old tokens are now called Sai. Please upgrade your Sai tokens to the new Dai." - }, - "migrateSaiInfo": { - "message": "To dismiss this notification you can migrate your tokens or hide SAI from the token list." - }, - "migrate": { - "message": "Migrate" - }, "showIncomingTransactions": { "message": "Show Incoming Transactions" }, diff --git a/app/scripts/controllers/app-state.js b/app/scripts/controllers/app-state.js index c60a1c4f5065..32866888a5e6 100644 --- a/app/scripts/controllers/app-state.js +++ b/app/scripts/controllers/app-state.js @@ -13,7 +13,6 @@ class AppStateController { this.onInactiveTimeout = onInactiveTimeout || (() => {}) this.store = new ObservableStore(extend({ timeoutMinutes: 0, - mkrMigrationReminderTimestamp: null, }, initState)) this.timer = null @@ -24,12 +23,6 @@ class AppStateController { this._setInactiveTimeout(preferences.autoLogoutTimeLimit) } - setMkrMigrationReminderTimestamp (timestamp) { - this.store.updateState({ - mkrMigrationReminderTimestamp: timestamp, - }) - } - /** * Sets the last active time to the current time * @return {void} diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index bd31705cbdb3..9eb46a40e518 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -509,7 +509,6 @@ module.exports = class MetamaskController extends EventEmitter { // AppStateController setLastActiveTime: nodeify(this.appStateController.setLastActiveTime, this.appStateController), - setMkrMigrationReminderTimestamp: nodeify(this.appStateController.setMkrMigrationReminderTimestamp, this.appStateController), // EnsController tryReverseResolveAddress: nodeify(this.ensController.reverseResolveAddress, this.ensController), diff --git a/ui/app/components/app/dai-migration-component/dai-migration-notification.component.js b/ui/app/components/app/dai-migration-component/dai-migration-notification.component.js deleted file mode 100644 index d26358df7367..000000000000 --- a/ui/app/components/app/dai-migration-component/dai-migration-notification.component.js +++ /dev/null @@ -1,78 +0,0 @@ -import { DateTime } from 'luxon' -import React, { PureComponent } from 'react' -import PropTypes from 'prop-types' -import HomeNotification from '../home-notification' - -export default class DaiV1MigrationNotification extends PureComponent { - static contextTypes = { - t: PropTypes.func, - } - - static defaultProps = { - mkrMigrationReminderTimestamp: null, - string: '', - symbol: '', - } - - static propTypes = { - setMkrMigrationReminderTimestamp: PropTypes.func.isRequired, - mkrMigrationReminderTimestamp: PropTypes.string, - string: PropTypes.string, - symbol: PropTypes.string, - } - - remindMeLater = () => { - const nextWeek = DateTime.utc().plus({ - days: 7, - }) - this.props.setMkrMigrationReminderTimestamp(nextWeek.toString()) - } - - render () { - const { t } = this.context - const { mkrMigrationReminderTimestamp, string: balanceString, symbol } = this.props - - if (mkrMigrationReminderTimestamp) { - const reminderDateTime = DateTime.fromISO(mkrMigrationReminderTimestamp, { - zone: 'UTC', - }) - if (reminderDateTime > DateTime.utc()) { - return null - } - } - - if (!balanceString || !symbol) { - return null - } - - if (balanceString === '0') { - return null - } - - return ( - - {t('migrateSai')} -   - { - window.open('https://blog.makerdao.com/multi-collateral-dai-is-live/', '_blank', 'noopener') - }} - > - {t('learnMore')}. - - - )} - acceptText={t('migrate')} - onAccept={() => { - window.open('https://migrate.makerdao.com', '_blank', 'noopener') - }} - ignoreText={t('remindMeLater')} - onIgnore={this.remindMeLater} - infoText={t('migrateSaiInfo')} - /> - ) - } -} diff --git a/ui/app/components/app/dai-migration-component/dai-migration-notification.container.js b/ui/app/components/app/dai-migration-component/dai-migration-notification.container.js deleted file mode 100644 index 175083bce982..000000000000 --- a/ui/app/components/app/dai-migration-component/dai-migration-notification.container.js +++ /dev/null @@ -1,34 +0,0 @@ -import { connect } from 'react-redux' -import { compose } from 'recompose' -import DaiMigrationNotification from './dai-migration-notification.component' -import withTokenTracker from '../../../helpers/higher-order-components/with-token-tracker' -import { getSelectedAddress, getDaiV1Token } from '../../../selectors/selectors' -import { setMkrMigrationReminderTimestamp } from '../../../store/actions' - -const mapStateToProps = (state) => { - const { - metamask: { - mkrMigrationReminderTimestamp, - }, - } = state - - const userAddress = getSelectedAddress(state) - const oldDai = getDaiV1Token(state) - - return { - mkrMigrationReminderTimestamp, - userAddress, - token: oldDai, - } -} - -const mapDispatchToProps = (dispatch) => { - return { - setMkrMigrationReminderTimestamp: (t) => dispatch(setMkrMigrationReminderTimestamp(t)), - } -} - -export default compose( - connect(mapStateToProps, mapDispatchToProps), - withTokenTracker, -)(DaiMigrationNotification) diff --git a/ui/app/components/app/dai-migration-component/index.js b/ui/app/components/app/dai-migration-component/index.js deleted file mode 100644 index e3c7cec2bab3..000000000000 --- a/ui/app/components/app/dai-migration-component/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './dai-migration-notification.container' diff --git a/ui/app/pages/home/home.component.js b/ui/app/pages/home/home.component.js index e51c8217798a..f08a0bb47fda 100644 --- a/ui/app/pages/home/home.component.js +++ b/ui/app/pages/home/home.component.js @@ -4,7 +4,6 @@ import Media from 'react-media' import { Redirect } from 'react-router-dom' import { formatDate } from '../../helpers/utils/util' import HomeNotification from '../../components/app/home-notification' -import DaiMigrationNotification from '../../components/app/dai-migration-component' import MultipleNotifications from '../../components/app/multiple-notifications' import WalletView from '../../components/app/wallet-view' import TransactionView from '../../components/app/transaction-view' @@ -24,7 +23,6 @@ export default class Home extends PureComponent { static defaultProps = { unsetMigratedPrivacyMode: null, - hasDaiV1Token: false, } static propTypes = { @@ -45,7 +43,6 @@ export default class Home extends PureComponent { restoreFromThreeBox: PropTypes.func, setShowRestorePromptToFalse: PropTypes.func, threeBoxLastUpdated: PropTypes.number, - hasDaiV1Token: PropTypes.bool, } componentWillMount () { @@ -89,7 +86,6 @@ export default class Home extends PureComponent { forgottenPassword, providerRequests, history, - hasDaiV1Token, showPrivacyModeNotification, unsetMigratedPrivacyMode, shouldShowSeedPhraseReminder, @@ -176,11 +172,6 @@ export default class Home extends PureComponent { /> : null } - { - hasDaiV1Token - ? - : null - } ) diff --git a/ui/app/pages/home/home.container.js b/ui/app/pages/home/home.container.js index 4a2106a55b91..1bac780afeb8 100644 --- a/ui/app/pages/home/home.container.js +++ b/ui/app/pages/home/home.container.js @@ -3,7 +3,7 @@ import { compose } from 'recompose' import { connect } from 'react-redux' import { withRouter } from 'react-router-dom' import { unconfirmedTransactionsCountSelector } from '../../selectors/confirm-transaction' -import { getCurrentEthBalance, getDaiV1Token } from '../../selectors/selectors' +import { getCurrentEthBalance } from '../../selectors/selectors' import { unsetMigratedPrivacyMode, restoreFromThreeBox, @@ -44,7 +44,6 @@ const mapStateToProps = state => { showRestorePrompt, selectedAddress, threeBoxLastUpdated, - hasDaiV1Token: Boolean(getDaiV1Token(state)), } } diff --git a/ui/app/selectors/selectors.js b/ui/app/selectors/selectors.js index d606b6db8a38..fab5f1dae114 100644 --- a/ui/app/selectors/selectors.js +++ b/ui/app/selectors/selectors.js @@ -49,7 +49,6 @@ const selectors = { getAccountType, getNumberOfAccounts, getNumberOfTokens, - getDaiV1Token, isEthereumNetwork, getMetaMetricState, getRpcPrefsForCurrentProvider, @@ -226,12 +225,6 @@ function getAddressBookEntryName (state, address) { return entry && entry.name !== '' ? entry.name : addressSlicer(address) } -function getDaiV1Token (state) { - const OLD_DAI_CONTRACT_ADDRESS = '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359' - const tokens = state.metamask.tokens || [] - return tokens.find(({address}) => checksumAddress(address) === OLD_DAI_CONTRACT_ADDRESS) -} - function accountsWithSendEtherInfoSelector (state) { const accounts = getMetaMaskAccounts(state) const { identities } = state.metamask diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js index 285216154564..19c9bfaea37f 100644 --- a/ui/app/store/actions.js +++ b/ui/app/store/actions.js @@ -367,7 +367,6 @@ var actions = { // AppStateController-related actions SET_LAST_ACTIVE_TIME: 'SET_LAST_ACTIVE_TIME', setLastActiveTime, - setMkrMigrationReminderTimestamp, getContractMethodData, loadingMethoDataStarted, @@ -2756,16 +2755,6 @@ function setLastActiveTime () { } } -function setMkrMigrationReminderTimestamp (timestamp) { - return (dispatch) => { - background.setMkrMigrationReminderTimestamp(timestamp, (err) => { - if (err) { - return dispatch(actions.displayWarning(err.message)) - } - }) - } -} - function loadingMethoDataStarted () { return { type: actions.LOADING_METHOD_DATA_STARTED,