// Metro module 11873 (f11874). import { isValidElement, memo } from "react"; import { View } from "react-native"; import GatewayConnectionStore from "../../../gateway/GatewayConnectionStore"; import { THREAD_CHANNEL_TYPES } from "../../../../records/ChannelRecord"; import ChannelStore from "../../../../stores/ChannelStore"; import GuildStore from "../../../../stores/GuildStore"; import PresenceStore from "../../../../stores/PresenceStore"; import RelationshipStore from "../../../../stores/RelationshipStore"; import UserStore from "../../../../stores/UserStore"; import { ChannelTypes, Fonts } from "../../../../Constants"; import { StaticChannelRoute } from "../../../channel/ChannelConstants"; import { ContentDismissActionType, DismissibleContentGroupName } from "../../../dismissible_content/DismissibleContentConstants"; import { createStyles } from "../../../../design/components/Styles/native/createStyles"; import TextStyles from "../../../rebrand/native/TextStyles"; import Module712 from "../../../../_bundle/Module712"; import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/Module589"; import { intl, t } from "../../../../intl/index.native"; import { getThreadChannelIcon, getChannelIconWithGuild, getChannelIcon } from "../../../../utils/native/ChannelUtils"; import { computeChannelName } from "../../../channel/useChannelName"; import ActivityStatus from "../../../activity_status/native/ActivityStatus"; import { useSelectedSpecialNavigationPath, SpecialNavigationPath } from "../NavigationPathUtils"; import useIsViewingPremiumMemberships from "../../../guild_role_subscriptions/useIsViewingPremiumMemberships"; import { Icon, LegacyText, Status, StatusSizes } from "../../../../design/void/native"; import Module10140 from "../../../../_bundle/Module10140"; import Module11876 from "../../../../_bundle/Module11876"; import FastImage from "../../../../components_native/common/FastImage"; import Module10138 from "../../../../_bundle/Module10138"; import { shouldNSFWGateGuild } from "../../../age_gate/native/AgeGateUtils"; import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables"; import { Text } from "../../../../design/components/Text/native/Text"; import UserUtils from "../../../../utils/UserUtils"; import isStreaming from "../../../activities/utils/isStreaming"; import TouchableHitBox from "../../../../design/void/TouchableHitBox/native/TouchableHitBox"; import { UNSAFE_markDismissibleContentAsDismissed } from "../../../dismissible_content/DismissibleContentUnsafeUtils"; import { DismissibleContent } from "../../../../_bundle/Module1358"; import SelectedDismissibleContent from "../../../dismissible_content/native/SelectedDismissibleContent"; import ActivitiesPrivateChannelCallTooltip from "../../../activities/native/ActivitiesPrivateChannelCallTooltip"; let useStyles, ChannelTitleWrapper, ParentChannelSubTitle, DMChannelName, ConnectedStatus; const ChannelTitleContent = function ChannelTitleContent(props) { const { title, icon, titleSuffix, subTitle, accessibleTitle } = props; const styles = useStyles(); return {icon != null ? isValidElement(icon) ? icon : : null} {isValidElement(title) ? title : {title} } {titleSuffix} {subTitle} ; }; ParentChannelSubTitle = function ParentChannelSubTitle(props) { const parentChannel = props.parentChannel; return {computeChannelName(parentChannel, UserStore, RelationshipStore, true)} ; }; DMChannelName = function DMChannelName(props) { const { userId, style } = props; const stateFromStores2 = useStateFromStores([UserStore, RelationshipStore], () => { let r7 = RelationshipStore.getNickname(userId); const user = UserStore.getUser(userId); if (r7 == null) { r7 = UserUtils.getName(user); } if (r7 == null) { r7 = ""; } return r7; }, [userId]); return {stateFromStores2}; }; ConnectedStatus = function ConnectedStatus(props) { const { style, userId: userId2 } = props; const stateFromStoresObject = useStateFromStoresObject([PresenceStore], () => ({ status: PresenceStore.getStatus(userId2), isMobileOnline: PresenceStore.isMobileOnline(userId2), isVROnline: PresenceStore.isVROnline(userId2), streaming: isStreaming(PresenceStore.getActivities(userId2)) })); return ; }; useStyles = createStyles({ navbarTitleContainer: { height: "100%", flex: 1, flexDirection: "row", alignItems: "center" }, navbarTitlePrimaryText: { ...TextStyles(Fonts.DISPLAY_SEMIBOLD, Module712.colors.MOBILE_TEXT_HEADING_PRIMARY, 18), flexShrink: 1 }, navbarTitleSecondaryText: { fontSize: 12, lineHeight: 16, color: Module712.colors.TEXT_MUTED, marginTop: -4 }, channelIcon: { height: 18, width: 18, marginRight: 8 }, channelIconColor: { color: Module712.colors.CHANNEL_ICON }, homeIcon: { height: 20, width: 20, tintColor: Module712.colors.TEXT_MUTED, marginTop: 0, marginRight: 8 }, premiumIcon: { marginRight: 4 }, status: { marginLeft: 1, marginTop: 4 }, channelTextContainer: { flex: 1, flexGrow: 1 }, channelNameContainer: { flexGrow: 1 }, channelName: { textAlign: "left" }, flexRow: { flexDirection: "row", alignItems: "center" } }); const r96 = memo(function({ onPressTitle, channelId, guildId, threadDraft, style }) { let stateFromStores; stateFromStores = void 0; const styles = useStyles(); const stateFromStores3 = useStateFromStores([GatewayConnectionStore], () => GatewayConnectionStore.isConnected()); stateFromStores = useStateFromStores([ChannelStore], () => channelId !== StaticChannelRoute.GUILD_HOME ? channelId !== StaticChannelRoute.MEMBER_SAFETY ? ChannelStore.getChannel(channelId) : null : null); const stateFromStores4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(stateFromStores == null ? void 0 : stateFromStores.getGuildId())); const stateFromStores2 = useStateFromStores([ChannelStore], () => threadDraft != null && threadDraft.parentChannelId != null ? ChannelStore.getChannel(threadDraft.parentChannelId) : stateFromStores != null ? stateFromStores.parent_id != null ? THREAD_CHANNEL_TYPES.has(stateFromStores.type) ? ChannelStore.getChannel(stateFromStores.parent_id) : null : null : null, [stateFromStores, threadDraft]); const selectedSpecialNavigationPath = useSelectedSpecialNavigationPath(); const isViewingPremiumMemberships = useIsViewingPremiumMemberships(); const title2 = stateFromStores3 ? intl.string(t.ai6Lbr) : intl.string(t.ZTNur7); if (selectedSpecialNavigationPath === SpecialNavigationPath.FRIENDS) { return ; } if (channelId === StaticChannelRoute.GUILD_HOME) { const icon3 = ; return ; } if (channelId === StaticChannelRoute.MEMBER_SAFETY) { const icon2 = ; return ; } if (isViewingPremiumMemberships) { const icon = ; return ; } if (threadDraft != null && !(stateFromStores == null ? void 0 : stateFromStores.isForumLikeChannel())) { const title = threadDraft.name != null && threadDraft.name.length > 0 ? threadDraft.name : intl.string(t["4WNcpu"]); const threadChannelIcon = getThreadChannelIcon(threadDraft.isPrivate ? ChannelTypes.PRIVATE_THREAD : ChannelTypes.PUBLIC_THREAD); return } /> ; } if (shouldNSFWGateGuild(guildId)) { return ; } if (stateFromStores == null) { return ; } const title3 = computeChannelName(stateFromStores, UserStore, RelationshipStore); const channelIconWithGuild = getChannelIconWithGuild(stateFromStores, stateFromStores4); if (stateFromStores.isDM()) { const recipientId = stateFromStores.getRecipientId(); return } icon={channelIconWithGuild} titleSuffix={stateFromStores.isSystemDM() ? null : } subTitle={} /> ; } if (stateFromStores.isThread()) { return } /> ; } return ; }); ChannelTitleWrapper = (props) => { const { children: children2, onPressTitle, style } = props; const styles = useStyles(); return onPressTitle == null ? {children2} : null}>{children2}; }; export function ChannelTitleWithoutRoute(props) { const { onPressTitle, channelId: channelId2 } = props; const styles = useStyles(); const stateFromStores2 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId2)); const r11 = useStateFromStores([GatewayConnectionStore], () => GatewayConnectionStore.isConnected()) ? intl.string(t.ai6Lbr) : intl.string(t.ZTNur7); const icon = stateFromStores2 != null ? getChannelIcon(stateFromStores2) : null; let title = stateFromStores2 != null ? computeChannelName(stateFromStores2, UserStore, RelationshipStore) : null; if (stateFromStores2 == null ? void 0 : stateFromStores2.isDM()) { const recipientId = stateFromStores2.getRecipientId(); return } icon={icon} titleSuffix={stateFromStores2.isSystemDM() ? null : } subTitle={} /> ; } if (title == null) { title = r11; } return ; } export { r96 as ChannelTitle }; export function ChannelButtons(props) { const buttons = props.buttons; return {buttons == null ? void 0 : buttons.map((button, index) => { let onPress2 = button.onPress; const onPress = onPress2; const { onLongPress, source, color, style, accessibilityLabel, children: children2, disabled, hasActivitiesPrivateChannelTooltip } = button; if (hasActivitiesPrivateChannelTooltip) { onPress2 = (a0) => { if (onPress != null) { onPress(a0); } UNSAFE_markDismissibleContentAsDismissed(DismissibleContent.ACTIVITY_GDM_CALL_TOOLTIP, { dismissAction: ContentDismissActionType.AUTO }); }; } return {children2} {hasActivitiesPrivateChannelTooltip ? {({ visibleContent, markAsDismissed }) => visibleContent === DismissibleContent.ACTIVITY_GDM_CALL_TOOLTIP ? markAsDismissed(ContentDismissActionType.UNKNOWN)} /> : null} : null} ; })} ; }