This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+79
View File
@@ -0,0 +1,79 @@
// Metro module 4207 (f4208).
let c2427_0 = {
STREAM: 0,
0: "STREAM",
HIDDEN_STREAM: 1,
1: "HIDDEN_STREAM",
USER: 2,
2: "USER",
ACTIVITY: 3,
3: "ACTIVITY"
};
const r14 = {
STREAM: "STREAM",
USER: "USER",
ACTIVITY: "ACTIVITY"
};
const r13 = {
NONE: "NONE",
AUTO: "AUTO"
};
const r12 = {
DESKTOP: 0,
0: "DESKTOP",
MOBILE: 1,
1: "MOBILE",
XBOX: 2,
2: "XBOX",
PLAYSTATION: 3,
3: "PLAYSTATION",
QUEST: 4,
4: "QUEST"
};
const r11 = {
CONTEXT_MENU: "Context Menu",
THREE_DOT: "Three-Dot",
CARET: "Caret",
OTHER_BUTTON: "Other Button"
};
const r37 = {
VIDEO: 0,
0: "VIDEO",
CAMERA_PREVIEW: 1,
1: "CAMERA_PREVIEW",
HAVEN: 2,
2: "HAVEN"
};
const r41 = {};
r41[r37.VIDEO] = 320;
r41[r37.CAMERA_PREVIEW] = 160;
r41[r37.HAVEN] = 320;
const r47 = {};
r47[r37.VIDEO] = 960;
r47[r37.CAMERA_PREVIEW] = 480;
r47[r37.HAVEN] = 960;
const r53 = {};
r53[r37.VIDEO] = 200;
r53[r37.CAMERA_PREVIEW] = 160;
r53[r37.HAVEN] = 200;
export { c2427_0 as ParticipantTypes };
export { r14 as ContextMenuTileTypes };
export { r13 as ParticipantSelectionTypes };
export { r12 as VoicePlatforms };
export { r11 as CallMenuEntrypoint };
export function isStreamParticipant(a0) {
return a0?.type === c2427_0.STREAM || a0?.type === c2427_0.HIDDEN_STREAM;
}
export function isUserParticipant(a0) {
return a0?.type === c2427_0.USER;
}
export function isActivityParticipant(a0) {
return a0?.type === c2427_0.ACTIVITY;
}
export { r37 as PictureInPictureTypes };
export { r41 as DEFAULT_PIP_WIDTH };
export { r47 as MAX_PIP_WIDTH };
export { r53 as MIN_PIP_WIDTH };
export const EMOJI_PICKER_EMOJI_TO_SHOW_COUNT = 8;
export const MIN_CALL_WIDTH = 550;
export const MIN_CALL_HEIGHT = 230;
+91
View File
@@ -0,0 +1,91 @@
// Metro module 16148 (f16149).
import SoundpackStore from "../soundpacks/SoundpackStore";
import CallStore from "../../stores/CallStore";
import ChannelStore from "../../stores/ChannelStore";
import NotificationSettingsStore from "../../stores/NotificationSettingsStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import StreamerModeStore from "../../stores/StreamerModeStore";
import VoiceStateStore from "../../stores/VoiceStateStore";
import SortedVoiceStateStore from "../../stores/views/SortedVoiceStateStore";
import ChannelRTCStore from "./ChannelRTCStore";
import { createSoundForPack } from "../sound_playback/SoundUtils";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
import { HermesBuiltin } from "../../_hermes/prelude";
let soundForPack = createSoundForPack("call_calling", SoundpackStore.getSoundpack());
let c11569_12 = Symbol("#n");
class ChannelCallManager extends AutomaticLifecycleManager {
constructor() {
super(...arguments);
const set = new Set();
if (Object.prototype.hasOwnProperty.call(this, c11569_12)) {
HermesBuiltin.throwTypeError("Cannot initialize private field twice.");
throw new Error("unreachable");
}
this[c11569_12] = set;
this.actions = {
GUILD_LOCAL_RING_START: (a0) => this.handleGuildRingStart(a0),
GUILD_RING_STOP: (a0) => this.handleGuildRingStop(a0)
};
this._handleRing = (a0, a1) => {
const currentClientVoiceChannelId = VoiceStateStore.getCurrentClientVoiceChannelId(a1);
const r1 = currentClientVoiceChannelId != null && SortedVoiceStateStore.countVoiceStatesForChannel(currentClientVoiceChannelId) >= 2;
if (currentClientVoiceChannelId != null && (!r1 && (a0 && (!NotificationSettingsStore.isSoundDisabled("call_calling") && !StreamerModeStore.disableSounds)))) {
soundForPack.loop();
} else {
soundForPack.stop();
}
};
this.handleSoundpackUpdate = () => {
soundForPack.stop();
soundForPack = createSoundForPack("call_calling", SoundpackStore.getSoundpack());
};
this.handleRingUpdate = () => {
let r7 = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId())?.guild_id;
if (r7 == null) {
r7 = null;
}
let r18 = CallStore.getCalls().some((item) => item.ringing.length > 0 && VoiceStateStore.getCurrentClientVoiceChannelId(null) === item.channelId);
if (!r18) {
r18 = this[c11569_12].size > 0;
}
this._handleRing(r18, r7);
};
this.handleGuildRingStart = ({ ringing, guildId }) => {
ringing.forEach((item) => {
this[c11569_12].add(item);
});
this._handleRing(this[c11569_12].size > 0, guildId);
};
this.handleGuildRingStop = ({ ringing, guildId }) => {
ringing.forEach((item) => {
this[c11569_12].delete(item);
});
this._handleRing(this[c11569_12].size > 0, guildId);
};
this.handleChannelRTCStoreChange = () => {
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
if (this[c11569_12].size > 0) {
if (voiceChannelId == null) {
this[c11569_12] = new Set();
this._handleRing(this[c11569_12].size > 0, null);
return void 0;
}
if (voiceChannelId != null) {
const guildRingingUsers = ChannelRTCStore.getGuildRingingUsers(voiceChannelId);
const set = new Set([...this[c11569_12]].filter((item) => !guildRingingUsers.has(item)));
if (set.size > 0) {
set.forEach((item) => {
this[c11569_12].delete(item);
});
this._handleRing(this[c11569_12].size > 0, null);
}
}
}
};
}
_initialize() {
this.stores = new Map().set(CallStore, this.handleRingUpdate).set(NotificationSettingsStore, this.handleRingUpdate).set(StreamerModeStore, this.handleRingUpdate).set(VoiceStateStore, this.handleRingUpdate).set(ChannelRTCStore, this.handleChannelRTCStoreChange).set(SoundpackStore, this.handleSoundpackUpdate);
}
}
const channelCallManager = new ChannelCallManager();
export default channelCallManager;
+365
View File
@@ -0,0 +1,365 @@
// Metro module 10511 (f10512).
import EmbeddedActivitiesStore from "../activities/EmbeddedActivitiesStore";
import ApplicationStreamingStore from "../../stores/ApplicationStreamingStore";
import AuthenticationStore from "../../stores/AuthenticationStore";
import CallStore from "../../stores/CallStore";
import ChannelStore from "../../stores/ChannelStore";
import MediaEngineStore from "../../stores/MediaEngineStore";
import SpeakingStore from "../../stores/SpeakingStore";
import UserStore from "../../stores/UserStore";
import VideoStreamStore from "../../stores/VideoStreamStore";
import VoiceStateStore from "../../stores/VoiceStateStore";
import { ParticipantTypes, isStreamParticipant } from "./CallConstants";
import { ActivityTypes, ChannelTypes } from "../../Constants";
import { MediaEngineContextTypes } from "../../_bundle/Module4250";
import getParticipantUserKey from "./getParticipantUserKey";
import { SecondaryIndexMap } from "../../_bundle/Module3813";
import { getIsSpeaking } from "../../hooks/useIsSpeaking";
import { uniqBy } from "../../_bundle/Module12";
import { ContentClassificationEmbeddedActivityFilterExperiment } from "../activities/ContentClassificationEmbeddedActivityFilterExperiment";
import { isAgeRestrictedClassificationReference } from "../content_classification/ContentClassificationReference";
import NicknameUtils from "../../utils/NicknameUtils";
import { getAvatarDecoration } from "../collectibles/avatar_decorations/useAvatarDecoration";
import { encodeStreamKey } from "../go_live/utils/StreamKeyUtils";
let c7054_18, c7054_20;
const sortKey = function sortKey(a0) {
const type = a0.type;
if (ParticipantTypes.ACTIVITY === type) {
return `\x01${a0.sortKey}`;
}
if (ParticipantTypes.HIDDEN_STREAM !== type && ParticipantTypes.STREAM !== type) {
if (ParticipantTypes.USER === type) {
return `${a0.voiceState?.selfVideo ? "\x03" : a0.voiceState?.selfStream ? "\x04" : "\x05"}${getParticipantUserKey(a0.userNick, a0.user)}`;
}
return void 0;
}
return `${a0.userVideo ? "\x02" : "\x03"}${getParticipantUserKey(a0.userNick, a0.user)}\x03`;
};
c7054_18 = "__EMBEDDED_ACTIVITIES__";
c7054_20 = {
VIDEO: "VIDEO",
STREAM: "STREAM",
FILTERED: "FILTERED",
SPEAKING: "SPEAKING",
ACTIVITY: "ACTIVITY",
NOT_POPPED_OUT: "NOT_POPPED_OUT"
};
class ChannelRTCParticipants {
constructor(a0) {
const r10 = {
__proto__: new.target.prototype,
participants: {},
lastSpoke: null,
guildRingingUsers: null,
poppedOutParticipants: null,
participantByIndex: null
};
r10.lastSpoke = {};
r10.guildRingingUsers = new Set();
r10.poppedOutParticipants = new Set();
r10.participantByIndex = new SecondaryIndexMap((a0) => {
const r8 = a0.type === ParticipantTypes.USER && a0.speaking;
const r9 = [];
if (r8) {
r9.push(c7054_20.SPEAKING);
}
L19: {
if (a0.type === ParticipantTypes.USER) {
if (a0.voiceState?.selfVideo) {
r9.push(c7054_20.VIDEO);
if (a0.localVideoDisabled || a0.isPoppedOut) {
break L19;
}
r9.push(c7054_20.FILTERED);
break L19;
}
}
if (isStreamParticipant(a0)) {
r9.push(c7054_20.STREAM);
if (!(a0.type === ParticipantTypes.HIDDEN_STREAM || a0.streamId == null || a0.isPoppedOut)) {
r9.push(c7054_20.FILTERED);
}
}
}
if (a0.type === ParticipantTypes.ACTIVITY) {
r9.push(c7054_20.ACTIVITY);
}
if (!("isPoppedOut" in a0 && a0.isPoppedOut)) {
r9.push(c7054_20.NOT_POPPED_OUT);
}
return r9;
}, sortKey);
r10.channelId = a0;
return r10;
}
get version() {
return this.participantByIndex.version;
}
size(a0) {
return this.participantByIndex.size(a0);
}
toArray(a0) {
return this.participantByIndex.values(a0, true);
}
rebuild() {
let c18092_0;
const channel = ChannelStore.getChannel(this.channelId);
if (channel != null && channel.type !== ChannelTypes.GUILD_TEXT) {
L5: {
this.call = CallStore.getCall(this.channelId);
if (channel.isPrivate()) {
if (this.call != null && !this.call.unavailable) {
break L5;
}
return false;
}
}
const set = new Set(channel.isGuildVocalOrThread() ? Object.keys(VoiceStateStore.getVoiceStatesForChannel(channel.id)) : channel.recipients);
c18092_0 = set;
set.add(AuthenticationStore.getId());
const size2 = this.guildRingingUsers.size;
let r46 = set;
if (size2 > 0) {
const set2 = new Set([...set, ...this.guildRingingUsers]);
c18092_0 = set2;
r46 = set2;
}
ApplicationStreamingStore.getAllActiveStreamsForChannel(this.channelId).forEach((item) => c18092_0.add(item.ownerId));
this.participantByIndex.clear();
this.participants = {};
r46.forEach((item) => this.updateParticipant(item));
this.updateEmbeddedActivities();
return true;
}
return false;
}
getParticipant(a0) {
let r5 = this.participantByIndex.get(a0);
if (r5 == null) {
r5 = null;
}
return r5;
}
updateEmbeddedActivities() {
return this.updateParticipant(c7054_18);
}
hasEmbeddedActivity() {
return this.size(c7054_20.ACTIVITY) > 0;
}
updateParticipant(a0) {
const r10 = this.participants[a0];
const r14 = a0 === c7054_18 ? this._getParticipantsForEmbeddedActivities() : this._getParticipantsForUser(a0);
let r1 = r10 != null || r14.length !== 0;
if (r1) {
if (r10 != null) {
r10.forEach((item) => {
this.participantByIndex.delete(item.id);
});
}
r14.forEach((item) => {
this.participantByIndex.set(item.id, item);
});
this.participants[a0] = r14;
r1 = true;
}
return r1;
}
updateParticipantSpeaking(a0) {
const userId = a0;
const r5 = this.participants[a0];
let r7 = r5 == null ? void 0 : r5.reduce((acc, item) => {
let r2 = acc;
if (item.type === ParticipantTypes.USER) {
const isSpeaking = getIsSpeaking({
userId,
checkIsMuted: true
});
const isSoundSharing = SpeakingStore.isSoundSharing(userId);
const r26 = this.participantByIndex.get(item.id);
if (!(r26?.type === ParticipantTypes.USER && (r26.speaking === isSpeaking && r26.soundsharing === isSoundSharing))) {
if (isSpeaking) {
this.lastSpoke[userId] = Date.now();
}
this.participantByIndex.set(item.id, {
...item,
speaking: isSpeaking,
lastSpoke: this.lastSpoke[userId],
soundsharing: isSoundSharing
});
r2 = true;
}
return r2;
}
return acc;
}, false);
if (r7 == null) {
r7 = false;
}
return r7;
}
updateParticipantQuality(a0, maxResolution, maxFrameRate) {
const r5 = this.participants[a0];
let r9 = r5 == null ? void 0 : r5.reduce((r1, item) => {
if (item.type === ParticipantTypes.STREAM) {
this.participantByIndex.set(item.id, {
...item,
maxResolution,
maxFrameRate
});
r1 = true;
}
return r1;
}, false);
if (r9 == null) {
r9 = false;
}
return r9;
}
updateGuildRingingUsers(a0, a1) {
const guildRingingUsers = this.guildRingingUsers;
if (a1) {
guildRingingUsers.add(a0);
} else {
guildRingingUsers.delete(a0);
}
}
updateParticipantPoppedOut(a0, a1) {
const poppedOutParticipants = this.poppedOutParticipants;
if (a1) {
poppedOutParticipants.add(a0);
} else {
poppedOutParticipants.delete(a0);
}
}
_getEmbeddedActivities() {
const embeddedActivitiesForChannelIncludingHidden = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannelIncludingHidden(this.channelId);
const selfEmbeddedActivityForChannel = EmbeddedActivitiesStore.getSelfEmbeddedActivityForChannel(this.channelId);
const r16 = selfEmbeddedActivityForChannel != null ? uniqBy([...embeddedActivitiesForChannelIncludingHidden, selfEmbeddedActivityForChannel], (a0) => a0.compositeInstanceId) : embeddedActivitiesForChannelIncludingHidden;
const enabled = ContentClassificationEmbeddedActivityFilterExperiment.getConfig({
location: "rtc_participants"
}).enabled;
return UserStore.getCurrentUser()?.nsfwAllowed ? r16 : enabled ? r16.filter((item) => !isAgeRestrictedClassificationReference(item.contentClassification)) : r16;
}
_getParticipantsForEmbeddedActivities() {
return this._getEmbeddedActivities().map((item, index) => {
const { applicationId, compositeInstanceId } = item;
const id = compositeInstanceId != null ? `activity-${applicationId}-${compositeInstanceId}` : `activity-${applicationId}`;
let participants = item.participants;
if (participants == null) {
participants = [];
}
const participants2 = [...participants];
const channel = ChannelStore.getChannel(this.channelId);
let guildId = channel == null ? void 0 : channel.getGuildId();
if (guildId == null) {
guildId = null;
}
return {
type: ParticipantTypes.ACTIVITY,
id,
applicationId: item.applicationId,
activityType: ActivityTypes.PLAYING,
activityUrl: item.url,
participants: participants2,
guildId,
sortKey: index.toString()
};
});
}
_getParticipantsForUser(a0) {
const r4 = [];
const user = UserStore.getUser(a0);
if (user == null) {
return r4;
}
const voiceStateForChannel = VoiceStateStore.getVoiceStateForChannel(this.channelId, a0);
const voicePlatformForChannel = VoiceStateStore.getVoicePlatformForChannel(this.channelId, a0);
const channel = ChannelStore.getChannel(this.channelId);
const r12 = channel == null ? void 0 : channel.getGuildId();
const call = this.call;
const r34 = call == null;
let ringing2 = void 0;
if (!r34) {
const ringing = call.ringing;
ringing2 = ringing == null ? void 0 : ringing.includes(a0);
}
if (!ringing2) {
ringing2 = this.guildRingingUsers.has(a0);
}
if (ringing2 == null) {
ringing2 = false;
}
if (voiceStateForChannel != null || ringing2) {
const r44 = {
type: ParticipantTypes.USER,
...VideoStreamStore.getUserStreamData(a0, r12),
user,
id: user.id,
voiceState: voiceStateForChannel,
voicePlatform: voicePlatformForChannel,
speaking: getIsSpeaking({
userId: a0,
checkIsMuted: true
})
};
let lastSpoke = this.lastSpoke[a0];
if (lastSpoke == null) {
lastSpoke = 0;
}
r44.lastSpoke = lastSpoke;
r44.soundsharing = SpeakingStore.isSoundSharing(a0);
r44.ringing = ringing2;
r44.userNick = NicknameUtils.getName(r12, this.channelId, user);
r44.userAvatarDecoration = getAvatarDecoration(user, r12);
r44.localVideoDisabled = MediaEngineStore.isLocalVideoDisabled(user.id);
r44.isPoppedOut = this.poppedOutParticipants.has(user.id);
r4.push(r44);
}
let stream = ApplicationStreamingStore.getStreamForUser(a0, r12);
if (stream == null) {
stream = ApplicationStreamingStore.getActiveStreamForUser(a0, r12);
}
if (stream != null && stream.channelId === this.channelId) {
const id = encodeStreamKey(stream);
const participant = this.getParticipant(id);
const r95 = stream.ownerId === AuthenticationStore.getId() && ApplicationStreamingStore.isSelfStreamHidden(this.channelId);
const r101 = participant?.type === ParticipantTypes.STREAM ? {
maxResolution: participant.maxResolution != null ? {
...participant.maxResolution
} : void 0,
maxFrameRate: participant.maxFrameRate
} : null;
const r110 = {
...VideoStreamStore.getUserStreamData(a0, r12, MediaEngineContextTypes.STREAM),
...r101,
type: r95 ? ParticipantTypes.HIDDEN_STREAM : ParticipantTypes.STREAM,
id
};
let userVideo = voiceStateForChannel?.selfVideo;
if (userVideo == null) {
userVideo = false;
}
r110.userVideo = userVideo;
r110.user = user;
r110.userNick = NicknameUtils.getName(r12, this.channelId, user);
r110.stream = stream;
r110.isPoppedOut = this.poppedOutParticipants.has(id);
r4.push(r110);
}
return r4;
}
}
export default ChannelRTCParticipants;
export function getEmbeddedActivityParticipantId({ applicationId, instanceId }) {
return instanceId != null ? `activity-${applicationId}-${instanceId}` : `activity-${applicationId}`;
}
export function activityParticipantIdToApplicationId(a0) {
return a0 != null ? a0.split("-")[1] : a0;
}
export { sortKey };
export function areParticipantsEqual(a0, a1) {
const [, r3] = a0;
const [, r26] = a1;
return r3 === r26;
}
export { c7054_20 as ChannelRTCParticipantsIndexes };
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,8 @@
// Metro module 16030 (f16031).
const r9 = {
STREAM: 0,
0: "STREAM",
VIDEO: 1,
1: "VIDEO"
};
export { r9 as SelfStreamAndVideoAlertType };
@@ -0,0 +1,15 @@
// Metro module 15880 (f15881).
import ApexExperiment from "../experiments/apex/ApexExperiment";
const r16 = ApexExperiment({
kind: "user",
name: "2026-02-mobile-mute-indicator",
defaultConfig: {
enableMuteWarning: false
},
variations: {
1: {
enableMuteWarning: true
}
}
});
export default r16;
+110
View File
@@ -0,0 +1,110 @@
// Metro module 12873 (f12874).
import AudioRouteStore_native from "../voice_calls/AudioRouteStore.native";
import MediaEngineStore from "../../stores/MediaEngineStore";
import Logger from "../debug/Logger";
import { Timeout } from "../../_bundle/Timeout";
import Dispatcher from "../../Dispatcher";
import AudioActionCreators from "../../actions/AudioActionCreators";
import { getVoiceEngine } from "../../_bundle/Module4238";
function $mk90545($env) {
return () => {
const r1 = $env;
const r2 = r1[0];
if (r2.audioRouteChangeIgnoreTimer.isStarted()) {
r2.audioRouteChangeIgnoreTimer.stop();
}
r2.ignoreForAudioRouteChange = true;
r2.audioRouteChangeIgnoreTimer.start(r2.AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS, $mk109007(r1));
};
}
function $mk109007($env) {
return () => {
$env[0].ignoreForAudioRouteChange = false;
};
}
let c8873_0;
let c8872_6;
let env8873;
let c8872_5 = new Logger("NativeMuteManager");
c8872_5.enableNativeLogger(true);
class NativeMuteManager {
constructor() {
let env20276;
const r5 = env20276 = {};
env20276[0] = this;
this.ignoreForNativeUnmute = false;
this.needToUnmuteNative = false;
this.ignoreForAudioRouteChange = false;
this.audioRouteChangeIgnoreTimer = new Timeout();
this.AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS = 300;
this.handleAudioRouteChange = $mk90545(r5);
AudioRouteStore_native.addChangeListener(this.handleAudioRouteChange);
Dispatcher.subscribe("VOICE_CHANNEL_SELECT", this.handleVoiceChannelSelect);
}
nativeMuteChanged() {
if (!MediaEngineStore.hasActiveCallKitCall()) {
if (this.ignoreForNativeUnmute) {
this.ignoreForNativeUnmute = false;
} else if (!this.ignoreForAudioRouteChange) {
this.needToUnmuteNative = true;
c8872_5.log("Native mute changed > toggling mute");
AudioActionCreators.toggleSelfMute({
playSoundEffect: false
});
}
}
}
updateNativeMute() {
if (!MediaEngineStore.hasActiveCallKitCall() && this.needToUnmuteNative) {
this.needToUnmuteNative = false;
this.ignoreForNativeUnmute = true;
c8872_5.log("Update native mute > unmuting native");
const voiceEngine = getVoiceEngine();
const setNativeMuteState = voiceEngine.setNativeMuteState;
if (setNativeMuteState != null) {
setNativeMuteState.call(voiceEngine, false);
}
}
}
handleVoiceChannelSelect(a0) {
if (a0.channelId == null) {
c8872_5.log("Leaving voice channel > unmuting native");
const voiceEngine = getVoiceEngine();
const setNativeMuteState = voiceEngine.setNativeMuteState;
if (setNativeMuteState != null) {
setNativeMuteState.call(voiceEngine, false);
}
}
}
}
const r39 = {
__proto__: NativeMuteManager.prototype
};
const r40 = env8873 = {};
c8873_0 = r39;
r39.ignoreForNativeUnmute = false;
r39.needToUnmuteNative = false;
r39.ignoreForAudioRouteChange = false;
r39.audioRouteChangeIgnoreTimer = new Timeout();
r39.AUDIO_ROUTE_CHANGE_IGNORE_DURATION_MS = 300;
r39.handleAudioRouteChange = $mk90545(r40);
AudioRouteStore_native.addChangeListener(r39.handleAudioRouteChange);
Dispatcher.subscribe("VOICE_CHANNEL_SELECT", r39.handleVoiceChannelSelect);
c8872_6 = r39;
class NativeMuteManagerWrapper {
constructor() {
return {
__proto__: new.target.prototype
};
}
nativeMuteChanged(a0) {
c8872_6.nativeMuteChanged(a0);
}
updateNativeMute() {
c8872_6.updateNativeMute();
}
}
const prototype = NativeMuteManagerWrapper.prototype;
export default {
__proto__: prototype
};
+20
View File
@@ -0,0 +1,20 @@
// Metro module 16299 (f16300).
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import ChannelRTCStore from "./ChannelRTCStore";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
class ParticipantFocusManager extends AutomaticLifecycleManager {
stores = new Map().set(ChannelRTCStore, this.handleFocusParticipant);
handleFocusParticipant() {
const channelId = RTCConnectionStore.getChannelId();
if (channelId != null) {
const selectedParticipantId = ChannelRTCStore.getSelectedParticipantId(channelId);
const videoParticipants = ChannelRTCStore.getVideoParticipants(channelId);
const rTCConnection = RTCConnectionStore.getRTCConnection();
if (rTCConnection != null) {
rTCConnection.setSelectedParticipant(videoParticipants.find((videoParticipant) => videoParticipant.id === selectedParticipantId && !videoParticipant.localVideoDisabled)?.id);
}
}
}
}
const participantFocusManager = new ParticipantFocusManager();
export default participantFocusManager;
@@ -0,0 +1,29 @@
// Metro module 5010 (f5011).
import ApexExperiment from "../experiments/apex/ApexExperiment";
const r19 = ApexExperiment({
kind: "user",
name: "2025-12-proportional-vad-indicator",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
},
2: {
enabled: true,
disableUI: true
},
3: {
enabled: true,
disableUI: true,
swallowVolumeOnlySpeakingEvents: true
},
4: {
enabled: true,
disableUI: true,
dontEmitVolumeOnlySpeakingEvents: true
}
}
});
export default r19;
+118
View File
@@ -0,0 +1,118 @@
// Metro module 10523 (f10524).
import ApplicationStreamingStore from "../../stores/ApplicationStreamingStore";
import AuthenticationStore from "../../stores/AuthenticationStore";
import MediaEngineStore from "../../stores/MediaEngineStore";
import SpeakingStore from "../../stores/SpeakingStore";
import ChannelRTCStore from "./ChannelRTCStore";
import { ParticipantTypes } from "./CallConstants";
import { encodeStreamKey } from "../go_live/utils/StreamKeyUtils";
import Module12 from "../../_bundle/Module12";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c7065_2, c7065_3, c7065_11, handleChannelRTCUpdate, c7065_13;
const updateSpeaker = function updateSpeaker(r2 = true) {
let r34;
let r5 = void 0;
let r11 = void 0;
const r4 = c7065_2 == null;
let r36 = null;
if (!r4) {
let r38 = ChannelRTCStore.getSelectedParticipantId(c7065_2);
if (r38 != null && ChannelRTCStore.isParticipantPoppedOut(c7065_2, r38)) {
r38 = null;
}
const lastActiveStream = ApplicationStreamingStore.getLastActiveStream();
const r44 = r38 != null ? ChannelRTCStore.getParticipant(c7065_2, r38) : null;
const r59 = r44?.type === ParticipantTypes.ACTIVITY || r44?.type === ParticipantTypes.USER && !r44.voiceState?.selfVideo ? null : r38;
let r60 = r59;
if (lastActiveStream != null) {
r60 = r59;
if (r59 == null) {
const id = ChannelRTCStore.getParticipant(c7065_2, encodeStreamKey(lastActiveStream))?.id;
r60 = id == null || ChannelRTCStore.isParticipantPoppedOut(c7065_2, id) ? r59 : id;
}
}
r36 = r60;
if (r36 == null) {
const id2 = AuthenticationStore.getId();
const r82 = Date.now();
const r83 = [];
const r84 = [];
let r90 = ChannelRTCStore.getVideoParticipants(c7065_2)[Symbol.iterator]();
const next = r90.next;
while (true) {
const r94 = r90 === void 0 ? void 0 : (r34 = next.call(r90)).done ? r90 = void 0 : r34.value;
if (r90 === void 0) {
for (const item of r84) {
const { userId, duration } = item;
if (r11 == null || duration < r11) {
r5 = userId;
r11 = duration;
}
}
r36 = r5;
if (r36 != null) {
break;
}
r36 = c7065_3 != null && r83.includes(c7065_3) ? c7065_3 : r83[0];
break;
}
try {
if (r94.user.id !== id2 && !MediaEngineStore.isLocalVideoDisabled(r94.user.id) && !ChannelRTCStore.isParticipantPoppedOut(c7065_2, r94.id)) {
r83.push(r94.user.id);
const duration2 = SpeakingStore.getSpeakingDuration(r94.user.id, r82);
if (duration2 !== 0) {
r84.push({
userId: r94.user.id,
duration: duration2
});
}
}
} catch (r127) {
if (r90 !== void 0 && typeof r90.return === "function") {
try {
r90.return();
} catch {}
}
throw r127;
}
}
}
}
if (c7065_3 !== r36) {
c7065_3 = r36;
if (r2) {
c7065_13.emitChange();
}
}
};
handleChannelRTCUpdate = function handleChannelRTCUpdate() {
c7065_11();
return false;
};
c7065_11 = Module12.throttle(updateSpeaker, 300, {
trailing: true
});
class VideoSpeakerStoreClass extends Module589.Store {
static displayName = "VideoSpeakerStore";
initialize() {
this.waitFor(ChannelRTCStore, AuthenticationStore, SpeakingStore, ApplicationStreamingStore, MediaEngineStore);
this.syncWith([ChannelRTCStore, ApplicationStreamingStore], handleChannelRTCUpdate);
}
getSpeaker(a0) {
if (c7065_2 !== a0) {
c7065_2 = a0;
c7065_3 = null;
updateSpeaker(false);
}
let r8 = c7065_3;
if (r8 == null) {
r8 = AuthenticationStore.getId();
}
return r8;
}
}
c7065_13 = new VideoSpeakerStoreClass(Dispatcher, {
AUDIO_SET_LOCAL_VIDEO_DISABLED: handleChannelRTCUpdate
});
export default c7065_13;
@@ -0,0 +1,18 @@
// Metro module 12867 (f12868).
import ApexExperiment from "../experiments/apex/ApexExperiment";
const r17 = ApexExperiment({
kind: "user",
name: "2026-05-ios-video-stabilization",
defaultConfig: {
mode: "off"
},
variations: {
1: {
mode: "standard"
},
2: {
mode: "low_latency"
}
}
});
export default r17;
+4
View File
@@ -0,0 +1,4 @@
// Metro module 5017 (f5018).
export default function getParticipantUserKey(a0, a1) {
return `${a0.toLowerCase().padEnd(32, "!")}${a1.id}`;
};
@@ -0,0 +1,13 @@
// Metro module 10599 (f10600).
import { ParticipantTypes } from "./CallConstants";
import { MediaEngineContextTypes } from "../../_bundle/Module4250";
const r19 = Object;
const r21 = {};
r21[ParticipantTypes.STREAM] = MediaEngineContextTypes.STREAM;
r21[ParticipantTypes.HIDDEN_STREAM] = MediaEngineContextTypes.STREAM;
r21[ParticipantTypes.USER] = MediaEngineContextTypes.DEFAULT;
r21[ParticipantTypes.ACTIVITY] = MediaEngineContextTypes.DEFAULT;
let c7108_0 = r19.freeze(r21);
export default function mediaEngineContextFromParticipantType(a0) {
return c7108_0[a0];
};
@@ -0,0 +1,8 @@
// Metro module 13506 (f13507).
import LifecycleManager from "../../../lib/LifecycleManager";
class CallKitLifecycleManager extends LifecycleManager {
_initialize() {}
_terminate() {}
}
const callKitLifecycleManager = new CallKitLifecycleManager();
export default callKitLifecycleManager;
+17
View File
@@ -0,0 +1,17 @@
// Metro module 7762 (f7763).
import CallStore from "../../../stores/CallStore";
import ChannelRTCStore from "../ChannelRTCStore";
import { ParticipantTypes } from "../CallConstants";
import { useStateFromStores } from "../../../_bundle/Module589";
let $mk79286 = function() {
return (a0) => a0.type === ParticipantTypes.USER && !a0.ringing;
};
export default function useIsCallActive(a0, a1) {
return useStateFromStores([CallStore, ChannelRTCStore], () => CallStore.isCallActive(a0, a1) && ChannelRTCStore.getParticipants(a0).some($mk79286()), [a0, a1]);
};
export function checkIsCallActive(a0, a1) {
return CallStore.isCallActive(a0, a1) && ChannelRTCStore.getParticipants(a0).some($mk79286());
}
export function useIsCallActiveNullable(a0, a1) {
return useStateFromStores([CallStore, ChannelRTCStore], () => a0 != null && (CallStore.isCallActive(a0, a1) && ChannelRTCStore.getParticipants(a0).some($mk79286())), [a0, a1]);
}
@@ -0,0 +1,703 @@
// Metro module 16324 (f16325).
import { NativeEventEmitter, DeviceEventEmitter } from "react-native";
import SoundpackStore from "../../soundpacks/SoundpackStore";
import ApplicationStreamingStore from "../../../stores/ApplicationStreamingStore";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import CallStore from "../../../stores/CallStore";
import ChannelStore from "../../../stores/ChannelStore";
import MediaEngineStore from "../../../stores/MediaEngineStore";
import NotificationSettingsStore from "../../../stores/NotificationSettingsStore";
import RTCConnectionStore from "../../../stores/RTCConnectionStore";
import RelationshipStore from "../../../stores/RelationshipStore";
import StreamerModeStore from "../../../stores/StreamerModeStore";
import UserStore from "../../../stores/UserStore";
import { ApplicationStreamStates } from "../../../Constants";
import { MediaEngineContextTypes } from "../../../_bundle/Module4250";
import Logger from "../../debug/Logger";
import Module10610 from "../../../_bundle/Module10610";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
import Module16325 from "../../../_bundle/Module16325";
import SelectedChannelActionCreators from "../../../actions/SelectedChannelActionCreators";
import CallActionCreators from "../../../actions/CallActionCreators";
import { navigateToVoiceChannel } from "../../../utils/native/PrivateChannelCallUtils";
import AudioActionCreators from "../../../actions/AudioActionCreators";
import { getVideoPermission } from "../../video_calls/useHasVideoPermission";
import { getOSRequirement, startStream, stopScreenshare } from "../../video_calls/native/useScreenshareUtils";
import { isMetaQuest } from "../../device/MetaQuestUtils.android";
import { computeChannelName } from "../../channel/useChannelName";
import { createSoundForPack } from "../../sound_playback/SoundUtils";
function $mk117270($env) {
return (a0) => {
c11741_25.warn("Failed to end orphaned call:", a0);
};
}
let c11741_28;
let env11741 = {};
const c11741_18 = "telecom-end-call-requested";
const c11741_19 = "telecom-set-foreground-requested";
const c11741_20 = "telecom-mic-mute-requested";
const c11741_21 = "telecom-screen-share-requested";
const c11741_22 = "telecom-incoming-call-answered";
const c11741_23 = "telecom-incoming-call-rejected";
const c11741_24 = "telecom-answer-call-requested";
const logger = new Logger("TelecomManager");
const c11741_25 = logger;
logger.enableNativeLogger(true);
const c11741_26 = {
Ringing: 0,
0: "Ringing",
Connecting: 1,
1: "Connecting",
Connected: 2,
2: "Connected"
};
const c11741_27 = new NativeEventEmitter(Module10610);
class TelecomManager extends AutomaticLifecycleManager {
stores = new Map().set(RTCConnectionStore, () => this.reconcileTelecomState()).set(MediaEngineStore, () => this.handleMuteStoreChange()).set(ApplicationStreamingStore, () => this.handleScreenShareStoreChange()).set(CallStore, () => this.handleIncomingCallStoreChange());
actions = {
CALL_CREATE: (a0) => this.handleCallCreate(a0),
CALL_UPDATE: (a0) => this.handleCallUpdate(a0),
CALL_DELETE: (a0) => this.handleCallDelete(a0)
};
currentCall = null;
isInitialized = false;
lastMuteState = null;
registeredIncomingCallIds = new Set();
lastScreenShareActive = null;
pendingScreenShareOffSyncTimeout = null;
reconcilePromise = null;
needsReconcile = false;
hostDestroySubscription = null;
pendingMutePreference = null;
ringtone = null;
handleHostDestroy = () => {
if (this.isEnabled() && this.currentCall != null) {
if (this.currentCall.state === c11741_26.Ringing) {
c11741_25.info("Activity destroyed with ringing call, cancelling incoming call");
this.cancelIncomingCall(this.currentCall.channelId);
return void 0;
}
c11741_25.info("Activity destroyed with active call, disconnecting from voice channel");
SelectedChannelActionCreators.disconnect();
}
};
handleEndCallRequested = (a0) => {
c11741_25.info("Received end call request from Call Bar:", a0.callId);
if (this.currentCall != null && a0.callId === this.currentCall.channelId) {
if (this.currentCall.state === c11741_26.Ringing) {
c11741_25.info("Rejecting ringing call from Call Bar:", this.currentCall.channelId);
CallActionCreators.stopRinging(this.currentCall.channelId);
this.clearCall(this.currentCall.channelId);
} else {
SelectedChannelActionCreators.disconnect();
}
return void 0;
}
};
handleSetForegroundRequested = (a0) => {
c11741_25.info("Received set foreground request from Call Bar");
if (this.currentCall != null && a0.callId === this.currentCall.channelId) {
const channel = ChannelStore.getChannel(this.currentCall.channelId);
if (channel != null) {
navigateToVoiceChannel(channel, "Call Bar");
}
}
};
handleMicMuteRequested = (a0) => {
c11741_25.info("Received mic mute request from Call Bar:", a0.callId, "isMuted:", a0.isMuted);
if (this.currentCall != null && a0.callId === this.currentCall.channelId) {
const state = this.currentCall.state;
if (!(state !== c11741_26.Ringing && this.currentCall.state !== c11741_26.Connecting)) {
this.pendingMutePreference = a0.isMuted;
}
if (MediaEngineStore.isSelfMute() !== a0.isMuted) {
c11741_25.info("Updating Call Bar -> Discord mute state:", a0.isMuted);
AudioActionCreators.toggleSelfMute();
}
}
};
handleScreenShareRequested = (a0) => {
L16: {
c11741_25.info("Received screen share request from Call Bar:", a0.callId, "isEnabled:", a0.isEnabled);
if (this.currentCall != null && a0.callId === this.currentCall.channelId) {
const channel = ChannelStore.getChannel(this.currentCall.channelId);
if (channel != null) {
const currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream();
const r1 = currentUserActiveStream != null && currentUserActiveStream.state === ApplicationStreamStates.ACTIVE;
if (a0.isEnabled && !r1) {
const videoPermission = getVideoPermission(channel);
if (getOSRequirement()) {
if (videoPermission) {
c11741_25.info("Starting screen share from Call Bar");
startStream();
break L16;
}
c11741_25.warn("Cannot start screen share from Call Bar: user lacks streaming permission in this channel");
return void 0;
}
c11741_25.warn("Cannot start screen share from Call Bar: OS version does not meet requirements");
return void 0;
}
const isEnabled2 = a0.isEnabled;
if (isEnabled2 ? !isEnabled2 : r1) {
c11741_25.info("Stopping screen share from Call Bar");
stopScreenshare();
}
}
}
}
};
handleAnswerCallRequested = (a0) => {
c11741_25.info("Received answer call request from Call Bar:", a0.callId);
if (this.currentCall != null && a0.callId === this.currentCall.channelId) {
const state = this.currentCall.state;
if (state === c11741_26.Ringing) {
this.stopRingtone();
this.currentCall.state = c11741_26.Connecting;
c11741_25.info("Answering incoming call, joining voice channel:", this.currentCall.channelId);
SelectedChannelActionCreators.selectVoiceChannel(this.currentCall.channelId);
} else {
c11741_25.warn("Answer requested but call is not ringing:", this.currentCall.state);
}
}
};
handleCallCreate = (a0) => {
if (this.isEnabled() && isMetaQuest()) {
this.processIncomingRing(a0.channelId, a0.ongoingRings);
}
};
handleCallUpdate = (a0) => {
if (this.isEnabled() && isMetaQuest()) {
this.processIncomingRing(a0.channelId, a0.ongoingRings);
}
};
handleCallDelete = (a0) => {
if (this.isEnabled() && isMetaQuest() && this.currentCall?.channelId === a0.channelId && this.isPendingIncomingCall(this.currentCall)) {
c11741_25.info("Pending incoming call deleted, cancelling incoming call:", a0.channelId);
this.cancelIncomingCall(a0.channelId);
}
};
handleIncomingCallAnswered = (a0) => {
c11741_25.info("Received incoming call answered from telecom:", a0.callId);
this.registeredIncomingCallIds.delete(a0.callId);
Module16325.endCall(a0.callId).catch((error) => {
c11741_25.warn("Failed to end answered telecom call:", error);
});
SelectedChannelActionCreators.selectVoiceChannel(a0.callId);
};
handleIncomingCallRejected = (a0) => {
c11741_25.info("Received incoming call rejected from telecom:", a0.callId);
this.registeredIncomingCallIds.delete(a0.callId);
CallActionCreators.stopRinging(a0.callId).catch((error) => {
c11741_25.warn("Failed to stop ringing after telecom reject:", error);
});
};
_initialize() {
if (!this.isInitialized) {
c11741_25.info("Initializing CallKitManager using Telecom framework");
const hostDestroySubscription = this.hostDestroySubscription;
if (hostDestroySubscription != null) {
hostDestroySubscription.remove();
}
this.hostDestroySubscription = c11741_27.addListener("onHostDestroy", this.handleHostDestroy);
DeviceEventEmitter.addListener(c11741_18, this.handleEndCallRequested);
DeviceEventEmitter.addListener(c11741_19, this.handleSetForegroundRequested);
DeviceEventEmitter.addListener(c11741_20, this.handleMicMuteRequested);
DeviceEventEmitter.addListener(c11741_21, this.handleScreenShareRequested);
DeviceEventEmitter.addListener(c11741_22, this.handleIncomingCallAnswered);
DeviceEventEmitter.addListener(c11741_23, this.handleIncomingCallRejected);
DeviceEventEmitter.addListener(c11741_24, this.handleAnswerCallRequested);
this.isInitialized = true;
}
}
_terminate() {
if (this.isInitialized) {
const hostDestroySubscription = this.hostDestroySubscription;
if (hostDestroySubscription != null) {
hostDestroySubscription.remove();
}
this.hostDestroySubscription = null;
DeviceEventEmitter.removeAllListeners(c11741_18);
DeviceEventEmitter.removeAllListeners(c11741_19);
DeviceEventEmitter.removeAllListeners(c11741_20);
DeviceEventEmitter.removeAllListeners(c11741_21);
DeviceEventEmitter.removeAllListeners(c11741_22);
DeviceEventEmitter.removeAllListeners(c11741_23);
DeviceEventEmitter.removeAllListeners(c11741_24);
for (const registeredIncomingCallId of this.registeredIncomingCallIds) {
Module16325.endCall(registeredIncomingCallId).catch((error) => {
c11741_25.warn("Failed to end telecom incoming call on terminate:", error);
});
}
this.registeredIncomingCallIds.clear();
this.clearPendingScreenShareOffSync();
this.stopRingtone();
this.reportCallEnded();
this.reconcilePromise = null;
this.needsReconcile = false;
this.isInitialized = false;
}
}
isEnabled() {
return this.isInitialized;
}
processIncomingRing(a0, a1) {
const id = AuthenticationStore.getId();
if (id in a1 && a1[id] != null) {
if (this.currentCall?.channelId === a0 && this.currentCall.state !== c11741_26.Ringing) {
return void 0;
}
if (RTCConnectionStore.getChannelId() != null) {
return void 0;
}
if (this.currentCall?.channelId === a0 && this.currentCall.state === c11741_26.Ringing) {
return void 0;
}
this.reportIncomingCall(a0);
} else if (this.currentCall?.channelId === a0 && this.currentCall.state === c11741_26.Ringing) {
c11741_25.info("Call no longer ringing, cancelling incoming call:", a0);
this.cancelIncomingCall(a0);
}
}
reportIncomingCall(a0) {
const channel = ChannelStore.getChannel(a0);
if (channel != null) {
if (this.currentCall != null && this.currentCall.channelId !== a0 && this.isPendingIncomingCall(this.currentCall)) {
this.cancelIncomingCall(this.currentCall.channelId);
}
const channelName = computeChannelName(channel, UserStore, RelationshipStore);
let guildId2 = channel.getGuildId();
if (guildId2 == null) {
guildId2 = null;
}
this.currentCall = {
channelId: a0,
guildId: guildId2,
channelName,
state: c11741_26.Ringing
};
c11741_25.info("Reporting incoming call to Telecom:", a0, "callerName:", channelName);
this.startRingtone();
Module16325.reportIncomingCall(a0, channelName, guildId2 != null ? {
guildId: guildId2
} : null).then((result) => {
if (!result) {
c11741_25.warn("Failed to report incoming call: resolved false");
this.clearCall(a0);
}
}).catch((error) => {
c11741_25.warn("Failed to report incoming call:", error);
this.clearCall(a0);
});
} else {
c11741_25.warn("Cannot report incoming call: channel not found:", a0);
}
}
cancelIncomingCall(a0) {
c11741_25.info("Cancelling incoming call:", a0);
return Module16325.cancelIncomingCall(a0).then(() => {
this.clearCall(a0);
return true;
}).catch((error) => {
c11741_25.warn("Failed to cancel incoming call:", error);
this.clearCall(a0);
return false;
});
}
isPendingIncomingCall(a0) {
const state = a0.state;
return state === c11741_26.Ringing || a0.state === c11741_26.Connecting;
}
reconcileTelecomState() {
if (this.isEnabled() && isMetaQuest()) {
if (this.reconcilePromise == null) {
this.reconcilePromise = this.doReconcile().finally(() => {
this.reconcilePromise = null;
if (this.needsReconcile) {
this.needsReconcile = false;
this.reconcileTelecomState();
}
});
} else {
this.needsReconcile = true;
}
}
}
async doReconcile() {
let r216;
const _this = this;
let guildId, c28338_1, c28338_2;
L64: {
L63: {
L62: {
L77: {
L24: {
L48: {
L35: {
let env31031;
c28338_2 = void 0;
const r14 = env31031 = {
$parent: env11741
};
c28338_1 = r14;
env31031[0] = void 0;
env31031[1] = void 0;
env31031[2] = void 0;
const channelId2 = RTCConnectionStore.getChannelId();
const isConnected = RTCConnectionStore.isConnected();
const r58 = isConnected ? channelId2 ?? null : null;
env31031[0] = r58;
c11741_25.info("Reconcile: rtc=", channelId2, "connected=", isConnected, "target=", r58, "current=", _this.currentCall?.channelId, "state=", _this.currentCall?.state);
if (r58 != null) {
if (_this.currentCall?.channelId === r58 && _this.currentCall.state === c11741_26.Connected) {
break L24;
}
const channelId3 = _this.currentCall?.channelId;
L31: {
if (channelId3 === r58) {
if (_this.currentCall.state !== c11741_26.Ringing && _this.currentCall.state !== c11741_26.Connecting) {
break L31;
}
c11741_25.info("Incoming call answered, transitioning to active:", r58);
_this.stopRingtone();
_this.currentCall.state = c11741_26.Connected;
_this.setIncomingCallActive(r58);
break L35;
}
}
if (_this.currentCall != null && _this.currentCall.channelId !== r58) {
if (_this.isPendingIncomingCall(_this.currentCall)) {
await _this.cancelIncomingCall(_this.currentCall.channelId);
} else {
await _this.endCall(_this.currentCall);
}
if (_this.currentCall?.channelId !== env31031[0]) {
env31031[1] = ChannelStore.getChannel(env31031[0]);
if (env31031[1] == null) {
break L77;
}
const guildId3 = RTCConnectionStore.getGuildId();
guildId = guildId3;
if (guildId3 == null) {
guildId = null;
}
_this.currentCall = {
channelId: env31031[0],
guildId,
channelName: computeChannelName(env31031[1], UserStore, RelationshipStore),
state: c11741_26.Connecting
};
}
if (_this.currentCall.state !== c11741_26.Connecting) {
break L64;
}
env31031[2] = _this.currentCall.channelId;
r216 = await _this.startCall({
channelId: _this.currentCall.channelId,
guildId: _this.currentCall.guildId
});
} else {
if (_this.currentCall?.channelId !== env31031[0]) {
env31031[1] = ChannelStore.getChannel(env31031[0]);
if (env31031[1] == null) {
break L48;
}
const guildId2 = RTCConnectionStore.getGuildId();
guildId = guildId2;
if (guildId2 == null) {
guildId = null;
}
_this.currentCall = {
channelId: env31031[0],
guildId,
channelName: computeChannelName(env31031[1], UserStore, RelationshipStore),
state: c11741_26.Connecting
};
}
if (_this.currentCall.state !== c11741_26.Connecting) {
break L24;
}
env31031[2] = _this.currentCall.channelId;
r216 = await _this.startCall({
channelId: _this.currentCall.channelId,
guildId: _this.currentCall.guildId
});
}
if (!r216) {
break L64;
}
if (_this.currentCall?.channelId !== env31031[2]) {
c11741_25.info("Call state changed during startCall, ending orphaned native call:", env31031[2]);
Module16325.endCall(env31031[2]).catch($mk117270(env11741));
break L63;
}
if (RTCConnectionStore.isConnected()) {
if (RTCConnectionStore.getChannelId() === env31031[2]) {
_this.currentCall.state = c11741_26.Connected;
_this.setCallActive(env31031[2]);
break L64;
}
}
c11741_25.info("RTCConnectionStore indicates disconnect after startCall, ending call:", env31031[2]);
await _this.reportCallEnded();
break L62;
}
if (!(_this.currentCall != null && _this.currentCall.state !== c11741_26.Ringing && _this.currentCall.state !== c11741_26.Connecting)) {
break L24;
}
await _this.reportCallEnded();
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
}
handleIncomingCallStoreChange() {
let r22;
let _this2;
L18: {
_this2 = this;
if (!isMetaQuest() && this.isEnabled()) {
const id = AuthenticationStore.getId();
const set = new Set();
let r40 = CallStore.getCalls()[Symbol.iterator]();
const next = r40.next;
while (true) {
const r43 = r40 === void 0 ? void 0 : (r22 = next.call(r40)).done ? r40 = void 0 : r22.value;
if (r40 === void 0) {
for (const registeredIncomingCallId of this.registeredIncomingCallIds) {
const r60 = registeredIncomingCallId;
if (!set.has(registeredIncomingCallId)) {
const registeredIncomingCallIds = this.registeredIncomingCallIds;
registeredIncomingCallIds.delete(r60);
Module16325.endCall(r60).catch((error) => {
c11741_25.warn("Failed to end telecom call:", error);
});
}
}
const _loop = function _loop(a0) {
if (!_this2.registeredIncomingCallIds.has(a0)) {
_this2.registeredIncomingCallIds.add(a0);
Module16325.registerIncomingCall(a0).then((result) => {
if (!result) {
c11741_25.warn("Failed to register incoming call with telecom: resolved false");
_this2.registeredIncomingCallIds.delete(a0);
}
}).catch((error) => {
c11741_25.warn("Failed to register incoming call with telecom:", error);
_this2.registeredIncomingCallIds.delete(a0);
});
}
};
for (const item of set) {
_loop(item);
}
break L18;
} else {
try {
if (r43.ringing.includes(id)) {
set.add(r43.channelId);
}
} catch (r52) {
if (r40 !== void 0 && typeof r40.return === "function") {
try {
r40.return();
} catch {}
}
throw r52;
}
}
}
}
}
}
async startCall(c22976_0) {
let r82;
const _this3 = this;
let c28340_2;
let c28340_3 = 0;
let c31032_0, c31032_1, c31032_2;
L19: {
L12: {
try {
c31032_0 = void 0;
c31032_1 = void 0;
const channelId2 = c22976_0.channelId;
c31032_0 = channelId2;
const guildId2 = c22976_0.guildId;
if (_this3.currentCall?.channelId === channelId2 && _this3.currentCall.state === c11741_26.Connected) {
c11741_25.info("Call already active for channel:", channelId2);
break L12;
}
c11741_25.info("Starting Telecom call:", channelId2);
c28340_3 = 1;
const r64 = await Module16325.startCall(channelId2, guildId2 != null ? {
guildId: guildId2
} : null);
const r76 = "Native startCall returned false, clearing call state";
c31032_1 = r64;
if (!c31032_1) {
c11741_25.warn(r76);
_this3.clearCall(c31032_0);
}
r82 = c31032_1;
c28340_3 = 0;
break L19;
} catch ($e) {
const r32 = $e;
let r8 = r32;
c28340_2 = r32;
if (c28340_3 !== 0) {
while (true) {
try {
const r100 = c28340_2;
c28340_3 = 0;
c31032_2 = r100;
c11741_25.warn("Failed to register call with Telecom:", c31032_2);
_this3.clearCall(c31032_0);
} catch (r96) {
r8 = r96;
c28340_2 = r96;
if (c28340_3 === 0) {
break;
}
continue;
}
return false;
}
}
throw r8;
}
}
return true;
}
return r82;
}
endCall(a0) {
c11741_25.info("Ending call:", a0.channelId);
return Module16325.endCall(a0.channelId).then((result) => {
this.clearCall(a0.channelId);
return result;
}).catch((error) => {
c11741_25.warn("Failed to end call:", error);
this.clearCall(a0.channelId);
return false;
});
}
reportCallEnded() {
c11741_25.info("Reporting call ended");
return this.currentCall == null ? Promise.resolve(true) : this.currentCall.state === c11741_26.Ringing ? this.cancelIncomingCall(this.currentCall.channelId) : this.endCall(this.currentCall);
}
setCallActive(a0) {
if (this.currentCall?.channelId === a0) {
c11741_25.info("Setting call active:", a0);
const isSelfMute = MediaEngineStore.isSelfMute();
Module16325.setCallActive(a0, isSelfMute);
this.lastMuteState = isSelfMute;
this.lastScreenShareActive = false;
} else {
c11741_25.warn("setCallActive called for unknown channel:", a0);
}
}
setIncomingCallActive(a0) {
if (this.currentCall?.channelId === a0) {
c11741_25.info("Setting incoming call active:", a0);
const isSelfMute = MediaEngineStore.isSelfMute();
const pendingMutePreference = this.pendingMutePreference;
let lastMuteState = isSelfMute;
if (pendingMutePreference != null) {
const pendingMutePreference2 = this.pendingMutePreference;
this.pendingMutePreference = null;
lastMuteState = isSelfMute;
if (isSelfMute !== pendingMutePreference2) {
c11741_25.info("Re-applying Telecom Bar ringing-state mute preference:", pendingMutePreference2);
AudioActionCreators.setSelfMute(MediaEngineContextTypes.DEFAULT, pendingMutePreference2, false);
lastMuteState = pendingMutePreference2;
}
}
Module16325.setIncomingCallActive(a0, lastMuteState);
this.lastMuteState = lastMuteState;
this.lastScreenShareActive = false;
} else {
c11741_25.warn("setIncomingCallActive called for unknown channel:", a0);
}
}
clearScreenShareState() {
this.lastScreenShareActive = null;
}
clearPendingScreenShareOffSync() {
if (this.pendingScreenShareOffSyncTimeout != null) {
clearTimeout(this.pendingScreenShareOffSyncTimeout);
this.pendingScreenShareOffSyncTimeout = null;
}
}
clearCall(a0) {
if (this.currentCall?.channelId === a0) {
this.stopRingtone();
this.currentCall = null;
this.lastMuteState = null;
this.pendingMutePreference = null;
this.clearScreenShareState();
this.clearPendingScreenShareOffSync();
}
}
startRingtone() {
if (isMetaQuest() && this.ringtone == null && !(StreamerModeStore.disableSounds || NotificationSettingsStore.isSoundDisabled("call_ringing"))) {
this.ringtone = createSoundForPack("call_ringing", SoundpackStore.getSoundpack());
this.ringtone.loop();
}
}
stopRingtone() {
const ringtone = this.ringtone;
if (ringtone != null) {
this.ringtone = null;
ringtone.stop();
}
}
handleMuteStoreChange() {
if (this.isEnabled() && this.currentCall != null && this.currentCall.state === c11741_26.Connected) {
const isSelfMute = MediaEngineStore.isSelfMute();
if (this.lastMuteState !== isSelfMute) {
this.lastMuteState = isSelfMute;
c11741_25.info("Syncing Discord -> Call Bar mute state:", isSelfMute);
Module16325.setMicMuted(this.currentCall.channelId, isSelfMute);
}
}
}
handleScreenShareStoreChange() {
let channelId;
if (this.isEnabled() && this.currentCall != null && this.currentCall.state === c11741_26.Connected) {
const currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream();
const lastScreenShareActive = currentUserActiveStream != null && currentUserActiveStream.state === ApplicationStreamStates.ACTIVE;
if (this.lastScreenShareActive !== lastScreenShareActive) {
this.lastScreenShareActive = lastScreenShareActive;
this.clearPendingScreenShareOffSync();
if (lastScreenShareActive) {
c11741_25.info("Syncing Discord -> Call Bar screen share state: true");
Module16325.setScreenShareState(this.currentCall.channelId, true, true);
} else {
channelId = this.currentCall.channelId;
this.pendingScreenShareOffSyncTimeout = setTimeout(() => {
this.pendingScreenShareOffSyncTimeout = null;
if (this.isEnabled() && this.currentCall?.channelId === channelId) {
c11741_25.info("Syncing Discord -> Call Bar screen share state: false (delayed)");
Module16325.setScreenShareState(channelId, true, false);
}
}, 400);
}
}
}
}
}
c11741_28 = TelecomManager;
const r128 = new TelecomManager();
export default r128;
+147
View File
@@ -0,0 +1,147 @@
// Metro module 7980 (f7981).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { useState, useEffect, memo } from "react";
import { Image as Image2, NativeModules, View } from "react-native";
import { EMPTY_STRING_SNOWFLAKE_ID, NOOP } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module12 from "../../../_bundle/Module12";
import useGetIsMounted from "../../../hooks/useGetIsMounted";
import VideoBackgroundManager from "./VideoBackgroundManager";
import { hexToRgb } from "../../../utils/ColorUtils";
import Module712 from "../../../_bundle/Module712";
import MobileVisualRefreshExperiment from "../../themes/experiments/MobileVisualRefreshExperiment";
import useDisplayProfile from "../../user_profile/hooks/useDisplayProfile";
import { useVideoTileGradientColors } from "./useVideoTileGradientColors";
import maybeFetchUserProfile from "../../user_profile/maybeFetchUserProfile";
import * as _native from "../../../design/void/native";
import { Avatar } from "../../../design/void/native";
import Module4611 from "../../../_bundle/Module4611";
let useStyles, c5046_13;
const useDominantRGBFromImage = function useDominantRGBFromImage(url, source) {
let c16141_1 = source;
const isArray = Array.isArray(source);
let r11 = source;
if (isArray) {
const r18 = source[0];
c16141_1 = r18;
r11 = r18;
}
const getIsMounted = useGetIsMounted();
let c16141_2 = getIsMounted;
let r23 = url != null ? VideoBackgroundManager.cachedDominantColors[url] : void 0;
if (r23 == null) {
r23 = hexToRgb(Module712.unsafe_rawColors.PRIMARY_800);
}
const [state, setState] = useState(r23);
useEffect(() => {
if (c16141_1 != null && url != null) {
if (VideoBackgroundManager.cachedDominantColors[url] == null) {
(typeof c16141_1 === "number" ? NativeModules.ImageManager.getDominantColorsLocalAsset(Image2.resolveAssetSource(c16141_1)) : NativeModules.ImageManager.getDominantColors(Image2.resolveAssetSource(c16141_1))).then((result) => {
if (c16141_2()) {
const r10 = _slicedToArray(result[0], 3);
const r11 = {
r: r10[0],
g: r10[1],
b: r10[2]
};
setState(r11);
VideoBackgroundManager.cachedDominantColors[url] = r11;
}
}).catch(NOOP);
} else {
setState(VideoBackgroundManager.cachedDominantColors[url]);
}
}
}, [r11, url, getIsMounted]);
return state;
};
const VideoBackground = function VideoBackground(props) {
const { style, url, isStageCall = false, avatarStyle, user, guildId, renderVideoDetails, ...props2 } = props;
const styles = useStyles();
const source = c5046_13(url);
const dominantRGBFromImage = useDominantRGBFromImage(url, source);
const backgroundColor = `rgb(${dominantRGBFromImage.r}, ${dominantRGBFromImage.g}, ${dominantRGBFromImage.b})`;
const r23 = MobileVisualRefreshExperiment("VideoBackground-native");
let c16142_1 = r23;
let r46 = user?.id;
if (r46 == null) {
r46 = EMPTY_STRING_SNOWFLAKE_ID;
}
const EMPTY_STRING_SNOWFLAKE_ID2 = r46;
const displayProfile = useDisplayProfile(EMPTY_STRING_SNOWFLAKE_ID2, guildId);
const r50 = displayProfile == null;
let r51 = void 0;
if (!r50) {
const themeColors = displayProfile.themeColors;
r51 = themeColors == null ? void 0 : themeColors[0];
}
if (r51 == null) {
r51 = null;
}
const r54 = displayProfile == null;
let r24 = void 0;
if (!r54) {
const themeColors2 = displayProfile.themeColors;
r24 = themeColors2 == null ? void 0 : themeColors2[1];
}
if (r24 == null) {
r24 = null;
}
const r57 = r23 && r51 != null && r24 != null;
const videoTileGradientColors = useVideoTileGradientColors(r57 ? r51 : null, r57 ? r24 : null);
useEffect(() => {
if (EMPTY_STRING_SNOWFLAKE_ID2 !== EMPTY_STRING_SNOWFLAKE_ID && c16142_1) {
maybeFetchUserProfile(EMPTY_STRING_SNOWFLAKE_ID2, void 0, {
guildId,
dispatchWait: true
});
}
}, [r23, EMPTY_STRING_SNOWFLAKE_ID2, guildId]);
if (source == null) {
return null;
}
let r68 = renderVideoDetails == null ? void 0 : renderVideoDetails();
if (r68 == null) {
r68 = null;
}
const style2 = [style, styles.videoBackground, r57 ? null : {
backgroundColor
}, r68 != null ? styles.videoDetailsSpacer : null];
const r86 = <Avatar source={source} {...props2} avatarStyle={[avatarStyle, isStageCall ? r57 ? null : {
backgroundColor
} : null]} isStageCall={isStageCall} />;
return videoTileGradientColors != null ? <Module4611 colors={videoTileGradientColors} start={{
x: 0,
y: 0
}} end={{
x: 0,
y: 1
}} style={style2}>
{r86}
{r68}
</Module4611> : <View style={style2}>
{r86}
{r68}
</View>;
};
useStyles = createStyles({
videoBackground: {
alignItems: "center"
},
videoDetailsSpacer: {
paddingTop: 12
}
});
c5046_13 = Module12.memoize((a0) => a0 == null ? null : a0 !== "" ? typeof a0 !== "number" ? {
uri: a0
} : a0 : null);
VideoBackground.AvatarSizes = _native.AvatarSizes;
const r48 = memo(VideoBackground);
export default r48;
export const AvatarSizes = _native.AvatarSizes;
export { c5046_13 as memoizedImageSource };
export { useDominantRGBFromImage };
export function useDominantColorFromImage(a0, a1) {
const dominantRGBFromImage = useDominantRGBFromImage(a0, a1);
return `rgb(${dominantRGBFromImage.r}, ${dominantRGBFromImage.g}, ${dominantRGBFromImage.b})`;
}
@@ -0,0 +1,18 @@
// Metro module 7982 (f7983).
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
class VideoBackgroundManager extends AutomaticLifecycleManager {
previousSelectedVoiceChannelId = SelectedChannelStore.getVoiceChannelId();
cachedDominantColors = {};
_handleSelectVoiceChannel = ({ channelId }) => {
if (this.previousSelectedVoiceChannelId !== channelId) {
this.cachedDominantColors = {};
}
this.previousSelectedVoiceChannelId = channelId;
};
actions = {
VOICE_CHANNEL_SELECT: this._handleSelectVoiceChannel
};
}
const videoBackgroundManager = new VideoBackgroundManager();
export default videoBackgroundManager;
@@ -0,0 +1,55 @@
// Metro module 8830 (f8831).
import VoiceStateStore from "../../../stores/VoiceStateStore";
import { NOOP_NULL } from "../../../Constants";
import * as _PrivateChannelCallUtils from "../../../utils/native/PrivateChannelCallUtils";
import { checkIsCallActive } from "../mobile/useIsCallActive";
import { intl, t } from "../../../intl/index.native";
import { handleDisconnect } from "../../voice_calls/native/CallsUtils";
export default function getPrivateChannelCall(a0) {
let accessibilityHint, onPress, text;
let r11 = arguments[1];
if (r11 === void 0) {
r11 = false;
}
let c16817_1 = r11;
let r4 = arguments[2];
if (r4 === void 0) {
r4 = _PrivateChannelCallUtils.handleStartCall;
}
const handleStartCall = r4;
let r19 = arguments[3];
if (r19 === void 0) {
r19 = _PrivateChannelCallUtils.handleJoinCall;
}
const handleJoinCall = r19;
const isInChannel = VoiceStateStore.isInChannel(a0.id);
const r30 = checkIsCallActive(a0.id);
if (a0.isSystemDM()) {
onPress = NOOP_NULL;
text = null;
accessibilityHint = void 0;
} else if (isInChannel) {
const r72 = r11 ? null : intl.string(t["4ry6yi"]);
onPress = () => handleDisconnect(a0);
text = r72;
accessibilityHint = void 0;
} else if (r30) {
const r59 = r11 ? a0 != null ? VoiceStateStore.hasVideo(a0.id) ? intl.string(t.W68MhH) : null : null : intl.string(t.fdEeb5);
onPress = () => handleJoinCall(a0, c16817_1);
text = r59;
accessibilityHint = void 0;
} else {
text = r11 ? intl.string(t["7AWk50"]) : intl.string(t["EZgS+9"]);
accessibilityHint = r11 ? intl.string(t.oCqlGG) : intl.string(t.focH1t);
onPress = () => handleStartCall(a0, c16817_1);
}
if (accessibilityHint == null) {
accessibilityHint = text;
}
return {
text,
accessibilityHint,
inCall: isInChannel,
onPress
};
};
@@ -0,0 +1,61 @@
// Metro module 12225 (f12226).
import { useCallback } from "react";
import ChannelStore from "../../../stores/ChannelStore";
import { useStateFromStoresObject } from "../../../_bundle/Module589";
import { intl, t } from "../../../intl/index.native";
import getPrivateChannelCall from "./getPrivateChannelCall";
import ChannelActionCreators from "../../../actions/ChannelActionCreators";
export default function usePrivateChannelCall(a0, a1, a2) {
const stateFromStoresObject = useStateFromStoresObject([ChannelStore], () => {
const channel = ChannelStore.getChannel(ChannelStore.getDMFromUserId(a0));
if (channel != null && channel.isPrivate()) {
const privateChannelCall = getPrivateChannelCall(channel, a1);
return {
text: privateChannelCall.text,
accessibilityHint: privateChannelCall.accessibilityHint,
inCall: privateChannelCall.inCall
};
}
return {
text: a1 ? intl.string(t["7AWk50"]) : intl.string(t["EZgS+9"]),
accessibilityHint: a1 ? intl.string(t.oCqlGG) : intl.string(t.focH1t),
inCall: false
};
}, [a1, a0]);
return {
text: stateFromStoresObject.text,
inCall: stateFromStoresObject.inCall,
accessibilityHint: stateFromStoresObject.accessibilityHint,
handlePress: useCallback(async () => {
let c27275_1;
let c30513_0, c30513_1;
L25: {
c27275_1 = void 0;
c30513_0 = void 0;
c30513_1 = void 0;
c30513_0 = ChannelStore.getChannel(ChannelStore.getDMFromUserId(a0));
if (c30513_0 == null) {
c30513_1 = await ChannelActionCreators.ensurePrivateChannel(a0);
c30513_0 = ChannelStore.getChannel(c30513_1);
const r82 = c30513_0;
if (r82 == null ? void 0 : r82.isPrivate()) {
getPrivateChannelCall(c30513_0, a1).onPress();
}
if (a2 == null) {
break L25;
}
a2();
break L25;
}
const r41 = c30513_0;
if (r41 == null ? void 0 : r41.isPrivate()) {
getPrivateChannelCall(c30513_0, a1).onPress();
}
if (a2 != null) {
a2();
}
return void 0;
}
}, [a0, a1, a2])
};
};
@@ -0,0 +1,29 @@
// Metro module 7988 (f7989).
import { useMemo } from "react";
import { ThemeTypes } from "../../../Constants";
import { getProfileTheme, calculateModalV2BackgroundColor, getValueInColorGradientByPercentage } from "../../user_profile/UserProfileGradientUtils";
import { int2rgbArray } from "../../../_bundle/int2hslRaw";
let computeVideoTileGradientStops;
const rgbToHex = function rgbToHex(a0) {
const [r12, r14, r15] = a0;
return `#${Math.max(0, Math.min(255, r12)).toString(16).padStart(2, "0")}${Math.max(0, Math.min(255, r14)).toString(16).padStart(2, "0")}${Math.max(0, Math.min(255, r15)).toString(16).padStart(2, "0")}`;
};
computeVideoTileGradientStops = function computeVideoTileGradientStops(a0, a1) {
if (a0 != null && a1 != null) {
let r12 = getProfileTheme(a0);
if (r12 == null) {
r12 = ThemeTypes.DARK;
}
const r21 = int2rgbArray(calculateModalV2BackgroundColor(a0, a1, r12));
const r25 = int2rgbArray(a0);
const r29 = int2rgbArray(a1);
const valueInColorGradientByPercentage = getValueInColorGradientByPercentage([r21[0], r21[1], r21[2]], [r25[0], r25[1], r25[2]], 20);
const valueInColorGradientByPercentage2 = getValueInColorGradientByPercentage([r21[0], r21[1], r21[2]], [r29[0], r29[1], r29[2]], 60);
return [rgbToHex(valueInColorGradientByPercentage), rgbToHex(valueInColorGradientByPercentage2)];
}
return null;
};
export { computeVideoTileGradientStops };
export function useVideoTileGradientColors(a0, a1) {
return useMemo(() => computeVideoTileGradientStops(a0, a1), [a0, a1]);
}
+24
View File
@@ -0,0 +1,24 @@
// Metro module 13568 (f13569).
import ChannelStore from "../../stores/ChannelStore";
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import ChannelRTCStore from "./ChannelRTCStore";
import ChannelRTCActionCreators from "../../actions/ChannelRTCActionCreators";
export function toggleVoiceChannelChat(a0) {
if (RTCConnectionStore.isConnected()) {
const channelId = RTCConnectionStore.getChannelId();
if (channelId == null) {
return null;
}
const channel = ChannelStore.getChannel(channelId);
if (channel != null && channel.isGuildVoice()) {
const chatOpen = a0 == null ? !ChannelRTCStore.getChatOpen(channelId) : a0;
ChannelRTCActionCreators.updateChatOpen(channelId, chatOpen);
return {
channelId,
chatOpen
};
}
return null;
}
return null;
}
+15
View File
@@ -0,0 +1,15 @@
// Metro module 15029 (f15030).
import AuthenticationStore from "../../stores/AuthenticationStore";
import CallStore from "../../stores/CallStore";
import { useStateFromStoresObject } from "../../_bundle/Module589";
export default function useCallA11yState(c21540_0) {
return useStateFromStoresObject([CallStore, AuthenticationStore], () => {
const call = CallStore.getCall(c21540_0);
const id = AuthenticationStore.getId();
const isIncomingCall = call != null && id != null && call.ringing.includes(id);
return {
isIncomingCall,
isOngoingCall: CallStore.isCallActive(c21540_0) && !isIncomingCall
};
});
};
+112
View File
@@ -0,0 +1,112 @@
// Metro module 8915 (f8916).
import AuthenticationStore from "../../stores/AuthenticationStore";
import CallStore from "../../stores/CallStore";
import ChannelStore from "../../stores/ChannelStore";
import GuildMemberStore from "../../stores/GuildMemberStore";
import GuildVerificationStore from "../../stores/GuildVerificationStore";
import PermissionStore from "../../stores/PermissionStore";
import PresenceStore from "../../stores/PresenceStore";
import RelationshipStore from "../../stores/RelationshipStore";
import VoiceStateStore from "../../stores/VoiceStateStore";
import { ChannelTypes, ChannelTypesSets, StatusTypes } from "../../Constants";
import { useStateFromStores } from "../../_bundle/Module589";
import GuildVoiceRingingExperiment from "../voice_calls/GuildVoiceRingingExperiment";
import canJoinVoiceChannel from "../channel/canJoinVoiceChannel";
import useChannelRoleSubscriptionStatus from "../guild_role_subscriptions/useChannelRoleSubscriptionStatus";
const useCanRingToGuildVoiceChannel = function useCanRingToGuildVoiceChannel(c16870_0, location2 = "useCanRingToGuildVoiceChannel", r9) {
let c16870_1 = r9;
const stateFromStores2 = useStateFromStores([PermissionStore], () => c16870_1 != null && canJoinVoiceChannel(c16870_1, PermissionStore));
const stateFromStores3 = useStateFromStores([GuildMemberStore, GuildVerificationStore], () => {
const guild_id = c16870_1?.guild_id;
if (guild_id == null) {
return false;
}
let r11 = GuildMemberStore.getMember(guild_id, c16870_0.id) != null;
const canChat = GuildVerificationStore.getCheck(guild_id).canChat;
if (r11) {
r11 = canChat;
}
return r11;
});
const needSubscriptionToAccess = useChannelRoleSubscriptionStatus(r9?.id).needSubscriptionToAccess;
let enabled = GuildVoiceRingingExperiment.useExperiment({
guildId: r9?.guild_id,
location: location2
}).enabled;
const type = r9?.type;
const GUILD_VOICE = ChannelTypes.GUILD_VOICE;
if (enabled) {
enabled = type === GUILD_VOICE;
}
if (enabled) {
enabled = stateFromStores3;
}
if (enabled) {
enabled = stateFromStores2;
}
if (enabled) {
enabled = !needSubscriptionToAccess;
}
return enabled;
};
export function useCanRing(a0) {
let r10 = arguments[1];
if (r10 === void 0) {
r10 = "useCanRing";
}
let c16871_1 = arguments[2];
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(c16871_1));
const stateFromStores2 = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId() === a0.id);
let r30 = useStateFromStores([RelationshipStore], () => RelationshipStore.isFriend(a0.id));
const stateFromStores3 = useStateFromStores([PresenceStore], () => PresenceStore.getStatus(a0.id) === StatusTypes.DND && stateFromStores?.guild_id != null);
const type = stateFromStores?.type;
const r39 = type != null && ChannelTypesSets.CALLABLE.has(type);
let r44 = useCanRingToGuildVoiceChannel(a0, r10, stateFromStores);
if (r30) {
r30 = !stateFromStores3;
}
if (r30) {
r30 = !stateFromStores2;
}
if (r30) {
r30 = !a0.bot;
}
if (r30) {
r30 = !a0.system;
}
if (r30) {
r30 = !a0.isProvisional;
}
if (r30) {
if (!r44) {
r44 = r39;
}
r30 = r44;
}
return r30;
}
export function canRingUsersInChannel(a0) {
const r11 = ChannelTypesSets.CALLABLE.has(a0.type);
const type = a0.type;
const GUILD_VOICE = ChannelTypes.GUILD_VOICE;
if (r11) {
const call = CallStore.getCall(a0.id);
return call != null && call.messageId != null && !CallStore.isCallUnavailable(a0.id);
}
if (type === GUILD_VOICE) {
let enabled = GuildVoiceRingingExperiment.getCurrentConfig({
guildId: a0.guild_id,
location: "ring"
}).enabled;
const voiceState = VoiceStateStore.getVoiceState(a0.guild_id, AuthenticationStore.getId());
if (enabled) {
enabled = voiceState != null;
}
if (enabled) {
enabled = voiceState.channelId === a0.id;
}
return enabled;
}
return false;
}
export { useCanRingToGuildVoiceChannel };
@@ -0,0 +1,65 @@
// Metro module 15940 (f15941).
import PermissionStore from "../../stores/PermissionStore";
import { Permissions } from "../../_bundle/Module505";
import { useStateFromStores } from "../../_bundle/Module589";
function $mk98238($env) {
return (a0) => {
let r13;
const r2 = $env;
const user = r2[2];
if (user == null) {
r13 = r2[1].can(a0, r2[0]);
} else {
const r1 = $env.$parent;
r13 = (0, r1[1])(r1[2][2]).can({
permission: a0,
user,
context: r2[0]
});
}
return r13;
};
}
let env11421 = {};
const c11421_4 = [Permissions.SET_VOICE_CHANNEL_STATUS, Permissions.CONNECT, Permissions.VIEW_CHANNEL];
const c11421_5 = [Permissions.SET_VOICE_CHANNEL_STATUS];
export default function useCanSetVoiceChannelStatus(a0) {
let r8 = arguments[1];
if (r8 === void 0) {
r8 = false;
}
let c22628_1 = r8;
const r7 = arguments[2];
let c22628_2 = r7;
return useStateFromStores([PermissionStore], () => {
let env28188;
const r1 = env11421;
const r6 = env28188 = {
$parent: r1
};
env28188[0] = a0;
env28188[1] = PermissionStore;
env28188[2] = c22628_2;
return (c22628_1 ? c11421_5 : c11421_4).every($mk98238(r6));
}, [a0, r8, r7]);
};
export function _canSetVoiceChannelStatus(a0, a1, a2, a3) {
let env22627;
const r0 = env22627 = {
$parent: env11421
};
env22627[0] = a0;
env22627[1] = a1;
env22627[2] = a3;
return (a2 ? c11421_5 : c11421_4).every($mk98238(r0));
}
export function canSetVoiceChannelStatus(a0, r3 = false) {
let env22629;
const r1 = env22629 = {
$parent: env11421
};
env22629[0] = a0;
env22629[1] = PermissionStore;
env22629[2] = arguments[2];
return (r3 ? c11421_5 : c11421_4).every($mk98238(r1));
}
+15
View File
@@ -0,0 +1,15 @@
// Metro module 16032 (f16033).
import AuthenticationStore from "../../stores/AuthenticationStore";
import MediaEngineStore from "../../stores/MediaEngineStore";
import { VideoToggleState } from "../../Constants";
import { Features, MediaEngineContextTypes } from "../../_bundle/Module4250";
import { useStateFromStores } from "../../_bundle/Module589";
import AudioActionCreators from "../../actions/AudioActionCreators";
export default function useHideSelfVideo(a0, r3 = MediaEngineContextTypes.DEFAULT) {
const DEFAULT = r3;
const stateFromStores = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId());
const stateFromStores2 = useStateFromStores([MediaEngineStore], () => MediaEngineStore.supports(Features.DISABLE_VIDEO));
return [(a0 == null || a0 === stateFromStores) && stateFromStores2, useStateFromStores([MediaEngineStore], () => MediaEngineStore.isLocalVideoDisabled(stateFromStores, DEFAULT), [stateFromStores, DEFAULT]), function(a0) {
AudioActionCreators.setDisableLocalVideo(stateFromStores, a0 ? VideoToggleState.DISABLED : VideoToggleState.MANUAL_ENABLED, DEFAULT);
}];
};