Move MicrophoneState to shortcut-microphone

This commit is contained in:
redphx
2024-05-25 07:51:51 +07:00
parent 774a822e69
commit 90df5d655f
2 changed files with 11 additions and 9 deletions

View File

@@ -1,6 +1,15 @@
import { t } from "@utils/translation";
import { Toast } from "@utils/toast";
export enum MicrophoneState {
REQUESTED = 'Requested',
ENABLED = 'Enabled',
MUTED = 'Muted',
NOT_ALLOWED = 'NotAllowed',
NOT_FOUND = 'NotFound',
}
export class MicrophoneShortcut {
static toggle(showToast: boolean = true): boolean {
if (!window.BX_EXPOSED.streamSession) {
@@ -8,7 +17,7 @@ export class MicrophoneShortcut {
}
const state = window.BX_EXPOSED.streamSession._microphoneState;
const enableMic = state === 'Enabled' ? false : true;
const enableMic = state === MicrophoneState.ENABLED ? false : true;
try {
window.BX_EXPOSED.streamSession.tryEnableChatAsync(enableMic);