From 9f728f46d3cea6c2a4d2657c704c724cb4ee96d8 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 11 Feb 2025 15:21:57 +0900 Subject: [PATCH] [bugfix] GlobalHotKeyController: Fix the bug that even if VRCT is not available, (that when ai models has not been detected), registered the hotkeys works and could turn on main functions. --- .../app/_app_controllers/GlobalHotKeyController.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src-ui/app/_app_controllers/GlobalHotKeyController.jsx b/src-ui/app/_app_controllers/GlobalHotKeyController.jsx index d687c138..050232cf 100644 --- a/src-ui/app/_app_controllers/GlobalHotKeyController.jsx +++ b/src-ui/app/_app_controllers/GlobalHotKeyController.jsx @@ -1,22 +1,25 @@ import { useEffect } from "react"; import { useHotkeys } from "@logics_configs"; -import { useIsBackendReady, useIsSoftwareUpdating } from "@logics_common"; +import { useIsBackendReady, useIsSoftwareUpdating, useIsVrctAvailable } from "@logics_common"; export const GlobalHotKeyController = () => { const { currentIsBackendReady } = useIsBackendReady(); const { currentIsSoftwareUpdating } = useIsSoftwareUpdating(); const { registerShortcuts, unregisterAll } = useHotkeys(); + const { currentIsVrctAvailable } = useIsVrctAvailable(); + useEffect(() => { const is_backend_ready = currentIsBackendReady.data; const is_software_updating = currentIsSoftwareUpdating.data; + const is_vrct_available = currentIsVrctAvailable.data; - if (is_backend_ready && !is_software_updating) { + if (is_vrct_available && is_backend_ready && !is_software_updating) { registerShortcuts(); - } else if (is_software_updating) { + } else { unregisterAll(); } - }, [currentIsBackendReady.data, currentIsSoftwareUpdating.data]); + }, [currentIsBackendReady.data, currentIsSoftwareUpdating.data, currentIsVrctAvailable.data]); return null; }; \ No newline at end of file