[Update] Prevent hotkeys function while opening config page and register the hotkeys when closed.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user