Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #13551 from NejcZdovc/feature/#13424-seed
Browse files Browse the repository at this point in the history
Adds broken seed overlay
  • Loading branch information
NejcZdovc authored Mar 22, 2018
2 parents 26794f7 + 1517df6 commit 8bc5146
Show file tree
Hide file tree
Showing 11 changed files with 335 additions and 124 deletions.
20 changes: 18 additions & 2 deletions app/browser/api/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const updateState = require('../../common/state/updateState')
// Constants
const settings = require('../../../js/constants/settings')
const messages = require('../../../js/constants/messages')
const ledgerStatuses = require('../../common/constants/ledgerStatuses')

// Utils
const config = require('../../../js/constants/buildConfig')
Expand Down Expand Up @@ -179,11 +180,25 @@ const paymentPresent = (state, tabId, present) => {
}

appActions.onPromotionGet()

state = checkSeed(state)
getPublisherTimestamp(true)
} else if (balanceTimeoutId) {
clearTimeout(balanceTimeoutId)
balanceTimeoutId = false
}

return state
}

const checkSeed = (state) => {
const seed = ledgerState.getInfoProp(state, 'passphrase')

if (seed && !client.isValidPassPhrase(seed)) {
state = ledgerState.setAboutProp(state, 'status', ledgerStatuses.CORRUPTED_SEED)
}

return state
}

const getPublisherTimestamp = (updateList) => {
Expand Down Expand Up @@ -1629,7 +1644,7 @@ const getStateInfo = (state, parsedData) => {
const oldReconcileStamp = ledgerState.getInfoProp(state, 'reconcileStamp')

if (oldReconcileStamp && newInfo.reconcileStamp > oldReconcileStamp) {
state = ledgerState.setAboutProp(state, 'status', 'contributionInProgress')
state = ledgerState.setAboutProp(state, 'status', ledgerStatuses.IN_PROGRESS)
}

let passphrase = ledgerClient.prototype.getWalletPassphrase(parsedData)
Expand Down Expand Up @@ -2963,7 +2978,8 @@ const getMethods = () => {
onReferralInit,
roundTripFromWindow,
onReferralCodeRead,
onVerifiedPStatus
onVerifiedPStatus,
checkSeed
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/browser/reducers/ledgerReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ const ledgerReducer = (state, action, immutableAction) => {
}
case appConstants.APP_LEDGER_PAYMENTS_PRESENT:
{
ledgerApi.paymentPresent(state, action.get('tabId'), action.get('present'))
state = ledgerApi.paymentPresent(state, action.get('tabId'), action.get('present'))
break
}
case appConstants.APP_ON_ADD_FUNDS_CLOSED:
Expand Down
1 change: 1 addition & 0 deletions app/browser/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ const updateAboutDetails = (tabId) => {
.set('wizardData', wizardData)
.set('migration', migration)
.set('promotion', ledgerState.getAboutPromotion(appState))
.set('tabId', tabId)
sendAboutDetails(tabId, messages.LEDGER_UPDATED, ledgerData)
} else if (url === 'about:preferences#sync' || location === 'about:contributions' || onPaymentsPage) {
const sync = appState.get('sync', Immutable.Map())
Expand Down
10 changes: 10 additions & 0 deletions app/common/constants/ledgerStatuses.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const statuses = {
CORRUPTED_SEED: 'corruptedSeed',
IN_PROGRESS: 'contributionInProgress'
}

module.exports = statuses
5 changes: 5 additions & 0 deletions app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ contributionTime=Contribution Time
copied=Copied!
copy=Copy
copyToClipboard.title=Copy to clipboard
corruptedOverlayTitle=Hello!
corruptedOverlayMessage=Unfortunately your active wallet has been corrupted.
corruptedOverlayText=You must recover your backup wallet with your recovery keys before any transactions can be processed. We apologize for the inconvenience.
corruptedOverlayFAQ=View the Brave Payments FAQ…
corruptedOverlayButton=Recover your Brave Wallet
createdWalletStatus=Your wallet is ready!
createWallet=create wallet
createWalletStatus=Click the Create Wallet button to get started.
Expand Down
5 changes: 4 additions & 1 deletion app/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ var rendererIdentifiers = function () {
'promotionGeneralErrorText',
'promotionClaimedErrorMessage',
'promotionClaimedErrorText',
'promotionClaimedErrorTitle'
'promotionClaimedErrorTitle',
'corruptedOverlayTitle',
'corruptedOverlayMessage',
'corruptedOverlayText'
].concat(countryCodes).concat(availableLanguages)
}

Expand Down
Loading

0 comments on commit 8bc5146

Please sign in to comment.