[Update] Config Page: Device Tab. Add mic/speaker auto select section.
This commit is contained in:
28
src-ui/logics/configs/useEnableAutoMicSelect.js
Normal file
28
src-ui/logics/configs/useEnableAutoMicSelect.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import { useStore_EnableAutoMicSelect } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useEnableAutoMicSelect = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentEnableAutoMicSelect, updateEnableAutoMicSelect } = useStore_EnableAutoMicSelect();
|
||||
|
||||
const getEnableAutoMicSelect = () => {
|
||||
updateEnableAutoMicSelect(() => new Promise(() => {}));
|
||||
asyncStdoutToPython("/config/enable_mic_automatic_selection");
|
||||
};
|
||||
|
||||
const toggleEnableAutoMicSelect = () => {
|
||||
updateEnableAutoMicSelect(() => new Promise(() => {}));
|
||||
if (currentEnableAutoMicSelect.data) {
|
||||
asyncStdoutToPython("/controller/callback_disable_mic_automatic_selection");
|
||||
} else {
|
||||
asyncStdoutToPython("/controller/callback_enable_mic_automatic_selection");
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
currentEnableAutoMicSelect,
|
||||
getEnableAutoMicSelect,
|
||||
updateEnableAutoMicSelect,
|
||||
toggleEnableAutoMicSelect,
|
||||
};
|
||||
};
|
||||
28
src-ui/logics/configs/useEnableAutoSpeakerSelect.js
Normal file
28
src-ui/logics/configs/useEnableAutoSpeakerSelect.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import { useStore_EnableAutoSpeakerSelect } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useEnableAutoSpeakerSelect = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect();
|
||||
|
||||
const getEnableAutoSpeakerSelect = () => {
|
||||
updateEnableAutoSpeakerSelect(() => new Promise(() => {}));
|
||||
asyncStdoutToPython("/config/enable_speaker_automatic_selection");
|
||||
};
|
||||
|
||||
const toggleEnableAutoSpeakerSelect = () => {
|
||||
updateEnableAutoSpeakerSelect(() => new Promise(() => {}));
|
||||
if (currentEnableAutoSpeakerSelect.data) {
|
||||
asyncStdoutToPython("/controller/callback_disable_speaker_automatic_selection");
|
||||
} else {
|
||||
asyncStdoutToPython("/controller/callback_enable_speaker_automatic_selection");
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
currentEnableAutoSpeakerSelect,
|
||||
getEnableAutoSpeakerSelect,
|
||||
updateEnableAutoSpeakerSelect,
|
||||
toggleEnableAutoSpeakerSelect,
|
||||
};
|
||||
};
|
||||
@@ -5,6 +5,8 @@ import { useSelectableLanguageList } from "./useSelectableLanguageList";
|
||||
import { useVolume } from "./useVolume";
|
||||
|
||||
import { useSoftwareVersion } from "@logics_configs/useSoftwareVersion";
|
||||
import { useEnableAutoMicSelect } from "@logics_configs/useEnableAutoMicSelect";
|
||||
import { useEnableAutoSpeakerSelect } from "@logics_configs/useEnableAutoSpeakerSelect";
|
||||
import { useMicHostList } from "@logics_configs/useMicHostList";
|
||||
import { useSelectedMicHost } from "@logics_configs/useSelectedMicHost";
|
||||
import { useMicDeviceList } from "@logics_configs/useMicDeviceList";
|
||||
@@ -35,6 +37,10 @@ export const useReceiveRoutes = () => {
|
||||
} = useMessage();
|
||||
|
||||
const { updateSoftwareVersion } = useSoftwareVersion();
|
||||
|
||||
const { updateEnableAutoMicSelect } = useEnableAutoMicSelect();
|
||||
const { updateEnableAutoSpeakerSelect } = useEnableAutoSpeakerSelect();
|
||||
|
||||
const { updateMicHostList } = useMicHostList();
|
||||
const { updateSelectedMicHost } = useSelectedMicHost();
|
||||
const { updateMicDeviceList } = useMicDeviceList();
|
||||
@@ -70,6 +76,11 @@ export const useReceiveRoutes = () => {
|
||||
|
||||
"/config/version": updateSoftwareVersion,
|
||||
|
||||
"/controller/callback_enable_mic_automatic_selection": updateEnableAutoMicSelect,
|
||||
"/controller/callback_disable_mic_automatic_selection": updateEnableAutoMicSelect,
|
||||
"/controller/callback_enable_speaker_automatic_selection": updateEnableAutoSpeakerSelect,
|
||||
"/controller/callback_disable_speaker_automatic_selection": updateEnableAutoSpeakerSelect,
|
||||
|
||||
"/controller/list_mic_host": (payload) => updateMicHostList(arrayToObject(payload)),
|
||||
"/config/choice_mic_host": updateSelectedMicHost,
|
||||
"/controller/callback_set_mic_host": (payload) => {
|
||||
|
||||
Reference in New Issue
Block a user