quickfix: prevent redirecting to Dashboard for first time RECEIVE_WALLET_TYPE

pull/147/head
Szymon Lesisz 6 years ago
parent cd183e6409
commit 571462f08f

@ -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,
});
};

@ -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<void> => {

@ -85,10 +85,10 @@ class WalletType extends Component<Props> {
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<Props> {
Standard Wallet
</Span>
<P isSmaller>Continue to access your standard wallet.</P>
<StyledButton onClick={() => this.changeType(false)}>Go to your standard wallet</StyledButton>
<StyledButton onClick={() => this.changeType(false, device.state)}>Go to your standard wallet</StyledButton>
<Divider />
<Span>
<WalletTypeIcon type="hidden" size={24} color={colors.TEXT_SECONDARY} />
@ -129,7 +129,7 @@ class WalletType extends Component<Props> {
</StyledTooltip>
</Span>
<P isSmaller>You will be asked to enter your passphrase to unlock your hidden wallet.</P>
<StyledButton isWhite onClick={() => this.changeType(true)}>Go to your hidden wallet</StyledButton>
<StyledButton isWhite onClick={() => this.changeType(true, device.state)}>Go to your hidden wallet</StyledButton>
</Row>
</Wrapper>
);

@ -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;

Loading…
Cancel
Save