From a7c71bc247a35debe6625a27d6bb35b49da80f37 Mon Sep 17 00:00:00 2001 From: "Valentin D. Pinkman" Date: Fri, 17 Jan 2025 15:17:35 +0100 Subject: [PATCH] test without refresher --- .../src/renderer/hooks/useListenToHidDevices.ts | 8 +++++++- libs/ledger-live-common/package.json | 1 + .../src/hooks/useDeviceSessionRefresherToggle.tsx | 9 ++++++--- pnpm-lock.yaml | 3 +++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/apps/ledger-live-desktop/src/renderer/hooks/useListenToHidDevices.ts b/apps/ledger-live-desktop/src/renderer/hooks/useListenToHidDevices.ts index 64708532fc6..e4f42d5d029 100644 --- a/apps/ledger-live-desktop/src/renderer/hooks/useListenToHidDevices.ts +++ b/apps/ledger-live-desktop/src/renderer/hooks/useListenToHidDevices.ts @@ -2,7 +2,11 @@ import { useEffect } from "react"; import { useDispatch } from "react-redux"; import { Subscription, Observable } from "rxjs"; import { useFeature } from "@ledgerhq/live-common/featureFlags/index"; -import { useDeviceManagementKit, DeviceManagementKitTransport } from "@ledgerhq/live-dmk"; +import { + useDeviceManagementKit, + DeviceManagementKitTransport, + useDeviceSessionRefresherToggle, +} from "@ledgerhq/live-dmk"; import { DeviceModelId } from "@ledgerhq/types-devices"; import { IPCTransport } from "~/renderer/IPCTransport"; import { addDevice, removeDevice, resetDevices } from "~/renderer/actions/devices"; @@ -13,6 +17,8 @@ export const useListenToHidDevices = () => { const deviceManagementKit = useDeviceManagementKit(); + useDeviceSessionRefresherToggle(ldmkFeatureFlag?.enabled ?? false); + useEffect(() => { let sub: Subscription; diff --git a/libs/ledger-live-common/package.json b/libs/ledger-live-common/package.json index 81ec3edb20b..9026a99b81a 100644 --- a/libs/ledger-live-common/package.json +++ b/libs/ledger-live-common/package.json @@ -182,6 +182,7 @@ "@ledgerhq/live-config": "workspace:^", "@ledgerhq/live-countervalues": "workspace:^", "@ledgerhq/live-countervalues-react": "workspace:^", + "@ledgerhq/live-dmk": "workspace:^", "@ledgerhq/live-env": "workspace:^", "@ledgerhq/live-hooks": "workspace:*", "@ledgerhq/live-network": "workspace:^", diff --git a/libs/live-dmk/src/hooks/useDeviceSessionRefresherToggle.tsx b/libs/live-dmk/src/hooks/useDeviceSessionRefresherToggle.tsx index 148b66b6018..6aacf02cc6f 100644 --- a/libs/live-dmk/src/hooks/useDeviceSessionRefresherToggle.tsx +++ b/libs/live-dmk/src/hooks/useDeviceSessionRefresherToggle.tsx @@ -16,7 +16,8 @@ export const useDeviceSessionRefresherToggle = (enabled: boolean) => { if (sessionId.current) { sdk.toggleDeviceSessionRefresher({ sessionId: sessionId.current, - enabled: true, + // TODO: remove this once we have a proper way to disable the refresher + enabled: false, }); } @@ -36,7 +37,8 @@ export const useDeviceSessionRefresherToggle = (enabled: boolean) => { if (sessionId.current) { sdk.toggleDeviceSessionRefresher({ sessionId: sessionId.current, - enabled: true, + // TODO: remove this once we have a proper way to disable the refresher + enabled: false, }); } }; @@ -48,7 +50,8 @@ export const useDeviceSessionRefresherToggle = (enabled: boolean) => { if (sessionId.current) { sdk.toggleDeviceSessionRefresher({ sessionId: sessionId.current, - enabled: true, + // TODO: remove this once we have a proper way to disable the refresher + enabled: false, }); } }, [sdk]); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b2e41fea958..bb1c14780e4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4095,6 +4095,9 @@ importers: '@ledgerhq/live-countervalues-react': specifier: workspace:^ version: link:../live-countervalues-react + '@ledgerhq/live-dmk': + specifier: workspace:^ + version: link:../live-dmk '@ledgerhq/live-env': specifier: workspace:^ version: link:../env