[Refactor] (Huge Refactoring) ReceiveRoutes: change the way define endpoints, hooks and methods.
Remove 'multi language translation enable/disable' related methods that is no longer in use from quite ago.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useStore_MicDeviceList } from "@store";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
import { arrayToObject } from "@utils";
|
||||
|
||||
export const useMicDeviceList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
@@ -10,9 +11,17 @@ export const useMicDeviceList = () => {
|
||||
asyncStdoutToPython("/get/data/mic_device_list");
|
||||
};
|
||||
|
||||
|
||||
const updateMicDeviceList_FromBackend = (payload) => {
|
||||
updateMicDeviceList(arrayToObject(payload));
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
currentMicDeviceList,
|
||||
getMicDeviceList,
|
||||
updateMicDeviceList,
|
||||
|
||||
updateMicDeviceList_FromBackend,
|
||||
};
|
||||
};
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useStore_MicHostList } from "@store";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
import { arrayToObject } from "@utils";
|
||||
|
||||
export const useMicHostList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
@@ -10,9 +11,15 @@ export const useMicHostList = () => {
|
||||
asyncStdoutToPython("/get/data/mic_host_list");
|
||||
};
|
||||
|
||||
const updateMicHostList_FromBackend = (payload) => {
|
||||
updateMicHostList(arrayToObject(payload));
|
||||
};
|
||||
|
||||
return {
|
||||
currentMicHostList,
|
||||
getMicHostList,
|
||||
updateMicHostList,
|
||||
|
||||
updateMicHostList_FromBackend,
|
||||
};
|
||||
};
|
||||
@@ -1,10 +1,13 @@
|
||||
import { useStore_SelectedMicHost } from "@store";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
import { useSelectedMicDevice } from "@logics_configs";
|
||||
|
||||
export const useSelectedMicHost = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost();
|
||||
|
||||
const { updateSelectedMicDevice } = useSelectedMicDevice();
|
||||
|
||||
const getSelectedMicHost = () => {
|
||||
pendingSelectedMicHost();
|
||||
asyncStdoutToPython("/get/data/selected_mic_host");
|
||||
@@ -15,10 +18,20 @@ export const useSelectedMicHost = () => {
|
||||
asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host);
|
||||
};
|
||||
|
||||
|
||||
// Need refactoring (Duplicated, Host, Device)
|
||||
const updateSelectedMicHostAndDevice = (payload) => {
|
||||
updateSelectedMicHost(payload.host);
|
||||
updateSelectedMicDevice(payload.device);
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
currentSelectedMicHost,
|
||||
getSelectedMicHost,
|
||||
updateSelectedMicHost,
|
||||
setSelectedMicHost,
|
||||
|
||||
updateSelectedMicHostAndDevice,
|
||||
};
|
||||
};
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useStore_SpeakerDeviceList } from "@store";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
import { arrayToObject } from "@utils";
|
||||
|
||||
export const useSpeakerDeviceList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
@@ -10,9 +11,16 @@ export const useSpeakerDeviceList = () => {
|
||||
asyncStdoutToPython("/get/data/speaker_device_list");
|
||||
};
|
||||
|
||||
const updateSpeakerDeviceList_FromBackend = (payload) => {
|
||||
updateSpeakerDeviceList(arrayToObject(payload));
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
currentSpeakerDeviceList,
|
||||
getSpeakerDeviceList,
|
||||
updateSpeakerDeviceList,
|
||||
|
||||
updateSpeakerDeviceList_FromBackend,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user