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

@@ -0,0 +1,17 @@
// Metro module 15952 (f15953).
import ChannelStore from "../../../../stores/ChannelStore";
import GuildStore from "../../../../stores/GuildStore";
import PermissionStore from "../../../../stores/PermissionStore";
import VoiceStateStore from "../../../../stores/VoiceStateStore";
import { Permissions } from "../../../../_bundle/Module505";
import { useStateFromStoresObject } from "../../../../_bundle/Module589";
import { isChannelFull } from "../../../../utils/ChannelUtils";
export default function useCanConnect(a0) {
return useStateFromStoresObject([ChannelStore, PermissionStore, GuildStore, VoiceStateStore], () => {
const channel = ChannelStore.getChannel(a0);
return {
canConnect: channel != null && (channel.isPrivate() || PermissionStore.can(Permissions.CONNECT, channel)),
isAtMaxCapacity: channel == null || isChannelFull(channel, VoiceStateStore, GuildStore)
};
}, [a0]);
};
@@ -0,0 +1,11 @@
// Metro module 15928 (f15929).
import ChannelStore from "../../../../stores/ChannelStore";
import PermissionStore from "../../../../stores/PermissionStore";
import { Permissions } from "../../../../_bundle/Module505";
import { useStateFromStores } from "../../../../_bundle/defaultAreStatesEqual";
export function useCanInviteMembers(a0) {
return useStateFromStores([ChannelStore, PermissionStore], () => {
const channel = ChannelStore.getChannel(a0);
return channel != null && PermissionStore.can(Permissions.CONNECT, channel) && PermissionStore.can(Permissions.CREATE_INSTANT_INVITE, channel);
}, [a0]);
}
@@ -0,0 +1,6 @@
// Metro module 15956 (f15957).
import ReadStateStore from "../../../../stores/ReadStateStore";
import { useStateFromStores } from "../../../../_bundle/Module589";
export default function useChatBadge(c22640_0) {
return useStateFromStores([ReadStateStore], () => ReadStateStore.getMentionCount(c22640_0) > 0 ? "mention" : ReadStateStore.hasUnread(c22640_0) ? "unread" : null);
};
@@ -0,0 +1,41 @@
// Metro module 15995 (f15996).
import GameConsoleStore from "../../../game_console/GameConsoleStore";
import SessionsStore from "../../../../stores/SessionsStore";
import useVoiceStateForRemoteSession from "../../../game_console/hooks/useVoiceStateForRemoteSession";
import { useStateFromStores } from "../../../../_bundle/defaultAreStatesEqual";
import useShouldDisplayCancelConsoleTransfer from "../../../game_console/native/useShouldDisplayCancelConsoleTransfer";
import getConsoleIcon from "../../../game_console/native/getConsoleIcon";
import { getConsoleConnectingText } from "../../../game_console/native/getConsoleConnectingText";
import getConsoleColor from "../../../game_console/native/getConsoleColor";
export default function useConsoleConnectingInfo(a0) {
const voiceStateForRemoteSession = useVoiceStateForRemoteSession();
let c22705_0 = voiceStateForRemoteSession;
const channelId = voiceStateForRemoteSession?.channelId;
const stateFromStores = useStateFromStores([GameConsoleStore], () => GameConsoleStore.getAwaitingRemoteSessionInfo());
const stateFromStores2 = useStateFromStores([SessionsStore], () => {
let r7 = c22705_0?.sessionId;
if (r7 == null) {
r7 = "";
}
return SessionsStore.getSessionById(r7);
});
let r28 = stateFromStores?.type;
if (r28 == null) {
r28 = stateFromStores2 == null ? void 0 : stateFromStores2.clientInfo.os;
}
if (r28 == null) {
r28 = "";
}
const shouldDisplayCancelConsoleTransfer = useShouldDisplayCancelConsoleTransfer(stateFromStores);
const channelId2 = stateFromStores?.channelId;
const channelId3 = stateFromStores?.channelId;
const r41 = channelId === a0;
return {
isConnectingToConsole: channelId2 === a0,
isConnectingOrConnectedToConsole: channelId3 === a0 || r41,
icon: getConsoleIcon(r28),
text: getConsoleConnectingText(stateFromStores2, stateFromStores, r41),
color: getConsoleColor(r28),
displayCancel: shouldDisplayCancelConsoleTransfer
};
};
@@ -0,0 +1,36 @@
// Metro module 16025 (f16026).
import { useContext, useEffect } from "react";
import VoicePanelStateContext from "../VoicePanelStateContext";
import MobileVisualRefreshExperiment from "../../../themes/experiments/MobileVisualRefreshExperiment";
import useConsoleConnectingInfo from "./useConsoleConnectingInfo";
import { useSharedValue, useDerivedValue } from "../../../reanimated/ReanimatedRexport";
import { CONSOLE_STATUS_HEIGHT } from "../controls/VoicePanelConsoleStatus";
import { useShouldShowFloatingCTA } from "../controls/utils/VoicePanelFloatingCTAUtils";
import { getFloatingCTATotalViewHeight } from "../controls/VoicePanelFloatingCTAContainer";
const __initData = {
code: "function useControlAccessoryHeightTsx1(){const{consoleStatusHeight,floatingCTAHeight}=this.__closure;return consoleStatusHeight.get()+floatingCTAHeight.get();}"
};
export default function useControlAccessoryHeight() {
let shouldShowFloatingCTA, sharedValue2, floatingCTATotalViewHeight;
const channelId = useContext(VoicePanelStateContext).channelId;
const r10 = MobileVisualRefreshExperiment("useControlAccessoryHeight");
const isConnectingOrConnectedToConsole = useConsoleConnectingInfo(channelId).isConnectingOrConnectedToConsole;
const sharedValue = useSharedValue(0);
useEffect(() => {
sharedValue.set(isConnectingOrConnectedToConsole ? CONSOLE_STATUS_HEIGHT : 0);
}, [sharedValue, isConnectingOrConnectedToConsole]);
shouldShowFloatingCTA = useShouldShowFloatingCTA(channelId);
sharedValue2 = useSharedValue(0);
floatingCTATotalViewHeight = getFloatingCTATotalViewHeight(r10);
useEffect(() => {
sharedValue2.set(shouldShowFloatingCTA ? floatingCTATotalViewHeight : 0);
}, [sharedValue2, shouldShowFloatingCTA, floatingCTATotalViewHeight]);
const c = () => sharedValue.get() + sharedValue2.get();
c.__closure = {
consoleStatusHeight: sharedValue,
floatingCTAHeight: sharedValue2
};
c.__workletHash = 7974849446653;
c.__initData = __initData;
return useDerivedValue(c);
};
@@ -0,0 +1,31 @@
// Metro module 16001 (f16002).
import { useContext } from "react";
import { MODE_CHANGE_PHYSICS } from "../../VoicePanelConstants";
import { CALL_TILE_GUTTER } from "../card/VoicePanelCardConstants";
import VoicePanelStateContext from "../VoicePanelStateContext";
import { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
const __initData = {
code: "function useControlsTranslationTsx1(){const{withSpring,wrapperSpecs,MODE_CHANGE_PHYSICS,useReducedMotion,CALL_TILE_GUTTER,viewHeight}=this.__closure;return{transform:[{translateX:withSpring(wrapperSpecs.get().x,MODE_CHANGE_PHYSICS)},{translateY:withSpring(!useReducedMotion.get()&&wrapperSpecs.get().hidden?wrapperSpecs.get().height+CALL_TILE_GUTTER+viewHeight.get():wrapperSpecs.get().y,MODE_CHANGE_PHYSICS)}]};}"
};
export default function useControlsTranslation(a0, a1, a2) {
const useReducedMotion = useContext(VoicePanelStateContext).useReducedMotion;
const S = () => ({
transform: [{
translateX: _spring.withSpring(a1.get().x, MODE_CHANGE_PHYSICS)
}, {
translateY: _spring.withSpring(!useReducedMotion.get() && a1.get().hidden ? a1.get().height + CALL_TILE_GUTTER + a2.get() : a1.get().y, MODE_CHANGE_PHYSICS)
}]
});
S.__closure = {
withSpring: _spring.withSpring,
wrapperSpecs: a1,
MODE_CHANGE_PHYSICS,
useReducedMotion,
CALL_TILE_GUTTER,
viewHeight: a2
};
S.__workletHash = 11281989557090;
S.__initData = __initData;
return useAnimatedStyle(S);
};
@@ -0,0 +1,14 @@
// Metro module 15886 (f15887).
import { useCallback } from "react";
import ChannelStore from "../../../../stores/ChannelStore";
import { AnalyticsPages, InstantInviteSources } from "../../../../Constants";
import { navigateToNewGroupDM } from "../../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import { showInstantInviteActionSheet } from "../../../instant_invite/native/InstantInviteUtils";
export function useInviteMembersCallback(a0) {
return useCallback(() => {
const channel = ChannelStore.getChannel(a0);
return channel != null ? channel.isPrivate() ? navigateToNewGroupDM(channel.id, AnalyticsPages.CHANNEL_CALL) : showInstantInviteActionSheet(channel, {
source: InstantInviteSources.VOICE_CHANNEL
}) : null;
}, [a0]);
}
@@ -0,0 +1,26 @@
// Metro module 15863 (f15864).
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import RTCConnectionStore from "../../../../stores/RTCConnectionStore";
import VoiceStateStore from "../../../../stores/VoiceStateStore";
import { RTCConnectionStates } from "../../../../Constants";
import { useStateFromStores } from "../../../../_bundle/Module589";
export default function useIsConnectedToVoiceChannel(c22529_0) {
return useStateFromStores([RTCConnectionStore, VoiceStateStore, AuthenticationStore], () => {
const channelId = RTCConnectionStore.getChannelId();
let r6 = c22529_0;
if (r6 == null) {
r6 = channelId;
}
if (r6 !== channelId) {
return false;
}
if (VoiceStateStore.isInChannel(r6, AuthenticationStore.getId())) {
return true;
}
const state = RTCConnectionStore.getState();
if (RTCConnectionStates.DISCONNECTED !== state && RTCConnectionStates.NO_ROUTE !== state) {
return true;
}
return false;
});
};
@@ -0,0 +1,32 @@
// Metro module 16020 (f16021).
import { useCallback, useMemo } from "react";
import ChannelStore from "../../../../stores/ChannelStore";
import useIsConnectedToVoiceChannel from "./useIsConnectedToVoiceChannel";
import { useIsDismissibleContentDismissed_UNSAFE } from "../../../dismissible_content/DismissibleContentUnsafeUtils";
import { DismissibleContent } from "../../../../_bundle/Module1358";
import { showSoundboardSoundPickerActionSheet } from "../../../soundboard/native/SoundboardActionCreators";
import canChannelUseSoundboard from "../../../soundboard/canChannelUseSoundboard";
let c11487_5 = {
VOICE_CONTROLS: "call control drawer",
VOICE_PANEL_CONTROLS: "voice panel controls"
};
export default function useSoundboardConfig(a0, a1) {
const analyticsSource = a1;
const isConnectedToVoiceChannel = useIsConnectedToVoiceChannel(a0);
const showIndicator = !useIsDismissibleContentDismissed_UNSAFE(DismissibleContent.SOUNDBOARD_MOBILE_NEW_BADGE);
return {
visible: isConnectedToVoiceChannel && (c11487_5.VOICE_CONTROLS !== a1 ? c11487_5.VOICE_PANEL_CONTROLS === a1 ? true : false : true),
handlePress: useCallback(() => {
const channel = ChannelStore.getChannel(a0);
if (channel != null) {
showSoundboardSoundPickerActionSheet({
channel,
analyticsSource
});
}
}, [a0, a1]),
disabled: useMemo(() => !canChannelUseSoundboard(ChannelStore.getChannel(a0)), [a0]),
showIndicator
};
};
export { c11487_5 as SoundboardButtonLocation };
@@ -0,0 +1,142 @@
// Metro module 15948 (f15949).
import { useContext, useState, useMemo, useEffect, useCallback } from "react";
import { setVoiceUpsellDismissed, useConsoleVoiceUpsellStore } from "../../../game_console/ConsoleVoiceUpsellStore";
import { VoicePanelControlsModes } from "../controls/VoicePanelControlsConstants";
import { ContentDismissActionType } from "../../../dismissible_content/DismissibleContentConstants";
import useConsoleConnectedAccountForVoiceUpsell from "../../../game_console/useConsoleConnectedAccountForVoiceUpsell";
import useChannelFloatingCTAContent from "../../../video_calls/native/useChannelFloatingCTAContent";
import { useIsVoicePanelFullscreen } from "../../VoicePanelUtils.native";
import VoicePanelStateContext from "../VoicePanelStateContext";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import { useAnimatedReaction } from "../../../reanimated/ReanimatedRexport";
import { useSelectedDismissibleContent } from "../../../dismissible_content/hooks/useSelectedDismissibleContent";
import useControlsLock from "../controls/useControlsLock";
import { intl, t } from "../../../../intl/index.native";
import { DismissibleContent } from "../../../../_bundle/Module1358";
import VoicePanelConsoleFacepile, { getConsoleInfo } from "../header/VoicePanelConsoleFacepile";
import { useCoachmark } from "../../../../design/components/Coachmark/native/useCoachmark.native";
function $mk98252($env) {
return () => {
const r2 = $env[0];
if (r2.visible) {
r2.onDismiss();
}
};
}
function $mk98253($env) {
return () => {
const r1 = $env;
if (!r1[1]) {
(0, r1[2])();
}
};
}
const __initData = {
code: "function useSpeakerTooltipsTsx1(){const{controlsSpecs}=this.__closure;return controlsSpecs.get().mode;}"
};
const __initData2 = {
code: "function useSpeakerTooltipsTsx2(currentControlsMode,previous){const{runOnJS,setIsShowingControls,VoicePanelControlsModes}=this.__closure;if(currentControlsMode===previous)return;runOnJS(setIsShowingControls)(currentControlsMode===VoicePanelControlsModes.FLOATING_DEFAULT);}"
};
export default function useSpeakerTooltips(a0, a1) {
let c22634_6, c22634_7, c22634_8, memo, visible;
let r13 = a1;
let state = a1;
const consoleConnectedAccountForVoiceUpsell = useConsoleConnectedAccountForVoiceUpsell();
let c22634_1 = consoleConnectedAccountForVoiceUpsell;
const voiceUpsellDismissed = useConsoleVoiceUpsellStore().voiceUpsellDismissed;
const channelFloatingCTAContent = useChannelFloatingCTAContent(void 0);
let c22634_3 = channelFloatingCTAContent;
const isVoicePanelFullscreen = useIsVoicePanelFullscreen();
const controlsSpecs = useContext(VoicePanelStateContext).controlsSpecs;
const [state2, setState] = useState(true);
const v = () => controlsSpecs.get().mode;
v.__closure = {
controlsSpecs
};
v.__workletHash = 13952338295275;
v.__initData = __initData;
const b = function b(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(setState)(a0 === VoicePanelControlsModes.FLOATING_DEFAULT);
}
};
b.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setIsShowingControls: setState,
VoicePanelControlsModes
};
b.__workletHash = 5084069556209;
b.__initData = __initData2;
useAnimatedReaction(v, b);
if (a1) {
r13 = isVoicePanelFullscreen;
}
if (r13) {
r13 = state2;
}
state = r13;
const [r59, r60] = useSelectedDismissibleContent(useMemo(() => state ? c22634_3 : [], [r13, channelFloatingCTAContent]));
c22634_6 = r59;
c22634_7 = r60;
const controlsLock = useControlsLock();
c22634_8 = controlsLock;
memo = useMemo(() => ({
position: "bottom",
title: intl.string(t.O2WA4u),
description: intl.string(t.fr5bJy),
visible: state && c22634_6 === DismissibleContent.DONUT_MOBILE_NUX,
renderImgComponent: () => <VoicePanelConsoleFacepile />,
withBlurBackground: true,
onDismiss: () => c22634_7(ContentDismissActionType.UNKNOWN)
}), [r13, r60, r59]);
const memo2 = useMemo(() => {
const r4 = c22634_1 != null ? getConsoleInfo(c22634_1) : null;
const visible2 = state && !voiceUpsellDismissed && r4 != null && !memo.visible;
let title = r4?.connectLabel;
if (title == null) {
title = "";
}
let description = r4?.connectSublabel;
if (description == null) {
description = "";
}
return {
position: "bottom",
title,
description,
visible: visible2,
imgSource: r4?.icon,
withBlurBackground: true,
onDismiss: () => {
setVoiceUpsellDismissed(true);
}
};
}, [consoleConnectedAccountForVoiceUpsell, r13, voiceUpsellDismissed, memo.visible]);
const r73 = memo.visible || memo2.visible;
let env22635;
let env22636;
visible = r73;
useEffect(() => {
if (visible) {
c22634_8.lock(VoicePanelControlsModes.FLOATING_DEFAULT);
} else {
c22634_8.unlock();
}
}, [visible, controlsLock]);
const r79 = env22635 = {};
env22635[0] = memo;
env22635[1] = r13;
env22635[2] = void 0;
const callback = useCallback($mk98252(r79), [memo]);
env22635[2] = callback;
useEffect($mk98253(r79), [r13, callback]);
useCoachmark(a0, memo);
const r92 = env22636 = {};
env22636[0] = memo2;
env22636[1] = r13;
env22636[2] = void 0;
const callback2 = useCallback($mk98252(r92), [memo2]);
env22636[2] = callback2;
useEffect($mk98253(r92), [r13, callback2]);
useCoachmark(a0, memo2);
};
@@ -0,0 +1,105 @@
// Metro module 15962 (f15963).
import { useContext, useRef, useLayoutEffect, useMemo } from "react";
import VoicePanelStateContext from "../VoicePanelStateContext";
import { Gesture } from "../../../../_bundle/Module5273";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import * as _HapticUtils_native from "../../../haptics/HapticUtils.native";
const __initData = {
code: "function useTapGesturesTsx1(){const{runOnJS,handleEvent}=this.__closure;return runOnJS(handleEvent)('double');}"
};
const __initData2 = {
code: "function useTapGesturesTsx2(event,manager){const{isFocusedVideoZoomed}=this.__closure;if(isFocusedVideoZoomed.get()){manager.fail();}}"
};
const __initData3 = {
code: "function useTapGesturesTsx3(){const{runOnJS,handleEvent}=this.__closure;return runOnJS(handleEvent)('single');}"
};
const __initData4 = {
code: "function useTapGesturesTsx4(){const{runOnJS,triggerHapticFeedback,HapticFeedbackTypes,handleEvent}=this.__closure;runOnJS(triggerHapticFeedback)(HapticFeedbackTypes.IMPACT_MEDIUM);runOnJS(handleEvent)('long');}"
};
export default function useTapGestures(a0) {
const current = a0;
const isFocusedVideoZoomed = useContext(VoicePanelStateContext).isFocusedVideoZoomed;
const ref = useRef(a0);
const r1 = a0.onSingleTap != null;
let c22656_3 = r1;
const r2 = a0.onDoubleTap != null;
let c22656_4 = r2;
const r20 = a0.onLongPress != null;
let c22656_5 = r20;
const gesturesEnabled = a0.gesturesEnabled;
useLayoutEffect(() => {
ref.current = current;
});
return useMemo(() => {
const handleEvent2 = function handleEvent(a0) {
if (a0 === "single") {
const current4 = ref.current;
const onSingleTap = current4.onSingleTap;
if (onSingleTap != null) {
onSingleTap.call(current4);
}
} else if (a0 === "double") {
const current3 = ref.current;
const onDoubleTap = current3.onDoubleTap;
if (onDoubleTap != null) {
onDoubleTap.call(current3);
}
} else if (a0 === "long") {
const current2 = ref.current;
const onLongPress = current2.onLongPress;
if (onLongPress != null) {
onLongPress.call(current2);
}
}
};
const r9 = Gesture.Tap();
let r12 = gesturesEnabled;
const r29 = r9.enabled(gesturesEnabled ? c22656_4 : gesturesEnabled).maxDistance(30).numberOfTaps(2);
const S = function S(a0, a1) {
if (isFocusedVideoZoomed.get()) {
a1.fail();
}
};
S.__closure = {
isFocusedVideoZoomed
};
S.__workletHash = 3236469126950;
S.__initData = __initData2;
const r34 = r29.onTouchesDown(S);
const b = () => _ReanimatedRexport.runOnJS(handleEvent2)("double");
b.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
handleEvent: handleEvent2
};
b.__workletHash = 13571114432746;
b.__initData = __initData;
const r43 = r34.onStart(b);
const r53 = Gesture.Tap().enabled(gesturesEnabled ? c22656_3 : gesturesEnabled).maxDistance(30);
const c = () => _ReanimatedRexport.runOnJS(handleEvent2)("single");
c.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
handleEvent: handleEvent2
};
c.__workletHash = 14109132753191;
c.__initData = __initData3;
const r61 = r53.onStart(c);
const r66 = Gesture.LongPress();
if (gesturesEnabled) {
r12 = c22656_5;
}
const r68 = r66.enabled(r12);
const n = function n() {
_ReanimatedRexport.runOnJS(_HapticUtils_native.triggerHapticFeedback)(_HapticUtils_native.HapticFeedbackTypes.IMPACT_MEDIUM);
_ReanimatedRexport.runOnJS(handleEvent2)("long");
};
n.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
triggerHapticFeedback: _HapticUtils_native.triggerHapticFeedback,
HapticFeedbackTypes: _HapticUtils_native.HapticFeedbackTypes,
handleEvent: handleEvent2
};
n.__workletHash = 1947700378974;
n.__initData = __initData4;
return Gesture.Exclusive(r43, r61, r68.onStart(n));
}, [r1, r2, r20, gesturesEnabled, isFocusedVideoZoomed]);
};
@@ -0,0 +1,143 @@
// Metro module 15932 (f15933).
import { useContext, useCallback, useMemo } from "react";
import RTCConnectionStore from "../../../../stores/RTCConnectionStore";
import VoiceStateStore from "../../../../stores/VoiceStateStore";
import { ParticipantTypes } from "../../../calls/CallConstants";
import VoicePanelStateContext from "../VoicePanelStateContext";
import { useMuteDeafenIconState, useVideoIconState, VideoIconState, MuteDeafenIconState } from "../utils/VoiceStateIconUtils";
import { useStateFromStores } from "../../../../_bundle/defaultAreStatesEqual";
import useMuteAwareLocalVolume from "../../../media_engine/useMuteAwareLocalVolume";
import { MediaEngineContextTypes } from "../../../../_bundle/Module4286";
import MobileAudioOutputExperiment from "../../../media_engine/MobileAudioOutputExperiment";
import { useIsRTCDisconnectedUIVisible } from "../../../voice_calls/RTCConnectionDesyncHooks";
import { OverrideFloatingCTA } from "../controls/utils/VoicePanelFloatingCTAUtils";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import { CircleErrorIcon } from "../../../../design/components/Icon/native/redesign/generated/CircleErrorIcon";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
let c11414_8 = {
STREAM_ICON: "STREAM_ICON",
USER_VIDEO_ICON: "USER_VIDEO_ICON",
MUTE_DEAFEN_ICON: "MUTE_DEAFEN_ICON",
USER_DISCONNECTED_ICON: "DISCONNECTED_ICON",
SPEAKER_MUTE_ICON: "SPEAKER_MUTE_ICON"
};
export default function useVoicePanelCardUserStateIcons(a0, a1, a2) {
let stateFromStores2, c22619_8, isRTCDisconnectedUIVisible, callback, callback2;
let r12 = arguments[3];
if (r12 === void 0) {
r12 = null;
}
let c22619_2 = r12;
stateFromStores2 = void 0;
c22619_8 = void 0;
isRTCDisconnectedUIVisible = void 0;
callback = void 0;
callback2 = void 0;
const setShowFloatingCTA = useContext(VoicePanelStateContext).setShowFloatingCTA;
const muteDeafenIconState = useMuteDeafenIconState(a0 === ParticipantTypes.USER ? a1 : void 0, a2);
const videoIconState = useVideoIconState(a0 === ParticipantTypes.USER ? a1 : void 0, a2);
const stateFromStores = useStateFromStores([RTCConnectionStore], () => RTCConnectionStore.isConnected());
stateFromStores2 = useStateFromStores([VoiceStateStore], () => {
const r1 = c22619_2 != null;
let r2 = null;
if (r1) {
r2 = a1 != null ? VoiceStateStore.getVoicePlatformForChannel(c22619_2, a1) : null;
}
return r2;
}, [r12, a1]);
const effectiveVolume = useMuteAwareLocalVolume(a0 === ParticipantTypes.STREAM ? a1 : void 0, MediaEngineContextTypes.STREAM).effectiveVolume;
const r61 = MobileAudioOutputExperiment.useConfig({
location: "useVoicePanelCardUserStateIcons"
}).showTileVolumeIndicator && effectiveVolume === 0 && a0 === ParticipantTypes.STREAM;
c22619_8 = r61;
isRTCDisconnectedUIVisible = useIsRTCDisconnectedUIVisible(r12, a1);
callback = useCallback(() => {
setShowFloatingCTA(OverrideFloatingCTA.BAD_CONNECTION);
}, [setShowFloatingCTA]);
callback2 = useCallback(() => {
ToastActionCreators.open({
key: "user-disconnected-indicator",
icon: () => <CircleErrorIcon size="xs" color={Module712.colors.STATUS_WARNING} />,
content: intl.string(t.HFwRpk)
});
}, []);
return useMemo(() => {
if (stateFromStores) {
if (a0 === ParticipantTypes.STREAM) {
const r50 = [];
if (c22619_8) {
r50.push({
type: c11414_8.SPEAKER_MUTE_ICON,
onPress: () => {
ToastActionCreators.open({
key: `${a1}-stream-status`,
content: intl.string(t.Q8Uzof)
});
}
});
}
r50.push({
type: c11414_8.STREAM_ICON,
voicePlatform: stateFromStores2
});
return r50;
}
if (a0 !== ParticipantTypes.USER) {
return [];
}
const r15 = [];
if (isRTCDisconnectedUIVisible) {
r15.push({
type: c11414_8.USER_DISCONNECTED_ICON,
onPress: callback2
});
}
if (videoIconState != null && videoIconState !== VideoIconState.VIDEO_ACTIVE) {
r15.push({
type: c11414_8.USER_VIDEO_ICON,
videoIconState,
onPress: videoIconState === VideoIconState.VIDEO_DISABLED_LOCAL_AUTO ? callback : void 0
});
}
if (muteDeafenIconState != null) {
r15.push({
type: c11414_8.MUTE_DEAFEN_ICON,
muteDeafenIconState,
withLeftMargin: r15.length > 0,
onPress: () => {
if (MuteDeafenIconState.DEAFENED_SERVER === muteDeafenIconState) {
ToastActionCreators.open({
key: `${a1}-status`,
content: intl.string(t.btxSdB)
});
} else if (MuteDeafenIconState.DEAFENED === muteDeafenIconState) {
ToastActionCreators.open({
key: `${a1}-status`,
content: intl.string(t.NjmiOL)
});
} else if (MuteDeafenIconState.MUTED_SERVER === muteDeafenIconState) {
ToastActionCreators.open({
key: `${a1}-status`,
content: intl.string(t.uLddbQ)
});
} else if (MuteDeafenIconState.MUTED_LOCAL === muteDeafenIconState) {
ToastActionCreators.open({
key: `${a1}-status`,
content: intl.string(t.Q8Uzof)
});
} else if (MuteDeafenIconState.MUTED === muteDeafenIconState) {
ToastActionCreators.open({
key: `${a1}-status`,
content: intl.string(t.tjtv3P)
});
}
}
});
}
return r15;
}
return [];
}, [stateFromStores, a0, videoIconState, muteDeafenIconState, isRTCDisconnectedUIVisible, stateFromStores2, callback, a1, callback2, r61]);
};
export { c11414_8 as VoicePanelCardUserStateIconType };
@@ -0,0 +1,18 @@
// Metro module 15929 (f15930).
import { useContext, useCallback } from "react";
import { VoicePanelControlsModes } from "../controls/VoicePanelControlsConstants";
import VoicePanelStateContext from "../VoicePanelStateContext";
export default function useVoicePanelNavArrowPressed() {
const context = useContext(VoicePanelStateContext);
const { focused, setFocused, dismissPanel, controlsSpecs } = context;
return useCallback(() => {
let r16;
if (focused.get()?.id != null && controlsSpecs.get().mode !== VoicePanelControlsModes.DRAWER) {
setFocused(null);
r16 = true;
} else {
r16 = dismissPanel();
}
return r16;
}, [focused, controlsSpecs, dismissPanel, setFocused]);
};
@@ -0,0 +1,151 @@
// Metro module 15909 (f15910).
import { useState, useEffect, useContext } from "react";
import ChannelRTCStore from "../../../calls/ChannelRTCStore";
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import ChannelStore from "../../../../stores/ChannelStore";
import RTCConnectionStore from "../../../../stores/RTCConnectionStore";
import VoiceStateStore from "../../../../stores/VoiceStateStore";
import SortedVoiceStateStore from "../../../../stores/views/SortedVoiceStateStore";
import { VoicePanelCTACard, VoicePanelCardItemType } from "../../VoicePanelConstants";
import { RTCConnectionStates } from "../../../../Constants";
import useIsConnectedToVoiceChannel from "./useIsConnectedToVoiceChannel";
import { useStateFromStores, useStateFromStoresArray } from "../../../../_bundle/Module589";
import { useDesyncedChannelParticipants } from "../../../voice_calls/RTCConnectionDesyncHooks";
import VoicePanelStateContext from "../VoicePanelStateContext";
import { useManagerSubscription } from "../card/VoicePanelCardLayoutManager";
let c11393_14;
const getMemoizedParticipant = function getMemoizedParticipant(item, a1) {
const r10 = `${item.type}-${item.id}`;
let r12 = a1.get(r10);
if (r12 == null) {
a1.set(r10, item);
r12 = item;
}
return r12;
};
c11393_14 = [];
export default function useVoicePanelCards(a0, a1) {
let stateFromStores, desyncedChannelParticipants;
const id = AuthenticationStore.getId();
const channel = ChannelStore.getChannel(a0);
let r13 = channel == null ? void 0 : channel.isDM();
if (r13 == null) {
r13 = false;
}
let c22594_3 = r13;
const isConnectedToVoiceChannel = useIsConnectedToVoiceChannel(a0);
let c22594_4 = isConnectedToVoiceChannel;
const [state] = useState(() => new Map());
useEffect(() => () => state.clear(), [state]);
stateFromStores = useStateFromStores([RTCConnectionStore], () => RTCConnectionStore.getState() === RTCConnectionStates.RTC_CONNECTED);
desyncedChannelParticipants = useDesyncedChannelParticipants(a0);
return {
items: useStateFromStoresArray([ChannelRTCStore, SortedVoiceStateStore], () => {
let r6 = void 0;
if (!c22594_4) {
let r33 = SortedVoiceStateStore.getVoiceStatesForChannelAlt(a0, a1).map((item) => {
const r2 = {
type: VoicePanelCardItemType.PARTICIPANT,
id: item.user.id
};
const r17 = `${r2.type}-${r2.id}`;
let r19 = state.get(r17);
if (r19 == null) {
state.set(r17, r2);
r19 = r2;
}
return r19;
});
if (!(r33.length > 0)) {
r33 = c11393_14;
}
return r33;
}
let r38 = ChannelRTCStore.getVoiceParticipantsHidden(a0);
const r39 = [];
for (const item of ChannelRTCStore.getFilteredParticipants(a0)) {
r39.push(item);
}
if (!r38 && desyncedChannelParticipants != null) {
for (const desyncedChannelParticipant of desyncedChannelParticipants) {
r39.push(desyncedChannelParticipant);
}
}
let r61 = [];
for (const item2 of r39) {
const memoizedParticipant = getMemoizedParticipant({
type: VoicePanelCardItemType.PARTICIPANT,
id: item2.id
}, state);
if (c22594_3 && memoizedParticipant.id === id) {
r6 = memoizedParticipant;
continue;
}
r61.push(memoizedParticipant);
}
if (r6 != null) {
r61.push(r6);
}
if (c22594_3 && stateFromStores && r61.length === 1) {
r61.push(getMemoizedParticipant({
type: VoicePanelCardItemType.CTA,
id: VoicePanelCTACard.CALLER_DISCONNECTED
}, state));
}
if (r38) {
r38 = r39.length === 0;
}
if (r38) {
r61.push(getMemoizedParticipant({
type: VoicePanelCardItemType.CTA,
id: VoicePanelCTACard.NO_VIDEO_PARTICIPANTS
}, state));
}
if (!(r61.length > 0)) {
r61 = c11393_14;
}
return r61;
}, [isConnectedToVoiceChannel, desyncedChannelParticipants, a0, a1, state, r13, id, stateFromStores]),
isConnected: isConnectedToVoiceChannel
};
};
export function useChunkedParticipants(a0, a1) {
const id2 = AuthenticationStore.getId();
const layoutManager = useContext(VoicePanelStateContext).layoutManager;
const managerSubscription = useManagerSubscription(layoutManager);
const [state2] = useState(() => new Map());
useEffect(() => () => state2.clear(), [state2]);
return useStateFromStoresArray([VoiceStateStore, ChannelRTCStore], () => {
if (managerSubscription < 0) {
return c11393_14;
}
const isInChannel = VoiceStateStore.isInChannel(a0, id2);
let r25 = [];
if (!isInChannel) {
return r25;
}
for (const item of new Set((() => {
const r2 = [];
let start = a1.start;
if (start <= a1.end) {
do {
r2.push.apply(r2, [...Array.from(layoutManager.getChunk(start))]);
start = start + 1;
} while (start <= a1.end);
}
return r2;
})())) {
r25.push(getMemoizedParticipant(item, state2));
}
if (ChannelRTCStore.getVoiceParticipantsHidden(a0) && r25.length === 0) {
r25.push(getMemoizedParticipant({
type: VoicePanelCardItemType.CTA,
id: VoicePanelCTACard.NO_VIDEO_PARTICIPANTS
}, state2));
}
if (!(r25.length > 0)) {
r25 = c11393_14;
}
return r25;
}, [a0, state2, layoutManager, a1, managerSubscription, id2]);
}