88 lines
4.0 KiB
TypeScript
88 lines
4.0 KiB
TypeScript
// Metro module 10692 (f10693).
|
|
import { View } from "react-native";
|
|
import ChannelStore from "../../../../stores/ChannelStore";
|
|
import GuildStore from "../../../../stores/GuildStore";
|
|
import RTCConnectionStore from "../../../../stores/RTCConnectionStore";
|
|
import SessionsStore from "../../../../stores/SessionsStore";
|
|
import { RTC_PANEL_HEIGHT } from "../ConnectivityConstants";
|
|
import { RTCConnectionStates } from "../../../../Constants";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../../_bundle/Module712";
|
|
import useVoiceStateForRemoteSession from "../../../game_console/hooks/useVoiceStateForRemoteSession";
|
|
import { useStateFromStoresObject } from "../../../../_bundle/Module589";
|
|
import useCanSpeakInChannel from "../../../stage_channels/useCanSpeakInChannel";
|
|
import useIsInvitedToSpeak from "../../../stage_channels/useIsInvitedToSpeak";
|
|
import * as _shared from "../../../../design/shared";
|
|
import useTheme from "../../../../hooks/useTheme";
|
|
import { useIsScreenLandscape } from "../../../screen/useIsScreenLandscape.native";
|
|
import { isModalOpen } from "../../../main_tabs_v2/helpers/NavigationRouteUtils.native";
|
|
import ChannelCallModal from "../../../video_calls/native/components/ChannelCallModal";
|
|
import { isAndroid } from "../../../../utils/PlatformUtils";
|
|
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
|
|
import StatusBar_android from "../../../status_bar/native/components/StatusBar.android";
|
|
import GlobalStageChannelStatus from "../../../stage_channels/native/components/GlobalStageChannelStatus";
|
|
const useStyles = createStyles({
|
|
bgNeutral: {
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
|
|
},
|
|
bg: {
|
|
backgroundColor: Module712.unsafe_rawColors.GREEN_360
|
|
},
|
|
container: {
|
|
paddingHorizontal: 16,
|
|
minHeight: RTC_PANEL_HEIGHT,
|
|
alignItems: "center",
|
|
justifyContent: "center"
|
|
}
|
|
});
|
|
export default function ConnectivityGlobalStatusContent() {
|
|
const styles = useStyles();
|
|
const voiceStateForRemoteSession = useVoiceStateForRemoteSession();
|
|
let c18199_0 = voiceStateForRemoteSession;
|
|
const stateFromStoresObject = useStateFromStoresObject([RTCConnectionStore, GuildStore, ChannelStore, SessionsStore], () => {
|
|
let r10 = c18199_0?.channelId;
|
|
if (r10 == null) {
|
|
r10 = RTCConnectionStore.getChannelId();
|
|
}
|
|
const channel = ChannelStore.getChannel(r10);
|
|
const guild = GuildStore.getGuild(c18199_0 != null ? channel == null ? void 0 : channel.getGuildId() : RTCConnectionStore.getGuildId());
|
|
let r24 = c18199_0?.sessionId;
|
|
if (r24 == null) {
|
|
r24 = "";
|
|
}
|
|
const sessionById = SessionsStore.getSessionById(r24);
|
|
const remotePlatform = sessionById == null ? void 0 : sessionById.clientInfo.os;
|
|
return {
|
|
guild,
|
|
channel,
|
|
rtcConnectionState: c18199_0 != null ? RTCConnectionStates.RTC_CONNECTED : RTCConnectionStore.getState(),
|
|
remotePlatform
|
|
};
|
|
}, [voiceStateForRemoteSession]);
|
|
const { guild, channel, rtcConnectionState, remotePlatform } = stateFromStoresObject;
|
|
const r15 = channel == null ? void 0 : channel.isGuildStageVoice();
|
|
let r37 = useCanSpeakInChannel(channel?.id);
|
|
const isInvitedToSpeak = useIsInvitedToSpeak();
|
|
const hasRTCConnectivity = channel != null;
|
|
const isThemeDark = _shared.isThemeDark(useTheme());
|
|
let r47 = hasRTCConnectivity;
|
|
if (r15) {
|
|
if (!r37) {
|
|
r37 = isInvitedToSpeak;
|
|
}
|
|
r47 = r37;
|
|
}
|
|
let r51 = useIsScreenLandscape() && isModalOpen(ChannelCallModal) && isAndroid();
|
|
const top = useSafeAreaInsets_native().top;
|
|
const style = [r47 ? styles.bg : styles.bgNeutral, styles.container, {
|
|
paddingTop: r51 ? 0 : top
|
|
}];
|
|
if (r51) {
|
|
r51 = <StatusBar_android hidden />;
|
|
}
|
|
return <View style={style}>
|
|
{r51}
|
|
{r15 ? <GlobalStageChannelStatus channel={channel} guild={guild} hasRTCConnectivity={hasRTCConnectivity} isDarkTheme={isThemeDark} rtcConnectionState={rtcConnectionState} remotePlatform={remotePlatform} /> : null}
|
|
</View>;
|
|
};
|