[Refactor] Change the function names.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { useEnableAutoClearMessageBox as useStoreEnableAutoClearMessageBox } from "@store";
|
||||
import { useStore_EnableAutoClearMessageBox } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useEnableAutoClearMessageBox = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentEnableAutoClearMessageBox, updateEnableAutoClearMessageBox } = useStoreEnableAutoClearMessageBox();
|
||||
const { currentEnableAutoClearMessageBox, updateEnableAutoClearMessageBox } = useStore_EnableAutoClearMessageBox();
|
||||
|
||||
const getEnableAutoClearMessageBox = () => {
|
||||
updateEnableAutoClearMessageBox(() => new Promise(() => {}));
|
||||
@@ -20,9 +20,9 @@ export const useEnableAutoClearMessageBox = () => {
|
||||
};
|
||||
|
||||
return {
|
||||
currentEnableAutoClearMessageBox,
|
||||
getEnableAutoClearMessageBox,
|
||||
toggleEnableAutoClearMessageBox,
|
||||
currentEnableAutoClearMessageBox,
|
||||
updateEnableAutoClearMessageBox
|
||||
updateEnableAutoClearMessageBox,
|
||||
};
|
||||
};
|
||||
@@ -1,14 +1,18 @@
|
||||
import { useMicDeviceList as useStoreMicDeviceList } from "@store";
|
||||
import { useStore_MicDeviceList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useMicDeviceList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentMicDeviceList, updateMicDeviceList } = useStoreMicDeviceList();
|
||||
const { currentMicDeviceList, updateMicDeviceList } = useStore_MicDeviceList();
|
||||
|
||||
const getMicDeviceList = () => {
|
||||
updateMicDeviceList(() => new Promise(() => {}));
|
||||
asyncStdoutToPython("/controller/list_mic_device");
|
||||
};
|
||||
|
||||
return { currentMicDeviceList, getMicDeviceList, updateMicDeviceList };
|
||||
return {
|
||||
currentMicDeviceList,
|
||||
getMicDeviceList,
|
||||
updateMicDeviceList,
|
||||
};
|
||||
};
|
||||
@@ -1,14 +1,18 @@
|
||||
import { useMicHostList as useStoreMicHostList } from "@store";
|
||||
import { useStore_MicHostList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useMicHostList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentMicHostList, updateMicHostList } = useStoreMicHostList();
|
||||
const { currentMicHostList, updateMicHostList } = useStore_MicHostList();
|
||||
|
||||
const getMicHostList = () => {
|
||||
updateMicHostList(() => new Promise(() => {}));
|
||||
asyncStdoutToPython("/controller/list_mic_host");
|
||||
};
|
||||
|
||||
return { currentMicHostList, getMicHostList, updateMicHostList };
|
||||
return {
|
||||
currentMicHostList,
|
||||
getMicHostList,
|
||||
updateMicHostList,
|
||||
};
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useMicThreshold as useStoreMicThreshold } from "@store";
|
||||
import { useStore_MicThreshold } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useMicThreshold = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { updateMicThreshold, currentMicThreshold } = useStoreMicThreshold();
|
||||
const { updateMicThreshold, currentMicThreshold } = useStore_MicThreshold();
|
||||
|
||||
const getMicThreshold = () => {
|
||||
asyncStdoutToPython("/config/input_mic_energy_threshold");
|
||||
@@ -13,5 +13,10 @@ export const useMicThreshold = () => {
|
||||
asyncStdoutToPython("/controller/callback_set_mic_energy_threshold", mic_threshold);
|
||||
};
|
||||
|
||||
return { getMicThreshold, setMicThreshold, currentMicThreshold, updateMicThreshold };
|
||||
return {
|
||||
currentMicThreshold,
|
||||
getMicThreshold,
|
||||
setMicThreshold,
|
||||
updateMicThreshold,
|
||||
};
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useSelectedMicDevice as useStoreSelectedMicDevice } from "@store";
|
||||
import { useStore_SelectedMicDevice } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSelectedMicDevice = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSelectedMicDevice, updateSelectedMicDevice } = useStoreSelectedMicDevice();
|
||||
const { currentSelectedMicDevice, updateSelectedMicDevice } = useStore_SelectedMicDevice();
|
||||
|
||||
const getSelectedMicDevice = () => {
|
||||
updateSelectedMicDevice(() => new Promise(() => {}));
|
||||
@@ -15,5 +15,10 @@ export const useSelectedMicDevice = () => {
|
||||
asyncStdoutToPython("/controller/callback_set_mic_device", selected_mic_device);
|
||||
};
|
||||
|
||||
return { currentSelectedMicDevice, getSelectedMicDevice, updateSelectedMicDevice, setSelectedMicDevice };
|
||||
return {
|
||||
currentSelectedMicDevice,
|
||||
getSelectedMicDevice,
|
||||
updateSelectedMicDevice,
|
||||
setSelectedMicDevice,
|
||||
};
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useSelectedMicHost as useStoreSelectedMicHost } from "@store";
|
||||
import { useStore_SelectedMicHost } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSelectedMicHost = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSelectedMicHost, updateSelectedMicHost } = useStoreSelectedMicHost();
|
||||
const { currentSelectedMicHost, updateSelectedMicHost } = useStore_SelectedMicHost();
|
||||
|
||||
const getSelectedMicHost = () => {
|
||||
updateSelectedMicHost(() => new Promise(() => {}));
|
||||
@@ -15,5 +15,10 @@ export const useSelectedMicHost = () => {
|
||||
asyncStdoutToPython("/controller/callback_set_mic_host", selected_mic_host);
|
||||
};
|
||||
|
||||
return { currentSelectedMicHost, getSelectedMicHost, updateSelectedMicHost, setSelectedMicHost };
|
||||
return {
|
||||
currentSelectedMicHost,
|
||||
getSelectedMicHost,
|
||||
updateSelectedMicHost,
|
||||
setSelectedMicHost,
|
||||
};
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useSelectedSpeakerDevice as useStoreSelectedSpeakerDevice } from "@store";
|
||||
import { useStore_SelectedSpeakerDevice } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSelectedSpeakerDevice = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice } = useStoreSelectedSpeakerDevice();
|
||||
const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice();
|
||||
|
||||
const getSelectedSpeakerDevice = () => {
|
||||
updateSelectedSpeakerDevice(() => new Promise(() => {}));
|
||||
@@ -15,5 +15,10 @@ export const useSelectedSpeakerDevice = () => {
|
||||
asyncStdoutToPython("/controller/callback_set_speaker_device", selected_speaker_device);
|
||||
};
|
||||
|
||||
return { currentSelectedSpeakerDevice, getSelectedSpeakerDevice, updateSelectedSpeakerDevice, setSelectedSpeakerDevice };
|
||||
return {
|
||||
currentSelectedSpeakerDevice,
|
||||
getSelectedSpeakerDevice,
|
||||
updateSelectedSpeakerDevice,
|
||||
setSelectedSpeakerDevice,
|
||||
};
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useSendMessageButtonType as useStoreSendMessageButtonType } from "@store";
|
||||
import { useStore_SendMessageButtonType } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSendMessageButtonType = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSendMessageButtonType, updateSendMessageButtonType } = useStoreSendMessageButtonType();
|
||||
const { currentSendMessageButtonType, updateSendMessageButtonType } = useStore_SendMessageButtonType();
|
||||
|
||||
const getSendMessageButtonType = () => {
|
||||
updateSendMessageButtonType(() => new Promise(() => {}));
|
||||
@@ -16,9 +16,9 @@ export const useSendMessageButtonType = () => {
|
||||
};
|
||||
|
||||
return {
|
||||
currentSendMessageButtonType,
|
||||
getSendMessageButtonType,
|
||||
setSendMessageButtonType,
|
||||
currentSendMessageButtonType,
|
||||
updateSendMessageButtonType
|
||||
updateSendMessageButtonType,
|
||||
};
|
||||
};
|
||||
@@ -1,14 +1,18 @@
|
||||
import { useSoftwareVersion as useStoreSoftwareVersion } from "@store";
|
||||
import { useStore_SoftwareVersion } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSoftwareVersion = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSoftwareVersion, updateSoftwareVersion } = useStoreSoftwareVersion();
|
||||
const { currentSoftwareVersion, updateSoftwareVersion } = useStore_SoftwareVersion();
|
||||
|
||||
const getSoftwareVersion = () => {
|
||||
updateSoftwareVersion(() => new Promise(() => {}));
|
||||
asyncStdoutToPython("/config/version");
|
||||
};
|
||||
|
||||
return { currentSoftwareVersion, getSoftwareVersion, updateSoftwareVersion };
|
||||
return {
|
||||
currentSoftwareVersion,
|
||||
getSoftwareVersion,
|
||||
updateSoftwareVersion,
|
||||
};
|
||||
};
|
||||
@@ -1,14 +1,18 @@
|
||||
import { useSpeakerDeviceList as useStoreSpeakerDeviceList } from "@store";
|
||||
import { useStore_SpeakerDeviceList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSpeakerDeviceList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSpeakerDeviceList, updateSpeakerDeviceList } = useStoreSpeakerDeviceList();
|
||||
const { currentSpeakerDeviceList, updateSpeakerDeviceList } = useStore_SpeakerDeviceList();
|
||||
|
||||
const getSpeakerDeviceList = () => {
|
||||
updateSpeakerDeviceList(() => new Promise(() => {}));
|
||||
asyncStdoutToPython("/controller/list_speaker_device");
|
||||
};
|
||||
|
||||
return { currentSpeakerDeviceList, getSpeakerDeviceList, updateSpeakerDeviceList };
|
||||
return {
|
||||
currentSpeakerDeviceList,
|
||||
getSpeakerDeviceList,
|
||||
updateSpeakerDeviceList,
|
||||
};
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useSpeakerThreshold as useStoreSpeakerThreshold } from "@store";
|
||||
import { useStore_SpeakerThreshold } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSpeakerThreshold = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { updateSpeakerThreshold, currentSpeakerThreshold } = useStoreSpeakerThreshold();
|
||||
const { updateSpeakerThreshold, currentSpeakerThreshold } = useStore_SpeakerThreshold();
|
||||
|
||||
const getSpeakerThreshold = () => {
|
||||
asyncStdoutToPython("/config/input_speaker_energy_threshold");
|
||||
@@ -13,5 +13,10 @@ export const useSpeakerThreshold = () => {
|
||||
asyncStdoutToPython("/controller/callback_set_speaker_energy_threshold", speaker_threshold);
|
||||
};
|
||||
|
||||
return { getSpeakerThreshold, setSpeakerThreshold, currentSpeakerThreshold, updateSpeakerThreshold };
|
||||
return {
|
||||
currentSpeakerThreshold,
|
||||
getSpeakerThreshold,
|
||||
setSpeakerThreshold,
|
||||
updateSpeakerThreshold,
|
||||
};
|
||||
};
|
||||
@@ -1,10 +1,10 @@
|
||||
import { getCurrent } from "@tauri-apps/api/window";
|
||||
|
||||
import {
|
||||
useTranslationStatus,
|
||||
useTranscriptionSendStatus,
|
||||
useTranscriptionReceiveStatus,
|
||||
useForegroundStatus,
|
||||
useStore_TranslationStatus,
|
||||
useStore_TranscriptionSendStatus,
|
||||
useStore_TranscriptionReceiveStatus,
|
||||
useStore_ForegroundStatus,
|
||||
} from "@store";
|
||||
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
@@ -14,21 +14,21 @@ export const useMainFunction = () => {
|
||||
currentTranslationStatus,
|
||||
updateTranslationStatus,
|
||||
asyncUpdateTranslationStatus,
|
||||
} = useTranslationStatus();
|
||||
} = useStore_TranslationStatus();
|
||||
const {
|
||||
currentTranscriptionSendStatus,
|
||||
updateTranscriptionSendStatus,
|
||||
asyncUpdateTranscriptionSendStatus,
|
||||
} = useTranscriptionSendStatus();
|
||||
} = useStore_TranscriptionSendStatus();
|
||||
const {
|
||||
currentTranscriptionReceiveStatus,
|
||||
updateTranscriptionReceiveStatus,
|
||||
asyncUpdateTranscriptionReceiveStatus,
|
||||
} = useTranscriptionReceiveStatus();
|
||||
} = useStore_TranscriptionReceiveStatus();
|
||||
const {
|
||||
currentForegroundStatus,
|
||||
updateForegroundStatus,
|
||||
} = useForegroundStatus();
|
||||
} = useStore_ForegroundStatus();
|
||||
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {
|
||||
useMessageLogsStatus,
|
||||
useStore_MessageLogs,
|
||||
} from "@store";
|
||||
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useMessage = () => {
|
||||
const { currentMessageLogsStatus, addMessageLogsStatus, updateMessageLogsStatus } = useMessageLogsStatus();
|
||||
const { currentMessageLogs, addMessageLogs, updateMessageLogs } = useStore_MessageLogs();
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
|
||||
const sendMessage = (message) => {
|
||||
@@ -16,7 +16,7 @@ export const useMessage = () => {
|
||||
};
|
||||
asyncStdoutToPython("/controller/callback_messagebox_send", send_message_object);
|
||||
|
||||
addMessageLogsStatus({
|
||||
addMessageLogs({
|
||||
id: uuid,
|
||||
category: "sent",
|
||||
status: "pending",
|
||||
@@ -29,19 +29,19 @@ export const useMessage = () => {
|
||||
};
|
||||
|
||||
const updateSentMessageLogById = (payload) => {
|
||||
updateMessageLogsStatus(updateItemById(payload.id, payload.translation));
|
||||
updateMessageLogs(updateItemById(payload.id, payload.translation));
|
||||
};
|
||||
const addSentMessageLog = (payload) => {
|
||||
const message_object = generateMessageObject(payload, "sent");
|
||||
addMessageLogsStatus(message_object);
|
||||
addMessageLogs(message_object);
|
||||
};
|
||||
const addReceivedMessageLog = (payload) => {
|
||||
const message_object = generateMessageObject(payload, "received");
|
||||
addMessageLogsStatus(message_object);
|
||||
addMessageLogs(message_object);
|
||||
};
|
||||
|
||||
return {
|
||||
currentMessageLogsStatus,
|
||||
currentMessageLogs,
|
||||
sendMessage,
|
||||
updateSentMessageLogById,
|
||||
addSentMessageLog,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import {
|
||||
useMicVolume,
|
||||
useSpeakerVolume,
|
||||
useStore_MicVolume,
|
||||
useStore_SpeakerVolume,
|
||||
} from "@store";
|
||||
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useVolume = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { updateMicVolume } = useMicVolume();
|
||||
const { updateSpeakerVolume } = useSpeakerVolume();
|
||||
const { updateMicVolume } = useStore_MicVolume();
|
||||
const { updateSpeakerVolume } = useStore_SpeakerVolume();
|
||||
|
||||
return {
|
||||
volumeCheckStart_Mic: () => asyncStdoutToPython("/controller/callback_enable_check_mic_threshold"),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { WebviewWindow } from "@tauri-apps/api/window";
|
||||
import { store, useIsOpenedConfigPage } from "@store";
|
||||
import { store, useStore_IsOpenedConfigPage } from "@store";
|
||||
import { getCurrent } from "@tauri-apps/api/window";
|
||||
|
||||
export const useWindow = () => {
|
||||
const { updateIsOpenedConfigPage } = useIsOpenedConfigPage();
|
||||
const { updateIsOpenedConfigPage } = useStore_IsOpenedConfigPage();
|
||||
|
||||
const createConfigPage = async () => {
|
||||
const main_page = getCurrent();
|
||||
|
||||
Reference in New Issue
Block a user