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({ dispatch({
type: MODAL.CLOSE, type: MODAL.CLOSE,
}); });
@ -120,6 +120,7 @@ export const onWalletTypeRequest = (device: TrezorDevice, hidden: boolean): Thun
type: CONNECT.RECEIVE_WALLET_TYPE, type: CONNECT.RECEIVE_WALLET_TYPE,
device, device,
hidden, hidden,
state,
}); });
}; };

View File

@ -79,6 +79,7 @@ export type TrezorConnectAction = {
type: typeof CONNECT.RECEIVE_WALLET_TYPE, type: typeof CONNECT.RECEIVE_WALLET_TYPE,
device: TrezorDevice, device: TrezorDevice,
hidden: boolean, hidden: boolean,
state: ?string,
}; };
export const init = (): AsyncAction => async (dispatch: Dispatch, getState: GetState): Promise<void> => { 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; keyboardHandler: (event: KeyboardEvent) => void;
changeType(hidden: boolean) { changeType(hidden: boolean, state: ?string) {
const { modal } = this.props; const { modal } = this.props;
if (!modal.opened) return; if (!modal.opened) return;
this.props.modalActions.onWalletTypeRequest(modal.device, hidden); this.props.modalActions.onWalletTypeRequest(modal.device, hidden, state);
} }
render() { render() {
@ -110,7 +110,7 @@ class WalletType extends Component<Props> {
Standard Wallet Standard Wallet
</Span> </Span>
<P isSmaller>Continue to access your standard wallet.</P> <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 /> <Divider />
<Span> <Span>
<WalletTypeIcon type="hidden" size={24} color={colors.TEXT_SECONDARY} /> <WalletTypeIcon type="hidden" size={24} color={colors.TEXT_SECONDARY} />
@ -129,7 +129,7 @@ class WalletType extends Component<Props> {
</StyledTooltip> </StyledTooltip>
</Span> </Span>
<P isSmaller>You will be asked to enter your passphrase to unlock your hidden wallet.</P> <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> </Row>
</Wrapper> </Wrapper>
); );

View File

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