1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

Backport "Delete Dai/Sai migration notification (#8418)" (#8447)

This backports the deletion of the Dai/Sai migration notification
(#8418). Note that the migration to delete the now unused background
state has not been included, as it is non-essential and would have been
more difficult to backport. The migration to delete the unused state
will be included in the next major release instead.
This commit is contained in:
Mark Stacey 2020-04-29 11:40:08 -03:00 committed by GitHub
parent 8fb615c9f6
commit 57fdc03dc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 2 additions and 159 deletions

View File

@ -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

View File

@ -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"
},

View File

@ -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}

View File

@ -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),

View File

@ -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 (
<HomeNotification
descriptionText={(
<div>
{t('migrateSai')}
&nbsp;
<a
href="#"
onClick={() => {
window.open('https://blog.makerdao.com/multi-collateral-dai-is-live/', '_blank', 'noopener')
}}
>
{t('learnMore')}.
</a>
</div>
)}
acceptText={t('migrate')}
onAccept={() => {
window.open('https://migrate.makerdao.com', '_blank', 'noopener')
}}
ignoreText={t('remindMeLater')}
onIgnore={this.remindMeLater}
infoText={t('migrateSaiInfo')}
/>
)
}
}

View File

@ -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)

View File

@ -1 +0,0 @@
export { default } from './dai-migration-notification.container'

View File

@ -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
? <DaiMigrationNotification />
: null
}
</MultipleNotifications>
</TransactionView>
)

View File

@ -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)),
}
}

View File

@ -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

View File

@ -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,