Files
discord-decomp/modules/voice_calls/collectCallFeedback.tsx
T
2026-11-01 12:12:55 +02:00

63 lines
2.9 KiB
TypeScript

// Metro module 12689 (f12690).
import VideoBackgroundStore from "../video_backgrounds/VideoBackgroundStore";
import ChannelStore from "../../stores/ChannelStore";
import MediaEngineStore from "../../stores/MediaEngineStore";
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import UserStore from "../../stores/UserStore";
import AudioRouteStore_native from "./AudioRouteStore.native";
import { getVoiceStateMetadata } from "../app_analytics/AppAnalyticsUtils";
import { getLastUsedVideoBackgroundOption } from "../video_backgrounds/LastUsedVideoBackgroundOption";
import { getEffectAnalyticsType, getEffectDetailAnalyticsName } from "../video_backgrounds/VideoBackgroundUtils";
import Dispatcher from "../../Dispatcher";
import { HermesBuiltin } from "../../_hermes/prelude";
export default function collectCallFeedback(a0, a1, a2, a3) {
L15: {
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
const channel = ChannelStore.getChannel(voiceChannelId);
if (a1 == null && (voiceChannelId != null && channel != null)) {
const rTCConnection = RTCConnectionStore.getRTCConnection();
const r9 = rTCConnection == null ? void 0 : rTCConnection.getVoiceDurationStats();
const analyticsData = {
channel_id: channel.id,
channel_type: channel.type,
guild_id: channel.getGuildId(),
rtc_connection_id: RTCConnectionStore.getRTCConnectionId(),
duration: RTCConnectionStore.getDuration(),
media_session_id: RTCConnectionStore.getMediaSessionId(),
...getVoiceStateMetadata(RTCConnectionStore.getGuildId(), RTCConnectionStore.getChannelId(), a3)
};
let duration_muted_ms = r9?.duration_muted_ms;
if (duration_muted_ms == null) {
duration_muted_ms = null;
}
analyticsData.duration_muted_ms = duration_muted_ms;
analyticsData.output_audio_route_type = AudioRouteStore_native.getCurrentRouteType();
a0();
if (VideoBackgroundStore.hasUsedBackgroundInCall) {
const analyticsData2 = {
...analyticsData
};
const lastUsedVideoBackgroundOption = getLastUsedVideoBackgroundOption(UserStore.getCurrentUser());
HermesBuiltin.copyDataProperties(analyticsData2, {
video_device_name: MediaEngineStore.getVideoDevices()[MediaEngineStore.getVideoDeviceId()]?.name,
video_hardware_scaling_enabled: MediaEngineStore.getHardwareEncoding(),
video_effect_type: getEffectAnalyticsType(lastUsedVideoBackgroundOption),
video_effect_detail: getEffectDetailAnalyticsName(lastUsedVideoBackgroundOption)
});
Dispatcher.dispatch({
type: "VIDEO_BACKGROUND_SHOW_FEEDBACK",
analyticsData: analyticsData2
});
break L15;
}
Dispatcher.dispatch({
type: "VOICE_CHANNEL_SHOW_FEEDBACK",
analyticsData
});
} else {
a0();
}
}
};