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

re-enable option to Recover Wallet #10447

Merged
merged 1 commit into from
Aug 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions app/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const uuid = require('uuid')
const appActions = require('../js/actions/appActions')
const appConfig = require('../js/constants/appConfig')
const appConstants = require('../js/constants/appConstants')
const appDispatcher = require('../js/dispatcher/appDispatcher')
const messages = require('../js/constants/messages')
const settings = require('../js/constants/settings')
const request = require('../js/lib/request')
Expand Down Expand Up @@ -145,7 +144,7 @@ let notificationTryPaymentsMessage
let notificationTimeout = null

// TODO(bridiver) - create a better way to get setting changes
const doAction = (action) => {
const doAction = (state, action) => {
var i, publisher

/* TBD: handle
Expand All @@ -163,12 +162,26 @@ const doAction = (action) => {
}

switch (action.actionType) {
case appConstants.APP_SET_STATE:
init()
break

case appConstants.APP_BACKUP_KEYS:
state = backupKeys(state, action)
break

case appConstants.APP_RECOVER_WALLET:
state = recoverKeys(state, action)
break

case appConstants.APP_SHUTTING_DOWN:
quit()
break

case appConstants.APP_ON_CLEAR_BROWSING_DATA:
if (action.clearDataDetail.get('browserHistory') && !getSetting(settings.PAYMENTS_ENABLED)) reset(true)
if (state.getIn(['clearBrowsingDataDefaults', 'browserHistory']) && !getSetting(settings.PAYMENTS_ENABLED)) {
reset(true)
}
break

case appConstants.APP_IDLE_STATE_CHANGED:
Expand Down Expand Up @@ -264,6 +277,8 @@ const doAction = (action) => {
default:
break
}

return state
}

/*
Expand All @@ -272,7 +287,6 @@ const doAction = (action) => {

var init = () => {
try {
appDispatcher.register(doAction)
initialize(getSetting(settings.PAYMENTS_ENABLED))
} catch (ex) { console.log('ledger.js initialization failed: ' + ex.toString() + '\n' + ex.stack) }
}
Expand Down Expand Up @@ -2269,5 +2283,6 @@ module.exports = {
backupKeys: backupKeys,
quit: quit,
boot: boot,
reset: reset
reset: reset,
doAction
}
5 changes: 1 addition & 4 deletions js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ function handleChangeSettingAction (settingKey, settingValue) {
}

let reducers = []
let ledger = null

const applyReducers = (state, action, immutableAction) => reducers.reduce(
(appState, reducer) => {
Expand All @@ -388,7 +387,6 @@ const applyReducers = (state, action, immutableAction) => reducers.reduce(

const handleAppAction = (action) => {
if (action.actionType === appConstants.APP_SET_STATE) {
ledger = require('../../app/ledger')
reducers = [
require('../../app/browser/reducers/downloadsReducer'),
require('../../app/browser/reducers/flashReducer'),
Expand All @@ -409,7 +407,7 @@ const handleAppAction = (action) => {
require('../../app/browser/reducers/extensionsReducer'),
require('../../app/browser/reducers/shareReducer'),
require('../../app/browser/reducers/updatesReducer'),
require('../../app/browser/reducers/topSitesReducer')
require('../../app/ledger').doAction
]
initialized = true
appState = action.appState
Expand All @@ -435,7 +433,6 @@ const handleAppAction = (action) => {
appState = profiles.init(appState, action, appStore)
appState = require('../../app/browser/menu').init(appState, action, appStore)
appState = require('../../app/sync').init(appState, action, appStore)
ledger.init()
break
case appConstants.APP_SHUTTING_DOWN:
AppDispatcher.shutdown()
Expand Down