1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 09:18:09 +00:00

quickfix: prevent redirecting to Dashboard for first time RECEIVE_WALLET_TYPE

This commit is contained in:
Szymon Lesisz 2018-10-09 13:28:59 +02:00
parent cd183e6409
commit 571462f08f
4 changed files with 10 additions and 6 deletions

View File

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

View File

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

View File

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

View File

@ -110,7 +110,9 @@ const WalletService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
api.dispatch(DiscoveryActions.restore());
break;
case CONNECT.RECEIVE_WALLET_TYPE:
if (action.state) {
api.dispatch(RouterActions.selectFirstAvailableDevice(true));
}
api.dispatch(TrezorConnectActions.authorizeDevice());
break;
default: break;