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

56 lines
1.7 KiB
TypeScript

// Metro module 10043 (f10044).
import AuthenticationStore from "../../stores/AuthenticationStore";
import MediaEngineStore from "../../stores/MediaEngineStore";
import { ParticipantTypes, isStreamParticipant, isUserParticipant } from "../calls/CallConstants";
import { useStateFromStores } from "../../_bundle/Module589";
const canRenderParticipantVideo = function canRenderParticipantVideo(a0, r7 = MediaEngineStore) {
let r15;
let r3 = a0 != null;
if (r3) {
let r12 = a0.type !== ParticipantTypes.ACTIVITY;
if (r12) {
if (isStreamParticipant(a0)) {
r15 = a0.streamId != null;
} else {
r15 = a0.voiceState?.selfVideo;
if (r15 == null) {
r15 = false;
}
}
r12 = r15;
}
let r18 = !!r12;
if (r18) {
const isStreamParticipant2 = isStreamParticipant(a0);
let r21 = isStreamParticipant2 ? a0.user.id !== AuthenticationStore.getId() : !isStreamParticipant2;
if (r21) {
const isUserParticipant2 = isUserParticipant(a0);
r21 = isUserParticipant2 ? !r7.isLocalVideoDisabled(a0.id) : !isUserParticipant2;
}
r18 = r21;
}
r3 = r18;
}
return r3;
};
export default function participantHasVideo(a0) {
let r12;
let r8 = a0.type !== ParticipantTypes.ACTIVITY;
if (r8) {
if (isStreamParticipant(a0)) {
r12 = a0.streamId != null;
} else {
r12 = a0.voiceState?.selfVideo;
if (r12 == null) {
r12 = false;
}
}
r8 = r12;
}
return r8;
};
export { canRenderParticipantVideo };
export function useCanRenderParticipantVideo(c17651_0) {
return useStateFromStores([MediaEngineStore], () => canRenderParticipantVideo(c17651_0, MediaEngineStore));
}