aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app
diff options
context:
space:
mode:
authorDan Finlay <flyswatter@users.noreply.github.com>2016-12-23 06:43:43 +0800
committerGitHub <noreply@github.com>2016-12-23 06:43:43 +0800
commit898e96fd6ae905932a60d60c42e2c3bddab65556 (patch)
tree23fba23503db1da05c1b397487aa71e3d9cb7d58 /ui/app
parent98527c1c254fe2d438191c73053dcf3223062ef3 (diff)
parentd3b2698f341e1d0dda86612cdf331e51067719c5 (diff)
downloadtangerine-wallet-browser-898e96fd6ae905932a60d60c42e2c3bddab65556.tar
tangerine-wallet-browser-898e96fd6ae905932a60d60c42e2c3bddab65556.tar.gz
tangerine-wallet-browser-898e96fd6ae905932a60d60c42e2c3bddab65556.tar.bz2
tangerine-wallet-browser-898e96fd6ae905932a60d60c42e2c3bddab65556.tar.lz
tangerine-wallet-browser-898e96fd6ae905932a60d60c42e2c3bddab65556.tar.xz
tangerine-wallet-browser-898e96fd6ae905932a60d60c42e2c3bddab65556.tar.zst
tangerine-wallet-browser-898e96fd6ae905932a60d60c42e2c3bddab65556.zip
Merge pull request #948 from MetaMask/RecoverLostAccounts
Auto-Recover accounts lost to BIP44 derivation fix
Diffstat (limited to 'ui/app')
-rw-r--r--ui/app/actions.js12
-rw-r--r--ui/app/app.js18
-rw-r--r--ui/app/components/notice.js (renamed from ui/app/notice.js)20
3 files changed, 34 insertions, 16 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 1c32c9bb1..606460314 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -20,6 +20,7 @@ var actions = {
showNotice: showNotice,
CLEAR_NOTICES: 'CLEAR_NOTICES',
clearNotices: clearNotices,
+ markAccountsFound,
// intialize screen
AGREE_TO_DISCLAIMER: 'AGREE_TO_DISCLAIMER',
agreeToDisclaimer: agreeToDisclaimer,
@@ -591,6 +592,17 @@ function clearNotices () {
}
}
+function markAccountsFound() {
+ return (dispatch) => {
+ dispatch(this.showLoadingIndication())
+ background.markAccountsFound((err, newState) => {
+ dispatch(this.hideLoadingIndication())
+ if (err) return dispatch(this.showWarning(err.message))
+ dispatch(actions.updateMetamaskState(newState))
+ })
+ }
+}
+
//
// config
//
diff --git a/ui/app/app.js b/ui/app/app.js
index 2fa6415dd..6da0c3b1d 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -16,7 +16,8 @@ const AccountDetailScreen = require('./account-detail')
const SendTransactionScreen = require('./send')
const ConfirmTxScreen = require('./conf-tx')
// notice
-const NoticeScreen = require('./notice')
+const NoticeScreen = require('./components/notice')
+const generateLostAccountsNotice = require('../lib/lost-accounts-notice')
// other views
const ConfigScreen = require('./config')
const InfoScreen = require('./info')
@@ -55,6 +56,8 @@ function mapStateToProps (state) {
network: state.metamask.network,
provider: state.metamask.provider,
forgottenPassword: state.appState.forgottenPassword,
+ lastUnreadNotice: state.metamask.lastUnreadNotice,
+ lostAccounts: state.metamask.lostAccounts,
}
}
@@ -366,8 +369,19 @@ App.prototype.renderPrimary = function () {
}
}
+ // notices
if (!props.noActiveNotices) {
- return h(NoticeScreen, {key: 'NoticeScreen'})
+ return h(NoticeScreen, {
+ notice: props.lastUnreadNotice,
+ key: 'NoticeScreen',
+ onConfirm: () => props.dispatch(actions.markNoticeRead(props.lastUnreadNotice)),
+ })
+ } else if (props.lostAccounts && props.lostAccounts.length > 0) {
+ return h(NoticeScreen, {
+ notice: generateLostAccountsNotice(props.lostAccounts),
+ key: 'LostAccountsNotice',
+ onConfirm: () => props.dispatch(actions.markAccountsFound()),
+ })
}
// show current view
diff --git a/ui/app/notice.js b/ui/app/components/notice.js
index 3c2c746f2..00db734d7 100644
--- a/ui/app/notice.js
+++ b/ui/app/components/notice.js
@@ -2,18 +2,10 @@ const inherits = require('util').inherits
const Component = require('react').Component
const h = require('react-hyperscript')
const ReactMarkdown = require('react-markdown')
-const connect = require('react-redux').connect
-const actions = require('./actions')
const linker = require('extension-link-enabler')
const findDOMNode = require('react-dom').findDOMNode
-module.exports = connect(mapStateToProps)(Notice)
-
-function mapStateToProps (state) {
- return {
- lastUnreadNotice: state.metamask.lastUnreadNotice,
- }
-}
+module.exports = Notice
inherits(Notice, Component)
function Notice () {
@@ -21,9 +13,8 @@ function Notice () {
}
Notice.prototype.render = function () {
- const props = this.props
- const title = props.lastUnreadNotice.title
- const date = props.lastUnreadNotice.date
+ const { notice, onConfirm } = this.props
+ const { title, date, body } = notice
return (
h('.flex-column.flex-center.flex-grow', [
@@ -59,6 +50,7 @@ Notice.prototype.render = function () {
.markdown {
overflow-x: hidden;
}
+
.markdown h1, .markdown h2, .markdown h3 {
margin: 10px 0;
font-weight: bold;
@@ -92,13 +84,13 @@ Notice.prototype.render = function () {
},
}, [
h(ReactMarkdown, {
- source: props.lastUnreadNotice.body,
+ source: body,
skipHtml: true,
}),
]),
h('button', {
- onClick: () => props.dispatch(actions.markNoticeRead(props.lastUnreadNotice)),
+ onClick: onConfirm,
style: {
marginTop: '18px',
},