1
0
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:
Szymon Lesisz 2018-10-11 13:07:29 +02:00
parent eab3bde184
commit 337eacd1d2
2 changed files with 3 additions and 2 deletions

View File

@ -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,

View File

@ -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;