From 571462f08f5139387144c49a00bf89c5ca61e4e3 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 9 Oct 2018 13:28:59 +0200 Subject: [PATCH] quickfix: prevent redirecting to Dashboard for first time RECEIVE_WALLET_TYPE --- src/actions/ModalActions.js | 3 ++- src/actions/TrezorConnectActions.js | 1 + src/components/modals/device/WalletType/index.js | 8 ++++---- src/services/WalletService.js | 4 +++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/actions/ModalActions.js b/src/actions/ModalActions.js index ea2434d9..0ca8f9fa 100644 --- a/src/actions/ModalActions.js +++ b/src/actions/ModalActions.js @@ -112,7 +112,7 @@ export const onDeviceConnect = (device: Device): ThunkAction => (dispatch: Dispa } }; -export const onWalletTypeRequest = (device: TrezorDevice, hidden: boolean): ThunkAction => (dispatch: Dispatch): void => { +export const onWalletTypeRequest = (device: TrezorDevice, hidden: boolean, state: ?string): ThunkAction => (dispatch: Dispatch): void => { dispatch({ type: MODAL.CLOSE, }); @@ -120,6 +120,7 @@ export const onWalletTypeRequest = (device: TrezorDevice, hidden: boolean): Thun type: CONNECT.RECEIVE_WALLET_TYPE, device, hidden, + state, }); }; diff --git a/src/actions/TrezorConnectActions.js b/src/actions/TrezorConnectActions.js index c5928afa..9c44f8ce 100644 --- a/src/actions/TrezorConnectActions.js +++ b/src/actions/TrezorConnectActions.js @@ -79,6 +79,7 @@ export type TrezorConnectAction = { type: typeof CONNECT.RECEIVE_WALLET_TYPE, device: TrezorDevice, hidden: boolean, + state: ?string, }; export const init = (): AsyncAction => async (dispatch: Dispatch, getState: GetState): Promise => { diff --git a/src/components/modals/device/WalletType/index.js b/src/components/modals/device/WalletType/index.js index 260196c3..86fbdb1a 100644 --- a/src/components/modals/device/WalletType/index.js +++ b/src/components/modals/device/WalletType/index.js @@ -85,10 +85,10 @@ class WalletType extends Component { keyboardHandler: (event: KeyboardEvent) => void; - changeType(hidden: boolean) { + changeType(hidden: boolean, state: ?string) { const { modal } = this.props; if (!modal.opened) return; - this.props.modalActions.onWalletTypeRequest(modal.device, hidden); + this.props.modalActions.onWalletTypeRequest(modal.device, hidden, state); } render() { @@ -110,7 +110,7 @@ class WalletType extends Component { Standard Wallet

Continue to access your standard wallet.

- this.changeType(false)}>Go to your standard wallet + this.changeType(false, device.state)}>Go to your standard wallet @@ -129,7 +129,7 @@ class WalletType extends Component {

You will be asked to enter your passphrase to unlock your hidden wallet.

- this.changeType(true)}>Go to your hidden wallet + this.changeType(true, device.state)}>Go to your hidden wallet ); diff --git a/src/services/WalletService.js b/src/services/WalletService.js index dac93767..24b35496 100644 --- a/src/services/WalletService.js +++ b/src/services/WalletService.js @@ -110,7 +110,9 @@ const WalletService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa api.dispatch(DiscoveryActions.restore()); break; case CONNECT.RECEIVE_WALLET_TYPE: - api.dispatch(RouterActions.selectFirstAvailableDevice(true)); + if (action.state) { + api.dispatch(RouterActions.selectFirstAvailableDevice(true)); + } api.dispatch(TrezorConnectActions.authorizeDevice()); break; default: break;