mirror of
https://github.com/trezor/trezor-wallet
synced 2024-12-01 04:38:15 +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) {
|
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);
|
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) {
|
||||||
const isSelected = deviceUtils.isSelectedDevice(getState().wallet.selectedDevice, instances[0]);
|
const isSelected = deviceUtils.isSelectedDevice(getState().wallet.selectedDevice, device);
|
||||||
if (!isSelected && getState().modal.context !== CONTEXT_NONE) {
|
if (!isSelected && getState().modal.context !== CONTEXT_NONE) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: CONNECT.FORGET_SILENT,
|
type: CONNECT.FORGET_SILENT,
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import colors from 'config/colors';
|
import colors from 'config/colors';
|
||||||
|
|
||||||
|
import type { Device } from 'trezor-connect';
|
||||||
import type {
|
import type {
|
||||||
TrezorDevice,
|
TrezorDevice,
|
||||||
State,
|
State,
|
||||||
@ -91,7 +92,7 @@ export const isDeviceAccessible = (device: ?TrezorDevice): boolean => {
|
|||||||
return device.mode === 'normal' && device.firmware !== 'required';
|
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 => {
|
export const getVersion = (device: TrezorDevice): string => {
|
||||||
let version;
|
let version;
|
||||||
|
Loading…
Reference in New Issue
Block a user