|
|
|
@ -113,6 +113,7 @@ export const init = (): AsyncAction => async (dispatch: Dispatch, getState: GetS
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
await TrezorConnect.init({
|
|
|
|
|
connectSrc: 'http://localhost:8081/',
|
|
|
|
|
transportReconnect: true,
|
|
|
|
|
debug: false,
|
|
|
|
|
popup: false,
|
|
|
|
@ -130,7 +131,6 @@ export const init = (): AsyncAction => async (dispatch: Dispatch, getState: GetS
|
|
|
|
|
// error
|
|
|
|
|
// })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// called after backend was initialized
|
|
|
|
@ -158,21 +158,6 @@ export const postInit = (): ThunkAction => (dispatch: Dispatch, getState: GetSta
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (devices.length > 0) {
|
|
|
|
|
const unacquired: ?TrezorDevice = devices.find(d => d.unacquired);
|
|
|
|
|
if (unacquired) {
|
|
|
|
|
dispatch(onSelectDevice(unacquired));
|
|
|
|
|
} else {
|
|
|
|
|
const latest: Array<TrezorDevice> = sortDevices(devices);
|
|
|
|
|
const firstConnected: ?TrezorDevice = latest.find(d => d.connected);
|
|
|
|
|
dispatch(onSelectDevice(firstConnected || latest[0]));
|
|
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
if (initialParams) {
|
|
|
|
|
if (!initialParams.hasOwnProperty('network') && initialPathname !== getState().router.location.pathname) {
|
|
|
|
|
// dispatch( push(initialPathname) );
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
if (devices.length > 0) {
|
|
|
|
|
const unacquired: ?TrezorDevice = devices.find(d => d.type === 'unacquired');
|
|
|
|
|
if (unacquired) {
|
|
|
|
@ -192,7 +177,6 @@ export const postInit = (): ThunkAction => (dispatch: Dispatch, getState: GetSta
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const sortDevices = (devices: Array<TrezorDevice>): Array<TrezorDevice> => devices.sort((a, b) => {
|
|
|
|
@ -344,7 +328,6 @@ export const deviceDisconnect = (device: Device): AsyncAction => async (dispatch
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const coinChanged = (network: ?string): ThunkAction => (dispatch: Dispatch, getState: GetState): void => {
|
|
|
|
|