Files
discord-decomp/modules/messages/native/MessagesHandlers.tsx
T
2026-11-01 12:12:55 +02:00

2190 lines
97 KiB
TypeScript

// Metro module 10904 (f10905).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import AgeVerificationStore from "../../age_assurance/AgeVerificationStore";
import ApplicationStore from "../../applications/ApplicationStore";
import ApplicationDirectoryApplicationsStore from "../../global_discovery_apps/stores/ApplicationDirectoryApplicationsStore";
import GuildIncidentsStore from "../../guild_antiraid/GuildIncidentsStore";
import GuildScheduledEventStore, { isGuildScheduledEventActive } from "../../guild_scheduled_events/GuildScheduledEventStore";
import PremiumGiftingIntentStore from "../../premium/gifting/PremiumGiftingIntentStore";
import QuestStore from "../../quests/QuestStore";
import ReferencedMessageStore from "../../replies/ReferencedMessageStore";
import SummaryStore from "../../summaries/SummaryStore";
import JoinedThreadsStore from "../../threads/JoinedThreadsStore";
import UserAffinitiesV2Store from "../../user_affinities/UserAffinitiesV2Store";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import ChannelStore from "../../../stores/ChannelStore";
import GiftCodeStore from "../../../stores/GiftCodeStore";
import GuildMemberStore from "../../../stores/GuildMemberStore";
import GuildStore from "../../../stores/GuildStore";
import InviteStore from "../../../stores/InviteStore";
import LocalActivityStore from "../../../stores/LocalActivityStore";
import MessageStore from "../../../stores/MessageStore";
import PermissionStore from "../../../stores/PermissionStore";
import PresenceStore from "../../../stores/PresenceStore";
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import SelectedGuildStore from "../../../stores/SelectedGuildStore";
import SelfPresenceStore from "../../../stores/SelfPresenceStore";
import UploadStore from "../../../stores/UploadStore";
import UserStore from "../../../stores/UserStore";
import { SeparatorAction } from "./renderer/RowGeneratorConstants";
import { ActivityActionTypes, ActivityFlags, ActivityGamePlatforms, ActivityTypes, AnalyticEvents, AnalyticsGameOpenTypes, AnalyticsLocations, AnalyticsObjectTypes, AnalyticsObjects, AnalyticsPages, AnalyticsSections, LinkingTypes, ME, MessageFlags, MessageStates, MessageTypes, Permissions, Routes, UpsellTypes, UserSettingsSections, WebBrowserType } from "../../../Constants";
import { InviteTypes } from "../../instant_invite/Constants";
import { PremiumTypes, PremiumUpsellTypes } from "../../premium/PremiumConstants";
import { SafetySystemNotificationCtaType } from "../../safety_hub/SafetyHubConstants";
import { OpenThreadAnalyticsLocations } from "../../threads/ThreadConstants";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import { isAlertOrActionSheetOpen } from "../../../components_native/chat/isAlertOrActionSheetOpen";
import { getNativeSyntheticEventData, castNativeSyntheticEventData } from "./snowflake/MessageDataSnowflakeUtils";
import { contentHandlers } from "../../../components_native/chat/contentHandlers";
import { checkIsCallActive } from "../../calls/mobile/useIsCallActive";
import { handleJoinCall, handleStartCall, navigateToVoiceChannel, openChannelCallModal } from "../../../utils/native/PrivateChannelCallUtils";
import { showSimpleActionSheet } from "../../action_sheet/native/showSimpleActionSheet";
import { intl, t } from "../../../intl/index.native";
import { PhoneCallIcon } from "../../../design/components/Icon/native/redesign/generated/PhoneCallIcon";
import { VideoIcon } from "../../../design/components/Icon/native/redesign/generated/VideoIcon";
import { handleTapCommandMention, handleLongPressCommandMention } from "../../markup/native/MarkupReactCommandRule";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import navigateToLastChannel from "../../main_tabs_v2/native/navigateToLastChannel";
import { ApplicationCommandTriggerLocations } from "../../application_commands/ApplicationCommandTypes";
import { isLinkTrusted } from "../../markup/MarkupReactLinkUtils";
import parseURL from "../../../utils/native/parseURL";
import { isGuildScheduledEventInviteEmbed, getGuildInviteExtendedType, GuildInviteExtendedType } from "../../instant_invite/InviteTypeUtils";
import handleAcceptEventInstantInvite from "../../guild_scheduled_events/native/handleAcceptEventInstantInvite";
import { handleAddOrRemoveReaction, getLongPressSelectedMedia, handleToggleFollowForumPost, handleCopyLinkForumPost } from "./MessagesUtils";
import { handleViewReactions, handleAddNewReactions } from "../../reactions/native/ReactionUtils";
import { showStickerDetailActionSheet } from "../../stickers/native/showStickerDetailActionSheet";
import { isIOS, isAndroid } from "../../../utils/PlatformUtils";
import isCrosspost from "../isCrosspost";
import { computeIsReadOnlyThread } from "../../threads/ThreadHooks";
import { getMentionTextWithUser } from "../../autocompleter/native/AutocompleteUtils";
import { isPublicSystemMessage } from "../../public_guilds/PublicGuildsUtils";
import showUserProfileActionSheet from "../../user_profile/native/showUserProfileActionSheet";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import trackRepliedMessageClicked from "../../replies/trackRepliedMessageClicked";
import SummaryActionCreators from "../../summaries/SummaryActionCreators";
import { asComponentId } from "../../interaction_components/InteractionComponentTypes";
import { showLongPressMessageActionSheet } from "./long_press/showLongPressMessageActionSheet";
import canAddNewReactions from "../../reactions/canAddNewReactions";
import { triggerHapticFeedback } from "../../haptics/HapticUtils.native";
import HapticFeedbackTypes from "../../haptics/HapticFeedbackTypes";
import replyToMessage from "../../replies/native/replyToMessage";
import { transitionToGuild, transitionTo } from "../../routing/router_utils";
import { handleCreateThread, handleEdit } from "./long_press/LongPressMessageActionSheetUtils";
import canEditMessage from "../canEditMessage";
import { openApplyBoostModal } from "../../../actions/native/BoostingActionCreators";
import AppAnalyticsUtils, { trackWithMetadata } from "../../app_analytics/AppAnalyticsUtils";
import { isAutomodMessageRecord, extractAutomodMessageFields, isAutomodNotification } from "../../guild_automod/AutomodMessageUtils";
import { handleAddDefaultDoubleTapReaction } from "../../double_tap_to_react/native/DoubleTapToReactUtils";
import UploadActionCreators from "../../../actions/native/UploadActionCreators";
import { openTrack } from "../../now_playing/native/UserActivitySpotify";
import { hasFlag } from "../../../_bundle/Module1384";
import { getCanJoin } from "../../activities/utils/getCanJoin";
import getCurrentUserPresenceActivity from "../../activities/utils/getCurrentUserPresenceActivity";
import { getSupportsRemoteJoin } from "../../activities/utils/getSupportsRemoteJoin";
import { getShouldShowAppAuthPrompt } from "../../application_account_linking/native/getShouldShowAppAuthPrompt";
import { startAuthorizationNoHook } from "../../application_account_linking/native/startAuthorizationNoHook";
import GamesActionCreators_native from "../../../actions/GamesActionCreators.native";
import trackApplicationOpen from "../../activities/utils/trackApplicationOpen";
import Linking from "../../../lib/native/Linking";
import { canFulfillStreamRequest } from "../../request_to_stream/useCanFulfillStreamRequest";
import { getStreamPressHandler, getOSRequirement } from "../../video_calls/native/useScreenshareUtils";
import ActivitiesActionCreators from "../../../actions/ActivitiesActionCreators";
import { generateInviteKeyFromExtraData, getInviteInstanceId } from "../../instant_invite/InviteCodeUtils";
import { openShareEvent, transitionToEventDetailsFromInvite, handleGuildScheduledEventRsvp } from "../../guild_scheduled_events/native/GuildScheduledEventModalActionCreators";
import getInviteURL from "../../instant_invite/getInviteURL";
import { isMetaQuest } from "../../device/MetaQuestUtils.android";
import { findQuestOrReplacement } from "../../quests/utils/QuestDataUtils";
import { openQuestHome, openDiscordQuestsFAQ } from "../../quests/native/QuestUtils.native";
import { QuestContent } from "../../../_bundle/Module5038";
import { enrollInQuest } from "../../quests/QuestActionCreators";
import { QuestContentCTA } from "../../quests/lib/analytics/AnalyticsTypes";
import { CodedLinkType } from "../../coded_links/CodedLink";
import { getVoiceChannelListInviteExperiment } from "../VoiceChannelListInviteExperiment";
import { canShowVoiceChannelListInviteEmbed } from "./renderer/row_data/embeds/coded_links/invite/VoiceChannelListInviteEmbed";
import InstantInviteActionCreators, { trackInviteEmbedActioned, trackInviteServerClicked } from "../../../actions/InstantInviteActionCreators";
import { toggleOverride } from "../../build_overrides/native/BuildOverrideUtils";
import { openSocialLayerStorefrontProductDetailsModal } from "../../slayer_storefront/native/SocialLayerStorefrontNativeActionCreators";
import * as _transitionToGuild_native from "../../routing/transitionToGuild.native";
import { GuildProfileCTAContext } from "../../guild_profile/hooks/useGuildProfileCTA";
import GuildTemplateActionCreators from "../../guild_templates/native/GuildTemplateActionCreators";
import { getExperimentFromEmbedURL, getExperimentTreatmentFromEmbedURL } from "../../experiments/ExperimentEmbedUtils";
import { handleCodedLinkExperimentEmbedTap } from "../../experiments/native/ExperimentEmbedPlatformUtils";
import { installApplication } from "../../../utils/native/ApplicationUtils";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { shouldShowAgeGateForVoiceChannel } from "../../age_gate/AgeGateUtils";
import { shouldShowSpoilerGateForChannelId } from "../../spoiler_channels/SpoilerChannelUtils";
import { connectAndOpen } from "../../stage_channels/StageChannelModalActionCreators";
import SelectedChannelActionCreators from "../../../actions/SelectedChannelActionCreators";
import { handleNSFWGuildInvite } from "../../age_gate/native/AgeGateUtils";
import { isAtGuildCapAndNonPremium } from "../../premium/GuildCapUpsellHooks";
import PremiumUpsellUtils from "../../../utils/native/PremiumUpsellUtils";
import EmailVerificationModalActionCreators from "../../../actions/native/EmailVerificationModalActionCreators";
import openBlockedPaymentsCountryActionSheet from "../../billing/native/openBlockedPaymentsCountryActionSheet";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { canOpenPremiumPlanDirectlyForReferralTrial } from "../../premium/native/referrals/ReferralMessageUtils";
import openPremiumPlanSelectionActionSheet from "../../premium/native/openPremiumPlanSelectionActionSheet";
import { openUserSettings } from "../../user_settings/core/native/openUserSettings";
import { parseGiftIntentType } from "../../premium/gifting/utils/PremiumGiftingIntentUtils";
import { openGiftModal } from "../../premium/native/utils/openGiftModal";
import { trackImpression } from "../../app_analytics/useTrackImpression";
import { ImpressionNames, ImpressionTypes } from "../../../_bundle/Module503";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import Module9311 from "../../../_bundle/Module9311";
import MessageActionCreators from "../../../actions/MessageActionCreators";
import { flattenComponents, getParents, canSelectBeEmpty } from "../../interaction_components/InteractionComponentUtils";
import { ComponentType, ButtonStyle } from "../../../flow/Server";
import AlertActionCreators from "../../../actions/AlertActionCreators";
import { executeMessageComponentInteraction } from "../../interactions/InteractionUtils";
import { handleWelcomeCtaClicked } from "../../welcome_cta/WelcomeCTAUtils";
import { handleRoleSubscriptionPurchaseSystemMessageCtaClicked } from "../../guild_role_subscriptions/native/system_message/GuildRoleSubscriptionSystemMessageUtils";
import { setUserSuppress } from "../../stage_channels/StageChannelActionCreators";
import { GuildIncidentActionSources } from "../../guild_antiraid/GuildAntiRaidTypes";
import { getIncidentAlertType } from "../../guild_antiraid/GuildAntiRaidUtils";
import showModerateUserActionSheet from "../../guild_automod/native/showModerateUserActionSheet";
import { openSubmitFeedback } from "../../guild_automod/GuildAutomodActionActionCreators.native";
import { transitionToThread, transitionToMessage, tryTransitionToThreadMessage } from "../../routing/transitionToChannel";
import { copy } from "../../../utils/ClipboardUtils.native";
import { presentCopiedToClipboard } from "../../toast/native/ToastUtils";
import { getForumOriginalPoster } from "../../forums/native/ForumOriginalPoster";
import { logVoiceMessagePlaybackStarted, logVoiceMessagePlaybackEnded, logVoiceMessagePlaybackFailed } from "../../voice_messages/VoiceMessageAnalytics";
import { logMediaAttachmentPlaybackStarted, logMediaAttachmentPlaybackEnded } from "../../media/MediaAnalytics";
import { canViewChannel } from "../../links/LinkUtils";
import { startLurking } from "../../../utils/GuildDiscoveryUtils";
import { dismissMediaPostSharePrompt } from "../../media_channel/MediaChannelActionCreators";
import * as _ExplicitMediaRedactionUtils from "../../explicit_media_redaction/ExplicitMediaRedactionUtils";
import { trackToggleMediaObscurityV2 } from "../../explicit_media_redaction/ExplicitMediaRedactionUtils";
import { maybePerformReactiveCheck } from "../../age_assurance/AgeVerificationUtils";
import AgeVerificationActionCreators_native from "../../age_assurance/AgeVerificationActionCreators.native";
import { AgeVerificationModalEntryPoint, trackAgeVerificationDmClicked, AgeVerificationDmCta } from "../../age_assurance/AgeVerificationAnalyticsUtils";
import PollsActionCreators from "../../polls/PollsActionCreators";
import { extractMediaSourcesFromMessage } from "../../media_viewer/native/MediaSourceUtil";
import { openMediaModal } from "../../media_viewer/native/components/openMediaModal";
import { CtaButtonType } from "../CtaButtonUtils";
import { handleSenderFalsePositiveFlow } from "../../explicit_media_redaction/ExplicitMediaActionCreators.native";
import { resumeFamilyCenterConnection } from "../../parent_tools/native/FamilyCenterNativeUtils";
import { getMessageAccessibilityActionFromLabel, MessageAccessibilityAction } from "./MessageAccessibilityActions";
import showChatGDMCustomizeActionSheet from "../../group_dm/native/showChatGDMCustomizeActionSheet";
import openPinnedMessages from "./openPinnedMessages";
import jumpToReferencedMessage from "./jumpToReferencedMessage";
import handleForwardBreadcrumb from "../../forwarding/handleForwardBreadcrumb";
import { getInlineForwardOptions } from "../../forwarding/getInlineForwardOptions";
import { openForwardModal } from "../../forwarding/native/ForwardModalUtils";
import openSoundmojiActionSheet from "../../premium/sounds/soundmoji/native/utils/openSoundmojiActionSheet";
import { onTapContentInventoryEntryEmbed } from "../../content_inventory/ContentInventoryActionCreators";
import { onTapCheckpointCard } from "../../checkpoint/native/onTapCheckpointCard";
import { handleTapAppMessageEmbed } from "../../applications/message_embed/native/createAppMessageEmbed";
import { handleTapPreviewSharedClientTheme } from "../../client_themes/native/chat/previewSharedClientTheme";
import { handleSharedClientThemeViewed } from "../../client_themes/native/chat/sharedClientThemeViewed";
const _excluded = ["messageId"];
const _excluded2 = ["messageId"];
const location_stack = [AnalyticsLocation.PREMIUM_GIFT_INTENT_CARD];
export class MessagesHandlers {
constructor(a0) {
let c18354_0;
let c18355_0;
const _this = this;
this.getMessageData = (a0) => {
if (a0 == null) {
return null;
}
const message = (0, _this.params.getMessage)(a0);
if (message == null) {
return null;
}
const channel2 = ChannelStore.getChannel(message.channel_id);
return channel2 == null ? null : {
message,
messageChannel: channel2
};
};
this.isModalOrActionsheetObstructing = () => isAlertOrActionSheetOpen(_this.params.selectedChannelId);
this.handleTapImage = ({ nativeEvent }) => {
const messageData = _this.getMessageData(nativeEvent.id);
if (messageData != null) {
import("./handlers/handleMessagesTapImage").then((result) => {
(0, result.handleMessagesTapImage)({
tapImageData: nativeEvent,
allowWithinModal: false,
message: messageData.message,
messageChannel: messageData.messageChannel,
selectedChannelId: _this.params.selectedChannelId
});
});
}
};
this.handleTapChannel = (a0) => {
if (!_this.isModalOrActionsheetObstructing()) {
const data = getNativeSyntheticEventData(a0).data;
import("./handlers/handleMessagesTapChannel").then((result) => {
(0, result.handleMessagesTapChannel)({
data,
dismissKeyboard: () => {
const current = _this.getParams().chatInputRef.current;
return current == null ? void 0 : current.dismissKeyboard();
}
});
});
}
};
this.handleLongPressChannel = (a0) => {
if (!_this.isModalOrActionsheetObstructing()) {
const data2 = getNativeSyntheticEventData(a0).data;
import("./handlers/handleMessagesLongPressChannel").then((result) => {
(0, result.handleMessagesLongPressChannel)({
data: data2
});
});
}
};
this.handleTapAttachmentLink = (a0) => {
if (!_this.isModalOrActionsheetObstructing()) {
contentHandlers.onTapAttachmentLink(a0);
}
};
this.handleLongPressAttachmentLink = (a0) => {
if (!_this.isModalOrActionsheetObstructing()) {
contentHandlers.onLongPressAttachmentLink(a0);
}
};
this.handleTapCall = (a0) => {
const data3 = getNativeSyntheticEventData(a0).data;
const { channelId, messageId: messageId2 } = data3;
const channel = ChannelStore.getChannel(channelId);
if (channel != null && channel.isPrivate()) {
if (checkIsCallActive(channelId, messageId2)) {
handleJoinCall(channel);
} else {
showSimpleActionSheet({
key: "CallTap",
options: [{
label: intl.string(t.focH1t),
IconComponent: PhoneCallIcon,
onPress: () => {
handleStartCall(channel);
}
}, {
label: intl.string(t.oCqlGG),
IconComponent: VideoIcon,
onPress: () => {
handleStartCall(channel, true);
}
}],
hasIcons: true
});
}
}
};
this.handleTapMention = (a0) => {
if (!_this.isModalOrActionsheetObstructing()) {
contentHandlers.onTapMention(a0);
}
};
this.handleTapCommandMention = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { channelId, commandName, commandId } = nativeSyntheticEventData2;
const chatInputRef = _this.getParams().chatInputRef;
const current = chatInputRef.current;
let currentText = current == null ? void 0 : current.getText();
if (currentText == null) {
currentText = "";
}
handleTapCommandMention({
channelId,
currentText,
commandId,
commandName,
onOpenCustomKeyboard: (a0) => {
const current = chatInputRef.current;
return current == null ? void 0 : current.openCustomKeyboard(a0);
},
onSetCommand: () => {
ActionSheetActionCreators.hideActionSheet();
navigateToLastChannel();
const current = chatInputRef.current;
if (current != null) {
current.openSystemKeyboard();
}
const current2 = chatInputRef.current;
if (current2 != null) {
const applicationCommandManager = current2.getApplicationCommandManager();
if (applicationCommandManager != null) {
applicationCommandManager.setPartialCommand(commandId, commandName, ApplicationCommandTriggerLocations.MENTION);
}
}
}
});
};
this.handleLongPressCommandMention = ({ nativeEvent: nativeEvent3 }) => {
handleLongPressCommandMention(nativeEvent3.commandName, nativeEvent3.commandId);
};
this.handleTapGameMention = (a0) => {
if (!_this.isModalOrActionsheetObstructing()) {
const nativeSyntheticEventData = getNativeSyntheticEventData(a0);
import("./handlers/handleMessagesTapGameMention").then((result) => {
(0, result.handleMessagesTapGameMention)({
gameId: nativeSyntheticEventData.gameId
});
});
}
};
this.handleTapGuildEventLink = ({ url, node }) => {
if (node != null && isLinkTrusted(node)) {
const payload = parseURL(url).payload;
if (payload.type !== LinkingTypes.INVITE) {
return false;
}
if (payload.inviteCode == null) {
return false;
}
const invite = InviteStore.getInvite(payload.inviteCode);
const r26 = invite == null || !isGuildScheduledEventInviteEmbed(invite);
let r31 = !r26;
if (!r26) {
handleAcceptEventInstantInvite(invite);
r31 = true;
}
return r31;
}
return false;
};
this.handleTapLink = ({ nativeEvent: nativeEvent2 }) => {
const messageData2 = _this.getMessageData(nativeEvent2.data.messageId);
import("./handlers/handleMessagesTapLink").then(({ handleMessagesTapLink: handleMessagesTapLink2 }) => {
handleMessagesTapLink2({
allowWithinModal: false,
chatInputRef: _this.params.chatInputRef,
handleTransitionToThread: _this.handleTransitionToThread,
message: messageData2?.message,
messageChannel: messageData2?.messageChannel,
selectedChannelId: _this.params.selectedChannelId,
tapLinkData: nativeEvent2
});
});
};
this.handleLongPressLink = (a0) => {
if (!_this.isModalOrActionsheetObstructing()) {
contentHandlers.onLongPressLink(a0);
}
};
this.handleTapReaction = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { reaction, messageId: messageId2, isBurst } = nativeSyntheticEventData2;
if (!_this.isModalOrActionsheetObstructing()) {
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
handleAddOrRemoveReaction(messageId2, messageData3.messageChannel, reaction != null ? {
...reaction,
emoji: reaction.emoji
} : null, isBurst, a0.nativeEvent.location);
}
}
};
this.handleTapReactionOverflow = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, channelId } = nativeSyntheticEventData2;
if (!_this.isModalOrActionsheetObstructing()) {
handleViewReactions({
messageId: messageId2,
channelId,
location: {
object: AnalyticsObjects.CHANNEL,
objectType: AnalyticsObjectTypes.REACTION_OVERFLOW
}
});
}
};
this.handleLongPressReaction = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { reaction, messageId: messageId2, channelId, isBurst } = nativeSyntheticEventData2;
if (!_this.isModalOrActionsheetObstructing()) {
handleViewReactions({
messageId: messageId2,
channelId,
emoji: reaction != null ? reaction.emoji : null,
isSelectedBurst: isBurst,
location: {
object: AnalyticsObjects.CHANNEL,
objectType: AnalyticsObjectTypes.REACTION
}
});
}
};
this.handleOpenSticker = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { sticker, messageId: messageId2 } = nativeSyntheticEventData2;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
showStickerDetailActionSheet({
renderableSticker: sticker,
channel: messageData3.messageChannel,
chatInputRef: _this.params.chatInputRef
});
}
};
this.handleTapAvatar = (a0) => {
_this.handleOpenProfile(a0, [AnalyticsLocation.AVATAR]);
};
this.handleTapUsername = (a0) => {
L16: {
if (isIOS()) {
_this.handleOpenProfile(a0, [AnalyticsLocation.USERNAME]);
} else {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { userId, messageId: messageId2 } = nativeSyntheticEventData2;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const message = messageData3.message;
if (isCrosspost(message) && message.messageReference.guild_id != null) {
_this.handleOpenProfile(a0, [AnalyticsLocation.USERNAME]);
break L16;
}
if (userId != null) {
const user = UserStore.getUser(userId);
const chatInputRef2 = _this.getParams().chatInputRef;
const messageChannel = messageData3.messageChannel;
const isPrivate = messageChannel.isPrivate();
const r42 = PermissionStore.can(Permissions.SEND_MESSAGES, messageChannel);
const r46 = computeIsReadOnlyThread(messageChannel);
if (!(user === void 0 || (isPrivate ? !isPrivate : !r42) || r46)) {
const current = chatInputRef2.current;
if (current != null) {
current.insertText(getMentionTextWithUser(messageChannel, user), null, true);
}
}
}
}
}
}
};
this.handleLongPressUsername = (a0) => {
_this.handleOpenProfile(a0, [AnalyticsLocation.USERNAME]);
};
this.handleOpenProfile = (a0, a1) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, userId } = nativeSyntheticEventData2;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const { messageChannel, message } = messageData3;
const r22 = userId != null ? UserStore.getUser(userId) : void 0;
let r14 = r22;
if (messageId2 != null) {
if (isPublicSystemMessage(message)) {
ActionSheetActionCreators.openLazy(import("../../public_guilds/native/components/PublicGuildAnnouncementProfile"), "PublicGuildAnnouncementProfile");
return void 0;
}
const r28 = r22 == null ? UserStore.getUser(message.author.id) : r22;
if (isCrosspost(message)) {
const guild_id = message.messageReference.guild_id;
if (guild_id != null) {
ActionSheetActionCreators.openLazy(import("../../guild_profile/native/components/GuildProfileActionSheet"), `GuildProfileActionSheet:${guild_id}`, {
guildId: guild_id
});
return void 0;
}
}
const type = message.type;
const THREAD_STARTER_MESSAGE = MessageTypes.THREAD_STARTER_MESSAGE;
r14 = r28;
if (type === THREAD_STARTER_MESSAGE) {
const messageReference = message.messageReference;
r14 = r28;
if (messageReference != null) {
const messageByReference = ReferencedMessageStore.getMessageByReference(message.messageReference);
r14 = r28;
if (messageByReference != null) {
const message2 = messageByReference.message;
r14 = r28;
if (message2 != null) {
const isCrosspost2 = isCrosspost(messageByReference.message);
r14 = r28;
if (isCrosspost2) {
const messageReference2 = messageByReference.message.messageReference;
r14 = r28;
if (messageReference2 != null) {
const guild_id2 = messageByReference.message.messageReference.guild_id;
r14 = r28;
if (guild_id2 != null) {
const guild_id3 = messageByReference.message.messageReference.guild_id;
ActionSheetActionCreators.openLazy(import("../../guild_profile/native/components/GuildProfileActionSheet"), `GuildProfileActionSheet:${guild_id3}`, {
guildId: guild_id3
});
return void 0;
}
}
}
}
}
}
}
}
if (r14 != null) {
showUserProfileActionSheet({
userId: r14.id,
channelId: messageChannel.id,
messageId: messageId2,
sourceAnalyticsLocations: a1
});
}
}
};
this.handleTapThreadEmbed = (a0) => {
const messageId2 = getNativeSyntheticEventData(a0).messageId;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const guildId2 = messageData3.messageChannel.getGuildId();
if (messageId2 != null && guildId2 != null) {
const current = _this.getParams().chatInputRef.current;
if (current != null) {
current.blur();
}
_this.handleTransitionToThread(guildId2, SnowflakeUtils.castMessageIdAsChannelId(messageId2), OpenThreadAnalyticsLocations.EMBED);
}
}
};
this.handleTapReply = (a0) => {
const originId = a0.nativeEvent.originId;
const messageData3 = _this.getMessageData(originId);
if (messageData3 != null) {
const { messageChannel, message } = messageData3;
let r6 = messageChannel.getGuildId();
if (r6 == null) {
r6 = ME;
}
const message_id = message.messageReference?.message_id;
if (message_id != null) {
trackRepliedMessageClicked(message, ReferencedMessageStore.getMessageByReference(message.messageReference), messageChannel);
_this.handleTransitionToMessage(r6, messageChannel.id, message_id);
}
}
};
this.handleTapSummary = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { channelId, messageId: messageId2, summaryId } = nativeSyntheticEventData2;
if (_this.getMessageData(messageId2) != null) {
const summary = SummaryStore.findSummary(channelId, summaryId);
if (summary != null) {
ActionSheetActionCreators.openLazy(import("../../summaries/native/SummaryActionSheet"), "SummaryActionSheet", {
summary
});
}
}
};
this.handleTapSummaryJump = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, channelId, summaryId } = nativeSyntheticEventData2;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const { messageChannel, message } = messageData3;
let r9 = messageChannel.getGuildId();
if (r9 == null) {
r9 = ME;
}
_this.handleTransitionToMessage(r9, messageChannel.id, message.id);
SummaryActionCreators.setSelectedSummary(channelId, summaryId);
}
};
this.handleLongPressMessage = (a0) => {
L9: {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, mediaIndex, mediaType, componentId, componentMediaIndex } = nativeSyntheticEventData2;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const { messageChannel, message } = messageData3;
if (!_this.isModalOrActionsheetObstructing()) {
const user = UserStore.getUser(message.author.id);
if (user == null && message.state !== MessageStates.SEND_FAILED) {
break L9;
}
if (UploadStore.getUploaderFileForMessageId(messageId2) != null && message.state !== MessageStates.SEND_FAILED) {
break L9;
}
let selectedMedia = getLongPressSelectedMedia(message, mediaIndex, mediaType, asComponentId(componentId), componentMediaIndex);
const r64 = {
analyticsLocation: {
section: AnalyticsSections.CHANNEL,
object: AnalyticsObjects.MESSAGE
},
canAddNewReactions: canAddNewReactions(messageChannel),
channel: messageChannel,
chatInputRef: _this.params.chatInputRef,
message,
selectedMedia: null,
user: null
};
if (selectedMedia == null) {
selectedMedia = void 0;
}
r64.selectedMedia = selectedMedia;
r64.user = user;
showLongPressMessageActionSheet(r64);
}
}
}
};
this.handleInitiateReply = (a0) => {
const chatInputRef2 = _this.params.chatInputRef;
const messageData3 = _this.getMessageData(getNativeSyntheticEventData(a0).messageId);
if (messageData3 != null) {
const { messageChannel, message } = messageData3;
if (a0.nativeEvent.triggerHaptic) {
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
}
let location2 = a0.nativeEvent.location;
if (location2 == null) {
location2 = "message_swipe";
}
replyToMessage({
message,
channel: messageChannel,
chatInputRef: chatInputRef2,
actionSource: location2,
invertible: true
});
}
};
this.handleInitiateThread = (a0) => {
const messageData3 = _this.getMessageData(getNativeSyntheticEventData(a0).messageId);
if (messageData3 != null) {
const { messageChannel, message } = messageData3;
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
if (message.hasFlag(MessageFlags.HAS_THREAD)) {
transitionToGuild(messageChannel.guild_id, SnowflakeUtils.castMessageIdAsChannelId(message.id));
} else {
handleCreateThread(messageChannel, message, "Message Shortcut");
}
}
};
this.handleInitiateEdit = (a0) => {
const chatInputRef2 = _this.params.chatInputRef;
const messageData3 = _this.getMessageData(getNativeSyntheticEventData(a0).messageId);
if (messageData3 != null) {
const { messageChannel, message } = messageData3;
if (canEditMessage(message, UserStore.getCurrentUser()?.id)) {
handleEdit(message, messageChannel, chatInputRef2, "message_swipe", true);
}
}
};
this.handleTapMessage = (a0) => {
L16: {
const messageId2 = getNativeSyntheticEventData(a0).messageId;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const { messageChannel, message } = messageData3;
const guildId2 = messageChannel.getGuildId();
if (message != null && guildId2 != null) {
const type = message.type;
if (MessageTypes.GUILD_BOOST !== type && MessageTypes.GUILD_BOOST_TIER_1 !== type && MessageTypes.GUILD_BOOST_TIER_2 !== type && MessageTypes.GUILD_BOOST_TIER_3 !== type) {
if (MessageTypes.AUTO_MODERATION_ACTION !== type) {
break L16;
}
if (!isAutomodMessageRecord(message)) {
break L16;
}
const r35 = extractAutomodMessageFields(message);
const { embedChannel, flaggedMessageId } = r35;
if (!(flaggedMessageId != null && embedChannel != null)) {
break L16;
}
_this.handleTransitionToMessage(guildId2, embedChannel?.id, flaggedMessageId);
break L16;
}
openApplyBoostModal(guildId2);
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.PREMIUM_GUILD_PROMOTION_OPENED, {
location: {
section: AnalyticsSections.CHANNEL_TEXT_AREA,
object: AnalyticsObjects.BOOST_ANNOUNCEMENT_UPSELL
}
});
}
}
}
};
this.handleDoubleTapMessage = (a0) => {
const messageData3 = _this.getMessageData(getNativeSyntheticEventData(a0).messageId);
if (messageData3 != null) {
handleAddDefaultDoubleTapReaction(messageData3.message, messageData3.messageChannel);
}
};
this.handleTapSeparator = ({ nativeEvent: nativeEvent3 }) => {
if (!_this.isModalOrActionsheetObstructing()) {
const type = nativeEvent3.type;
if (SeparatorAction.LOAD_MORE_BEFORE === type) {
_this.params.loadMoreBefore();
} else if (SeparatorAction.LOAD_MORE_AFTER === type) {
_this.params.loadMoreAfter();
} else if (SeparatorAction.TOGGLE_BLOCKED_MESSAGES === type && nativeEvent3.context != null) {
_this.handleReveal(nativeEvent3.context);
}
}
};
this.handleTapCancelUploadItem = ({ nativeEvent: nativeEvent3 }) => {
const { uploaderId, itemId } = nativeEvent3;
const uploads = _this.params.uploads;
if (uploads != null) {
const r15 = uploads.find((upload) => upload.id === uploaderId);
if (r15 != null) {
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
UploadActionCreators.cancelUploadItem(r15, itemId);
}
}
};
this.handleTapSpotifyResource = ({ author }) => {
if (author != null && author.id != null) {
openTrack(PresenceStore.findActivity(author.id, (a0) => a0.type === ActivityTypes.LISTENING));
}
};
this.handleTapActivityResource = (a0) => {
const { author, activity, application } = a0;
if (author != null && activity != null && application != null && author.id != null) {
const channel_id = a0.channel_id;
const channel2 = ChannelStore.getChannel(channel_id);
const { id: id3, deeplink_uri } = application;
const applicationActivity = PresenceStore.getApplicationActivity(author.id, id3);
if (applicationActivity != null) {
const session_id = applicationActivity.session_id;
if (session_id == null) {
return void 0;
}
const r15 = isIOS() ? ActivityGamePlatforms.IOS : isAndroid() ? ActivityGamePlatforms.ANDROID : void 0;
const isEmbeddedApplication = applicationActivity.flags != null && hasFlag(applicationActivity.flags, ActivityFlags.EMBEDDED);
let isGameLaunchable = r15 != null;
if (isGameLaunchable) {
const supported_platforms = applicationActivity.supported_platforms;
isGameLaunchable = supported_platforms == null ? void 0 : supported_platforms.includes(r15);
}
if (isGameLaunchable == null) {
isGameLaunchable = false;
}
let application2 = ApplicationStore.getApplication(id3);
if (application2 == null) {
application2 = null;
}
if (application2 == null) {
return void 0;
}
const canJoin = getCanJoin({
presenceActivity: applicationActivity,
currentUserPresenceActivity: getCurrentUserPresenceActivity(LocalActivityStore, SelfPresenceStore, id3),
currentUserId: AuthenticationStore.getId(),
message: a0,
application: application2,
isEmbeddedApplication,
isFrameApplication: false,
isGameLaunchable
});
const { canJoin: canJoin2, remoteJoinPlatform } = canJoin;
const remotePartyId = remoteJoinPlatform != null ? applicationActivity.party?.id : void 0;
if (!canJoin2 && getSupportsRemoteJoin(applicationActivity) && getShouldShowAppAuthPrompt(application2)) {
startAuthorizationNoHook(application2, [AnalyticsLocation.INVITE_EMBED]);
return void 0;
}
GamesActionCreators_native.join({
userId: author.id,
sessionId: session_id,
application,
channelId: channel_id,
messageId: a0.id,
applicationActivity,
remotePartyId,
embedded: isEmbeddedApplication,
source: AnalyticsLocations.MESSAGE_EMBED,
analyticsLocations: [AnalyticsLocation.INVITE_EMBED]
});
trackApplicationOpen({
type: AnalyticsGameOpenTypes.JOIN,
source: AnalyticsLocations.MESSAGE_EMBED,
userId: a0.author.id,
guildId: channel2?.guild_id,
channelId: channel_id,
applicationId: id3,
partyId: applicationActivity.party?.id,
messageId: a0.id,
analyticsLocations: [AnalyticsLocation.INVITE_EMBED],
remoteJoinPlatform
});
} else if (deeplink_uri != null) {
Linking.openURL(deeplink_uri, WebBrowserType.SAFARI);
trackApplicationOpen({
type: AnalyticsGameOpenTypes.PLAY,
source: AnalyticsLocations.MESSAGE_EMBED,
userId: a0.author.id,
guildId: channel2?.guild_id,
channelId: channel_id,
applicationId: application.id,
messageId: a0.id,
analyticsLocations: [AnalyticsLocation.INVITE_EMBED]
});
}
}
};
this.handleTapStreamRequest = (a0) => {
if (_slicedToArray(canFulfillStreamRequest(a0, true), 1)[0]) {
const channel2 = ChannelStore.getChannel(a0.channel_id);
if (channel2 != null) {
getStreamPressHandler({
channel: channel2,
hasPermission: true,
isActive: false,
osRequirement: getOSRequirement()
})();
}
}
};
this.handleTapActivityInviteToJoin = (a0) => {
const { author, application } = a0;
if (author != null && application != null && author.id != null) {
const applicationActivity = SelfPresenceStore.getApplicationActivity(application.id, true);
if (applicationActivity != null) {
ActivitiesActionCreators.sendActivityInvite({
channelId: a0.channel_id,
type: ActivityActionTypes.JOIN,
activity: applicationActivity,
location: AnalyticsLocations.MESSAGE_EMBED
});
}
}
};
this.handleTapGuildEventInvite = (a0) => {
let r32;
const { invite, isMember, primary, secondary } = a0;
let guildEventId = a0.guildEventId;
const recurrenceId = a0.recurrenceId;
if (invite != null) {
guildEventId = invite.guild_scheduled_event?.id;
}
const guildScheduledEvent = GuildScheduledEventStore.getGuildScheduledEvent(guildEventId);
if (guildScheduledEvent != null && guildEventId != null) {
if (!isMember && invite != null) {
handleAcceptEventInstantInvite(invite);
return {
action: "accept"
};
}
if (secondary) {
const r44 = invite != null ? generateInviteKeyFromExtraData({
baseCode: invite.code,
guildScheduledEventId: guildEventId
}) : null;
openShareEvent(guildScheduledEvent, r44 != null ? getInviteURL(r44) : void 0);
return {
action: "share"
};
}
if (primary && isGuildScheduledEventActive(guildScheduledEvent)) {
transitionToEventDetailsFromInvite(guildScheduledEvent, recurrenceId);
r32 = {
action: "transition"
};
} else if (primary) {
handleGuildScheduledEventRsvp(guildScheduledEvent.id, recurrenceId, guildScheduledEvent.guild_id);
r32 = {
action: "rsvp"
};
} else {
transitionToEventDetailsFromInvite(guildScheduledEvent, recurrenceId);
r32 = {
action: "transition"
};
}
return r32;
}
return {
action: "noop"
};
};
this._questsEmbedOnPress = (a0) => {
if (!isMetaQuest()) {
const r16 = findQuestOrReplacement(a0, QuestStore.quests, QuestStore.excludedQuests);
if (r16 != null) {
openQuestHome({
scrollToQuestId: r16.id,
fromContent: QuestContent.QUEST_EMBED_MOBILE
});
} else {
openQuestHome({
fromContent: QuestContent.QUEST_EMBED_MOBILE
});
}
}
};
this._questsEmbedOnAccept = (a0) => {
if (isMetaQuest()) {
openDiscordQuestsFAQ();
} else {
const r21 = findQuestOrReplacement(a0, QuestStore.quests, QuestStore.excludedQuests);
const r2 = QuestStore.questEnrollmentBlockedUntil != null;
if (r21 != null) {
if (r2) {
openQuestHome({
scrollToQuestId: r21.id,
fromContent: QuestContent.QUEST_EMBED_MOBILE
});
} else {
let r35 = r21.userStatus?.enrolledAt != null;
const r45 = r21.config.expiresAt < new Date().toISOString();
if (!r35) {
r35 = r45;
}
if (!r35) {
enrollInQuest(r21.id, {
questContent: QuestContent.QUEST_EMBED_MOBILE,
questContentCTA: QuestContentCTA.ACCEPT_QUEST,
sourceQuestContent: QuestContent.QUEST_EMBED_MOBILE
});
}
openQuestHome({
scrollToQuestId: r21.id,
fromContent: QuestContent.QUEST_EMBED_MOBILE
});
}
} else {
openQuestHome({
fromContent: QuestContent.QUEST_EMBED_MOBILE
});
}
}
};
this.handleTapInviteEmbedAccept = (a0) => {
let r42, action, inviteInstanceId;
L55: {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, index, primary, secondary } = nativeSyntheticEventData2;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const message = messageData3.message;
const current = _this.getParams().chatInputRef.current;
if (current != null) {
current.dismissKeyboard();
}
L11: {
if (message.type === MessageTypes.THREAD_STARTER_MESSAGE && message.messageReference != null) {
const message2 = ReferencedMessageStore.getMessageByReference(message.messageReference).message;
const r2 = message2 == null;
r42 = void 0;
if (r2) {
break L11;
}
r42 = message2.codedLinks;
} else {
r42 = message.messageSnapshots.length > 0 ? message.messageSnapshots[0].message.codedLinks : message.codedLinks;
}
}
const r50 = r42 == null ? void 0 : r42[index];
if (r50 != null) {
if (r50.type === CodedLinkType.INVITE) {
const invite = InviteStore.getInvite(r50.code);
if (invite == null) {
return void 0;
}
const id3 = AuthenticationStore.getId();
const isMember = GuildMemberStore.isMember(invite == null ? void 0 : invite.guild?.id, id3);
let r135 = false;
if (isMember) {
const r137 = invite.roles != null;
r135 = false;
if (r137) {
const r141 = invite.roles.length > 0;
r135 = false;
if (r141) {
const r145 = invite.guild?.id != null;
r135 = false;
if (r145) {
const member = GuildMemberStore.getMember(invite.guild.id, id3);
const r151 = Set;
let r153 = member?.roles;
if (r153 == null) {
r153 = [];
}
let c26855_0 = new r151(r153);
r135 = invite.roles.some((role) => !c26855_0.has(role.id));
}
}
}
}
L46: {
inviteInstanceId = getInviteInstanceId(r50.code, message.id);
if (isGuildScheduledEventInviteEmbed(invite)) {
action = _this.handleTapGuildEventInvite({
invite,
isMember,
primary,
secondary
}).action;
} else {
if (isMember && !r135) {
_this.handleTransitionToInviteChannel(invite);
action = "transition";
break L46;
}
_this.handleAcceptInstantInvite(invite, inviteInstanceId);
action = "accept";
}
}
const id4 = invite.guild?.id;
trackInviteEmbedActioned({
invite,
action,
inviter_id: message.author.id,
invite_message_id: message.id,
invite_instance_id: inviteInstanceId
}, id4 != null && (getGuildInviteExtendedType(invite) === GuildInviteExtendedType.VOICE_CHANNEL && (getVoiceChannelListInviteExperiment({
guildId: id4,
location: "mobile_invite_embed"
}).enabled && canShowVoiceChannelListInviteEmbed(invite))) ? [AnalyticsLocation.INVITE_EMBED, AnalyticsLocation.VOICE_CHANNEL_LIST_INVITE_EMBED] : [AnalyticsLocation.INVITE_EMBED]);
} else if (r50.type === CodedLinkType.CHANNEL_LINK) {
const r117 = _slicedToArray(r50.code.split("/"), 2);
_this.handleTapVoiceChannelPreview({
guildId: r117[0],
channelId: r117[1],
message
});
} else {
if (r50.type !== CodedLinkType.BUILD_OVERRIDE && r50.type !== CodedLinkType.MANUAL_BUILD_OVERRIDE) {
if (r50.type === CodedLinkType.QUESTS_EMBED) {
_this._questsEmbedOnAccept(r50.code);
break L55;
}
if (r50.type !== CodedLinkType.SOCIAL_LAYER_STOREFRONT && r50.type !== CodedLinkType.SOCIAL_LAYER_STOREFRONT_APP) {
break L55;
}
openSocialLayerStorefrontProductDetailsModal({
skuId: _slicedToArray(r50.code.split("-"), 1)[0],
analyticsLocations: [AnalyticsLocation.GIFT_CODE_EMBED]
});
break L55;
}
toggleOverride(r50.code);
}
}
}
}
};
this.handleTapInviteEmbed = (a0) => {
let r41, action;
L81: {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, index, primary, secondary } = nativeSyntheticEventData2;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const message = messageData3.message;
const current = _this.getParams().chatInputRef.current;
if (current != null) {
current.dismissKeyboard();
}
L11: {
if (message.type === MessageTypes.THREAD_STARTER_MESSAGE && message.messageReference != null) {
const message2 = ReferencedMessageStore.getMessageByReference(message.messageReference).message;
const r2 = message2 == null;
r41 = void 0;
if (r2) {
break L11;
}
r41 = message2.codedLinks;
} else {
r41 = message.messageSnapshots.length > 0 ? message.messageSnapshots[0].message.codedLinks : message.codedLinks;
}
}
const r20 = r41 == null ? void 0 : r41[index];
if (r20 != null) {
const id3 = AuthenticationStore.getId();
if (r20.type !== CodedLinkType.INVITE && r20.type !== CodedLinkType.EMBEDDED_ACTIVITY_INVITE) {
if (r20.type === CodedLinkType.TEMPLATE) {
GuildTemplateActionCreators.showModal(r20.code);
break L81;
}
if (r20.type !== CodedLinkType.BUILD_OVERRIDE && r20.type !== CodedLinkType.MANUAL_BUILD_OVERRIDE) {
if (r20.type === CodedLinkType.EXPERIMENT) {
const experimentFromEmbedURL = getExperimentFromEmbedURL(r20.code);
if (experimentFromEmbedURL == null) {
return void 0;
}
handleCodedLinkExperimentEmbedTap(experimentFromEmbedURL, getExperimentTreatmentFromEmbedURL(r20.code));
break L81;
}
if (r20.type === CodedLinkType.EVENT) {
const [r198, guildEventId, recurrenceId] = r20.code.split("-");
_this.handleTapGuildEventInvite({
invite: null,
isMember: GuildMemberStore.isMember(r198, id3),
primary,
secondary,
guildEventId,
recurrenceId
});
break L81;
}
if (r20.type === CodedLinkType.CHANNEL_LINK) {
const r185 = _slicedToArray(r20.code.split("/"), 2);
_this.handleTapVoiceChannelPreview({
guildId: r185[0],
channelId: r185[1],
message
});
break L81;
}
if (r20.type === CodedLinkType.APP_DIRECTORY_PROFILE) {
const application2 = ApplicationDirectoryApplicationsStore.getApplication(r20.code);
if (application2 == null) {
return void 0;
}
installApplication({
applicationId: application2.id,
customInstallUrl: application2.custom_install_url,
installParams: application2.install_params,
integrationTypesConfig: application2.integration_types_config,
source: "app_directory_profile_embed"
});
break L81;
}
if (r20.type === CodedLinkType.QUESTS_EMBED) {
_this._questsEmbedOnPress(r20.code);
break L81;
}
if (r20.type !== CodedLinkType.SOCIAL_LAYER_STOREFRONT && r20.type !== CodedLinkType.SOCIAL_LAYER_STOREFRONT_APP) {
if (r20.type !== CodedLinkType.APP_OAUTH2_LINK) {
throw Error(`Unknown coded link type: ${r20.type}`);
}
const application = ApplicationStore.getApplication(r20.code);
if (application == null) {
return void 0;
}
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.APP_OAUTH2_LINK_EMBED_CTA_CLICKED, {
application_id: application.id
});
installApplication({
applicationId: application.id,
customInstallUrl: application.customInstallUrl,
installParams: application.installParams,
integrationTypesConfig: application.integrationTypesConfig,
source: "app_oauth2_link_embed"
});
break L81;
}
openSocialLayerStorefrontProductDetailsModal({
skuId: _slicedToArray(r20.code.split("-"), 1)[0],
analyticsLocations: [AnalyticsLocation.GIFT_CODE_EMBED]
});
break L81;
}
toggleOverride(r20.code);
break L81;
}
const invite = InviteStore.getInvite(r20.code);
const isMember = GuildMemberStore.isMember(invite == null ? void 0 : invite.guild?.id, id3);
if (invite == null) {
return void 0;
}
const id4 = invite.guild?.id;
const r246 = id4 != null && getGuildInviteExtendedType(invite) === GuildInviteExtendedType.VOICE_CHANNEL && getVoiceChannelListInviteExperiment({
guildId: id4,
location: "mobile_invite_embed"
}).enabled && canShowVoiceChannelListInviteEmbed(invite);
L74: {
if (isGuildScheduledEventInviteEmbed(invite)) {
action = _this.handleTapGuildEventInvite({
invite,
isMember,
primary,
secondary
}).action;
} else {
if (r246) {
if (invite.channel?.id != null) {
const channel2 = ChannelStore.getChannel(invite.channel.id);
const r312 = channel2 != null;
action = "noop";
if (!r312) {
break L74;
}
const guildId2 = channel2.getGuildId();
if (guildId2 != null && guildId2 !== SelectedGuildStore.getGuildId()) {
_transitionToGuild_native.transitionToGuild(guildId2);
}
navigateToVoiceChannel(channel2, "Mobile Invite Embed");
action = "voice channel preview";
break L74;
}
}
if (invite.guild?.id != null) {
ActionSheetActionCreators.openLazy(import("../../guild_profile/native/components/GuildProfileActionSheet"), `GuildProfileActionSheet:${invite.guild.id}`, {
guildId: invite.guild.id,
context: GuildProfileCTAContext.INVITE,
inviteKey: r20.code
});
action = "show profile";
} else if (isMember) {
_this.handleTransitionToInviteChannel(invite);
action = "transition";
} else {
_this.handleAcceptInstantInvite(invite, getInviteInstanceId(r20.code, message.id));
action = "accept";
}
}
}
trackInviteServerClicked(invite == null ? void 0 : invite.guild?.id, action, r246 ? [AnalyticsLocation.INVITE_EMBED, AnalyticsLocation.VOICE_CHANNEL_LIST_INVITE_EMBED] : [AnalyticsLocation.INVITE_EMBED]);
}
}
}
};
this.handleTapVoiceChannelPreview = (a0) => {
L9: {
const { guildId: guildId2, channelId, message } = a0;
const guildId3 = SelectedGuildStore.getGuildId();
const channelId2 = SelectedChannelStore.getChannelId(guildId3);
const channel2 = ChannelStore.getChannel(channelId);
if (channel2 != null) {
AnalyticsUtils.track(AnalyticEvents.CHANNEL_LINK_PREVIEW_JOINED, {
author_id: message.author.id,
link_guild_id: guildId2,
link_channel_id: channelId,
link_channel_type: channel2.type,
guild_id: guildId3,
channel_id: channelId2
});
const current = _this.getParams().chatInputRef.current;
if (current != null) {
current.dismissKeyboard();
}
if (!shouldShowAgeGateForVoiceChannel(channelId) && !shouldShowSpoilerGateForChannelId(channelId)) {
if (channel2.isGuildStageVoice()) {
connectAndOpen(channel2);
break L9;
}
SelectedChannelActionCreators.selectVoiceChannel(channelId);
openChannelCallModal(channel2);
break L9;
}
transitionTo(Routes.CHANNEL(guildId2, channelId));
}
}
};
this.handleTapJoinActivity = (a0) => {
const messageId2 = getNativeSyntheticEventData(a0).messageId;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const message = messageData3.message;
const activity = message.activity;
if (activity != null) {
const type = activity.type;
if (type === ActivityActionTypes.LISTEN) {
_this.handleTapSpotifyResource(message);
} else if (type === ActivityActionTypes.JOIN) {
_this.handleTapActivityResource(message);
} else if (type === ActivityActionTypes.STREAM_REQUEST) {
_this.handleTapStreamRequest(message);
}
}
}
};
this.handleTapJoinRichPresence = (a0) => {
const messageId2 = getNativeSyntheticEventData(a0).messageId;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const message = messageData3.message;
const activity = message.activity;
if (activity != null) {
const type = activity.type;
if (type === ActivityActionTypes.LISTEN) {
_this.handleTapSpotifyResource(message);
} else if (type === ActivityActionTypes.JOIN) {
_this.handleTapActivityResource(message);
} else if (type === ActivityActionTypes.JOIN_REQUEST) {
_this.handleTapActivityInviteToJoin(message);
} else if (type === ActivityActionTypes.STREAM_REQUEST) {
_this.handleTapStreamRequest(message);
}
}
}
};
this.handleAcceptInstantInvite = (a0, a1) => {
if (!handleNSFWGuildInvite(a0) && a0.code != null) {
if (a0.type === InviteTypes.GUILD && isAtGuildCapAndNonPremium()) {
PremiumUpsellUtils.handleShowUpsellAlert({
initialUpsellKey: UpsellTypes.GUILD_CAP,
analyticsLocation: {
page: AnalyticsPages.INVITE_EMBED
},
analyticsLocations: [AnalyticsLocation.INVITE_EMBED],
analyticsProperties: {
type: PremiumUpsellTypes.GUILD_CAP_MODAL_UPSELL
}
});
return void 0;
}
InstantInviteActionCreators.acceptInvite({
inviteKey: a0.code,
context: {
location: "Invite Button Embed",
...a1 != null ? {
invite_instance_id: a1
} : {}
},
callback: _this.handleTransitionToInviteChannel
});
}
};
this.handleTransitionToInviteChannel = (a0) => {
InstantInviteActionCreators.transitionToInvite(a0, {
forceTransition: true
});
};
this.handleTapGiftCodeEmbed = () => {};
this.handleTapGiftCodeAccept = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { giftCode, messageId: messageId2 } = nativeSyntheticEventData2;
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
if (currentUser.verified) {
const r25 = GiftCodeStore.get(giftCode);
if (r25 != null) {
const r10 = r25.giftStyle != null ? _this.getMessageData(messageId2) : void 0;
if (_this.params.paymentsBlocked) {
openBlockedPaymentsCountryActionSheet();
} else {
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
type: "gift_accept",
location: null
});
const r48 = import("../../premium/native/gift_code_modal/GiftCodeRedeemModal");
const customMessage = r10 != null ? r10.message.content : void 0;
const r53 = r10 == null;
let soundId = void 0;
if (!r53) {
const message = r10.message;
const r56 = message == null;
soundId = void 0;
if (!r56) {
const giftInfo = message.giftInfo;
soundId = giftInfo == null ? void 0 : giftInfo.sound?.id;
}
}
const r61 = r10 == null;
let emojiName = void 0;
if (!r61) {
const message2 = r10.message;
const r64 = message2 == null;
emojiName = void 0;
if (!r64) {
const giftInfo2 = message2.giftInfo;
emojiName = giftInfo2 == null ? void 0 : giftInfo2.emoji?.name;
}
}
ModalActionCreators.pushLazy(r48, {
code: giftCode,
customMessage,
soundId,
emojiName
});
}
}
} else {
EmailVerificationModalActionCreators.open();
}
}
};
this.handleTapReferralRedeem = () => {
if (canOpenPremiumPlanDirectlyForReferralTrial()) {
openPremiumPlanSelectionActionSheet({
analyticsLocation: {
page: AnalyticsPages.REFERRAL_MESSAGE_EMBED
},
analyticsLocations: [AnalyticsLocation.REFERRAL_MESSAGE_EMBED],
premiumType: PremiumTypes.TIER_2
});
} else {
openUserSettings({
screen: UserSettingsSections.PREMIUM
});
}
};
this.getGiftIntentCtaContext = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, recipientUserId } = nativeSyntheticEventData2;
const giftIntentType = parseGiftIntentType(nativeSyntheticEventData2.giftIntentType);
if (giftIntentType == null) {
return null;
}
let r23 = _this.params.getMessage(messageId2)?.channel_id;
if (r23 == null) {
r23 = _this.params.selectedChannelId;
}
return {
channel: ChannelStore.getChannel(r23),
giftIntentType,
messageId: messageId2,
recipientUserId
};
};
this.handleTapGiftIntentPrimaryCta = (a0) => {
const giftIntentCtaContext = _this.getGiftIntentCtaContext(a0);
if (giftIntentCtaContext != null) {
const { channel: channel2, giftIntentType, recipientUserId } = giftIntentCtaContext;
AnalyticsUtils.track(AnalyticEvents.GIFT_INTENT_ACTION_BUTTON_CLICKED, {
gift_intent_type: giftIntentType,
affinity: UserAffinitiesV2Store.getUserAffinity(recipientUserId)?.dmProbability,
location_stack
});
openGiftModal({
recipientUserId,
analyticsLocation: {
page: channel2?.guild_id != null ? AnalyticsPages.GUILD_CHANNEL : AnalyticsPages.DM_CHANNEL
},
analyticsLocations: location_stack,
navigationParams: {
presentation: "card"
}
});
}
};
this.handleTapGiftIntentSecondaryCta = (a0) => {
const giftIntentCtaContext = _this.getGiftIntentCtaContext(a0);
if (giftIntentCtaContext != null && giftIntentCtaContext.channel != null) {
AnalyticsUtils.track(AnalyticEvents.GIFT_INTENT_CARD_SECONDARY_CTA_CLICKED, {
gift_intent_type: giftIntentCtaContext.giftIntentType,
cta_type: "send_message",
location_stack
});
ModalActionCreators.pushLazy(import("../../premium/gifting/native/GiftIntentGifModal"), {
channelId: giftIntentCtaContext.channel.id,
giftIntentType: giftIntentCtaContext.giftIntentType
});
}
};
this.handleGiftIntentCardViewed = (a0) => {
const gift_intent_type = parseGiftIntentType(getNativeSyntheticEventData(a0).giftIntentType);
if (gift_intent_type != null) {
trackImpression({
name: ImpressionNames.GIFT_INTENT_CARD,
type: ImpressionTypes.VIEW,
properties: {
gift_intent_type,
num_friend_anniversaries: PremiumGiftingIntentStore.getFriendAnniversaries().length
}
});
}
};
this.handleTapEmoji = (a0) => {
if (!_this.isModalOrActionsheetObstructing()) {
contentHandlers.onTapEmoji(a0);
}
};
this.handleTapTimestamp = (a0) => {
contentHandlers.onTapTimestamp(a0);
};
this.handleTapInlineCode = (a0) => {
contentHandlers.onTapInlineCode(a0);
};
this.handleTapRoleIcon = ({ nativeEvent: nativeEvent3 }) => {
const { roleName, roleIconSource, roleIconUnicodeEmoji } = nativeEvent3;
ToastActionCreators.open({
key: `ROLE_NAME-${roleName}`,
content: roleIconUnicodeEmoji != null ? `${roleIconUnicodeEmoji} ${roleName}` : roleName,
icon: roleIconSource != null ? {
uri: roleIconSource
} : void 0
});
};
this.handleTapVoiceChannelBadge = (a0) => {
const channel2 = ChannelStore.getChannel(getNativeSyntheticEventData(a0).channelId);
if (channel2 != null) {
navigateToVoiceChannel(channel2);
}
};
this.handleTapGameIcon = ({ nativeEvent: nativeEvent3 }) => {
const { gameApplicationId, timestamp } = nativeEvent3;
if (!_this.isModalOrActionsheetObstructing()) {
ActionSheetActionCreators.openLazy(import("./MessageGameIconActionSheet"), "MessageGameIconActionSheet", {
applicationId: gameApplicationId,
messageTimestamp: timestamp
});
}
};
this.handleTapSuppressNotificationsIcon = () => {
ToastActionCreators.open({
key: "SUPPRESS_NOTIFICATIONS_TOOLTIP",
content: intl.string(t["RO/KYj"]),
icon: Module9311
});
};
this.handleTapConnectionsRoleTag = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { userId, guildId: guildId2, channelId, roleId } = nativeSyntheticEventData2;
ActionSheetActionCreators.openLazy(import("../../connections/native/ConnectionsRoleMessageBadgeActionSheet"), "ConnectionsRoleMessageBadgeActionSheet", {
userId,
guildId: guildId2,
channelId,
roleId
});
};
this.handleTapTimeoutIcon = () => {
ToastActionCreators.open({
key: "GUILD_COMMUNICATION_DISABLED_ICON_TOOLTIP_BODY",
content: intl.string(t["AeYyL+"]),
icon: Module9311
});
};
this.handleReveal = (a0) => {
const messageData3 = _this.getMessageData(a0);
if (messageData3 != null) {
MessageActionCreators.revealMessage(messageData3.messageChannel.id, _this.params.revealedMessageId !== a0 ? a0 : null);
}
};
this.handleTapButtonActionComponent = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, componentId } = nativeSyntheticEventData2;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const { messageChannel, message } = messageData3;
let applicationId = message.applicationId;
if (applicationId == null) {
applicationId = message.author.id;
}
const r34 = flattenComponents(message.components).get(asComponentId(componentId));
if (r34 != null && r34.type === ComponentType.BUTTON && r34.customId != null) {
if (r34.style !== ButtonStyle.PREMIUM) {
executeMessageComponentInteraction({
componentType: ComponentType.BUTTON,
messageId: messageId2,
messageFlags: message.flags,
customId: r34.customId,
componentId: asComponentId(componentId),
applicationId,
channelId: messageChannel.id,
guildId: messageChannel.getGuildId()
});
} else {
AlertActionCreators.show({
title: intl.string(t["ZtdF0+"]),
body: intl.string(t["0BEZLT"]),
confirmText: intl.string(t.BddRzS)
});
}
}
}
};
this.handleTapSelectActionComponent = (a0) => {
let messageId, flags, id, id2, guildId, c26856_5;
L18: {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
messageId = nativeSyntheticEventData2.messageId;
const componentId = nativeSyntheticEventData2.componentId;
const messageData3 = _this.getMessageData(messageId);
if (messageData3 != null) {
const { messageChannel, message } = messageData3;
flags = message.flags;
let applicationId = message.applicationId;
if (applicationId == null) {
applicationId = message.author.id;
}
id = applicationId;
id2 = messageChannel.id;
guildId = messageChannel.getGuildId();
const selectionActionComponent = flattenComponents(message.components).get(asComponentId(componentId));
c26856_5 = selectionActionComponent;
if (selectionActionComponent != null) {
const parents = getParents(message.components, selectionActionComponent);
const r45 = parents == null ? void 0 : parents[0];
const r53 = {
channelId: id2,
guildId,
containerId: messageId,
labelComponent: r45?.type === ComponentType.LABEL ? r45 : void 0,
allowEmpty: canSelectBeEmpty(selectionActionComponent, "message"),
onSubmit: (a0) => {
executeMessageComponentInteraction({
componentType: c26856_5.type,
messageId,
messageFlags: flags,
customId: c26856_5.customId,
componentId: c26856_5.id,
applicationId: id,
channelId: id2,
guildId,
localState: a0
});
}
};
const type = selectionActionComponent.type;
if (ComponentType.STRING_SELECT === type) {
ActionSheetActionCreators.openLazy(import("../../interaction_components/native/components/StringSelectComponentActionSheet"), `StringSelectComponentActionSheet:${messageId}`, {
selectionActionComponent,
...r53
});
} else {
if (ComponentType.USER_SELECT !== type && ComponentType.ROLE_SELECT !== type && ComponentType.MENTIONABLE_SELECT !== type) {
if (ComponentType.CHANNEL_SELECT !== type) {
break L18;
}
ActionSheetActionCreators.openLazy(import("../../interaction_components/native/components/ChannelSelectComponentActionSheet"), `ChannelSelectComponentActionSheet:${messageId}`, {
selectionActionComponent,
...r53
});
break L18;
}
ActionSheetActionCreators.openLazy(import("../../interaction_components/native/components/MentionableSelectComponentActionSheet"), `MentionableSelectComponentActionSheet:${messageId}`, {
selectionActionComponent,
...r53
});
}
}
}
}
};
this.handleTapWelcomeReply = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, stickerId } = nativeSyntheticEventData2;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const { messageChannel, message } = messageData3;
if (message.type === MessageTypes.USER_JOIN) {
handleWelcomeCtaClicked(messageChannel, message, stickerId);
} else if (message.type === MessageTypes.ROLE_SUBSCRIPTION_PURCHASE) {
handleRoleSubscriptionPurchaseSystemMessageCtaClicked(messageChannel, message, stickerId);
}
}
};
this.handleTapInviteToSpeak = (a0) => {
const messageData3 = _this.getMessageData(getNativeSyntheticEventData(a0).messageId);
if (messageData3 != null) {
const { messageChannel, message } = messageData3;
if (message.type === MessageTypes.STAGE_RAISE_HAND) {
setUserSuppress(messageChannel, message.author.id, false);
MessageActionCreators.deleteMessage(messageChannel.id, message.id, true);
}
}
};
this.handleTapAutoModerationActions = (a0) => {
L13: {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, channelId } = nativeSyntheticEventData2;
if (!_this.isModalOrActionsheetObstructing()) {
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const { message, messageChannel } = messageData3;
if (isAutomodMessageRecord(message) && messageChannel.id === channelId) {
const guild = GuildStore.getGuild(ChannelStore.getChannel(channelId)?.guild_id);
if (guild != null) {
if (isAutomodMessageRecord(message) && isAutomodNotification(message)) {
const analyticsData = {
source: GuildIncidentActionSources.MESSAGE,
alertType: getIncidentAlertType(GuildIncidentsStore.getGuildIncident(guild.id)),
messageId: message.id
};
ActionSheetActionCreators.openLazy(import("../../guild_antiraid/native/GuildIncidentActionsActionSheet"), "GuildIncidentActionsActionSheet", {
guild,
analyticsData
});
break L13;
}
if (GuildMemberStore.isMember(guild.id, message.author.id)) {
showModerateUserActionSheet({
user: message.author,
guild
});
} else {
ToastActionCreators.open({
key: "GUILD_AUTOMOD_ERROR_MESSAGE_NOT_MEMBER",
content: intl.string(t.UsD2YP),
icon: Module9311
});
}
}
}
}
}
}
};
this.handleTapAutoModerationFeedback = (a0) => {
L8: {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, channelId } = nativeSyntheticEventData2;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
const { message, messageChannel } = messageData3;
if (isAutomodMessageRecord(message) && messageChannel.id === channelId) {
const channel2 = ChannelStore.getChannel(channelId);
if (channel2 != null) {
if (isAutomodMessageRecord(message) && isAutomodNotification(message)) {
ActionSheetActionCreators.openLazy(import("../../guild_antiraid/native/GuildRaidResolveActionSheet"), "GuildRaidResolveActionSheet", {
guildId: channel2.guild_id,
messageId: messageId2
});
break L8;
}
const r42 = extractAutomodMessageFields(message);
openSubmitFeedback(messageId2, r42.content, r42.decisionId, channel2);
}
}
}
}
};
this.handleTransitionToThread = (a0, a1, a2) => {
const channel2 = ChannelStore.getChannel(a1);
if (channel2 != null) {
transitionToThread(channel2, {
source: a2,
navigationReplace: false
});
}
};
this.handleTransitionToMessage = (a0, a1, a2) => {
transitionToMessage(a1, a2, {
navigationReplace: false
});
};
this.handleTapFollowForumPost = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, channelId } = nativeSyntheticEventData2;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
handleToggleFollowForumPost(messageData3.messageChannel, JoinedThreadsStore.hasJoined(channelId));
}
};
this.handleTapShareForumPost = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
handleCopyLinkForumPost(nativeSyntheticEventData2.guildId, nativeSyntheticEventData2.channelId, {
section: AnalyticsSections.CHANNEL
});
};
this.handleTapSeeMore = () => {};
this.handleCopyText = (a0) => {
copy(a0.nativeEvent.text);
presentCopiedToClipboard();
};
this.handleTapTag = (a0) => {
_this.getMessageData(getNativeSyntheticEventData(a0).messageId);
};
this.handleTapOpTag = () => {
ToastActionCreators.open({
key: `FORUM_OP-${_this.params.selectedChannelId}`,
content: getForumOriginalPoster
});
};
this.handleMediaAttachmentPlaybackStarted = (a0) => {
let attachmentId;
L9: {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, totalDurationSecs, startDurationSecs, isVoiceMessage } = nativeSyntheticEventData2;
attachmentId = nativeSyntheticEventData2.attachmentId;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
if (isVoiceMessage !== void 0 && !isVoiceMessage) {
const contentMessage = messageData3.message.getContentMessage();
const r13 = contentMessage == null ? void 0 : contentMessage.attachments.find((attachment) => attachment.id === attachmentId);
if (r13 == null) {
return void 0;
}
logMediaAttachmentPlaybackStarted(messageData3.messageChannel, r13, totalDurationSecs, messageId2, startDurationSecs, messageData3.message.author.id);
break L9;
}
logVoiceMessagePlaybackStarted(messageId2, totalDurationSecs, startDurationSecs, messageData3.message.author.id);
}
}
};
this.handleMediaAttachmentPlaybackEnded = (a0) => {
let attachmentId2;
L9: {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, totalDurationSecs, endDurationSecs, durationListeningSecs, isVoiceMessage } = nativeSyntheticEventData2;
attachmentId2 = nativeSyntheticEventData2.attachmentId;
const messageData3 = _this.getMessageData(messageId2);
if (messageData3 != null) {
if (isVoiceMessage !== void 0 && !isVoiceMessage) {
const contentMessage = messageData3.message.getContentMessage();
const r13 = contentMessage == null ? void 0 : contentMessage.attachments.find((attachment) => attachment.id === attachmentId2);
if (r13 == null) {
return void 0;
}
logMediaAttachmentPlaybackEnded(messageId2, totalDurationSecs, endDurationSecs, messageData3.message.author.id, durationListeningSecs, r13);
break L9;
}
logVoiceMessagePlaybackEnded(messageId2, totalDurationSecs, endDurationSecs, messageData3.message.author.id, durationListeningSecs);
}
}
};
this.handleVoiceMessagePlaybackFailed = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const messageId2 = nativeSyntheticEventData2.messageId;
let errorMessage = nativeSyntheticEventData2.errorMessage;
if (errorMessage == null) {
errorMessage = null;
}
logVoiceMessagePlaybackFailed(messageId2, errorMessage);
ToastActionCreators.open({
key: `AUDIO_PLAYBACK_FAILED-${messageId2}`,
content: intl.string(t.gRHMh8),
icon: Module9311
});
};
c18354_0 = void 0;
c18354_0 = async (c30302_0) => {
let c30302_3 = 0;
L18: {
L16: {
try {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(c30302_0);
const { guildId: guildId2, parentChannelId, threadId, messageId: messageId2 } = nativeSyntheticEventData2;
const isMember = GuildMemberStore.isMember(guildId2, UserStore.getCurrentUser()?.id);
const channel2 = ChannelStore.getChannel(parentChannelId);
trackWithMetadata(AnalyticEvents.MEDIA_POST_PREVIEW_EMBED_CLICKED, {
media_post_id: threadId,
can_access: channel2 != null && canViewChannel(channel2),
is_member: isMember
});
if (isMember) {
tryTransitionToThreadMessage(parentChannelId, threadId, messageId2);
break L18;
}
c30302_3 = 1;
await startLurking(guildId2, {}, {
channelId: parentChannelId
});
c30302_3 = 0;
} catch ($e) {
let r36 = $e;
if (c30302_3 !== 0) {
while (true) {
try {
c30302_3 = 0;
break L16;
} catch ($e) {
r36 = $e;
if (c30302_3 === 0) {
break;
}
}
}
}
throw r36;
}
}
return void 0;
}
};
this.handleTapPostPreviewEmbed = function() {
return c18354_0.apply(this, arguments);
};
this.handleTapDismissMediaPostSharePrompt = (a0) => {
dismissMediaPostSharePrompt(SnowflakeUtils.castMessageIdAsChannelId(getNativeSyntheticEventData(a0).messageId));
};
this.handleTapObscuredMediaLearnMore = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, channelId, attachmentId: attachmentId3, embedId } = nativeSyntheticEventData2;
ActionSheetActionCreators.openLazy(import("../../explicit_media_redaction/native/ExplicitMediaLearnMoreActionSheet"), "ExplicitMediaLearnMore", {
messageId: messageId2,
channelId,
attachmentId: attachmentId3,
embedId
});
};
c18355_0 = void 0;
c18355_0 = async (c30303_0) => {
let c30303_2;
let c31599_0, c31599_1;
L18: {
L17: {
c30303_2 = void 0;
c31599_0 = void 0;
c31599_1 = void 0;
const nativeSyntheticEventData2 = getNativeSyntheticEventData(c30303_0);
nativeSyntheticEventData2.messageId;
nativeSyntheticEventData2.channelId;
const isReveal = nativeSyntheticEventData2.isReveal;
c31599_0 = isReveal;
nativeSyntheticEventData2.attachmentId;
nativeSyntheticEventData2.embedId;
const shouldAgeVerifyForExplicitMedia = _ExplicitMediaRedactionUtils.shouldAgeVerifyForExplicitMedia();
if (isReveal && shouldAgeVerifyForExplicitMedia) {
c31599_1 = await maybePerformReactiveCheck();
if (!(c31599_1 != null ? c31599_1 === "passed" : AgeVerificationStore.getReactiveCheckPassed())) {
AgeVerificationActionCreators_native.showAgeVerificationGetStartedModal({
entryPoint: AgeVerificationModalEntryPoint.OBSCURED_MEDIA
});
}
trackToggleMediaObscurityV2({
obscure: c31599_0
});
break L17;
}
trackToggleMediaObscurityV2({
obscure: c31599_0
});
break L18;
}
return void 0;
}
};
this.onTapObscuredMediaToggle = function() {
return c18355_0.apply(this, arguments);
};
this.handleTapSafetyPolicyNoticeEmbed = (a0) => {
const classificationId = getNativeSyntheticEventData(a0).classificationId;
ModalActionCreators.pushLazy(import("../../safety_hub/native/ClassificationDetailModal"), {
classificationId,
shouldRedirectToAccountStanding: true
});
};
this.handleTapSafetySystemNotificationCta = ({ nativeEvent: nativeEvent3 }) => {
const { ctaType, ctaKey } = nativeEvent3;
if (SafetySystemNotificationCtaType.POLICY_VIOLATION_DETAIL === ctaType) {
if (ctaKey != null) {
ModalActionCreators.pushLazy(import("../../safety_hub/native/ClassificationDetailModal"), {
classificationId: ctaKey,
shouldRedirectToAccountStanding: true
});
}
} else if (SafetySystemNotificationCtaType.LEARN_MORE_LINK === ctaType && ctaKey != null) {
Linking.openURL(ctaKey);
}
};
this.handleTapPollAnswer = (a0) => {
const r13 = _this.replaceCorrectMessageParams(castNativeSyntheticEventData(a0));
if (r13 != null) {
PollsActionCreators.handlePollAnswerTapped(r13);
}
};
this.handleTapPollSubmitVote = (a0) => {
const r13 = _this.replaceCorrectMessageParams(castNativeSyntheticEventData(a0));
if (r13 != null) {
PollsActionCreators.handlePollSubmitVote(r13);
}
};
this.handleTapPollAction = (a0) => {
const r13 = _this.replaceCorrectMessageParams(castNativeSyntheticEventData(a0));
if (r13 != null) {
PollsActionCreators.handlePollActionTapped(r13);
}
};
this.handleLongPressPollImage = (a0) => {
const r15 = _this.replaceCorrectMessageParams(castNativeSyntheticEventData(a0));
let c26859_0 = r15;
if (r15 != null) {
const messageData3 = _this.getMessageData(r15.messageId);
if (messageData3 != null) {
const { message, messageChannel } = messageData3;
const initialIndex = message.attachments.findIndex((attachment) => attachment.id === c26859_0.attachmentId);
if (initialIndex != null) {
openMediaModal({
initialSources: extractMediaSourcesFromMessage(message, message, messageChannel.guild_id),
initialIndex,
originViewOrOriginLayout: r15.layout,
analyticsSource: "Channel",
channelId: messageChannel.id
});
}
}
}
};
this.handleTapCtaButton = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, channelId, callback } = nativeSyntheticEventData2;
if (CtaButtonType.MARK_AS_FALSE_POSITIVE === callback) {
handleSenderFalsePositiveFlow(channelId, messageId2);
} else if (CtaButtonType.AGE_VERIFICATION_RETRY === callback) {
AgeVerificationActionCreators_native.showAgeVerificationGetStartedModal({
entryPoint: AgeVerificationModalEntryPoint.SYSTEM_DM_RETRY_BUTTON
});
trackAgeVerificationDmClicked(AgeVerificationDmCta.RETRY, channelId);
} else if (CtaButtonType.CONNECT_TO_TEEN === callback) {
if (!resumeFamilyCenterConnection()) {
openUserSettings({
screen: UserSettingsSections.FAMILY_CENTER
});
}
trackAgeVerificationDmClicked(AgeVerificationDmCta.CONNECT_TO_TEEN, channelId);
}
};
this.handleMessageAccessibilityAction = (a0) => {
const messageId2 = getNativeSyntheticEventData(a0).messageId;
const messageAccessibilityActionFromLabel = getMessageAccessibilityActionFromLabel(a0.nativeEvent.action);
const params2 = _this.params;
const { getMessage, chatInputRef: chatInputRef2 } = params2;
const message = getMessage(messageId2);
if (message != null) {
const channel2 = ChannelStore.getChannel(message.channel_id);
if (MessageAccessibilityAction.VIEW_PROFILE === messageAccessibilityActionFromLabel) {
const userId = message.type === MessageTypes.FRIEND_REQUEST_ACCEPTED && (channel2 != null && channel2.isDM()) ? channel2.getRecipientId() : message.author?.id;
if (userId != null) {
showUserProfileActionSheet({
userId,
channelId: channel2?.id,
messageId: messageId2
});
}
} else if (MessageAccessibilityAction.REPLY === messageAccessibilityActionFromLabel) {
if (channel2 != null) {
replyToMessage({
message,
channel: channel2,
chatInputRef: chatInputRef2,
actionSource: "a11y_action"
});
}
} else if (MessageAccessibilityAction.ADD_REACTION === messageAccessibilityActionFromLabel) {
if (channel2 != null) {
handleAddNewReactions(channel2, message.id);
}
} else if (MessageAccessibilityAction.MESSAGE_ACTIONS_MENU === messageAccessibilityActionFromLabel) {
if (channel2 != null) {
showLongPressMessageActionSheet({
channel: channel2,
message,
canAddNewReactions: canAddNewReactions(channel2),
user: UserStore.getUser(message == null ? void 0 : message.author?.id),
chatInputRef: _this.params.chatInputRef
});
}
} else if (MessageAccessibilityAction.ADD_QUICK_REACTION === messageAccessibilityActionFromLabel) {
if (channel2 != null) {
handleAddDefaultDoubleTapReaction(message, channel2);
}
} else if (MessageAccessibilityAction.EDIT_GDM === messageAccessibilityActionFromLabel) {
if (channel2 != null) {
showChatGDMCustomizeActionSheet({
channelId: channel2.id
});
}
} else if (MessageAccessibilityAction.OPEN_PINS === messageAccessibilityActionFromLabel) {
openPinnedMessages(message.channel_id, "pinned-message-system-message");
} else if (MessageAccessibilityAction.JUMP_TO_MESSAGE === messageAccessibilityActionFromLabel) {
jumpToReferencedMessage(message);
}
}
};
this.handleTapForwardFooter = (a0) => {
const message = _this.params.getMessage(getNativeSyntheticEventData(a0).messageId);
if (message != null) {
handleForwardBreadcrumb(message);
}
};
this.handleTapInlineForward = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const message = _this.params.getMessage(nativeSyntheticEventData2.messageId);
if (message != null) {
const inlineForwardOptions = getInlineForwardOptions(message, nativeSyntheticEventData2);
if (inlineForwardOptions != null) {
const length = Object.keys(inlineForwardOptions).length;
if (a0.nativeEvent.triggerHaptic) {
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
}
let location2 = a0.nativeEvent.location;
if (location2 == null) {
location2 = "inline-button";
}
openForwardModal({
message,
source: location2,
forwardOptions: length !== 0 ? inlineForwardOptions : void 0
});
}
}
};
this.handleTapSoundmoji = (a0) => {
openSoundmojiActionSheet(getNativeSyntheticEventData(a0));
};
this.handleTapClanTagChiplet = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
if (nativeSyntheticEventData2 != null && nativeSyntheticEventData2.guildId != null) {
ActionSheetActionCreators.openLazy(import("../../guild_profile/native/components/GuildProfileActionSheet"), `GuildProfileActionSheet:${nativeSyntheticEventData2.guildId}`, {
guildId: nativeSyntheticEventData2.guildId
});
}
};
this.handleTapContentInventoryEntryEmbed = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, ...rest } = nativeSyntheticEventData2;
const message = (0, _this.params.getMessage)(messageId2);
if (message != null) {
onTapContentInventoryEntryEmbed({
message,
authorId: rest.authorId,
contentId: rest.contentId,
tappedElement: rest.tappedElement
});
}
};
this.handleTapCheckpointCard = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const { messageId: messageId2, ...rest } = nativeSyntheticEventData2;
const message = (0, _this.params.getMessage)(messageId2);
if (message != null) {
onTapCheckpointCard({
message,
authorId: rest.authorId
});
}
};
this.handleTapAppMessageEmbed = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const message = (0, _this.params.getMessage)(nativeSyntheticEventData2.messageId);
if (message != null) {
handleTapAppMessageEmbed({
...nativeSyntheticEventData2,
message
});
}
};
this.handleTapPreviewSharedClientTheme = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const message = (0, _this.params.getMessage)(nativeSyntheticEventData2.messageId);
if (message != null) {
handleTapPreviewSharedClientTheme({
...nativeSyntheticEventData2,
message
});
}
};
this.handleSharedClientThemeViewed = (a0) => {
const nativeSyntheticEventData2 = getNativeSyntheticEventData(a0);
const message = (0, _this.params.getMessage)(nativeSyntheticEventData2.messageId);
if (message != null) {
handleSharedClientThemeViewed({
...nativeSyntheticEventData2,
message
});
}
};
this.getParams = a0;
}
get params() {
return this.getParams();
}
replaceCorrectMessageParams(a0) {
let r37;
const getMessage = this.params.getMessage;
const nativeEvent3 = a0.nativeEvent;
const r15 = getMessage(nativeEvent3.messageId);
if (r15 != null) {
if (r15.type === MessageTypes.THREAD_STARTER_MESSAGE) {
const messageReference = r15.messageReference;
if (messageReference == null) {
return void 0;
}
if (MessageStore.getMessage(messageReference.channel_id, messageReference.message_id) != null) {
r37 = {
...nativeEvent3,
messageId: messageReference.message_id,
channelId: messageReference.channel_id
};
} else {
this.handleLongPressMessage({
...a0,
nativeEvent: {
...nativeEvent3,
mediaIndex: 0,
mediaType: ""
}
});
r37 = void 0;
}
return r37;
}
return {
...nativeEvent3,
messageId: r15.id,
channelId: r15.channel_id
};
}
}
}