2017-06-27 02:27:55 +04:00
|
|
|
// @flow
|
2017-04-27 01:13:33 -05:00
|
|
|
import {
|
2017-06-19 22:15:38 -05:00
|
|
|
GENERATE_WALLET_SHOW_PASSWORD,
|
|
|
|
GENERATE_WALLET_FILE,
|
2017-06-20 00:59:54 -05:00
|
|
|
GENERATE_WALLET_DOWNLOAD_FILE,
|
|
|
|
GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER
|
2017-06-19 22:15:38 -05:00
|
|
|
} from 'actions/generateWalletConstants';
|
2017-04-18 18:34:24 -05:00
|
|
|
|
2017-06-27 02:27:55 +04:00
|
|
|
export type State = {
|
2017-07-02 00:49:06 -05:00
|
|
|
showPassword: boolean,
|
|
|
|
generateWalletFile: boolean,
|
|
|
|
hasDownloadedWalletFile: boolean,
|
|
|
|
canProceedToPaper: boolean
|
|
|
|
};
|
2017-06-27 02:27:55 +04:00
|
|
|
|
|
|
|
const initialState: State = {
|
2017-06-19 22:15:38 -05:00
|
|
|
showPassword: false,
|
|
|
|
generateWalletFile: false,
|
|
|
|
hasDownloadedWalletFile: false,
|
|
|
|
canProceedToPaper: false
|
|
|
|
};
|
2017-04-18 18:34:24 -05:00
|
|
|
|
2017-06-27 02:27:55 +04:00
|
|
|
export function generateWallet(state: State = initialState, action): State {
|
2017-06-19 22:15:38 -05:00
|
|
|
switch (action.type) {
|
|
|
|
case GENERATE_WALLET_SHOW_PASSWORD: {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
showPassword: !state.showPassword
|
|
|
|
};
|
|
|
|
}
|
2017-04-18 18:34:24 -05:00
|
|
|
|
2017-06-19 22:15:38 -05:00
|
|
|
case GENERATE_WALLET_FILE: {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
generateWalletFile: true
|
|
|
|
};
|
|
|
|
}
|
2017-04-27 01:13:33 -05:00
|
|
|
|
2017-06-20 00:59:54 -05:00
|
|
|
case GENERATE_WALLET_DOWNLOAD_FILE: {
|
2017-06-19 22:15:38 -05:00
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
hasDownloadedWalletFile: true
|
|
|
|
};
|
|
|
|
}
|
2017-04-27 01:13:33 -05:00
|
|
|
|
2017-06-20 00:59:54 -05:00
|
|
|
case GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER: {
|
2017-06-19 22:15:38 -05:00
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
canProceedToPaper: true
|
|
|
|
};
|
2017-04-18 18:34:24 -05:00
|
|
|
}
|
2017-06-19 22:15:38 -05:00
|
|
|
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
2017-04-18 18:34:24 -05:00
|
|
|
}
|