diff --git a/src/modules/game-bar/action-microphone.ts b/src/modules/game-bar/action-microphone.ts index 4ebbfd7..6037a48 100644 --- a/src/modules/game-bar/action-microphone.ts +++ b/src/modules/game-bar/action-microphone.ts @@ -3,15 +3,8 @@ import { BxIcon } from "@utils/bx-icon"; import { createButton, ButtonStyle, CE } from "@utils/html"; import { t } from "@utils/translation"; import { BaseGameBarAction } from "./action-base"; -import { MicrophoneShortcut } from "../shortcuts/shortcut-microphone"; +import { MicrophoneShortcut, MicrophoneState } from "../shortcuts/shortcut-microphone"; -enum MicrophoneState { - REQUESTED = 'Requested', - ENABLED = 'Enabled', - MUTED = 'Muted', - NOT_ALLOWED = 'NotAllowed', - NOT_FOUND = 'NotFound', -} export class MicrophoneAction extends BaseGameBarAction { $content: HTMLElement; diff --git a/src/modules/shortcuts/shortcut-microphone.ts b/src/modules/shortcuts/shortcut-microphone.ts index af31ab9..eb54266 100644 --- a/src/modules/shortcuts/shortcut-microphone.ts +++ b/src/modules/shortcuts/shortcut-microphone.ts @@ -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);