// Metro module 10740 (f10741). import { useRef, useMemo, useCallback } from "react"; import { View } from "react-native"; import EmbeddedActivitiesStore from "../../../activities/EmbeddedActivitiesStore"; import ChannelRTCStore from "../../../calls/ChannelRTCStore"; import GameConsoleStore from "../../../game_console/GameConsoleStore"; import ApplicationStreamingStore from "../../../../stores/ApplicationStreamingStore"; import AuthenticationStore from "../../../../stores/AuthenticationStore"; import MediaEngineStore from "../../../../stores/MediaEngineStore"; import ChannelCallLifecycleStore from "../ChannelCallLifecycleStore"; import { ParticipantTypes } from "../../../calls/CallConstants"; import { createStyles } from "../../../../design/components/Styles/native/createStyles"; import { CALL_ACTION_BAR_HEIGHT, FIVE_BUTTON_LAYOUT_ACTION_BAR_HEIGHT, FIVE_BUTTON_CONTAINER_PADDING_TOP, FIVE_BUTTON_CONTAINER_PADDING_BOTTOM } from "../useActionBarHeight"; import useHasVideoPermission from "../../useHasVideoPermission"; import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/Module589"; import useChannelVideoLimit from "../../useChannelVideoLimit"; import { useStageHasMedia } from "../../../stage_channels/StageMediaHooks"; import { CameraLottie } from "../../../../design/components/LottieIcon/native/generated/CameraLottie"; import { handleToggleVideo, showCameraDisabledAlert, useMaskedSpeakerStates, handleDisconnect } from "../../../voice_calls/native/CallsUtils"; import { openIgnoreThermalStateAlert } from "../../../activities/native/openIgnoreThermalStateAlert"; import { ToggledActionButton, PrimaryActionButton } from "./CallBarAction"; import { intl, t } from "../../../../intl/index.native"; import Module10744 from "../../../../_bundle/Module10744"; import useScreenshareUtils from "../useScreenshareUtils"; import { useIsConnectedToVoiceChannel } from "../../../voice_chat/VoiceChatHooks"; import Module10761 from "../../../../_bundle/Module10761"; import Module10762 from "../../../../_bundle/Module10762"; import ChannelRTCActionCreators from "../../../../actions/ChannelRTCActionCreators"; import { stopStream } from "../../../../actions/StreamActionCreators"; import { encodeStreamKey } from "../../../go_live/utils/StreamKeyUtils"; import EmbeddedActivitiesNativeManager from "../../../activities/native/EmbeddedActivitiesNativeManager"; import Module10763 from "../../../../_bundle/Module10763"; import useIsRemote from "../../../game_console/hooks/useIsRemote"; import useIsVideoMode from "../useIsVideoMode"; import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../app_analytics/useAnalyticsLocations"; import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation"; import { useIsFiveButtonLayout } from "../useIsFiveButtonLayout"; import { CallConnectingActionBar } from "./ChannelCallConnectingScreen"; import { ChannelCallMicButton } from "./ChannelCallMicButton"; import { DisconnectRemoteButton } from "./DisconnectRemoteButton"; let useStyles, ScreenshareButton, AudioRouteButton, DisconnectCallButton, DisconnectStreamButton, LeaveActivityButton, c7219_24, useActionBarSecondButton, c7219_26, useActionBarPrimaryButtons; const VideoButton = function VideoButton(props) { let stateFromStores2, ref, callback; const { channel, isSmallSize } = props; stateFromStores2 = void 0; ref = void 0; callback = void 0; const hasVideoPermission = useHasVideoPermission(channel); let c18239_1 = hasVideoPermission; const stateFromStores = useStateFromStores([ChannelCallLifecycleStore], () => ChannelCallLifecycleStore.isReactingToThermalState()); stateFromStores2 = useStateFromStores([MediaEngineStore], () => MediaEngineStore.isVideoEnabled()); const reachedLimit = useChannelVideoLimit(channel).reachedLimit; const stageHasMedia = useStageHasMedia(channel.id); ref = useRef(null); const memo = useMemo(() => , [stateFromStores2]); callback = useCallback((a0) => { handleToggleVideo(a0); if (ref != null) { const current = ref.current; if (current != null) { current.play(); } } }, []); return { if (c18239_1) { if (stateFromStores) { openIgnoreThermalStateAlert(() => callback(channel)); } else { callback(channel); } } else { showCameraDisabledAlert(); } }, [channel, hasVideoPermission, stateFromStores, callback])} accessibilityLabel={intl.string(t.HK4JIu)} source={Module10744} isSmallSize={isSmallSize} lottieComponent={memo} />; }; ScreenshareButton = function ScreenshareButton(props) { const { channel: channel6, isSmallSize } = props; const screenshareUtils = useScreenshareUtils(channel6); const isActive = screenshareUtils.isActive; let onPress2 = screenshareUtils.onPress; const { imgSource, isFeatureEnabled } = screenshareUtils; if (!isFeatureEnabled) { onPress2 = () => {}; } return ; }; AudioRouteButton = function AudioRouteButton(props) { const { channel: channel2, isSmallSize } = props; const maskedSpeakerStates = useMaskedSpeakerStates(); const { isAudioRouteEnabled, toggleAudio, routeSource } = maskedSpeakerStates; const isConnectedToVoiceChannel = useIsConnectedToVoiceChannel(channel2); return { toggleAudio(channel2.id, isConnectedToVoiceChannel); }} accessibilityLabel={intl.string(t["A/Ly/2"])} isSmallSize={isSmallSize} />; }; DisconnectCallButton = function DisconnectCallButton(props) { const { channel: channel3, isSmallSize } = props; return { handleDisconnect(channel3); }} />; }; DisconnectStreamButton = function DisconnectStreamButton(props) { let stateFromStores4; const { channel: channel4, isSmallSize } = props; stateFromStores4 = void 0; const stateFromStores3 = useStateFromStores([ChannelRTCStore, AuthenticationStore], () => { const selectedParticipant = ChannelRTCStore.getSelectedParticipant(channel4.id); return selectedParticipant != null && selectedParticipant.type !== ParticipantTypes.ACTIVITY ? selectedParticipant.user.id !== AuthenticationStore.getId() ? selectedParticipant?.id : null : selectedParticipant?.id; }); stateFromStores4 = useStateFromStores([ApplicationStreamingStore], () => stateFromStores3 != null ? ApplicationStreamingStore.getActiveStreamForStreamKey(stateFromStores3) : null); return stateFromStores4 != null ? { ChannelRTCActionCreators.selectParticipant(channel4.id, null); stopStream(encodeStreamKey(stateFromStores4)); }} /> : null; }; LeaveActivityButton = function LeaveActivityButton(props) { const isSmallSize = props.isSmallSize; return ; }; useActionBarSecondButton = function useActionBarSecondButton({ channel: channel6 }) { let SCREEN_SHARE_END; let r7 = useIsConnectedToVoiceChannel(channel6); const isActive = useScreenshareUtils(channel6).isActive; const isRemote = useIsRemote(); const AUDIO_ROUTE = c7219_24.AUDIO_ROUTE; const r8 = r7 ? !isRemote : r7; const r22 = {}; r22[AUDIO_ROUTE] = r8; r22[c7219_24.NONE] = true; r22[c7219_24.SCREEN_SHARE_END] = (r7 ? !isRemote : r7) && isActive; const SCREEN_SHARE_START = c7219_24.SCREEN_SHARE_START; if (r7) { r7 = !isRemote; } L20: { r22[SCREEN_SHARE_START] = r7; const isVideoMode = useIsVideoMode(); if (r22[c7219_24.SCREEN_SHARE_END]) { SCREEN_SHARE_END = c7219_24.SCREEN_SHARE_END; } else { if (!(r22[c7219_24.AUDIO_ROUTE] && channel6.isPrivate()) && !(r22[c7219_24.AUDIO_ROUTE] && !isVideoMode)) { if (r22[c7219_24.SCREEN_SHARE_START]) { SCREEN_SHARE_END = c7219_24.SCREEN_SHARE_START; break L20; } SCREEN_SHARE_END = c7219_24.NONE; break L20; } SCREEN_SHARE_END = c7219_24.AUDIO_ROUTE; } } return SCREEN_SHARE_END; }; useActionBarPrimaryButtons = function useActionBarPrimaryButtons({ channel: channel5 }) { const isConnectedToVoiceChannel2 = useIsConnectedToVoiceChannel(channel5); const stateFromStores5 = useStateFromStores([ChannelRTCStore, AuthenticationStore], () => { const selectedParticipant = ChannelRTCStore.getSelectedParticipant(channel5.id); return selectedParticipant != null && selectedParticipant.type !== ParticipantTypes.ACTIVITY ? selectedParticipant.user.id !== AuthenticationStore.getId() ? selectedParticipant?.id : null : selectedParticipant?.id; }); const stateFromStores6 = useStateFromStores([ApplicationStreamingStore], () => stateFromStores5 != null ? ApplicationStreamingStore.getActiveStreamForStreamKey(stateFromStores5) : null); const stateFromStores7 = useStateFromStores([EmbeddedActivitiesStore], () => EmbeddedActivitiesStore.getCurrentEmbeddedActivity() != null); const stateFromStoresObject = useStateFromStoresObject([GameConsoleStore], () => ({ awaitingRemote: GameConsoleStore.getAwaitingRemoteSessionInfo() != null, remoteSessionId: GameConsoleStore.getRemoteSessionId() })); let awaitingRemote = stateFromStoresObject.awaitingRemote; const remoteSessionId = stateFromStoresObject.remoteSessionId; const r42 = {}; r42[c7219_26.END_ACTIVITY] = stateFromStores7; r42[c7219_26.END_CALL] = isConnectedToVoiceChannel2; const END_REMOTE = c7219_26.END_REMOTE; if (!awaitingRemote) { awaitingRemote = remoteSessionId != null; } r42[END_REMOTE] = awaitingRemote; r42[c7219_26.END_STREAM] = stateFromStores6 != null; return r42; }; useStyles = createStyles({ container: { height: CALL_ACTION_BAR_HEIGHT, justifyContent: "center", alignItems: "center", flexDirection: "row" }, containerForFiveButtonLayout: { height: FIVE_BUTTON_LAYOUT_ACTION_BAR_HEIGHT, paddingHorizontal: 16, paddingTop: FIVE_BUTTON_CONTAINER_PADDING_TOP, paddingBottom: FIVE_BUTTON_CONTAINER_PADDING_BOTTOM, justifyContent: "center", flexDirection: "row" } }); c7219_24 = { NONE: 0, 0: "NONE", SCREEN_SHARE_START: 1, 1: "SCREEN_SHARE_START", SCREEN_SHARE_END: 2, 2: "SCREEN_SHARE_END", AUDIO_ROUTE: 3, 3: "AUDIO_ROUTE" }; c7219_26 = { END_STREAM: 0, 0: "END_STREAM", END_ACTIVITY: 1, 1: "END_ACTIVITY", END_CALL: 2, 2: "END_CALL", END_REMOTE: 3, 3: "END_REMOTE" }; export default function ChannelCallActionBar(props) { let r54, r60, r85; const { channel: channel6, shouldShowConnectingScreen = false } = props; const styles = useStyles(); const isRemote = useIsRemote(); const actionBarSecondButton = useActionBarSecondButton({ channel: channel6 }); const actionBarPrimaryButtons = useActionBarPrimaryButtons({ channel: channel6 }); const r17 = actionBarPrimaryButtons[c7219_26.END_STREAM] ? c7219_26.END_STREAM : actionBarPrimaryButtons[c7219_26.END_REMOTE] ? c7219_26.END_REMOTE : actionBarPrimaryButtons[c7219_26.END_ACTIVITY] ? c7219_26.END_ACTIVITY : c7219_26.END_CALL; const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.CHANNEL_CALL_ACTION_BAR).analyticsLocations; const isFiveButtonLayout = useIsFiveButtonLayout(channel6.id); const style = isFiveButtonLayout ? styles.containerForFiveButtonLayout : styles.container; if (shouldShowConnectingScreen) { r85 = ; } else { const r18 = isRemote ? null : ; L23: { r54 = [r18, , , ,]; if (c7219_24.AUDIO_ROUTE === actionBarSecondButton) { r60 = ; } else { if (c7219_24.SCREEN_SHARE_START !== actionBarSecondButton && c7219_24.SCREEN_SHARE_END !== actionBarSecondButton) { c7219_24.NONE; r60 = null; break L23; } r60 = ; } } r54[1] = r60; r54[2] = ; r54[3] = c7219_26.END_REMOTE === r17 ? : c7219_26.END_STREAM === r17 ? : c7219_26.END_ACTIVITY === r17 ? : c7219_26.END_CALL === r17 ? : null; r85 = <>{r54}; } return {r85} ; }; export { VideoButton }; export { ScreenshareButton }; export { AudioRouteButton }; export { DisconnectCallButton }; export { DisconnectStreamButton }; export { c7219_24 as ActionBarSecondButton }; export function useActionBarSecondButtons({ channel: channel6 }) { let r11 = useIsConnectedToVoiceChannel(channel6); const isActive = useScreenshareUtils(channel6).isActive; const isRemote = useIsRemote(); const AUDIO_ROUTE = c7219_24.AUDIO_ROUTE; const r20 = r11 ? !isRemote : r11; const r21 = {}; r21[AUDIO_ROUTE] = r20; r21[c7219_24.NONE] = true; r21[c7219_24.SCREEN_SHARE_END] = (r11 ? !isRemote : r11) && isActive; const SCREEN_SHARE_START = c7219_24.SCREEN_SHARE_START; if (r11) { r11 = !isRemote; } r21[SCREEN_SHARE_START] = r11; return r21; } export { useActionBarSecondButton }; export { c7219_26 as ActionBarPrimaryButton }; export { useActionBarPrimaryButtons }; export function useActionBarPrimaryButton(a0) { const actionBarPrimaryButtons = useActionBarPrimaryButtons({ channel: a0.channel }); return actionBarPrimaryButtons[c7219_26.END_STREAM] ? c7219_26.END_STREAM : actionBarPrimaryButtons[c7219_26.END_REMOTE] ? c7219_26.END_REMOTE : actionBarPrimaryButtons[c7219_26.END_ACTIVITY] ? c7219_26.END_ACTIVITY : c7219_26.END_CALL; }