[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.
This commit is contained in:
1 parent
945b2a83a8
commit
9f728f46d3
1 file changed
+7
-4
@@ -1,22 +1,25 @@
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useHotkeys } from "@logics_configs";
|
import { useHotkeys } from "@logics_configs";
|
||||||
import { useIsBackendReady, useIsSoftwareUpdating } from "@logics_common";
|
import { useIsBackendReady, useIsSoftwareUpdating, useIsVrctAvailable } from "@logics_common";
|
||||||
|
|
||||||
export const GlobalHotKeyController = () => {
|
export const GlobalHotKeyController = () => {
|
||||||
const { currentIsBackendReady } = useIsBackendReady();
|
const { currentIsBackendReady } = useIsBackendReady();
|
||||||
const { currentIsSoftwareUpdating } = useIsSoftwareUpdating();
|
const { currentIsSoftwareUpdating } = useIsSoftwareUpdating();
|
||||||
const { registerShortcuts, unregisterAll } = useHotkeys();
|
const { registerShortcuts, unregisterAll } = useHotkeys();
|
||||||
|
|
||||||
|
const { currentIsVrctAvailable } = useIsVrctAvailable();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const is_backend_ready = currentIsBackendReady.data;
|
const is_backend_ready = currentIsBackendReady.data;
|
||||||
const is_software_updating = currentIsSoftwareUpdating.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();
|
registerShortcuts();
|
||||||
} else if (is_software_updating) {
|
} else {
|
||||||
unregisterAll();
|
unregisterAll();
|
||||||
}
|
}
|
||||||
}, [currentIsBackendReady.data, currentIsSoftwareUpdating.data]);
|
}, [currentIsBackendReady.data, currentIsSoftwareUpdating.data, currentIsVrctAvailable.data]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user