Revert casing to fix bottom nav status buttons (should swap back when as an in place option on send)

This commit is contained in:
GigiaJ 2025-04-22 00:27:31 -04:00
parent 02cb7ea9a7
commit 7beb8411a9

View file

@ -11,13 +11,12 @@ import { logger } from 'matrix-js-sdk/lib/logger';
import { WidgetApiToWidgetAction, ITransport, WidgetApiAction } from 'matrix-widget-api'; import { WidgetApiToWidgetAction, ITransport, WidgetApiAction } from 'matrix-widget-api';
interface MediaStatePayload { interface MediaStatePayload {
audioEnabled?: boolean; audio_enabled?: boolean;
videoEnabled?: boolean; video_enabled?: boolean;
} }
const WIDGET_MEDIA_STATE_UPDATE_ACTION = 'io.element.device_mute'; const WIDGET_MEDIA_STATE_UPDATE_ACTION = 'io.element.device_mute';
const WIDGET_HANGUP_ACTION = 'io.element.hangup'; const WIDGET_HANGUP_ACTION = 'io.element.hangup';
const SET_MEDIA_STATE_ACTION = 'io.element.device_mute'; const SET_MEDIA_STATE_ACTION = 'io.element.device_mute';
interface CallContextState { interface CallContextState {
@ -143,14 +142,14 @@ export function CallProvider({ children }: CallProviderProps) {
`CallContext: Received media state update from widget in room ${activeCallRoomId}:`, `CallContext: Received media state update from widget in room ${activeCallRoomId}:`,
ev.detail ev.detail
); );
const { audioEnabled, videoEnabled } = ev.detail; const { audio_enabled, video_enabled } = ev.detail;
if (typeof audioEnabled === 'boolean' && audioEnabled !== isAudioEnabled) { if (typeof audio_enabled === 'boolean' && audio_enabled !== isAudioEnabled) {
logger.debug(`CallContext: Updating audio enabled state from widget: ${audioEnabled}`); logger.debug(`CallContext: Updating audio enabled state from widget: ${audio_enabled}`);
setIsAudioEnabledState(audioEnabled); setIsAudioEnabledState(audio_enabled);
} }
if (typeof videoEnabled === 'boolean' && videoEnabled !== isVideoEnabled) { if (typeof video_enabled === 'boolean' && video_enabled !== isVideoEnabled) {
logger.debug(`CallContext: Updating video enabled state from widget: ${videoEnabled}`); logger.debug(`CallContext: Updating video enabled state from widget: ${video_enabled}`);
setIsVideoEnabledState(videoEnabled); setIsVideoEnabledState(video_enabled);
} }
}; };
@ -209,8 +208,8 @@ export function CallProvider({ children }: CallProviderProps) {
setIsAudioEnabledState(newState); setIsAudioEnabledState(newState);
try { try {
await sendWidgetAction(SET_MEDIA_STATE_ACTION, { await sendWidgetAction(SET_MEDIA_STATE_ACTION, {
audioEnabled: newState, audio_enabled: newState,
videoEnabled: isVideoEnabled, video_enabled: isVideoEnabled,
}); });
logger.debug(`CallContext: Successfully sent audio toggle action.`); logger.debug(`CallContext: Successfully sent audio toggle action.`);
} catch (error) { } catch (error) {
@ -226,8 +225,8 @@ export function CallProvider({ children }: CallProviderProps) {
setIsVideoEnabledState(newState); setIsVideoEnabledState(newState);
try { try {
await sendWidgetAction(SET_MEDIA_STATE_ACTION, { await sendWidgetAction(SET_MEDIA_STATE_ACTION, {
audioEnabled: isAudioEnabled, audio_enabled: isAudioEnabled,
videoEnabled: newState, video_enabled: newState,
}); });
logger.debug(`CallContext: Successfully sent video toggle action.`); logger.debug(`CallContext: Successfully sent video toggle action.`);
} catch (error) { } catch (error) {
@ -264,10 +263,12 @@ export function CallProvider({ children }: CallProviderProps) {
activeApiTransport, activeApiTransport,
registerActiveTransport, registerActiveTransport,
sendWidgetAction, sendWidgetAction,
isChatOpen,
isAudioEnabled, isAudioEnabled,
isVideoEnabled, isVideoEnabled,
toggleAudio, toggleAudio,
toggleVideo, toggleVideo,
toggleChat,
] ]
); );