[Refactor] Change state management structures. Async atom to be manage manually.
This commit is contained in:
@@ -71,8 +71,8 @@ const generateMessageObject = (data, category) => {
|
||||
};
|
||||
|
||||
|
||||
const updateItemById = (id, translated_data) => (prev_items) => {
|
||||
return prev_items.map(item => {
|
||||
const updateItemById = (id, translated_data) => (current_items) => {
|
||||
return current_items.data.map(item => {
|
||||
if (item.id === id) {
|
||||
item.status = "ok";
|
||||
item.messages.translated = translated_data;
|
||||
|
||||
@@ -11,17 +11,24 @@ export const useVolume = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { updateMicVolume } = useStore_MicVolume();
|
||||
const { updateSpeakerVolume } = useStore_SpeakerVolume();
|
||||
const { currentMicThresholdCheckStatus, updateMicThresholdCheckStatus } = useStore_MicThresholdCheckStatus();
|
||||
const { currentSpeakerThresholdCheckStatus, updateSpeakerThresholdCheckStatus } = useStore_SpeakerThresholdCheckStatus();
|
||||
const {
|
||||
currentMicThresholdCheckStatus,
|
||||
updateMicThresholdCheckStatus,
|
||||
pendingMicThresholdCheckStatus,
|
||||
} = useStore_MicThresholdCheckStatus();
|
||||
const {
|
||||
currentSpeakerThresholdCheckStatus,
|
||||
updateSpeakerThresholdCheckStatus,
|
||||
pendingSpeakerThresholdCheckStatus,
|
||||
} = useStore_SpeakerThresholdCheckStatus();
|
||||
|
||||
const asyncPending = () => new Promise(() => {});
|
||||
return {
|
||||
volumeCheckStart_Mic: () => {
|
||||
updateMicThresholdCheckStatus(asyncPending);
|
||||
pendingMicThresholdCheckStatus();
|
||||
asyncStdoutToPython("/set/enable_check_mic_threshold");
|
||||
},
|
||||
volumeCheckStop_Mic: () => {
|
||||
updateMicThresholdCheckStatus(asyncPending);
|
||||
pendingMicThresholdCheckStatus();
|
||||
asyncStdoutToPython("/set/disable_check_mic_threshold");
|
||||
},
|
||||
updateVolumeVariable_Mic: (payload) => {
|
||||
@@ -35,11 +42,11 @@ export const useVolume = () => {
|
||||
|
||||
volumeCheckStart_Speaker: () => {
|
||||
updateSpeakerVolume("0");
|
||||
updateSpeakerThresholdCheckStatus(asyncPending);
|
||||
pendingSpeakerThresholdCheckStatus();
|
||||
asyncStdoutToPython("/set/enable_check_speaker_threshold");
|
||||
},
|
||||
volumeCheckStop_Speaker: () => {
|
||||
updateSpeakerThresholdCheckStatus(asyncPending);
|
||||
pendingSpeakerThresholdCheckStatus();
|
||||
asyncStdoutToPython("/set/disable_check_speaker_threshold");
|
||||
},
|
||||
updateVolumeVariable_Speaker: (payload) => {
|
||||
|
||||
@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useEnableAutoClearMessageBox = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentEnableAutoClearMessageBox, updateEnableAutoClearMessageBox } = useStore_EnableAutoClearMessageBox();
|
||||
const { currentEnableAutoClearMessageBox, updateEnableAutoClearMessageBox, pendingEnableAutoClearMessageBox } = useStore_EnableAutoClearMessageBox();
|
||||
|
||||
const getEnableAutoClearMessageBox = () => {
|
||||
updateEnableAutoClearMessageBox(() => new Promise(() => {}));
|
||||
pendingEnableAutoClearMessageBox();
|
||||
asyncStdoutToPython("/get/auto_clear_message_box");
|
||||
};
|
||||
|
||||
const toggleEnableAutoClearMessageBox = () => {
|
||||
updateEnableAutoClearMessageBox(() => new Promise(() => {}));
|
||||
pendingEnableAutoClearMessageBox();
|
||||
if (currentEnableAutoClearMessageBox.data) {
|
||||
asyncStdoutToPython("/set/disable_auto_clear_message_box");
|
||||
} else {
|
||||
|
||||
@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useEnableAutoMicSelect = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentEnableAutoMicSelect, updateEnableAutoMicSelect } = useStore_EnableAutoMicSelect();
|
||||
const { currentEnableAutoMicSelect, updateEnableAutoMicSelect, pendingEnableAutoMicSelect } = useStore_EnableAutoMicSelect();
|
||||
|
||||
const getEnableAutoMicSelect = () => {
|
||||
updateEnableAutoMicSelect(() => new Promise(() => {}));
|
||||
pendingEnableAutoMicSelect();
|
||||
asyncStdoutToPython("/get/auto_mic_select");
|
||||
};
|
||||
|
||||
const toggleEnableAutoMicSelect = () => {
|
||||
updateEnableAutoMicSelect(() => new Promise(() => {}));
|
||||
pendingEnableAutoMicSelect();
|
||||
if (currentEnableAutoMicSelect.data) {
|
||||
asyncStdoutToPython("/set/disable_auto_mic_select");
|
||||
} else {
|
||||
|
||||
@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useEnableAutoSpeakerSelect = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect();
|
||||
const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect, pendingEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect();
|
||||
|
||||
const getEnableAutoSpeakerSelect = () => {
|
||||
updateEnableAutoSpeakerSelect(() => new Promise(() => {}));
|
||||
pendingEnableAutoSpeakerSelect();
|
||||
asyncStdoutToPython("/get/auto_speaker_select");
|
||||
};
|
||||
|
||||
const toggleEnableAutoSpeakerSelect = () => {
|
||||
updateEnableAutoSpeakerSelect(() => new Promise(() => {}));
|
||||
pendingEnableAutoSpeakerSelect();
|
||||
if (currentEnableAutoSpeakerSelect.data) {
|
||||
asyncStdoutToPython("/set/disable_auto_speaker_select");
|
||||
} else {
|
||||
|
||||
@@ -3,10 +3,10 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useMicDeviceList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentMicDeviceList, updateMicDeviceList } = useStore_MicDeviceList();
|
||||
const { currentMicDeviceList, updateMicDeviceList, pendingMicDeviceList } = useStore_MicDeviceList();
|
||||
|
||||
const getMicDeviceList = () => {
|
||||
updateMicDeviceList(() => new Promise(() => {}));
|
||||
pendingMicDeviceList();
|
||||
asyncStdoutToPython("/get/list_mic_device");
|
||||
};
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useMicHostList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentMicHostList, updateMicHostList } = useStore_MicHostList();
|
||||
const { currentMicHostList, updateMicHostList, pendingMicHostList } = useStore_MicHostList();
|
||||
|
||||
const getMicHostList = () => {
|
||||
updateMicHostList(() => new Promise(() => {}));
|
||||
pendingMicHostList();
|
||||
asyncStdoutToPython("/get/list_mic_host");
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
export const useMicThreshold = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { updateMicThreshold, currentMicThreshold } = useStore_MicThreshold();
|
||||
const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold();
|
||||
const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold();
|
||||
|
||||
const getMicThreshold = () => {
|
||||
asyncStdoutToPython("/get/mic_energy_threshold");
|
||||
@@ -15,12 +15,12 @@ export const useMicThreshold = () => {
|
||||
};
|
||||
|
||||
const getEnableAutomaticMicThreshold = () => {
|
||||
updateEnableAutomaticMicThreshold(() => new Promise(() => {}));
|
||||
pendingEnableAutomaticMicThreshold();
|
||||
asyncStdoutToPython("/get/mic_dynamic_energy_threshold");
|
||||
};
|
||||
|
||||
const toggleEnableAutomaticMicThreshold = () => {
|
||||
updateEnableAutomaticMicThreshold(() => new Promise(() => {}));
|
||||
pendingEnableAutomaticMicThreshold();
|
||||
if (currentEnableAutomaticMicThreshold.data) {
|
||||
asyncStdoutToPython("/set/disable_mic_dynamic_energy_threshold");
|
||||
} else {
|
||||
|
||||
@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSelectedMicDevice = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSelectedMicDevice, updateSelectedMicDevice } = useStore_SelectedMicDevice();
|
||||
const { currentSelectedMicDevice, updateSelectedMicDevice, pendingSelectedMicDevice } = useStore_SelectedMicDevice();
|
||||
|
||||
const getSelectedMicDevice = () => {
|
||||
updateSelectedMicDevice(() => new Promise(() => {}));
|
||||
pendingSelectedMicDevice();
|
||||
asyncStdoutToPython("/get/selected_mic_device");
|
||||
};
|
||||
|
||||
const setSelectedMicDevice = (selected_mic_device) => {
|
||||
updateSelectedMicDevice(() => new Promise(() => {}));
|
||||
pendingSelectedMicDevice();
|
||||
asyncStdoutToPython("/set/selected_mic_device", selected_mic_device);
|
||||
};
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSelectedMicHost = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSelectedMicHost, updateSelectedMicHost } = useStore_SelectedMicHost();
|
||||
const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost();
|
||||
|
||||
const getSelectedMicHost = () => {
|
||||
updateSelectedMicHost(() => new Promise(() => {}));
|
||||
pendingSelectedMicHost();
|
||||
asyncStdoutToPython("/get/selected_mic_host");
|
||||
};
|
||||
|
||||
const setSelectedMicHost = (selected_mic_host) => {
|
||||
updateSelectedMicHost(() => new Promise(() => {}));
|
||||
pendingSelectedMicHost();
|
||||
asyncStdoutToPython("/set/selected_mic_host", selected_mic_host);
|
||||
};
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSelectedSpeakerDevice = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice();
|
||||
const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice, pendingSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice();
|
||||
|
||||
const getSelectedSpeakerDevice = () => {
|
||||
updateSelectedSpeakerDevice(() => new Promise(() => {}));
|
||||
pendingSelectedSpeakerDevice();
|
||||
asyncStdoutToPython("/get/selected_speaker_device");
|
||||
};
|
||||
|
||||
const setSelectedSpeakerDevice = (selected_speaker_device) => {
|
||||
updateSelectedSpeakerDevice(() => new Promise(() => {}));
|
||||
pendingSelectedSpeakerDevice();
|
||||
asyncStdoutToPython("/set/selected_speaker_device", selected_speaker_device);
|
||||
};
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSendMessageButtonType = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSendMessageButtonType, updateSendMessageButtonType } = useStore_SendMessageButtonType();
|
||||
const { currentSendMessageButtonType, updateSendMessageButtonType, pendingSendMessageButtonType } = useStore_SendMessageButtonType();
|
||||
|
||||
const getSendMessageButtonType = () => {
|
||||
updateSendMessageButtonType(() => new Promise(() => {}));
|
||||
pendingSendMessageButtonType();
|
||||
asyncStdoutToPython("/get/send_message_button_type");
|
||||
};
|
||||
|
||||
const setSendMessageButtonType = (selected_type) => {
|
||||
updateSendMessageButtonType(() => new Promise(() => {}));
|
||||
pendingSendMessageButtonType();
|
||||
asyncStdoutToPython("/set/send_message_button_type", selected_type);
|
||||
};
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSoftwareVersion = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSoftwareVersion, updateSoftwareVersion } = useStore_SoftwareVersion();
|
||||
const { currentSoftwareVersion, updateSoftwareVersion, pendingSoftwareVersion } = useStore_SoftwareVersion();
|
||||
|
||||
const getSoftwareVersion = () => {
|
||||
updateSoftwareVersion(() => new Promise(() => {}));
|
||||
pendingSoftwareVersion();
|
||||
asyncStdoutToPython("/get/version");
|
||||
};
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSpeakerDeviceList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSpeakerDeviceList, updateSpeakerDeviceList } = useStore_SpeakerDeviceList();
|
||||
const { currentSpeakerDeviceList, updateSpeakerDeviceList, pendingSpeakerDeviceList } = useStore_SpeakerDeviceList();
|
||||
|
||||
const getSpeakerDeviceList = () => {
|
||||
updateSpeakerDeviceList(() => new Promise(() => {}));
|
||||
pendingSpeakerDeviceList();
|
||||
asyncStdoutToPython("/get/list_speaker_device");
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
export const useSpeakerThreshold = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { updateSpeakerThreshold, currentSpeakerThreshold } = useStore_SpeakerThreshold();
|
||||
const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold();
|
||||
const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold();
|
||||
|
||||
const getSpeakerThreshold = () => {
|
||||
asyncStdoutToPython("/get/speaker_energy_threshold");
|
||||
@@ -15,12 +15,12 @@ export const useSpeakerThreshold = () => {
|
||||
};
|
||||
|
||||
const getEnableAutomaticSpeakerThreshold = () => {
|
||||
updateEnableAutomaticSpeakerThreshold(() => new Promise(() => {}));
|
||||
pendingEnableAutomaticSpeakerThreshold();
|
||||
asyncStdoutToPython("/get/speaker_dynamic_energy_threshold");
|
||||
};
|
||||
|
||||
const toggleEnableAutomaticSpeakerThreshold = () => {
|
||||
updateEnableAutomaticSpeakerThreshold(() => new Promise(() => {}));
|
||||
pendingEnableAutomaticSpeakerThreshold();
|
||||
if (currentEnableAutomaticSpeakerThreshold.data) {
|
||||
asyncStdoutToPython("/set/disable_speaker_dynamic_energy_threshold");
|
||||
} else {
|
||||
|
||||
@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useUiLanguage = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentUiLanguage, updateUiLanguage } = useStore_UiLanguage();
|
||||
const { currentUiLanguage, updateUiLanguage, pendingUiLanguage } = useStore_UiLanguage();
|
||||
|
||||
const getUiLanguage = () => {
|
||||
updateUiLanguage(() => new Promise(() => {}));
|
||||
pendingUiLanguage();
|
||||
asyncStdoutToPython("/get/ui_language");
|
||||
};
|
||||
|
||||
const setUiLanguage = (selected_ui_language) => {
|
||||
updateUiLanguage(() => new Promise(() => {}));
|
||||
pendingUiLanguage();
|
||||
asyncStdoutToPython("/set/ui_language", selected_ui_language);
|
||||
};
|
||||
|
||||
|
||||
@@ -3,37 +3,61 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useLanguageSettings = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentEnableMultiTranslation, updateEnableMultiTranslation } = useStore_EnableMultiTranslation();
|
||||
const { currentSelectedYourLanguages, updateSelectedYourLanguages } = useStore_SelectedYourLanguages();
|
||||
const { currentSelectedTargetLanguages, updateSelectedTargetLanguages } = useStore_SelectedTargetLanguages();
|
||||
const { currentSelectedPresetTabNumber, updateSelectedPresetTabNumber } = useStore_SelectedPresetTabNumber();
|
||||
const { currentTranslationEngines, updateTranslationEngines } = useStore_TranslationEngines();
|
||||
const { currentSelectedTranslationEngines, updateSelectedTranslationEngines } = useStore_SelectedTranslationEngines();
|
||||
const {
|
||||
currentEnableMultiTranslation,
|
||||
updateEnableMultiTranslation,
|
||||
pendingEnableMultiTranslation,
|
||||
} = useStore_EnableMultiTranslation();
|
||||
const {
|
||||
currentSelectedYourLanguages,
|
||||
updateSelectedYourLanguages,
|
||||
pendingSelectedYourLanguages,
|
||||
} = useStore_SelectedYourLanguages();
|
||||
const {
|
||||
currentSelectedTargetLanguages,
|
||||
updateSelectedTargetLanguages,
|
||||
pendingSelectedTargetLanguages,
|
||||
} = useStore_SelectedTargetLanguages();
|
||||
const {
|
||||
currentSelectedPresetTabNumber,
|
||||
updateSelectedPresetTabNumber,
|
||||
pendingSelectedPresetTabNumber,
|
||||
} = useStore_SelectedPresetTabNumber();
|
||||
const {
|
||||
currentTranslationEngines,
|
||||
updateTranslationEngines,
|
||||
pendingTranslationEngines,
|
||||
} = useStore_TranslationEngines();
|
||||
const {
|
||||
currentSelectedTranslationEngines,
|
||||
updateSelectedTranslationEngines,
|
||||
pendingSelectedTranslationEngines,
|
||||
} = useStore_SelectedTranslationEngines();
|
||||
|
||||
const getEnableMultiTranslation = () => {
|
||||
updateEnableMultiTranslation(() => new Promise(() => {}));
|
||||
pendingEnableMultiTranslation();
|
||||
asyncStdoutToPython("/get/multi_language_translation");
|
||||
};
|
||||
|
||||
const getSelectedPresetTabNumber = () => {
|
||||
updateSelectedPresetTabNumber(() => new Promise(() => {}));
|
||||
pendingSelectedPresetTabNumber();
|
||||
asyncStdoutToPython("/get/selected_tab_no");
|
||||
};
|
||||
|
||||
const setSelectedPresetTabNumber = (preset_number) => {
|
||||
updateSelectedPresetTabNumber(() => new Promise(() => {}));
|
||||
pendingSelectedPresetTabNumber();
|
||||
|
||||
asyncStdoutToPython("/set/selected_tab_no", preset_number);
|
||||
};
|
||||
|
||||
|
||||
const getSelectedYourLanguages = () => {
|
||||
updateSelectedYourLanguages(() => new Promise(() => {}));
|
||||
pendingSelectedPresetTabNumber();
|
||||
asyncStdoutToPython("/get/selected_your_languages");
|
||||
};
|
||||
|
||||
const setSelectedYourLanguages = (selected_language_data) => {
|
||||
// updateSelectedYourLanguages(() => new Promise(() => {}));
|
||||
pendingSelectedYourLanguages();
|
||||
const send_obj = {
|
||||
...currentSelectedYourLanguages.data,
|
||||
[currentSelectedPresetTabNumber.data]: {
|
||||
@@ -48,12 +72,12 @@ export const useLanguageSettings = () => {
|
||||
|
||||
|
||||
const getSelectedTargetLanguages = () => {
|
||||
updateSelectedTargetLanguages(() => new Promise(() => {}));
|
||||
pendingSelectedTargetLanguages();
|
||||
asyncStdoutToPython("/get/selected_target_languages");
|
||||
};
|
||||
|
||||
const setSelectedTargetLanguages = (selected_language_data) => {
|
||||
// updateSelectedTargetLanguages(() => new Promise(() => {}));
|
||||
pendingSelectedTargetLanguages();
|
||||
let send_obj = currentSelectedTargetLanguages.data;
|
||||
|
||||
send_obj[currentSelectedPresetTabNumber.data].primary.language = selected_language_data.language,
|
||||
@@ -64,21 +88,19 @@ export const useLanguageSettings = () => {
|
||||
|
||||
|
||||
const getTranslationEngines = () => {
|
||||
updateTranslationEngines(() => new Promise(() => {}));
|
||||
pendingTranslationEngines();
|
||||
asyncStdoutToPython("/get/list_translation_engines");
|
||||
};
|
||||
|
||||
const getSelectedTranslationEngines = () => {
|
||||
updateSelectedTranslationEngines(() => new Promise(() => {}));
|
||||
pendingSelectedTranslationEngines();
|
||||
asyncStdoutToPython("/get/selected_translator_engines");
|
||||
};
|
||||
|
||||
const setSelectedTranslationEngines = (selected_translator) => {
|
||||
// updateSelectedTranslationEngines(() => new Promise(() => {}));
|
||||
let send_obj = currentSelectedTranslationEngines;
|
||||
|
||||
pendingSelectedTranslationEngines();
|
||||
let send_obj = currentSelectedTranslationEngines.data;
|
||||
send_obj[currentSelectedPresetTabNumber.data] = selected_translator;
|
||||
|
||||
asyncStdoutToPython("/set/selected_translator_engines", send_obj);
|
||||
};
|
||||
|
||||
|
||||
@@ -13,17 +13,17 @@ export const useMainFunction = () => {
|
||||
const {
|
||||
currentTranslationStatus,
|
||||
updateTranslationStatus,
|
||||
asyncUpdateTranslationStatus,
|
||||
pendingTranslationStatus,
|
||||
} = useStore_TranslationStatus();
|
||||
const {
|
||||
currentTranscriptionSendStatus,
|
||||
updateTranscriptionSendStatus,
|
||||
asyncUpdateTranscriptionSendStatus,
|
||||
pendingTranscriptionSendStatus,
|
||||
} = useStore_TranscriptionSendStatus();
|
||||
const {
|
||||
currentTranscriptionReceiveStatus,
|
||||
updateTranscriptionReceiveStatus,
|
||||
asyncUpdateTranscriptionReceiveStatus,
|
||||
pendingTranscriptionReceiveStatus,
|
||||
} = useStore_TranscriptionReceiveStatus();
|
||||
const {
|
||||
currentForegroundStatus,
|
||||
@@ -32,9 +32,8 @@ export const useMainFunction = () => {
|
||||
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
const asyncPending = () => new Promise(() => {});
|
||||
const toggleTranslation = () => {
|
||||
asyncUpdateTranslationStatus(asyncPending);
|
||||
pendingTranslationStatus();
|
||||
if (currentTranslationStatus.data) {
|
||||
asyncStdoutToPython("/set/disable_translation");
|
||||
} else {
|
||||
@@ -43,7 +42,7 @@ export const useMainFunction = () => {
|
||||
};
|
||||
|
||||
const toggleTranscriptionSend = () => {
|
||||
asyncUpdateTranscriptionSendStatus(asyncPending);
|
||||
pendingTranscriptionSendStatus();
|
||||
if (currentTranscriptionSendStatus.data) {
|
||||
asyncStdoutToPython("/set/disable_transcription_send");
|
||||
} else {
|
||||
@@ -52,7 +51,7 @@ export const useMainFunction = () => {
|
||||
};
|
||||
|
||||
const toggleTranscriptionReceive = () => {
|
||||
asyncUpdateTranscriptionReceiveStatus(asyncPending);
|
||||
pendingTranscriptionReceiveStatus();
|
||||
if (currentTranscriptionReceiveStatus.data) {
|
||||
asyncStdoutToPython("/set/disable_transcription_receive");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user