// Metro module 10035 (f10036). import { useState, useContext, useCallback } from "react"; import { View } from "react-native"; import ChannelRTCStore from "../../calls/ChannelRTCStore"; import ChannelStore from "../../../stores/ChannelStore"; import GuildStore from "../../../stores/GuildStore"; import { VoicePanelControlsModes } from "../../voice_panel/native/controls/VoicePanelControlsConstants"; import { createStyles } from "../../../design/components/Styles/native/createStyles"; import Module712 from "../../../_bundle/Module712"; import { useStateFromStores } from "../../../_bundle/Module589"; import useChannelName from "../../channel/useChannelName"; import VoicePanelStateContext from "../../voice_panel/native/VoicePanelStateContext"; import ChannelRTCActionCreators from "../../../actions/ChannelRTCActionCreators"; import GuildActionCreators from "../../../actions/GuildActionCreators"; import { getRootNavigationRef } from "../../main_tabs_v2/RootNavigationRef.native"; import { getChannelIconComponent } from "../../../utils/native/ChannelUtils"; import { Text } from "../../../design/components/Text/native/Text"; import { intl, t } from "../../../intl/index.native"; import { Stack } from "../../../design/components/Stack/native/Stack.native"; import MarkupUtils from "../../markup/MarkupUtils"; import { PressableHighlight } from "../../../design/void/Pressables/native/Pressables"; import GatedContent from "../../../components_native/warnings/GatedContent"; import { NsfwSpaceWarningModalType } from "../../age_assurance/AgeVerificationAnalyticsUtils"; const useStyles = createStyles({ subtitle: { textAlign: "center", lineHeight: 22 }, subtitleContainer: { alignItems: "center" }, divider: { height: 1, width: "100%", backgroundColor: Module712.colors.BORDER_SUBTLE, marginVertical: 16 }, subtitleMeasure: { position: "absolute", opacity: 0, left: 0, right: 0 } }); export default function ChannelSpoiler(props) { let isVocal, setControlsMode; let c17641_0 = props; const stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(c17641_0.guildId)); const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(c17641_0.channelId)); const styles = useStyles(); const [state, setState] = useState(false); const channelName = useChannelName(stateFromStores); isVocal = stateFromStores == null ? void 0 : stateFromStores.isVocal(); setControlsMode = useContext(VoicePanelStateContext).setControlsMode; const callback3 = useCallback(() => { if (isVocal) { if (ChannelRTCStore.getChatOpen(c17641_0.channelId)) { ChannelRTCActionCreators.updateChatOpen(c17641_0.channelId, false); setControlsMode({ mode: VoicePanelControlsModes.FLOATING_DEFAULT }); return void 0; } } GuildActionCreators.nsfwReturnToSafety(c17641_0.guildId); }, [props.guildId, props.channelId, setControlsMode, isVocal]); const callback2 = useCallback((a0) => { setState(a0.nativeEvent.lines.length > 3); }, []); const callback = useCallback(() => { const rootNavigationRef = getRootNavigationRef(); if (rootNavigationRef != null) { rootNavigationRef.navigate("sidebar", { channelId: c17641_0.channelId, expandTopic: true }); } }, [props.channelId]); const Component = stateFromStores != null ? getChannelIconComponent(stateFromStores) : null; return {channelName} : intl.string(t["q38/ae"])} subtitle={stateFromStores?.topic != null ? stateFromStores.topic.trim() !== "" ? {MarkupUtils.parseTopic(stateFromStores.topic, true, { channelId: stateFromStores.id })} {MarkupUtils.parseTopic(stateFromStores.topic, true, { channelId: stateFromStores.id })} {state ? {intl.string(t["/QvRak"])} : null} : null : null} description={intl.string(t["08bm2Z"])} agreement={intl.string(t.KmRwcW)} disagreement={intl.string(t["/g10LC"])} guildId={stateFromStores2?.id} channelId={props.channelId} />; };