From e1497fafa64b5f8e25407611709920dc5e0eaf77 Mon Sep 17 00:00:00 2001 From: Jacky Chan Date: Mon, 21 Aug 2017 04:56:09 -0700 Subject: Add UniqueImageScreen --- ui/app/actions.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index 84990922e..11cd14c16 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -243,19 +243,26 @@ function createNewVaultAndKeychain (password) { return (dispatch) => { dispatch(actions.showLoadingIndication()) log.debug(`background.createNewVaultAndKeychain`) - background.createNewVaultAndKeychain(password, (err) => { - if (err) { - return dispatch(actions.displayWarning(err.message)) - } - log.debug(`background.placeSeedWords`) - background.placeSeedWords((err) => { + + return new Promise((resolve, reject) => { + background.createNewVaultAndKeychain(password, (err) => { if (err) { - return dispatch(actions.displayWarning(err.message)) + dispatch(actions.displayWarning(err.message)) + return reject(err) } - dispatch(actions.hideLoadingIndication()) - forceUpdateMetamaskState(dispatch) + log.debug(`background.placeSeedWords`) + background.placeSeedWords((err) => { + if (err) { + dispatch(actions.displayWarning(err.message)) + return reject(err) + } + dispatch(actions.hideLoadingIndication()) + forceUpdateMetamaskState(dispatch) + resolve() + }) }) - }) + }); + } } -- cgit v1.2.3 From fd4fbdc0cd70e31764a497946f565757b204b616 Mon Sep 17 00:00:00 2001 From: Jacky Chan Date: Tue, 22 Aug 2017 05:59:44 -0700 Subject: Add NoticeScreen --- ui/app/actions.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index 11cd14c16..f026fd0ab 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -696,21 +696,23 @@ function goBackToInitView () { function markNoticeRead (notice) { return (dispatch) => { - dispatch(this.showLoadingIndication()) + dispatch(actions.showLoadingIndication()) log.debug(`background.markNoticeRead`) - background.markNoticeRead(notice, (err, notice) => { - dispatch(this.hideLoadingIndication()) - if (err) { - return dispatch(actions.displayWarning(err)) - } - if (notice) { - return dispatch(actions.showNotice(notice)) - } else { - dispatch(this.clearNotices()) - return { - type: actions.SHOW_ACCOUNTS_PAGE, + return new Promise((resolve, reject) => { + background.markNoticeRead(notice, (err, notice) => { + dispatch(actions.hideLoadingIndication()) + if (err) { + dispatch(actions.displayWarning(err)) + return reject(err) } - } + if (notice) { + dispatch(actions.showNotice(notice)) + resolve() + } else { + dispatch(actions.clearNotices()) + resolve() + } + }) }) } } -- cgit v1.2.3 From 1a9b217558fd7a3a528a068c6820f2d905d62e9d Mon Sep 17 00:00:00 2001 From: Jacky Chan Date: Wed, 23 Aug 2017 04:04:11 -0700 Subject: Add BackupPhraseScreen --- ui/app/actions.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index f026fd0ab..ec18f099e 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -215,14 +215,18 @@ function confirmSeedWords () { return (dispatch) => { dispatch(actions.showLoadingIndication()) log.debug(`background.clearSeedWordCache`) - background.clearSeedWordCache((err, account) => { - dispatch(actions.hideLoadingIndication()) - if (err) { - return dispatch(actions.displayWarning(err.message)) - } + return new Promise((resolve, reject) => { + background.clearSeedWordCache((err, account) => { + dispatch(actions.hideLoadingIndication()) + if (err) { + dispatch(actions.displayWarning(err.message)) + reject(err) + } - log.info('Seed word cache cleared. ' + account) - dispatch(actions.showAccountDetail(account)) + log.info('Seed word cache cleared. ' + account) + dispatch(actions.showAccountDetail(account)) + resolve(account) + }) }) } } -- cgit v1.2.3 From 449bce5eea5a5ee049828121876340ae226351b7 Mon Sep 17 00:00:00 2001 From: Jacky Chan Date: Tue, 29 Aug 2017 00:52:59 -0700 Subject: Implement Import Account Screen --- ui/app/actions.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index ec18f099e..04bba6bf2 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -310,18 +310,25 @@ function importNewAccount (strategy, args) { return (dispatch) => { dispatch(actions.showLoadingIndication('This may take a while, be patient.')) log.debug(`background.importAccountWithStrategy`) - background.importAccountWithStrategy(strategy, args, (err) => { - if (err) return dispatch(actions.displayWarning(err.message)) - log.debug(`background.getState`) - background.getState((err, newState) => { - dispatch(actions.hideLoadingIndication()) + return new Promise((resolve, reject) => { + background.importAccountWithStrategy(strategy, args, (err) => { if (err) { - return dispatch(actions.displayWarning(err.message)) + dispatch(actions.displayWarning(err.message)) + return reject(err) } - dispatch(actions.updateMetamaskState(newState)) - dispatch({ - type: actions.SHOW_ACCOUNT_DETAIL, - value: newState.selectedAddress, + log.debug(`background.getState`) + background.getState((err, newState) => { + dispatch(actions.hideLoadingIndication()) + if (err) { + dispatch(actions.displayWarning(err.message)) + return reject(err) + } + dispatch(actions.updateMetamaskState(newState)) + dispatch({ + type: actions.SHOW_ACCOUNT_DETAIL, + value: newState.selectedAddress, + }) + resolve(newState) }) }) }) -- cgit v1.2.3 From 85e485128ff3ca4e458bd5d99d15dc295de70f43 Mon Sep 17 00:00:00 2001 From: Jacky Chan Date: Wed, 30 Aug 2017 01:30:55 -0700 Subject: Add Go to Coinbase; Show Buy Ether after signup --- ui/app/actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index 04bba6bf2..a9f3185dd 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -224,7 +224,7 @@ function confirmSeedWords () { } log.info('Seed word cache cleared. ' + account) - dispatch(actions.showAccountDetail(account)) + dispatch(actions.showAccountsPage()) resolve(account) }) }) -- cgit v1.2.3 From c6a3d00d80e1fa6ca1426246d9a3e03b7ad4ecbb Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Mon, 18 Sep 2017 15:41:25 -0700 Subject: Fix merge conflict; separate onboarding buy screen --- ui/app/actions.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index a9f3185dd..eb066a0e7 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -133,6 +133,8 @@ var actions = { showLoadingIndication: showLoadingIndication, hideLoadingIndication: hideLoadingIndication, // buy Eth with coinbase + onboardingBuyEthView, + ONBOARDING_BUY_ETH_VIEW: 'ONBOARDING_BUY_ETH_VIEW', BUY_ETH: 'BUY_ETH', buyEth: buyEth, buyEthView: buyEthView, @@ -903,6 +905,13 @@ function buyEth (opts) { } } +function onboardingBuyEthView (address) { + return { + type: actions.ONBOARDING_BUY_ETH_VIEW, + value: address, + } +} + function buyEthView (address) { return { type: actions.BUY_ETH_VIEW, -- cgit v1.2.3 From 5cbbb476b3eb7a5fd70b014b2a1a83fea7092b58 Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Mon, 25 Sep 2017 14:51:49 -0700 Subject: ShapeShift Integration --- ui/app/actions.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index eb066a0e7..6a5a31bfb 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -138,6 +138,7 @@ var actions = { BUY_ETH: 'BUY_ETH', buyEth: buyEth, buyEthView: buyEthView, + buyWithShapeShift, BUY_ETH_VIEW: 'BUY_ETH_VIEW', COINBASE_SUBVIEW: 'COINBASE_SUBVIEW', coinBaseSubview: coinBaseSubview, @@ -977,6 +978,18 @@ function coinShiftRquest (data, marketData) { } } +function buyWithShapeShift (data) { + return dispatch => new Promise((resolve, reject) => { + shapeShiftRequest('shift', { method: 'POST', data}, (response) => { + if (response.error) { + return reject(response.error) + } + background.createShapeShiftTx(response.deposit, response.depositType) + return resolve(response) + }) + }) +} + function showQrView (data, message) { return { type: actions.SHOW_QR_VIEW, @@ -1010,9 +1023,14 @@ function shapeShiftRequest (query, options, cb) { options.method ? method = options.method : method = 'GET' var requestListner = function (request) { - queryResponse = JSON.parse(this.responseText) - cb ? cb(queryResponse) : null - return queryResponse + try { + queryResponse = JSON.parse(this.responseText) + cb ? cb(queryResponse) : null + return queryResponse + } catch (e) { + cb ? cb({error: e}) : null + return e + } } var shapShiftReq = new XMLHttpRequest() -- cgit v1.2.3 From ac50db52a9e86bfef9a47fbea3feb7fe78947566 Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Mon, 2 Oct 2017 11:08:34 -0700 Subject: Fix linter --- ui/app/actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index 6a5a31bfb..41b4494ad 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -268,7 +268,7 @@ function createNewVaultAndKeychain (password) { resolve() }) }) - }); + }) } } -- cgit v1.2.3 From f503120b82c108efae0a4fc1282a43721d961ca2 Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Fri, 20 Oct 2017 22:31:59 -0700 Subject: Add Import With Seed Phrase --- ui/app/actions.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'ui/app/actions.js') diff --git a/ui/app/actions.js b/ui/app/actions.js index 41b4494ad..04fd35b20 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -238,10 +238,20 @@ function createNewVaultAndRestore (password, seed) { return (dispatch) => { dispatch(actions.showLoadingIndication()) log.debug(`background.createNewVaultAndRestore`) - background.createNewVaultAndRestore(password, seed, (err) => { - dispatch(actions.hideLoadingIndication()) - if (err) return dispatch(actions.displayWarning(err.message)) - dispatch(actions.showAccountsPage()) + + return new Promise((resolve, reject) => { + background.createNewVaultAndRestore(password, seed, (err) => { + + dispatch(actions.hideLoadingIndication()) + + if (err) { + dispatch(actions.displayWarning(err.message)) + return reject(err) + } + + dispatch(actions.showAccountsPage()) + resolve() + }) }) } } -- cgit v1.2.3