[Update] Prevent hotkeys function while opening config page and register the hotkeys when closed.

This commit is contained in:
Sakamoto Shiina
2025-01-17 03:59:32 +09:00
parent bac7bb15d3
commit 04f7c1f556
5 changed files with 84 additions and 103 deletions

View File

@@ -9,6 +9,8 @@ import {
useMainFunction,
} from "@logics_main";
import { useHotkeys } from "@logics_configs";
import { useStore_MainFunctionsStateMemory } from "@store";
export const ConfigPageCloseTriggerController = () => {
@@ -27,6 +29,8 @@ export const ConfigPageCloseTriggerController = () => {
volumeCheckStop_Speaker,
} = useVolume();
const { registerShortcuts, unregisterAll } = useHotkeys();
const memorizeLatestMainFunctionsState = () => {
updateMainFunctionsStateMemory({
@@ -43,9 +47,11 @@ export const ConfigPageCloseTriggerController = () => {
useEffect(() => {
if (currentIsOpenedConfigPage.data === true) { // When config page is opened.
memorizeLatestMainFunctionsState();
unregisterAll();
if (currentTranscriptionSendStatus.data === true) setTranscriptionSend(false);
if (currentTranscriptionReceiveStatus.data === true) setTranscriptionReceive(false);
} else if (currentIsOpenedConfigPage.data === false) { // When config page is closed.
registerShortcuts();
if (currentMicThresholdCheckStatus.data === true) volumeCheckStop_Mic();
if (currentSpeakerThresholdCheckStatus.data === true) volumeCheckStop_Speaker();
restoreMainFunctionState();