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

49 lines
1.8 KiB
TypeScript

// Metro module 12853 (f12854).
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import CallStore from "../../../../stores/CallStore";
import VoiceStateStore from "../../../../stores/VoiceStateStore";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { intl, t } from "../../../../intl/index.native";
import { CallStates } from "../CallStateHooks";
import { LegacyText } from "../../../../design/void/native";
export default function OngoingCallStatusLabel(props) {
let r31;
const { style, channel: channel2, voiceState } = props;
let useAllAloneText = props.useAllAloneText;
if (useAllAloneText === void 0) {
useAllAloneText = true;
}
let id;
const channel = channel2;
if (useAllAloneText === void 0) {
useAllAloneText = true;
}
L15: {
id = void 0;
id = AuthenticationStore.getId();
const stateFromStores = useStateFromStores([VoiceStateStore, CallStore], () => {
if (channel == null) {
return false;
}
const r13 = Object.values(VoiceStateStore.getVoiceStatesForChannel(channel.id));
const call = CallStore.getCall(channel.id);
const r2 = call != null && call.ringing.length > 0;
return (r2 ? !r2 : r13.length === 1) && r13[0].userId === id;
}, [id, channel]);
r31 = intl.string(t["1zFMqU"]);
if (CallStates.DISCONNECTING !== voiceState && CallStates.CONNECTED !== voiceState) {
if (CallStates.RINGING === voiceState) {
r31 = intl.string(t.Xuzre8);
break L15;
}
if (CallStates.DISCONNECTED !== voiceState) {
break L15;
}
r31 = intl.string(t["w//7ET"]);
} else {
r31 = stateFromStores && useAllAloneText ? intl.string(t.xNeSms) : intl.string(t["NGg/fm"]);
}
}
return <LegacyText style={style}>{r31}</LegacyText>;
};