|
|
|
@ -55,9 +55,9 @@ const TrezorConnectService: Middleware = (api: MiddlewareAPI) => (next: Middlewa
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else if (action.type === DEVICE.DISCONNECT) {
|
|
|
|
|
api.dispatch( TrezorConnectActions.deviceDisconnect(action.device) );
|
|
|
|
|
api.dispatch( TrezorConnectActions.deviceDisconnect( action.device ) );
|
|
|
|
|
} else if (action.type === CONNECT.REMEMBER_REQUEST) {
|
|
|
|
|
api.dispatch(ModalActions.onRememberRequest(prevModalState));
|
|
|
|
|
api.dispatch( ModalActions.onRememberRequest( prevModalState ) );
|
|
|
|
|
} else if (action.type === CONNECT.FORGET) {
|
|
|
|
|
//api.dispatch( TrezorConnectActions.forgetDevice(action.device) );
|
|
|
|
|
api.dispatch( TrezorConnectActions.switchToFirstAvailableDevice() );
|
|
|
|
@ -75,23 +75,7 @@ const TrezorConnectService: Middleware = (api: MiddlewareAPI) => (next: Middlewa
|
|
|
|
|
} else if (action.type === DEVICE.CONNECT || action.type === DEVICE.CONNECT_UNACQUIRED) {
|
|
|
|
|
|
|
|
|
|
api.dispatch( DiscoveryActions.restore() );
|
|
|
|
|
|
|
|
|
|
// interrupt process of remembering device (force forget)
|
|
|
|
|
// TODO: the same for disconnect more than 1 device at once
|
|
|
|
|
// TODO: move it to modal actions
|
|
|
|
|
const { modal } = api.getState();
|
|
|
|
|
if (modal.opened && modal.windowType === CONNECT.REMEMBER_REQUEST) {
|
|
|
|
|
if (action.device.features && modal.device && modal.device.features && modal.device.features.device_id === action.device.features.device_id) {
|
|
|
|
|
api.dispatch({
|
|
|
|
|
type: MODAL.CLOSE,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
api.dispatch({
|
|
|
|
|
type: CONNECT.FORGET,
|
|
|
|
|
device: modal.device
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
api.dispatch( ModalActions.onDeviceConnect( action.device ) );
|
|
|
|
|
|
|
|
|
|
} else if (action.type === CONNECT.AUTH_DEVICE) {
|
|
|
|
|
api.dispatch( DiscoveryActions.check() );
|
|
|
|
|