mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 09:18:09 +00:00
remove DiscoveryActions from TrezorConnectActions
This commit is contained in:
parent
130b852977
commit
4354e494c4
@ -27,7 +27,6 @@ import type {
|
|||||||
Device,
|
Device,
|
||||||
TrezorDevice,
|
TrezorDevice,
|
||||||
} from 'flowtype';
|
} from 'flowtype';
|
||||||
import * as DiscoveryActions from './DiscoveryActions';
|
|
||||||
|
|
||||||
|
|
||||||
export type TrezorConnectAction = {
|
export type TrezorConnectAction = {
|
||||||
@ -202,13 +201,7 @@ export const getSelectedDeviceState = (): AsyncAction => async (dispatch: Dispat
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const deviceDisconnect = (device: Device): AsyncAction => async (dispatch: Dispatch, getState: GetState): Promise<void> => {
|
export const deviceDisconnect = (device: Device): AsyncAction => async (dispatch: Dispatch, getState: GetState): Promise<void> => {
|
||||||
const selected: ?TrezorDevice = getState().wallet.selectedDevice;
|
|
||||||
|
|
||||||
if (device.features) {
|
if (device.features) {
|
||||||
if (selected && selected.features && selected.features.device_id === device.features.device_id) {
|
|
||||||
dispatch(DiscoveryActions.stop(selected));
|
|
||||||
}
|
|
||||||
|
|
||||||
const instances = getState().devices.filter(d => d.features && device.features && d.state && !d.remember && d.features.device_id === device.features.device_id);
|
const instances = getState().devices.filter(d => d.features && device.features && d.state && !d.remember && d.features.device_id === device.features.device_id);
|
||||||
if (instances.length > 0) {
|
if (instances.length > 0) {
|
||||||
dispatch({
|
dispatch({
|
||||||
@ -224,17 +217,6 @@ export const deviceDisconnect = (device: Device): AsyncAction => async (dispatch
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const coinChanged = (network: ?string): ThunkAction => (dispatch: Dispatch, getState: GetState): void => {
|
|
||||||
const selected: ?TrezorDevice = getState().wallet.selectedDevice;
|
|
||||||
if (!selected) return;
|
|
||||||
|
|
||||||
dispatch(DiscoveryActions.stop(selected));
|
|
||||||
|
|
||||||
if (network) {
|
|
||||||
dispatch(DiscoveryActions.start(selected, network));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export function reload(): AsyncAction {
|
export function reload(): AsyncAction {
|
||||||
return async (): Promise<void> => {
|
return async (): Promise<void> => {
|
||||||
};
|
};
|
||||||
@ -301,12 +283,3 @@ export const duplicateDevice = (device: TrezorDevice): AsyncAction => async (dis
|
|||||||
device: { ...device, ...extended },
|
device: { ...device, ...extended },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export function addAccount(): ThunkAction {
|
|
||||||
return (dispatch: Dispatch, getState: GetState): void => {
|
|
||||||
const selected = getState().wallet.selectedDevice;
|
|
||||||
if (!selected) return;
|
|
||||||
dispatch(DiscoveryActions.start(selected, getState().router.location.state.network, true)); // TODO: network nicer
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user