// Metro module 11965 (f11966). import { useCallback } from "react"; import ChannelStore from "../../../stores/ChannelStore"; import RelationshipStore from "../../../stores/RelationshipStore"; import SelectedChannelStore from "../../../stores/SelectedChannelStore"; import UserStore from "../../../stores/UserStore"; import { AnalyticEvents, ApplicationFlags, ChannelTypesSets, RelationshipTypes } from "../../../Constants"; import { BLOCK_CONFIRMATION_ACTION_SHEET_KEY, IGNORE_CONFIRMATION_ACTION_SHEET_KEY } from "../../relationships/native/RestrictionConfirmationConstants"; import { useStateFromStoresObject, useStateFromStores } from "../../../_bundle/Module589"; import * as _SafetyExperienceIarUserReportingExperiment from "../../in_app_reports/SafetyExperienceIarUserReportingExperiment"; import { useUserProfileAnalyticsContext } from "../UserProfileAnalyticsContext"; import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../app_analytics/useAnalyticsLocations"; import AnalyticsLocation from "../../app_analytics/AnalyticsLocation"; import showUserProfileActionSheet from "./showUserProfileActionSheet"; import { intl, t } from "../../../intl/index.native"; import RelationshipActionCreators from "../../../actions/RelationshipActionCreators"; import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators"; import { ImpressionNames } from "../../../_bundle/Module503"; import SafetyToastsActionCreators_native from "../../safety_common/SafetyToastsActionCreators.native"; import { BOT_REPORT_CHOOSER_KEY } from "../../in_app_reports/native/BotReportChooser"; import { isAndroid } from "../../../utils/PlatformUtils"; import { alertUserReported } from "./UserProfileAlertUtils"; import AnalyticsUtils from "../../../utils/AnalyticsUtils"; import { copy } from "../../../utils/ClipboardUtils.native"; import UserUtils from "../../../utils/UserUtils"; import { presentUsernameCopied, presentLinkCopied, presentIdCopied } from "../../toast/native/ToastUtils"; import * as _ApplicationFlagUtils from "../../applications/utils/ApplicationFlagUtils"; import { getInstallAppPropsFromProfileApplication } from "../../app_launcher/utils/AppLauncherUtils"; import { getActivityLaunchURL, getApplicationInstallURL } from "../../applications/getApplicationInstallURL"; import { DeveloperMode } from "../../user_settings/UserSettings"; import openUserContextMenuCommands from "./openUserContextMenuCommands"; import { ContextMenu } from "../../../design/components/ContextMenu/native/ContextMenu.native"; import { IconButton } from "../../../design/components/Button/native/IconButton.native"; import { MoreHorizontalIcon } from "../../../design/components/Icon/native/redesign/generated/MoreHorizontalIcon"; import Module712 from "../../../_bundle/Module712"; export default function BotUserProfileOverflowMenu(props) { let r224; let stateFromStores, context, trackUserProfileAction, analyticsLocations, newestAnalyticsLocation, currentUser, callback, id, guildId, hasApplicationFlag, installAppPropsFromProfileApplication; const { application, user, channel } = props; stateFromStores = void 0; context = void 0; trackUserProfileAction = void 0; analyticsLocations = void 0; newestAnalyticsLocation = void 0; currentUser = void 0; callback = void 0; id = void 0; guildId = void 0; hasApplicationFlag = void 0; installAppPropsFromProfileApplication = void 0; const stateFromStoresObject = useStateFromStoresObject([RelationshipStore], () => ({ relationshipType: RelationshipStore.getRelationshipType(user.id), isIgnored: RelationshipStore.isIgnored(user.id) })); const { relationshipType, isIgnored } = stateFromStoresObject; stateFromStores = useStateFromStores([SelectedChannelStore, ChannelStore], () => ChannelStore.getChannel(SelectedChannelStore.getChannelId())); const isIarUserReportingEnabled = _SafetyExperienceIarUserReportingExperiment.isIarUserReportingEnabled("User Profile Options - Mobile"); const userProfileAnalyticsContext = useUserProfileAnalyticsContext(); context = userProfileAnalyticsContext.context; trackUserProfileAction = userProfileAnalyticsContext.trackUserProfileAction; const analyticsLocations2 = useAnalyticsLocations(AnalyticsLocation.USER_PROFILE_OVERFLOW_MENU); analyticsLocations = analyticsLocations2.analyticsLocations; newestAnalyticsLocation = analyticsLocations2.newestAnalyticsLocation; currentUser = UserStore.getCurrentUser(); const r17 = [user.id, , , ,]; const id2 = channel?.id; const r57 = (a0) => { showUserProfileActionSheet({ ...context, showGuildProfile: a0, userId: user.id, channelId: channel?.id, sourceAnalyticsLocations: analyticsLocations, ignoreBlockedSpeedBump: true }); }; r17[1] = id2; r17[2] = context; r17[3] = analyticsLocations; callback = useCallback(r57, r17); id = user.id; const r61 = channel == null ? void 0 : channel.getGuildId(); const r63 = []; guildId = r61; const r66 = relationshipType === RelationshipTypes.BLOCKED; if (isIgnored && !r66) { r63.push({ label: intl.string(t["8wXU9B"]), action: () => { trackUserProfileAction({ action: "UNIGNORE", analyticsLocations }); RelationshipActionCreators.unignoreUser(id, newestAnalyticsLocation, channel?.id); callback(); } }); } else if (!r66) { r63.push({ label: intl.string(t.ytCpKs), action: () => { trackUserProfileAction({ action: "IGNORE", analyticsLocations }); ActionSheetActionCreators.openLazy(import("../../relationships/native/IgnoreConfirmationActionSheet"), IGNORE_CONFIRMATION_ACTION_SHEET_KEY, { userId: id, onSuccess: () => { callback(); }, impressionName: ImpressionNames.IGNORE_USER_CONFIRMATION }, "stack"); } }); } if (r66) { r63.push({ label: intl.string(t.XyHpKH), action: () => { trackUserProfileAction({ action: "UNBLOCK", analyticsLocations }); RelationshipActionCreators.unblockUser(id, { location: newestAnalyticsLocation }); SafetyToastsActionCreators_native.showUnblockSuccessToast(id, channel?.id); callback(); } }); } if (!r66) { r63.push({ label: intl.string(t.l4Emac), variant: "destructive", action: () => { trackUserProfileAction({ action: "BLOCK", analyticsLocations }); ActionSheetActionCreators.openLazy(import("../../relationships/native/BlockConfirmationActionSheet"), BLOCK_CONFIRMATION_ACTION_SHEET_KEY, { userId: id, channelId: channel?.id, onSuccess: () => { callback(); }, impressionName: ImpressionNames.BLOCK_USER_CONFIRMATION }, "stack"); } }); if (isIarUserReportingEnabled) { r63.push({ label: intl.string(t.jhJzez), variant: "destructive", action: () => { trackUserProfileAction({ action: "REPORT", analyticsLocations }); const contextualGuildId = guildId !== "@me" ? guildId !== null ? guildId : void 0 : void 0; ActionSheetActionCreators.openLazy(import("../../in_app_reports/native/BotReportChooser"), BOT_REPORT_CHOOSER_KEY, { user, entrypoint: "UserProfileOverflowMenu", contextualGuildId, contextualChannelId: channel?.id }, "replaceAll"); } }); } else if (isAndroid()) { r63.push({ label: intl.string(t.TbHyMG), variant: "destructive", action: () => { trackUserProfileAction({ action: "REPORT", analyticsLocations }); alertUserReported(); AnalyticsUtils.track(AnalyticEvents.TNS_USER_REPORT_SUBMITTED, { reported_user_id: id }); } }); } } const r149 = []; r149.push({ label: intl.string(t.y5MwJy), action: () => { trackUserProfileAction({ action: "COPY_USERNAME", analyticsLocations }); copy(UserUtils.getUserTag(user, { decoration: "never", identifiable: "always" })); presentUsernameCopied(); callback(); } }); if (application != null) { hasApplicationFlag = _ApplicationFlagUtils.hasApplicationFlag(application, ApplicationFlags.EMBEDDED); installAppPropsFromProfileApplication = getInstallAppPropsFromProfileApplication(application); r149.push({ label: intl.string(t.WqhZss), action: () => { trackUserProfileAction({ action: "COPY_APP_LINK", analyticsLocations }); copy(hasApplicationFlag ? getActivityLaunchURL({ applicationId: application.id, referrerId: currentUser?.id }) : getApplicationInstallURL({ id: application.id, ...installAppPropsFromProfileApplication })); presentLinkCopied(); } }); } if (DeveloperMode.getSetting()) { r149.push({ label: intl.string(t["/AXYnE"]), action: () => { trackUserProfileAction({ action: "COPY_USER_ID", analyticsLocations }); copy(id); presentIdCopied(); callback(); } }); } if (channel != null && stateFromStores != null && ChannelTypesSets.TEXTUAL.has(stateFromStores.type)) { r149.push({ label: intl.string(t.PHjkRE), action: () => openUserContextMenuCommands({ userId: id, selectedChannel: stateFromStores, showUserProfile: callback, analyticsLocations }) }); } L29: { if (r149.length === 0) { const length = r63.length; r224 = null; if (length === 0) { break L29; } } r224 = {(a0) => { const { ref, ...rest } = a0; return } />; }} ; } return r224; };