Skip to content

Commit

Permalink
Merge pull request brave#13850 from ryanml/no-dialogue-after-recovery
Browse files Browse the repository at this point in the history
Fixes wallet recovery dialogue re-appearing on relaunch after a successful recovery.
  • Loading branch information
NejcZdovc authored Apr 19, 2018
2 parents 622ef4b + 7f194c9 commit 0abdd64
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ class AboutPreferences extends React.Component {
ledgerRecoveryOverlayVisible: false
})
this.forceUpdate()
this.removeParams()
}

enableSyncRestore (enabled) {
Expand Down Expand Up @@ -548,6 +549,16 @@ class AboutPreferences extends React.Component {
this.setState(newState)
}

/**
* Using the history API, this removes any parameters
* from the current URL, leaving only the needed hash (ex #payments)
* This does not reload the page, it only modifies the browser history state,
* which replaces what is entered in the address bar
*/
removeParams () {
window.history.replaceState(null, null, `#${this.hash}`)
}

/**
* Parses a query string like:
* about:preferences#payments?ledgerBackupOverlayVisible
Expand Down Expand Up @@ -632,9 +643,12 @@ class AboutPreferences extends React.Component {
let stateDiff = {}
stateDiff[`${overlayName}OverlayVisible`] = isVisible
this.setState(stateDiff)
// Tell ledger when Add Funds overlay is closed
if (isVisible === false && overlayName === 'addFunds') {
appActions.onAddFundsClosed()
if (isVisible === false) {
// Tell ledger when Add Funds overlay is closed
if (overlayName === 'addFunds') {
appActions.onAddFundsClosed()
}
this.removeParams()
}
}

Expand Down

0 comments on commit 0abdd64

Please sign in to comment.