707 lines
29 KiB
TypeScript
707 lines
29 KiB
TypeScript
// Metro module 9098 (f9099).
|
|
import { useEffect } from "react";
|
|
import { SafetyWarningTypes } from "../../self_mod/ChannelSafetyWarningsStore";
|
|
import ChannelSpoilerAgreeStore from "../../spoiler_channels/ChannelSpoilerAgreeStore";
|
|
import StageInstanceStore from "../../stage_channels/StageInstanceStore";
|
|
import ActiveThreadsStore from "../../threads/ActiveThreadsStore";
|
|
import { isGuildTextChannelType, isGuildVocalChannelType, isReadableType, isTextChannel } from "../../../records/ChannelRecord";
|
|
import CategoryCollapseStore from "../../../stores/CategoryCollapseStore";
|
|
import ChannelStore from "../../../stores/ChannelStore";
|
|
import CollapsedVoiceChannelStore from "../../../stores/CollapsedVoiceChannelStore";
|
|
import GuildStore from "../../../stores/GuildStore";
|
|
import PermissionStore from "../../../stores/PermissionStore";
|
|
import RelationshipStore from "../../../stores/RelationshipStore";
|
|
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
|
|
import UserGuildSettingsStore from "../../../stores/UserGuildSettingsStore";
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { AnalyticsObjectTypes, AnalyticsObjects, AnalyticsSections, ChannelSettingsSections, ChannelTypes, InstantInviteSources, NULL_STRING_GUILD_ID, Permissions, ZERO_STRING_GUILD_ID } from "../../../Constants";
|
|
import { ChannelDetailsNavigatorScreens } from "../../main_tabs_v2/native/sidebar/details/ChannelDetailsConstants";
|
|
import "../../../_bundle/asyncRequire";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { UserCircleIcon } from "../../../design/components/Icon/native/redesign/generated/UserCircleIcon";
|
|
import showUserProfileActionSheet from "../../user_profile/native/showUserProfileActionSheet";
|
|
import { UserMinusIcon } from "../../../design/components/Icon/native/redesign/generated/UserMinusIcon";
|
|
import ChannelActionCreators from "../../../actions/ChannelActionCreators";
|
|
import useChannelName, { computeChannelName } from "../useChannelName";
|
|
import AlertActionCreators from "../../../actions/AlertActionCreators";
|
|
import { PencilIcon } from "../../../design/components/Icon/native/redesign/generated/PencilIcon";
|
|
import showChatGDMCustomizeActionSheet from "../../group_dm/native/showChatGDMCustomizeActionSheet";
|
|
import { LinkIcon } from "../../../design/components/Icon/native/redesign/generated/LinkIcon";
|
|
import ModalActionCreators from "../../../actions/ModalActionCreators";
|
|
import FavoritesGuild_messages from "../../favorites/intl/FavoritesGuild.messages";
|
|
import { ServerIcon } from "../../../design/components/Icon/native/redesign/generated/ServerIcon";
|
|
import { transitionToGuild } from "../../routing/router_utils";
|
|
import { PlusLargeIcon } from "../../../design/components/Icon/native/redesign/generated/PlusLargeIcon";
|
|
import buildFavoritesSectionButtons from "../../favorites/native/buildFavoritesSectionButtons";
|
|
import { GroupPlusIcon } from "../../../design/components/Icon/native/redesign/generated/GroupPlusIcon";
|
|
import { showInstantInviteActionSheet } from "../../instant_invite/native/InstantInviteUtils";
|
|
import { PinIcon } from "../../../design/components/Icon/native/redesign/generated/PinIcon";
|
|
import { setIsFavorite, setOptInChannel, setMessagesFavorite } from "../../opt_in_channels/OptInChannelsActionCreators";
|
|
import { getRootNavigationRef } from "../../main_tabs_v2/RootNavigationRef.native";
|
|
import { XSmallIcon } from "../../../design/components/Icon/native/redesign/generated/XSmallIcon";
|
|
import { copyGuildChannelOrThreadLink } from "./ChannelActionSheetUtils";
|
|
import { WarningIcon } from "../../../design/components/Icon/native/redesign/generated/WarningIcon";
|
|
import { markAsInappropriateConversation } from "../../self_mod/inappropriate_conversation/InappropriateConversationsActionCreators";
|
|
import { InboxIcon } from "../../../design/components/Icon/native/redesign/generated/InboxIcon";
|
|
import { markAsMessageRequest, clearMessageRequestState } from "../../message_request/MessageRequestActionCreators";
|
|
import { EyeIcon } from "../../../design/components/Icon/native/redesign/generated/EyeIcon";
|
|
import { ackChannel } from "../../../actions/ReadStateActionCreators";
|
|
import { BellSlashIcon } from "../../../design/components/Icon/native/redesign/generated/BellSlashIcon";
|
|
import { BellIcon } from "../../../design/components/Icon/native/redesign/generated/BellIcon";
|
|
import NotificationSettingsModalActionCreators from "../../../actions/NotificationSettingsModalActionCreators";
|
|
import { NotificationLabel } from "../../../utils/NotificationSettingsUtils";
|
|
import { ChannelNotificationIcon } from "../../../design/components/Icon/native/redesign/generated/ChannelNotificationIcon";
|
|
import ChannelSettingsActionCreators from "../../../actions/ChannelSettingsActionCreators";
|
|
import { ThreadIcon } from "../../../design/components/Icon/native/redesign/generated/ThreadIcon";
|
|
import showThreadBrowserModal from "../../threads/native/showThreadBrowserModal";
|
|
import ChannelCollapseActionCreators from "../../../actions/ChannelCollapseActionCreators";
|
|
import { StageIcon } from "../../../design/components/Icon/native/redesign/generated/StageIcon";
|
|
import { ChatIcon } from "../../../design/components/Icon/native/redesign/generated/ChatIcon";
|
|
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
|
|
import hideLaunchPad from "../../launchpad/native/hideLaunchPad";
|
|
import ChannelRTCActionCreators from "../../../actions/ChannelRTCActionCreators";
|
|
import { FlagIcon } from "../../../design/components/Icon/native/redesign/generated/FlagIcon";
|
|
import { showReportModalForStageChannel } from "../../in_app_reports/ReportModals";
|
|
import { EyeSlashIcon } from "../../../design/components/Icon/native/redesign/generated/EyeSlashIcon";
|
|
import GuildActionCreators from "../../../actions/GuildActionCreators";
|
|
import { SettingsIcon } from "../../../design/components/Icon/native/redesign/generated/SettingsIcon";
|
|
import { CopyIcon } from "../../../design/components/Icon/native/redesign/generated/CopyIcon";
|
|
import CreateChannelModalActionCreators from "../../../actions/native/CreateChannelModalActionCreators";
|
|
import { IdIcon } from "../../../design/components/Icon/native/redesign/generated/IdIcon";
|
|
import { copy } from "../../../utils/ClipboardUtils.native";
|
|
import { presentIdCopied } from "../../toast/native/ToastUtils";
|
|
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../app_analytics/useAnalyticsLocations";
|
|
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
|
|
import { useIsFavoritesGuildSelected } from "../../favorites/FavoritesHooks";
|
|
import { useStateFromStores, useStateFromStoresObject } from "../../../_bundle/Module589";
|
|
import { MODERATE_STAGE_CHANNEL_PERMISSIONS } from "../../stage_channels/StageChannelPermissions";
|
|
import { useOptInEnabledForGuild } from "../../opt_in_channels/isOptInEnabled";
|
|
import useIsNsfwGated from "../../age_gate/useIsNsfwGated";
|
|
import { DeveloperMode } from "../../user_settings/UserSettings";
|
|
import GuildIcon, { GuildIconSizes } from "../../guild/native/GuildIcon";
|
|
import { Avatar, AvatarSizes } from "../../../design/void/native";
|
|
import { useInappropriateConversationsTiers } from "../../self_mod/inappropriate_conversation/hooks/useInappropriateConversationsTiers";
|
|
import useFavoritesGuildChannelActions from "../../favorites/native/action/useFavoritesGuildChannelActions";
|
|
import useFavoritesGuildCategoryAddAction from "../../favorites/native/action/useFavoritesGuildCategoryAddAction";
|
|
import { ActionSheet } from "../../../design/components/Sheet/native/ActionSheet.native";
|
|
import { isMetaQuest } from "../../device/MetaQuestUtils.android";
|
|
import { ActionSheetIconHeader } from "../../../design/components/Sheet/native/ActionSheetIconHeader.native";
|
|
import { ActionSheetRow } from "../../../design/components/Sheet/native/ActionSheetRow.native";
|
|
let ChannelLongPressActionSheetConnected;
|
|
const handleVoiceOrStageChannelConnectPress = async function handleVoiceOrStageChannelConnectPress(c26358_0) {
|
|
let c30024_0 = c26358_0;
|
|
if (c26358_0.isGuildStageVoice()) {
|
|
(0, (await import("../../stage_channels/StageChannelModalActionCreators")).connectAndOpen)(c30024_0);
|
|
} else {
|
|
(0, (await import("../../../utils/native/PrivateChannelCallUtils")).openGuildVoiceModal)(c30024_0, "Channel List");
|
|
}
|
|
};
|
|
ChannelLongPressActionSheetConnected = function ChannelLongPressActionSheetConnected(props) {
|
|
let label, label2;
|
|
let setting, c16949_4;
|
|
const { channel, onClose } = props;
|
|
setting = void 0;
|
|
c16949_4 = void 0;
|
|
const analyticsLocations2 = useAnalyticsLocations(AnalyticsLocation.CHANNEL_LONG_PRESS_MENU).analyticsLocations;
|
|
let r57 = channel.getGuildId();
|
|
const guildId = r57;
|
|
const isFavoritesGuildSelected = useIsFavoritesGuildSelected();
|
|
const stateFromStores4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
|
|
const stateFromStoresObject = useStateFromStoresObject([PermissionStore], () => ({
|
|
canManageChannel: PermissionStore.can(Permissions.MANAGE_CHANNELS, channel),
|
|
canCreateInstantInvite: PermissionStore.can(Permissions.CREATE_INSTANT_INVITE, channel),
|
|
canConnect: PermissionStore.can(Permissions.CONNECT, channel),
|
|
canModerateStage: PermissionStore.can(MODERATE_STAGE_CHANNEL_PERMISSIONS, channel)
|
|
}));
|
|
const canManageChannel = stateFromStoresObject.canManageChannel;
|
|
let canCreateInstantInvite = stateFromStoresObject.canCreateInstantInvite;
|
|
const { canConnect, canModerateStage } = stateFromStoresObject;
|
|
if (guildId == null) {
|
|
r57 = NULL_STRING_GUILD_ID;
|
|
}
|
|
const optInEnabledForGuild = useOptInEnabledForGuild(r57);
|
|
const stateFromStoresObject2 = useStateFromStoresObject([UserGuildSettingsStore], () => {
|
|
let r3 = guildId;
|
|
const r1 = {
|
|
isOptedIn: UserGuildSettingsStore.isChannelOptedIn(guildId, channel.id),
|
|
isParentOptedIn: channel.parent_id != null && UserGuildSettingsStore.isChannelOptedIn(guildId, channel.parent_id),
|
|
isPinned: null
|
|
};
|
|
if (guildId == null) {
|
|
r3 = ZERO_STRING_GUILD_ID;
|
|
}
|
|
r1.isPinned = UserGuildSettingsStore.isFavorite(r3, channel.id);
|
|
return r1;
|
|
});
|
|
const { isOptedIn: isOptedIn2, isParentOptedIn, isPinned: isPinned2 } = stateFromStoresObject2;
|
|
const stateFromStores9 = useStateFromStores([UserGuildSettingsStore], () => UserGuildSettingsStore.isChannelMuted(guildId, channel.id));
|
|
const stateFromStores8 = useStateFromStores([ActiveThreadsStore], () => guildId != null && ActiveThreadsStore.hasThreadsForChannel(guildId, channel.id));
|
|
const stateFromStores6 = useStateFromStores([CategoryCollapseStore], () => CategoryCollapseStore.isCollapsed(channel.parent_id));
|
|
const stateFromStores7 = useStateFromStores([CollapsedVoiceChannelStore], () => CollapsedVoiceChannelStore.isCollapsed(channel.id));
|
|
const stateFromStores5 = useStateFromStores([StageInstanceStore], () => StageInstanceStore.isLive(channel.id));
|
|
const channelName = useChannelName(channel, true);
|
|
const isNsfwGated = useIsNsfwGated(channel);
|
|
setting = DeveloperMode.useSetting();
|
|
const icon = stateFromStores4 != null ? <GuildIcon guild={stateFromStores4} size={GuildIconSizes.LARGE} /> : <Avatar size={AvatarSizes.LARGE} channel={channel} />;
|
|
const stateFromStores11 = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
|
|
const r142 = stateFromStores11 != null && channel.isOwner(stateFromStores11.id);
|
|
const stateFromStores10 = useStateFromStores([UserGuildSettingsStore], () => UserGuildSettingsStore.isMessagesFavorite(channel.id));
|
|
const inappropriateConversationsTiers = useInappropriateConversationsTiers(channel);
|
|
const r4 = inappropriateConversationsTiers?.isTier1 != null && !inappropriateConversationsTiers?.isTier1;
|
|
const r158 = inappropriateConversationsTiers?.isTier2 != null && !inappropriateConversationsTiers?.isTier2;
|
|
const stateFromStores12 = useStateFromStores([ChannelSpoilerAgreeStore], () => ChannelSpoilerAgreeStore.didAgree(channel.id));
|
|
const favoritesGuildChannelActions = useFavoritesGuildChannelActions(channel, "ChannelLongPressActionSheet");
|
|
const favoritesGuildCategoryAddAction = useFavoritesGuildCategoryAddAction(channel);
|
|
const r173 = stateFromStores11 == null ? void 0 : stateFromStores11.isStaff();
|
|
let guildId2;
|
|
const channel2 = channel;
|
|
const stateFromStores = stateFromStores9;
|
|
const isOptedIn = isOptedIn2;
|
|
const isPinned = isPinned2;
|
|
const stateFromStores2 = stateFromStores10;
|
|
const analyticsLocations = analyticsLocations2;
|
|
const r41 = {
|
|
sectionKey: "dm",
|
|
buttons: []
|
|
};
|
|
if (channel.isDM()) {
|
|
r41.buttons.push({
|
|
label: intl.string(t.LYju5J),
|
|
IconComponent: UserCircleIcon,
|
|
onPress: () => {
|
|
showUserProfileActionSheet({
|
|
userId: channel2.getRecipientId(),
|
|
channelId: channel2.id,
|
|
sourceAnalyticsLocations: analyticsLocations
|
|
});
|
|
}
|
|
});
|
|
if (!isFavoritesGuildSelected) {
|
|
r41.buttons.push({
|
|
label: intl.string(t.jsvgc3),
|
|
IconComponent: UserMinusIcon,
|
|
onPress: () => {
|
|
ChannelActionCreators.closePrivateChannel(channel2.id, SelectedChannelStore.getCurrentlySelectedChannelId() === channel2.id);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
const r210 = {
|
|
sectionKey: "gdm",
|
|
buttons: []
|
|
};
|
|
const r212 = {
|
|
sectionKey: "gdm-destructive",
|
|
buttons: []
|
|
};
|
|
if (channel.isGroupDM()) {
|
|
if (!isFavoritesGuildSelected) {
|
|
r212.buttons.push({
|
|
label: intl.string(t["26C4oi"]),
|
|
IconComponent: UserMinusIcon,
|
|
isDestructive: true,
|
|
onPress: () => {
|
|
const name = computeChannelName(channel2, UserStore, RelationshipStore);
|
|
const r23 = intl.formatToPlainString(t.hJ5Ap4, {
|
|
name
|
|
});
|
|
let body = intl.format(t.SSIVOu, {
|
|
name
|
|
});
|
|
const isManaged = channel2.isManaged();
|
|
let title = r23;
|
|
if (isManaged) {
|
|
title = intl.formatToPlainString(t.hVGjEW, {
|
|
name
|
|
});
|
|
body = intl.format(t.IK1Qvs, {
|
|
name
|
|
});
|
|
}
|
|
AlertActionCreators.show({
|
|
title,
|
|
body,
|
|
confirmText: intl.string(t.p89ACt),
|
|
cancelText: intl.string(t.gm1Vej),
|
|
onConfirm: () => {
|
|
ChannelActionCreators.closePrivateChannel(channel2.id, SelectedChannelStore.getCurrentlySelectedChannelId() === channel2.id);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
r210.buttons.push({
|
|
label: intl.string(t["1r5E+m"]),
|
|
IconComponent: PencilIcon,
|
|
onPress: () => {
|
|
showChatGDMCustomizeActionSheet({
|
|
channelId: channel2.id
|
|
});
|
|
}
|
|
});
|
|
if (r142) {
|
|
r210.buttons.push({
|
|
label: intl.string(t.OQ9MKu),
|
|
IconComponent: LinkIcon,
|
|
onPress: () => {
|
|
ModalActionCreators.pushLazy(import("../../instant_invite/native/components/GroupDMInviteManagementScreen"), {
|
|
channelId: channel2.id
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
const r264 = [];
|
|
if (r41.buttons.length > 0) {
|
|
r264.push(r41);
|
|
}
|
|
if ((isFavoritesGuildSelected ? channel.guild_id != null : isFavoritesGuildSelected) && !channel.isCategory()) {
|
|
r264.push({
|
|
sectionKey: "go-to-server",
|
|
buttons: [{
|
|
label: intl.string(FavoritesGuild_messages["3KruG3"]),
|
|
IconComponent: ServerIcon,
|
|
onPress: () => {
|
|
transitionToGuild(channel2.guild_id, channel2.id);
|
|
}
|
|
}]
|
|
});
|
|
}
|
|
if (favoritesGuildCategoryAddAction != null) {
|
|
r264.push({
|
|
sectionKey: "favorites-add-to-category",
|
|
buttons: [{
|
|
label: favoritesGuildCategoryAddAction.label,
|
|
IconComponent: PlusLargeIcon,
|
|
onPress: favoritesGuildCategoryAddAction.perform
|
|
}]
|
|
});
|
|
}
|
|
const r302 = buildFavoritesSectionButtons(favoritesGuildChannelActions);
|
|
if (r302 != null) {
|
|
r264.push({
|
|
sectionKey: "favorites",
|
|
buttons: [r302]
|
|
});
|
|
}
|
|
guildId2 = channel.getGuildId();
|
|
const r310 = {
|
|
sectionKey: "channel-actions",
|
|
buttons: []
|
|
};
|
|
if (canCreateInstantInvite) {
|
|
canCreateInstantInvite = channel.type !== ChannelTypes.GUILD_CATEGORY;
|
|
}
|
|
if (canCreateInstantInvite) {
|
|
r310.buttons.push({
|
|
label: intl.string(t.VINpSK),
|
|
IconComponent: GroupPlusIcon,
|
|
onPress: () => {
|
|
showInstantInviteActionSheet(channel2, {
|
|
source: InstantInviteSources.CONTEXT_MENU
|
|
});
|
|
}
|
|
});
|
|
}
|
|
if (!(isFavoritesGuildSelected || guildId2 == null || channel.isThread())) {
|
|
if (!channel.isCategory()) {
|
|
r310.buttons.push({
|
|
label: isPinned ? intl.string(t.M5PWSf) : intl.string(t.RMpwZu),
|
|
IconComponent: PinIcon,
|
|
onPress: () => {
|
|
setIsFavorite(guildId2, channel2.id, !isPinned, {
|
|
section: AnalyticsSections.CHANNEL_ACTION_SHEET
|
|
});
|
|
if (!isPinned) {
|
|
const rootNavigationRef = getRootNavigationRef();
|
|
if (rootNavigationRef != null) {
|
|
const name = rootNavigationRef.getCurrentRoute()?.name;
|
|
const params = rootNavigationRef.getCurrentRoute()?.params;
|
|
if (name === "guilds" && params?.guildId === guildId2) {
|
|
rootNavigationRef.setParams({
|
|
jumpToChannelId: channel2.id
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
if (optInEnabledForGuild) {
|
|
const buttons = r310.buttons;
|
|
const r355 = {
|
|
label: null,
|
|
IconComponent: null,
|
|
onPress: null
|
|
};
|
|
if (isParentOptedIn) {
|
|
r355.label = intl.string(t.jNphKT);
|
|
r355.IconComponent = XSmallIcon;
|
|
r355.onPress = () => {
|
|
if (channel2.parent_id != null) {
|
|
setOptInChannel(guildId2, channel2.parent_id, false, {
|
|
section: AnalyticsSections.CHANNEL_ACTION_SHEET
|
|
});
|
|
}
|
|
};
|
|
buttons.push(r355);
|
|
} else {
|
|
r355.label = isOptedIn ? intl.string(t["3zySTA"]) : intl.string(t["9mysCh"]);
|
|
r355.IconComponent = isOptedIn ? XSmallIcon : PlusLargeIcon;
|
|
r355.onPress = () => {
|
|
setOptInChannel(guildId2, channel2.id, !isOptedIn, {
|
|
section: AnalyticsSections.CHANNEL_ACTION_SHEET
|
|
});
|
|
};
|
|
buttons.push(r355);
|
|
}
|
|
}
|
|
}
|
|
if (isGuildTextChannelType(channel.type) || isGuildVocalChannelType(channel.type) || channel.isForumLikeChannel()) {
|
|
r310.buttons.push({
|
|
label: intl.string(t.WqhZss),
|
|
IconComponent: LinkIcon,
|
|
isDestructive: false,
|
|
onPress: () => {
|
|
copyGuildChannelOrThreadLink(channel2.guild_id, channel2.id);
|
|
}
|
|
});
|
|
}
|
|
if (isFavoritesGuildSelected ? !isFavoritesGuildSelected : channel.isPrivate()) {
|
|
r310.buttons.push({
|
|
label: stateFromStores2 ? intl.string(t.vDYmad) : intl.string(t["uKw3A+"]),
|
|
IconComponent: PinIcon,
|
|
onPress: () => {
|
|
setMessagesFavorite(channel2.id, !stateFromStores2);
|
|
}
|
|
});
|
|
}
|
|
const r424 = {
|
|
sectionKey: "safety-warning-tooling",
|
|
buttons: []
|
|
};
|
|
if (r4) {
|
|
r424.buttons.push({
|
|
label: intl.string(t.EuzCET),
|
|
IconComponent: WarningIcon,
|
|
onPress: () => {
|
|
markAsInappropriateConversation(channel2.id, SafetyWarningTypes.INAPPROPRIATE_CONVERSATION_TIER_1);
|
|
}
|
|
});
|
|
}
|
|
if (r158) {
|
|
r424.buttons.push({
|
|
label: intl.string(t["tBw/1i"]),
|
|
IconComponent: WarningIcon,
|
|
onPress: () => {
|
|
markAsInappropriateConversation(channel2.id, SafetyWarningTypes.INAPPROPRIATE_CONVERSATION_TIER_2);
|
|
}
|
|
});
|
|
}
|
|
if (r424.buttons.length > 0) {
|
|
r264.push(r424);
|
|
}
|
|
if (r173 === true && setting && channel.isDM()) {
|
|
const r466 = {
|
|
sectionKey: "message-request",
|
|
buttons: []
|
|
};
|
|
if (channel.isMessageRequest !== true) {
|
|
r466.buttons.push({
|
|
label: intl.string(t.L6623r),
|
|
IconComponent: InboxIcon,
|
|
onPress: () => {
|
|
markAsMessageRequest(channel2.id);
|
|
}
|
|
});
|
|
}
|
|
r466.buttons.push({
|
|
label: intl.string(t["85YWlY"]),
|
|
IconComponent: InboxIcon,
|
|
onPress: () => {
|
|
clearMessageRequestState(channel2.id);
|
|
}
|
|
});
|
|
if (r466.buttons.length > 0) {
|
|
r264.push(r466);
|
|
}
|
|
}
|
|
if (r310.buttons.length > 0) {
|
|
r264.push(r310);
|
|
}
|
|
const r511 = {
|
|
sectionKey: "notifications",
|
|
buttons: []
|
|
};
|
|
if (isReadableType(channel.type) || channel.isCategory() || channel.isForumLikeChannel()) {
|
|
r511.buttons.push({
|
|
label: intl.string(t.e6RscS),
|
|
IconComponent: EyeIcon,
|
|
onPress: () => {
|
|
ackChannel(channel2, {
|
|
section: AnalyticsSections.CHANNEL_ACTION_SHEET,
|
|
object: AnalyticsObjects.MARK_CHANNEL_AS_READ_BUTTON,
|
|
objectType: AnalyticsObjectTypes.ACK_MANUAL
|
|
});
|
|
}
|
|
});
|
|
}
|
|
if (!(!isTextChannel(channel.type) && (!channel.isCategory() && !channel.isForumLikeChannel()))) {
|
|
if (stateFromStores) {
|
|
L118: {
|
|
const r592 = intl.string(t.OYefme);
|
|
if (channel.isCategory()) {
|
|
label2 = intl.string(t.olaBeG);
|
|
} else {
|
|
if (!channel.isDM() && !channel.isGroupDM()) {
|
|
const isThread2 = channel.isThread();
|
|
label2 = r592;
|
|
if (!isThread2) {
|
|
break L118;
|
|
}
|
|
label2 = intl.string(t["Cq/TzF"]);
|
|
break L118;
|
|
}
|
|
label2 = intl.string(t["s5/5fm"]);
|
|
}
|
|
}
|
|
r511.buttons.push({
|
|
label: label2,
|
|
IconComponent: BellIcon,
|
|
onPress: () => {
|
|
NotificationSettingsModalActionCreators.updateChannelOverrideSettings(channel2.getGuildId(), channel2.id, {
|
|
muted: !stateFromStores
|
|
}, NotificationLabel.muted(!stateFromStores));
|
|
}
|
|
});
|
|
} else {
|
|
L110: {
|
|
const r549 = intl.string(t.tbeRRJ);
|
|
if (channel.isCategory()) {
|
|
label = intl.string(t.pNMCg2);
|
|
} else {
|
|
if (!channel.isDM() && !channel.isGroupDM()) {
|
|
const isThread = channel.isThread();
|
|
label = r549;
|
|
if (!isThread) {
|
|
break L110;
|
|
}
|
|
label = intl.string(t.bUUd8q);
|
|
break L110;
|
|
}
|
|
label = intl.string(t.LO3kaK);
|
|
}
|
|
}
|
|
r511.buttons.push({
|
|
label,
|
|
IconComponent: BellSlashIcon,
|
|
onPress: () => {
|
|
const rootNavigationRef = getRootNavigationRef();
|
|
if (rootNavigationRef != null && rootNavigationRef.isReady()) {
|
|
rootNavigationRef.navigate("sidebar", {
|
|
channelId: channel2.id,
|
|
initialRouteName: ChannelDetailsNavigatorScreens.MUTE,
|
|
source: "channel-long-press-sheet"
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
if (isGuildTextChannelType(channel.type) || channel.isCategory() || channel.isGuildStageVoice() || channel.isForumLikeChannel()) {
|
|
r511.buttons.push({
|
|
label: intl.string(t.h850Ss),
|
|
IconComponent: ChannelNotificationIcon,
|
|
disableColor: true,
|
|
onPress: () => {
|
|
ChannelSettingsActionCreators.setSection(ChannelSettingsSections.NOTIFICATIONS);
|
|
ChannelSettingsActionCreators.open(channel2.id);
|
|
}
|
|
});
|
|
}
|
|
if (r511.buttons.length > 0) {
|
|
r264.push(r511);
|
|
}
|
|
const r661 = {
|
|
sectionKey: "threads",
|
|
buttons: []
|
|
};
|
|
if (!(channel.isThread() || channel.isForumLikeChannel() || !stateFromStores8 || isNsfwGated)) {
|
|
r661.buttons.push({
|
|
label: intl.string(t.B2panI),
|
|
IconComponent: ThreadIcon,
|
|
onPress: () => {
|
|
showThreadBrowserModal(channel2);
|
|
}
|
|
});
|
|
}
|
|
if (r661.buttons.length > 0) {
|
|
r264.push(r661);
|
|
}
|
|
const r687 = {
|
|
sectionKey: "voice",
|
|
buttons: []
|
|
};
|
|
if (isGuildVocalChannelType(channel.type) && !stateFromStores6) {
|
|
r687.buttons.push({
|
|
label: stateFromStores7 ? intl.string(t.JYF2Oa) : intl.string(t.LxzNiu),
|
|
IconComponent: UserCircleIcon,
|
|
onPress: () => {
|
|
ChannelCollapseActionCreators.update(channel2.id);
|
|
}
|
|
});
|
|
}
|
|
if (channel.isGuildVocal()) {
|
|
const isGuildStageVoice = channel.isGuildStageVoice();
|
|
const buttons2 = r687.buttons;
|
|
const r715 = {
|
|
label: null,
|
|
IconComponent: null,
|
|
onPress: null
|
|
};
|
|
if (isGuildStageVoice) {
|
|
r715.label = intl.string(t["7vb2cc"]);
|
|
r715.IconComponent = StageIcon;
|
|
r715.onPress = () => {
|
|
handleVoiceOrStageChannelConnectPress(channel2);
|
|
};
|
|
buttons2.push(r715);
|
|
r687.buttons.push({
|
|
label: intl.string(t.ZXxLQg),
|
|
IconComponent: ChatIcon,
|
|
onPress: () => {
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
ModalActionCreators.pushLazy(import("../../video_calls/native/components/ChannelVoiceChatModal"), {
|
|
channel: channel2
|
|
});
|
|
hideLaunchPad();
|
|
}
|
|
});
|
|
} else {
|
|
r715.label = intl.string(t.ZXxLQg);
|
|
r715.IconComponent = ChatIcon;
|
|
r715.onPress = () => {
|
|
handleVoiceOrStageChannelConnectPress(channel2);
|
|
ChannelRTCActionCreators.updateChatOpen(channel2.id, true);
|
|
hideLaunchPad();
|
|
};
|
|
buttons2.push(r715);
|
|
}
|
|
}
|
|
if (channel.isGuildStageVoice() && stateFromStores5 && canModerateStage) {
|
|
r687.buttons.push({
|
|
label: intl.string(t.saZaRb),
|
|
IconComponent: XSmallIcon,
|
|
isDestructive: true,
|
|
onPress: async () => {
|
|
let c31486_0;
|
|
c31486_0 = void 0;
|
|
(0, (await import("../../stage_channels/StageChannelActionCreatorExtras.native")).openEndStageModal)(channel2);
|
|
}
|
|
});
|
|
}
|
|
if (channel.isGuildStageVoice() && stateFromStores5 && canConnect) {
|
|
r687.buttons.push({
|
|
label: intl.string(t["+78Pfm"]),
|
|
IconComponent: FlagIcon,
|
|
isDestructive: true,
|
|
onPress: () => {
|
|
showReportModalForStageChannel(channel2);
|
|
}
|
|
});
|
|
}
|
|
if (r687.buttons.length > 0) {
|
|
r264.push(r687);
|
|
}
|
|
if (channel.isSpoilerChannel() && stateFromStores12) {
|
|
const r799 = {
|
|
sectionKey: "spoiler",
|
|
buttons: []
|
|
};
|
|
r799.buttons.push({
|
|
label: intl.string(t.ix2UVZ),
|
|
IconComponent: EyeSlashIcon,
|
|
onPress: () => {
|
|
GuildActionCreators.clearSpoilerAgree(channel2.id);
|
|
}
|
|
});
|
|
r264.push(r799);
|
|
}
|
|
const r820 = {
|
|
sectionKey: "admin-actions",
|
|
buttons: []
|
|
};
|
|
if (canManageChannel) {
|
|
r820.buttons.push({
|
|
label: channel.isCategory() ? intl.string(t.zdPFs9) : intl.string(t["3gUsJb"]),
|
|
IconComponent: SettingsIcon,
|
|
onPress: () => {
|
|
ChannelSettingsActionCreators.setSection(ChannelSettingsSections.OVERVIEW);
|
|
ChannelSettingsActionCreators.open(channel2.id);
|
|
}
|
|
});
|
|
if (isGuildTextChannelType(channel.type) || channel.isForumLikeChannel() || channel.isGuildVoice() || channel.isCategory()) {
|
|
r820.buttons.push({
|
|
label: channel.isCategory() ? intl.string(t["fUYU+j"]) : intl.string(t.dEaPc4),
|
|
IconComponent: channel.isCategory() ? PlusLargeIcon : CopyIcon,
|
|
onPress: () => {
|
|
CreateChannelModalActionCreators.open(channel2.isCategory() ? void 0 : channel2.type, channel2.getGuildId(), channel2.isCategory() ? channel2.id : channel2.parent_id, channel2.isCategory() ? void 0 : channel2.id);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
if (setting) {
|
|
r820.buttons.push({
|
|
label: intl.string(t.gFHI3k),
|
|
IconComponent: IdIcon,
|
|
onPress: () => {
|
|
copy(channel2.id);
|
|
presentIdCopied();
|
|
}
|
|
});
|
|
}
|
|
if (r820.buttons.length > 0) {
|
|
r264.push(r820);
|
|
}
|
|
if (r210.buttons.length > 0) {
|
|
r264.push(r210);
|
|
}
|
|
if (r212.buttons.length > 0) {
|
|
r264.push(r212);
|
|
}
|
|
c16949_4 = r264;
|
|
const subtitle = channel.isGroupDM() ? intl.formatToPlainString(t.ABMKx3, {
|
|
members: channel.recipients.length + 1
|
|
}) : void 0;
|
|
useEffect(() => {
|
|
if (!(c16949_4.length !== 0 || setting)) {
|
|
onClose();
|
|
}
|
|
}, [r264.length, setting, onClose]);
|
|
return <AnalyticsLocationProvider value={analyticsLocations}>
|
|
<ActionSheet showGradient startExpanded={isMetaQuest()} header={<ActionSheetIconHeader icon={icon} title={channelName} subtitle={subtitle} />}>
|
|
{r264.map((item) => <ActionSheetRow.Group key={item.sectionKey} hasIcons>
|
|
{item.buttons.map((button, index) => {
|
|
const { label, IconComponent, iconStyle, trailing, isDestructive, onPress: onPress2 } = button;
|
|
return <ActionSheetRow key={index} variant={isDestructive ? "danger" : "default"} label={label} icon={<ActionSheetRow.Icon IconComponent={IconComponent} style={iconStyle} disableColor={button.disableColor} />} trailing={trailing} onPress={() => {
|
|
if (onPress2 != null) {
|
|
onPress2();
|
|
}
|
|
onClose();
|
|
}} />;
|
|
})}
|
|
</ActionSheetRow.Group>)}
|
|
</ActionSheet>
|
|
</AnalyticsLocationProvider>;
|
|
};
|
|
export default function ChannelLongPressActionSheet(props) {
|
|
const { channelId, onClose: onClose2 } = props;
|
|
const stateFromStores3 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
|
|
useEffect(() => {
|
|
if (stateFromStores3 == null) {
|
|
onClose2();
|
|
}
|
|
}, [stateFromStores3, onClose2]);
|
|
return stateFromStores3 != null ? <ChannelLongPressActionSheetConnected channel={stateFromStores3} onClose={onClose2} /> : null;
|
|
};
|