mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-05 07:38:57 +00:00
fixed deviceUtils.isSelectedDevice
This commit is contained in:
parent
eab3bde184
commit
337eacd1d2
@ -237,7 +237,7 @@ export const deviceDisconnect = (device: Device): AsyncAction => async (dispatch
|
||||
if (device.features) {
|
||||
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) {
|
||||
const isSelected = deviceUtils.isSelectedDevice(getState().wallet.selectedDevice, instances[0]);
|
||||
const isSelected = deviceUtils.isSelectedDevice(getState().wallet.selectedDevice, device);
|
||||
if (!isSelected && getState().modal.context !== CONTEXT_NONE) {
|
||||
dispatch({
|
||||
type: CONNECT.FORGET_SILENT,
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
import colors from 'config/colors';
|
||||
|
||||
import type { Device } from 'trezor-connect';
|
||||
import type {
|
||||
TrezorDevice,
|
||||
State,
|
||||
@ -91,7 +92,7 @@ export const isDeviceAccessible = (device: ?TrezorDevice): boolean => {
|
||||
return device.mode === 'normal' && device.firmware !== 'required';
|
||||
};
|
||||
|
||||
export const isSelectedDevice = (current: ?TrezorDevice, device: ?TrezorDevice): boolean => !!((current && device && (current.path === device.path && current.instance === device.instance)));
|
||||
export const isSelectedDevice = (selected: ?TrezorDevice, device: ?(TrezorDevice | Device)): boolean => !!((selected && device && (selected.path === device.path && (device.ts && selected.instance === device.instance))));
|
||||
|
||||
export const getVersion = (device: TrezorDevice): string => {
|
||||
let version;
|
||||
|
Loading…
Reference in New Issue
Block a user