// Metro module 10570 (f10571). import _slicedToArray from "../../../../_bundle/_slicedToArray"; import { memo, useCallback } from "react"; import { View } from "react-native"; import VoiceChannelEffectsStore, { clearVoiceChannelEffectForUser } from "../../../voice_channel_effects/VoiceChannelEffectsStore"; import AuthenticationStore from "../../../../stores/AuthenticationStore"; import ChannelStore from "../../../../stores/ChannelStore"; import MediaEngineStore from "../../../../stores/MediaEngineStore"; import { VideoToggleState } from "../../../../Constants"; import { ParticipantTypes } from "../../../calls/CallConstants"; import { MediaEngineContextTypes } from "../../../../_bundle/Module4250"; import { createStyles } from "../../../../design/components/Styles/native/createStyles"; import Module712 from "../../../../_bundle/Module712"; import { hexWithOpacity } from "../../../../utils/ColorUtils"; import { useStateFromStores, useStateFromStoresArray } from "../../../../_bundle/Module589"; import VideoBackground from "../../../calls/native/VideoBackground"; import { Icon } from "../../../../design/void/native"; import Module8346 from "../../../../_bundle/Module8346"; import { Text } from "../../../../design/components/Text/native/Text"; import { intl, t } from "../../../../intl/index.native"; import VideoRenderer, { ResizeMode } from "./VideoRenderer"; import { VideoSpinnerContext } from "../../../../lib/VideoSpinnerTimer"; import Module7671 from "../../../../_bundle/Module7671"; import Module10596 from "../../../../_bundle/Module10596"; import Module10597 from "../../../../_bundle/Module10597"; import Module10598 from "../../../../_bundle/Module10598"; import useIsSpeaking from "../../../../hooks/useIsSpeaking"; import participantHasVideo from "../../participantHasVideo"; import mediaEngineContextFromParticipantType from "../../../calls/mediaEngineContextFromParticipantType"; import { useVoiceChatNavigationContext } from "../../../voice_chat/native/VoiceChatModalContext"; import useParticipantTileTapGesture from "../useParticipantTileTapGesture"; import { Gesture, GestureDetector } from "../../../../_bundle/Module5273"; import AnimatedEffectEmoji from "../../../voice_channel_effects/native/AnimatedEffectEmoji"; let Component2; const useStyles = createStyles({ container: { flex: 1, width: "100%", alignItems: "center", justifyContent: "center", overflow: "hidden", backgroundColor: Module712.colors.BLACK }, imageBackground: { flex: 1, justifyContent: "center", alignItems: "center", alignSelf: "stretch" }, autoDisabledVideoWrapper: { width: "100%", flexDirection: "row", justifyContent: "center" }, autoDisabledVideo: { backgroundColor: hexWithOpacity(Module712.unsafe_rawColors.PRIMARY_700, 0.5), alignItems: "center", height: 24 }, autoDisabledVideoTextWrapper: { borderRadius: Module712.radii.sm, flexDirection: "row", justifyContent: "space-evenly", paddingHorizontal: 8, paddingVertical: 4, alignItems: "center" }, statusWrapper: { position: "absolute", bottom: 8, right: 8, backgroundColor: hexWithOpacity(Module712.unsafe_rawColors.PRIMARY_700, 0.5), borderRadius: Module712.radii.md, width: 24, height: 24, justifyContent: "center", alignItems: "center" }, labelText: { marginLeft: 8, height: 20, alignItems: "center" } }); let Component = memo(function({ streamId, user: user2, resizeMode, ringing, avatarSize, speaking, gestureEnabled, hasVideo, guildId }) { let c18134_3, c18134_4; c18134_3 = void 0; c18134_4 = void 0; const styles = useStyles(); const id = user2.id; const stateFromStores = useStateFromStores([AuthenticationStore], () => { let r1 = hasVideo; if (hasVideo) { r1 = id === AuthenticationStore.getId(); } return r1; }, [hasVideo, id]); c18134_3 = _slicedToArray(useStateFromStoresArray([MediaEngineStore], () => [MediaEngineStore.isLocalVideoAutoDisabled(id)], [id]), 1)[0]; const r2 = useStateFromStores([MediaEngineStore], () => id != null ? MediaEngineStore.getVideoToggleState(id, MediaEngineContextTypes.DEFAULT) : VideoToggleState.NONE, [id]) === VideoToggleState.AUTO_PROBING; c18134_4 = r2; return !ringing && (hasVideo && !r2) ? : {intl.string(t.m2Hyj0)} : c18134_4 ? {intl.string(t.m2Hyj0)} : null; }} />; }); Component2 = memo(function({ muted, deafened, userId, style }) { let r39; const styles2 = useStyles(); let [r30, r31, r32] = useStateFromStoresArray([MediaEngineStore], () => [MediaEngineStore.isLocalMute(userId), MediaEngineStore.isLocalVideoDisabled(userId), MediaEngineStore.isLocalVideoAutoDisabled(userId)], [userId]); const source = r30 ? Module7671 : deafened ? Module10596 : muted ? Module10597 : void 0; if (r31) { r31 = !r32; } L17: { if (!r31) { r39 = null; if (source == null) { break L17; } } r39 = <> {[r31 ? : null, source != null ? : null]} ; } return r39; }); export default function UserTile(props) { let user, id2; const { participant, onSingleTap, onDoubleTap, onLongPress, avatarSize, resizeMode = ResizeMode.COVER, statusStyle, gestureEnabled, hasNotch, style } = props; user = void 0; id2 = void 0; const styles2 = useStyles(); const callback2 = useCallback(() => onSingleTap == null ? void 0 : onSingleTap(participant), [onSingleTap, participant]); const callback = useCallback(() => onDoubleTap == null ? void 0 : onDoubleTap(participant), [onDoubleTap, participant]); const callback3 = useCallback(() => onLongPress == null ? void 0 : onLongPress(participant), [participant, onLongPress]); const { streamId, ringing } = participant; user = participant.user; const voiceState = participant.voiceState; const isSpeaking = useIsSpeaking({ userId: participant.id }); let guildId = ChannelStore.getChannel(voiceState?.channelId)?.guild_id; if (guildId == null) { guildId = void 0; } let hasVideo2 = participantHasVideo(participant); let muted = voiceState == null ? void 0 : voiceState.isVoiceMuted(); if (muted == null) { muted = false; } let deafened = voiceState == null ? void 0 : voiceState.isVoiceDeafened(); if (deafened == null) { deafened = false; } const stateFromStores = useStateFromStores([MediaEngineStore], () => user.id != null && MediaEngineStore.isLocalVideoDisabled(user.id, mediaEngineContextFromParticipantType(participant.type)), [user.id, participant.type]); const swipeDismissRef = useVoiceChatNavigationContext()?.swipeDismissRef; id2 = participant.user?.id; const stateFromStores2 = useStateFromStores([VoiceChannelEffectsStore], () => id2 != null ? VoiceChannelEffectsStore.getEffectForUserId(id2) : null); if (participant.type !== ParticipantTypes.USER) { participant.type; } const participantTileTapGesture = useParticipantTileTapGesture({ onDoubleTapStart: callback, onSingleTapStart: callback2 }); const r106 = Gesture.LongPress().onStart(callback3).minDuration(800); const props2 = { gesture: Gesture.Simultaneous(swipeDismissRef != null ? r106.requireExternalGestureToFail(swipeDismissRef) : r106, participantTileTapGesture), children: null }; if (hasVideo2) { hasVideo2 = !stateFromStores; } props2.children = {id2 != null ? stateFromStores2 != null ? clearVoiceChannelEffectForUser(id2)} userId={id2} hasNotch={hasNotch} /> : null : null} ; return ; };