Skip to content

Commit

Permalink
Merge pull request #7479 from MetaMask/master
Browse files Browse the repository at this point in the history
Master sync
  • Loading branch information
Gudahtt committed Nov 20, 2019
2 parents aa41057 + 72eb233 commit 056e8cd
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 51 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Current Develop Branch

## 7.6.1 Tue Nov 19 2019
- [#7475](https://github.com/MetaMask/metamask-extension/pull/7475): Add 'Remind Me Later' to the Maker notification
- [#7436](https://github.com/MetaMask/metamask-extension/pull/7436): Add additional rpcUrl verification
- [#7468](https://github.com/MetaMask/metamask-extension/pull/7468): Show transaction fee units on approve screen

## 7.6.0 Mon Nov 18 2019
- [#7450](https://github.com/MetaMask/metamask-extension/pull/7450): Add migration notification for users with non-zero Sai
- [#7461](https://github.com/MetaMask/metamask-extension/pull/7461): Import styles for showing multiple notifications
Expand Down
3 changes: 3 additions & 0 deletions app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"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"
},
Expand Down
2 changes: 1 addition & 1 deletion app/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_appName__",
"short_name": "__MSG_appName__",
"version": "7.6.0",
"version": "7.6.1",
"manifest_version": 2,
"author": "https://metamask.io",
"description": "__MSG_appDescription__",
Expand Down
7 changes: 7 additions & 0 deletions app/scripts/controllers/app-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class AppStateController {
this.onInactiveTimeout = onInactiveTimeout || (() => {})
this.store = new ObservableStore(extend({
timeoutMinutes: 0,
mkrMigrationReminderTimestamp: null,
}, initState))
this.timer = null

Expand All @@ -23,6 +24,12 @@ class AppStateController {
this._setInactiveTimeout(preferences.autoLogoutTimeLimit)
}

setMkrMigrationReminderTimestamp (timestamp) {
this.store.updateState({
mkrMigrationReminderTimestamp: timestamp,
})
}

/**
* Sets the last active time to the current time
* @return {void}
Expand Down
1 change: 1 addition & 0 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ 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),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@material-ui/core": "1.0.0",
"@sentry/browser": "^4.1.1",
"@zxing/library": "^0.8.0",
"abi-decoder": "^2.2.0",
"abi-decoder": "^1.2.0",
"abortcontroller-polyfill": "^1.3.0",
"asmcrypto.js": "^2.3.2",
"await-semaphore": "^0.1.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DateTime } from 'luxon'
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import HomeNotification from '../home-notification'
Expand All @@ -8,18 +9,37 @@ export default class DaiV1MigrationNotification extends PureComponent {
}

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 { string: balanceString, symbol } = this.props
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
Expand All @@ -31,15 +51,27 @@ export default class DaiV1MigrationNotification extends PureComponent {

return (
<HomeNotification
descriptionText={t('migrateSai')}
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('learnMore')}
onIgnore={() => {
window.open('https://blog.makerdao.com/multi-collateral-dai-is-live/', '_blank', 'noopener')
}}
ignoreText={t('remindMeLater')}
onIgnore={this.remindMeLater}
infoText={t('migrateSaiInfo')}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,32 @@ 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),
connect(mapStateToProps, mapDispatchToProps),
withTokenTracker,
)(DaiMigrationNotification)
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export default class HomeNotification extends PureComponent {
}

static propTypes = {
acceptText: PropTypes.string.isRequired,
acceptText: PropTypes.node.isRequired,
onAccept: PropTypes.func,
ignoreText: PropTypes.string,
ignoreText: PropTypes.node,
onIgnore: PropTypes.func,
descriptionText: PropTypes.string.isRequired,
infoText: PropTypes.string,
descriptionText: PropTypes.node.isRequired,
infoText: PropTypes.node,
classNames: PropTypes.array,
}

Expand Down
11 changes: 11 additions & 0 deletions ui/app/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ var actions = {
// AppStateController-related actions
SET_LAST_ACTIVE_TIME: 'SET_LAST_ACTIVE_TIME',
setLastActiveTime,
setMkrMigrationReminderTimestamp,

getContractMethodData,
loadingMethoDataStarted,
Expand Down Expand Up @@ -2765,6 +2766,16 @@ 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,
Expand Down
60 changes: 22 additions & 38 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3071,13 +3071,12 @@ abbrev@1:
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==

abi-decoder@^2.2.0:
version "2.2.2"
resolved "https://registry.yarnpkg.com/abi-decoder/-/abi-decoder-2.2.2.tgz#aa1e6679f43c6c6be5d2a3fb20e9578e14e44440"
integrity sha512-viRNIt7FzBC9/Y99AVKsAvEMJsIe9Yc/PMrqYT7edSlZ4EnbXlxAq7hS08XTeMzjMP6DpoVrYyCwhSCskCPQqA==
abi-decoder@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/abi-decoder/-/abi-decoder-1.2.0.tgz#c42882dbb91b444805f0cd203a87a5cc3c22f4a8"
integrity sha512-y2OKSEW4gf2838Eavc56vQY9V46zaXkf3Jl1WpTfUBbzAVrXSr4JRZAAWv55Tv9s5WNz1rVgBgz5d2aJIL1QCg==
dependencies:
web3-eth-abi "^1.2.1"
web3-utils "^1.2.1"
web3 "^0.18.4"

abort-controller@^3.0.0:
version "3.0.0"
Expand Down Expand Up @@ -5339,6 +5338,10 @@ bignumber.js@^9.0.0:
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.0.tgz#805880f84a329b5eac6e7cb6f8274b6d82bdf075"
integrity sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==

"bignumber.js@git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2":
version "2.0.7"
resolved "git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2"

"bignumber.js@git+https://github.com/frozeman/bignumber.js-nolookahead.git":
version "2.0.7"
resolved "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934"
Expand Down Expand Up @@ -10336,13 +10339,6 @@ ethashjs@~0.0.7:
ethereumjs-util "^4.0.1"
miller-rabin "^4.0.0"

ethereum-bloom-filters@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.6.tgz#9cdebb3ec20de96ec4a434c6bad6ea5a513037aa"
integrity sha512-dE9CGNzgOOsdh7msZirvv8qjHtnHpvBlKe2647kM8v+yeF71IRso55jpojemvHV+jMjr48irPWxMRaHuOWzAFA==
dependencies:
js-sha3 "^0.8.0"

ethereum-common@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.2.0.tgz#13bf966131cce1eeade62a1b434249bb4cb120ca"
Expand Down Expand Up @@ -21912,7 +21908,7 @@ randombytes@^2.0.0, randombytes@^2.0.5:
dependencies:
safe-buffer "^5.1.0"

randombytes@^2.0.1, randombytes@^2.0.3, randombytes@^2.0.6, randombytes@^2.1.0:
randombytes@^2.0.1, randombytes@^2.0.3, randombytes@^2.0.6:
version "2.1.0"
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==
Expand Down Expand Up @@ -27615,15 +27611,6 @@ web3-eth-abi@1.2.1:
underscore "1.9.1"
web3-utils "1.2.1"

web3-eth-abi@^1.2.1:
version "1.2.4"
resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.2.4.tgz#5b73e5ef70b03999227066d5d1310b168845e2b8"
integrity sha512-8eLIY4xZKoU3DSVu1pORluAw9Ru0/v4CGdw5so31nn+7fR8zgHMgwbFe0aOqWQ5VU42PzMMXeIJwt4AEi2buFg==
dependencies:
ethers "4.0.0-beta.3"
underscore "1.9.1"
web3-utils "1.2.4"

web3-eth-accounts@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.2.1.tgz#2741a8ef337a7219d57959ac8bd118b9d68d63cf"
Expand Down Expand Up @@ -27827,20 +27814,6 @@ web3-utils@1.2.1:
underscore "1.9.1"
utf8 "3.0.0"

web3-utils@1.2.4, web3-utils@^1.2.1:
version "1.2.4"
resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.2.4.tgz#96832a39a66b05bf8862a5b0bdad2799d709d951"
integrity sha512-+S86Ip+jqfIPQWvw2N/xBQq5JNqCO0dyvukGdJm8fEWHZbckT4WxSpHbx+9KLEWY4H4x9pUwnoRkK87pYyHfgQ==
dependencies:
bn.js "4.11.8"
eth-lib "0.2.7"
ethereum-bloom-filters "^1.0.6"
ethjs-unit "0.1.6"
number-to-bn "1.7.0"
randombytes "^2.1.0"
underscore "1.9.1"
utf8 "3.0.0"

web3@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/web3/-/web3-1.2.1.tgz#5d8158bcca47838ab8c2b784a2dee4c3ceb4179b"
Expand All @@ -27854,6 +27827,17 @@ web3@1.2.1:
web3-shh "1.2.1"
web3-utils "1.2.1"

web3@^0.18.4:
version "0.18.4"
resolved "https://registry.yarnpkg.com/web3/-/web3-0.18.4.tgz#81ec1784145491f2eaa8955b31c06049e07c5e7d"
integrity sha1-gewXhBRUkfLqqJVbMcBgSeB8Xn0=
dependencies:
bignumber.js "git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2"
crypto-js "^3.1.4"
utf8 "^2.1.1"
xhr2 "*"
xmlhttprequest "*"

web3@^0.20.7:
version "0.20.7"
resolved "https://registry.yarnpkg.com/web3/-/web3-0.20.7.tgz#1605e6d81399ed6f85a471a4f3da0c8be57df2f7"
Expand Down Expand Up @@ -28243,7 +28227,7 @@ xhr2-cookies@1.1.0, xhr2-cookies@^1.1.0:
dependencies:
cookiejar "^2.1.1"

xhr2@0.1.3:
xhr2@*, xhr2@0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/xhr2/-/xhr2-0.1.3.tgz#cbfc4759a69b4a888e78cf4f20b051038757bd11"
integrity sha1-y/xHWaabSoiOeM9PILBRA4dXvRE=
Expand Down

0 comments on commit 056e8cd

Please sign in to comment.