/* Metro module 9874; source: modules/messages/native/handlers/handleMessagesTapLink.tsx; dependencies: [7861, 4234, 8183, 9865, 1885, 1379, 4097, 1878, 661, 1483, 1386, 9696, 5079, 1243, 9875, 4093, 4116, 9876, 8872, 9877, 8743, 4080, 9300, 1962, 4796, 8913, 4008, 9879, 9899, 7067, 6789, 8447, 1583, 9900, 4634, 1230, 8235, 9903, 9926, 2] */ function _fun77455(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#77455, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10060:6, offset: 0x01dfc94b, size: 405 bytes, params: 8, frame: 20 const env0_0 = require; const closure = handleMessagesTapURLLink; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = (require(7861) /* metro dependency 7861: ApplicationCommandIndexStore */).getSection; const applicationStore = importDefault(4234) /* metro dependency 4234: ApplicationStore */; const guildAutomodMessageStore = importDefault(8183) /* metro dependency 8183: GuildAutomodMessageStore */; const summaryStore = importDefault(9865) /* metro dependency 9865: SummaryStore */; const userRecord = importDefault(1885) /* metro dependency 1885: UserRecord */; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const inviteStore = importDefault(4097) /* metro dependency 4097: InviteStore */; const userStore = importDefault(1878) /* metro dependency 1878: UserStore */; const constantsModule = require(661) /* metro dependency 661: Constants */; const env0_11 = constantsModule.AnalyticsLocations; const env0_12 = constantsModule.LinkingTypes; const env0_13 = constantsModule.Routes; const env0_14 = (require(1483) /* metro dependency 1483: AppLauncherNativeConstants */).AppLauncherRouteName; const env0_15 = (require(1386) /* metro dependency 1386: ChannelConstants */).StaticChannelRoute; const env0_16 = (require(9696) /* metro dependency 9696: ChannelDetailsConstants */).ChannelDetailsNavigatorScreens; const env0_17 = (require(5079) /* metro dependency 5079: PushNotificationConstants */).NotificationTypes; const env0_18 = (require(1243) /* metro dependency 1243: ThreadConstants */).OpenThreadAnalyticsLocations; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/messages/native/handlers/handleMessagesTapLink.tsx'); exports.handleMessagesTapURLLink = closure; exports.handleMessagesTapLink = handleMessagesTapLink; } function handleMessagesTapURLLink(a0, a1) { // fn#77456, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10060:420, offset: 0x01dfcae0, size: 393 bytes, params: 3, frame: 19 var r1; var r2; var r6; var node; var moduleValue; var payload; var value3; var moduleValue2; var moduleValue3; var handleClick; var object2; var value6; var moduleValue4; let url = a0.url; let value = url != null; let r0 = value && a0.url !== ''; if (r0) { url = a0.url; node = a0.node; value = false; if (node == null) { r2 = value; } else { moduleValue = require(9875) /* metro dependency 9875: MarkupReactLinkUtils */; if (moduleValue.isLinkTrusted(node)) { payload = (importDefault(4093) /* metro dependency 4093: parseURL */)(url).payload; if (payload.type !== LinkingTypes.INVITE) { r2 = value; } else if (payload.inviteCode == null) { r2 = value; } else { value = InviteStore.getInvite(payload.inviteCode); value3 = value == null; if (value3) { r1 = value3; } else { moduleValue2 = require(4116) /* metro dependency 4116: InviteTypeUtils */; r1 = !moduleValue2.isGuildScheduledEventInviteEmbed(value); } if (!r1) { (importDefault(9876) /* metro dependency 9876: handleAcceptEventInstantInvite */)(value); value = 0; r1 = value; } value = !r1; r2 = value; } } else { r2 = value; } } value = true; if (r2) { r0 = value; } else { moduleValue3 = require(8872) /* metro dependency 8872: MaskedLinkUtils */; handleClick = moduleValue3.handleClick; object2 = {}; object2.href = a0.url; value6 = a0.node != null; if (value6) { moduleValue4 = require(9875) /* metro dependency 9875: MarkupReactLinkUtils */; r6 = moduleValue4.isLinkTrusted(a0.node); } else { r6 = value6; } object2.trusted = r6; object2.messageId = a0.messageId; object2.channelId = a1; Reflect.apply(handleClick, moduleValue3, [object2]); r0 = value; } } return r0; } function handleMessagesTapLink({allowWithinModal, chatInputRef, handleTransitionToThread, message, messageChannel, selectedChannelId, tapLinkData}) { // fn#77457, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10060:1089, offset: 0x01dfcc69, size: 2644 bytes, params: 2, frame: 31 var id; var r4; var r12; var guild_id; var r7; var author; var r6; var value; var handleMessagesTapURLLinkBinding; var value2; var action; var current; var insertText; var text; var addSpace; var getChannel; var value3; var notificationType; var value4; var defaultImport; var openLazy; var object2; var MESSAGE_EMBED; var moduleValue2; var openGuildHighlightNotificationForPush; var moduleValue3; var moduleValue4; var transitionTo; var CHANNEL; var guildId; var trackRoleSubscriptionPurchaseMessageTierClick; var value5; var value6; var value7; const KeyboardTypes = require(dependencyMap[32]).KeyboardTypes; var value9; var value11; var moduleValue5; var defaultImport2; var moduleValue6; var userRecord; var applicationId; var value12; var getSectionBinding; var sectionBinding; var descriptor; var value14; var value16; var getMessage; var value18; var removeAutomodMessageNotice; var rootNavigationRef; var stream; var defaultImport3; var messageReference; var defaultImport4; const data = tapLinkData.data; if (allowWithinModal === true) { handleMessagesTapURLLinkBinding = handleMessagesTapURLLink; value2 = undefined; id = messageChannel == null ? value2 : messageChannel.id; if (handleMessagesTapURLLinkBinding(data, id)) { return undefined; } action = data.action; if (action == null) { return undefined; } action = data.action; if (action === 'bindUserMenu') { importDefault(dependencyMap[20])({userId: data.userId, channelId: data.messageChannelId, messageId: data.messageId}); return undefined; } if (action === 'bindGuildMenu') { messageReference = data.messageReference; if (messageReference == null) { return value2; } messageReference = data.messageReference; guild_id = messageReference.guild_id; if (guild_id == null) { return value2; } defaultImport4 = importDefault(dependencyMap[21]); openLazy = defaultImport4.openLazy; value = require(dependencyMap[23]); value = value(dependencyMap[22], dependencyMap.paths); Reflect.apply(openLazy, defaultImport4, [value, 'GuildProfileActionSheet:' + guild_id, {guildId: guild_id}]); return undefined; } if (action === 'bindJoinStream') { stream = data.stream; if (stream == null) { return value2; } defaultImport3 = importDefault(dependencyMap[24]); defaultImport3.selectVoiceChannel(stream.channelId); require(dependencyMap[25]).watchStreamAndTransitionToStream(stream); return undefined; } if (action === 'bindOpenPins') { rootNavigationRef = require(dependencyMap[26]).getRootNavigationRef(); if (rootNavigationRef == null) { return value2; } if (rootNavigationRef.isReady()) { rootNavigationRef.navigate('sidebar', {initialRouteName: ChannelDetailsNavigatorScreens.PINNED_MESSAGES, channelId: data.messageChannelId, source: 'pinned-message-system-message'}); return undefined; } return value2; } if (action === 'bindOpenGdmCustomizeActionSheet') { importDefault(dependencyMap[27])({channelId: data.messageChannelId}); return undefined; } if (action === 'bindDismissMessage') { getMessage = GuildAutomodMessageStore.getMessage; message = data.message; value18 = Reflect.apply(getMessage, GuildAutomodMessageStore, [message == null ? value2 : message.id]); if (value18 == null) { value = importDefault(dependencyMap[29]); value.dismissAutomatedMessage(data.message); } else if (value18.isBlockedEdit) { value = require(dependencyMap[28]); removeAutomodMessageNotice = value.removeAutomodMessageNotice; message = data.message; Reflect.apply(removeAutomodMessageNotice, value, [message == null ? value2 : message.id]); } else { value = importDefault(dependencyMap[29]); value.dismissAutomatedMessage(data.message); } return undefined; } if (action === 'bindTapUsername') { value = importDefault(dependencyMap[20]); object2 = {}; object2.userId = data.userId; object2.channelId = data.messageChannelId; object2.messageId = data.messageId; object2.sourceAnalyticsLocations = [importDefault(dependencyMap[30]).USERNAME]; value(object2); return undefined; } if (action === 'bindTapCommandName') { if ((message == null ? value2 : message.interaction) == null) { return value2; } if (messageChannel == null) { return value2; } value11 = UserStore.getUser(data.userId); if (value11 == null) { return value2; } moduleValue5 = require(dependencyMap[31]); if (moduleValue5.isPrimaryEntryPointCommandMessage(message)) { applicationId = message.applicationId; if (applicationId == null) { return value2; } value12 = ChannelStore.getChannel(data.messageChannelId); if (value12 == null) { return value2; } getSectionBinding = getSection; applicationId = message.applicationId; sectionBinding = getSectionBinding({channel: value12, type: 'channel'}, applicationId); descriptor = sectionBinding.descriptor; if ((descriptor == null ? value2 : descriptor.application) != null) { value16 = chatInputRef == null; if (value16) { r4 = value16; r6 = value2; } else { current = chatInputRef.current; r4 = current == null; r6 = current; } if (!r4) { r6.openCustomKeyboard({type: KeyboardTypes.APP_LAUNCHER, context: {initialRouteName: AppLauncherRouteName.APPLICATION_VIEW, initiallyExpanded: true, application: sectionBinding.descriptor.application, installOnDemand: !sectionBinding.isGuildInstalled && !sectionBinding.isUserInstalled}}); } } else { value14 = chatInputRef == null; if (value14) { r4 = value14; r7 = value2; } else { current = chatInputRef.current; r4 = current == null; r7 = current; } if (!r4) { r7.openCustomKeyboard({type: KeyboardTypes.APP_LAUNCHER, context: {initialRouteName: AppLauncherRouteName.APPLICATION_VIEW, initiallyExpanded: true, applicationId: message.applicationId, installOnDemand: true}}); } } return undefined; } author = message == null ? value2 : message.author; if (author != null) { defaultImport2 = importDefault(dependencyMap[33]); object2 = {}; moduleValue6 = require(dependencyMap[34]); object2.author = moduleValue6.getUserAuthor(message.interaction.user, messageChannel); object2.channelId = data.messageChannelId; object2.chatInputRef = chatInputRef; object2.messageId = data.messageId; object2.user = value11; author = message == null ? value2 : message.author; userRecord = new UserRecord(); object2.applicationUser = userRecord; userRecord = messageChannel.getGuildId(); object2.guildId = userRecord ?? value2; object2.messageType = data.messageType; defaultImport2(object2); } return undefined; } if (action === 'bindTapActivityText') { value6 = ApplicationStore.getApplication(data.applicationUserId); if (value6 == null) { value9 = chatInputRef == null; if (value9) { r4 = value9; r7 = value2; } else { current = chatInputRef.current; r4 = current == null; r7 = current; } if (!r4) { r7.openCustomKeyboard({type: KeyboardTypes.APP_LAUNCHER, context: {initialRouteName: AppLauncherRouteName.APPLICATION_VIEW, applicationId: data.applicationUserId, initiallyExpanded: true}}); } } else { value7 = chatInputRef == null; if (value7) { r4 = value7; r7 = value2; } else { current = chatInputRef.current; r4 = current == null; r7 = current; } if (!r4) { r7.openCustomKeyboard({type: KeyboardTypes.APP_LAUNCHER, context: {initialRouteName: AppLauncherRouteName.APPLICATION_VIEW, application: value6, initiallyExpanded: true}}); } } } else if (action === 'bindOpenThreadChannel') { value5 = ChannelStore.getChannel(data.threadId); if (value5 != null) { handleTransitionToThread(value5 == null ? value2 : value5.guild_id, value5.id, OpenThreadAnalyticsLocations.EMBED); } } else if (action === 'bindJumpToMessage') { importDefault(dependencyMap[29]).jumpToMessage({channelId: data.targetChannelId, messageId: data.targetMessageId, flash: true, returnMessageId: data.messageId}); } else if (action === 'bindOpenRoleSubscriptionOverview') { moduleValue4 = require(dependencyMap[35]); transitionTo = moduleValue4.transitionTo; CHANNEL = Routes.CHANNEL; guildId = data.guildId; Reflect.apply(transitionTo, moduleValue4, [Reflect.apply(CHANNEL, Routes, [guildId, StaticChannelRoute.ROLE_SUBSCRIPTIONS])]); value = require(dependencyMap[36]); trackRoleSubscriptionPurchaseMessageTierClick = value.trackRoleSubscriptionPurchaseMessageTierClick; guildId = data.guildId; Reflect.apply(trackRoleSubscriptionPurchaseMessageTierClick, value, [guildId, data.channelId, data.messageId, data.roleSubscriptionListingId]); } else if (action === 'bindUserSurvey') { getChannel = ChannelStore.getChannel; message = data.message; value3 = Reflect.apply(getChannel, ChannelStore, [message.channel_id]); guild_id = value3 == null ? value2 : value3.guild_id; if (guild_id != null) { notificationType = data.notificationType; if (NotificationTypes.TRENDING_CONTENT_PUSH === notificationType) { moduleValue3 = require(dependencyMap[37]); openGuildHighlightNotificationForPush = moduleValue3.openGuildHighlightNotificationForPush; message = data.message; notificationType = data.notificationType; MESSAGE_EMBED = AnalyticsLocations.MESSAGE_EMBED; value = SummaryStore.selectedSummary(data.message.channel_id); id = value == null ? value2 : value.id; value = 'unknown'; Reflect.apply(openGuildHighlightNotificationForPush, moduleValue3, [guild_id, message, notificationType, MESSAGE_EMBED, {summary_id: id ?? value}]); } else if (NotificationTypes.TOP_MESSAGE_PUSH === notificationType) { moduleValue2 = require(dependencyMap[37]); moduleValue2.openGuildHighlightNotificationForPush(guild_id, data.message, data.notificationType, AnalyticsLocations.MESSAGE_EMBED); } else { value4 = require(dependencyMap[23])(dependencyMap[38], dependencyMap.paths); defaultImport = importDefault(dependencyMap[21]); defaultImport.openLazy(value4, 'NotificationSurvey', {location: AnalyticsLocations.MESSAGE_EMBED, messageId: data.message.id, notificationType: data.notificationType ?? NotificationTypes.TOP_MESSAGE_PUSH}); } } } else if (action === 'bindInsertText') { value = chatInputRef == null; if (value) { r4 = value; r12 = value2; } else { current = chatInputRef.current; r4 = current == null; r12 = current; } if (!r4) { insertText = r12.insertText; text = data.text; addSpace = data.addSpace; Reflect.apply(insertText, r12, [text, null, addSpace == null || addSpace]); } } } else { value = require(dependencyMap[19]); if (value.isAlertOrActionSheetOpen(selectedChannelId)) { return undefined; } handleMessagesTapURLLinkBinding = handleMessagesTapURLLink; value2 = undefined; id = messageChannel == null ? value2 : messageChannel.id; if (handleMessagesTapURLLinkBinding(data, id)) { return undefined; } action = data.action; if (action == null) { return undefined; } action = data.action; if (action === 'bindUserMenu') { importDefault(dependencyMap[20])({userId: data.userId, channelId: data.messageChannelId, messageId: data.messageId}); return undefined; } if (action === 'bindGuildMenu') { messageReference = data.messageReference; if (messageReference == null) { return value2; } messageReference = data.messageReference; guild_id = messageReference.guild_id; if (guild_id == null) { return value2; } defaultImport4 = importDefault(dependencyMap[21]); openLazy = defaultImport4.openLazy; value = require(dependencyMap[23]); value = value(dependencyMap[22], dependencyMap.paths); Reflect.apply(openLazy, defaultImport4, [value, 'GuildProfileActionSheet:' + guild_id, {guildId: guild_id}]); return undefined; } if (action === 'bindJoinStream') { stream = data.stream; if (stream == null) { return value2; } defaultImport3 = importDefault(dependencyMap[24]); defaultImport3.selectVoiceChannel(stream.channelId); require(dependencyMap[25]).watchStreamAndTransitionToStream(stream); return undefined; } if (action === 'bindOpenPins') { rootNavigationRef = require(dependencyMap[26]).getRootNavigationRef(); if (rootNavigationRef == null) { return value2; } if (rootNavigationRef.isReady()) { rootNavigationRef.navigate('sidebar', {initialRouteName: ChannelDetailsNavigatorScreens.PINNED_MESSAGES, channelId: data.messageChannelId, source: 'pinned-message-system-message'}); return undefined; } return value2; } if (action === 'bindOpenGdmCustomizeActionSheet') { importDefault(dependencyMap[27])({channelId: data.messageChannelId}); return undefined; } if (action === 'bindDismissMessage') { getMessage = GuildAutomodMessageStore.getMessage; message = data.message; value18 = Reflect.apply(getMessage, GuildAutomodMessageStore, [message == null ? value2 : message.id]); if (value18 == null) { value = importDefault(dependencyMap[29]); value.dismissAutomatedMessage(data.message); } else if (value18.isBlockedEdit) { value = require(dependencyMap[28]); removeAutomodMessageNotice = value.removeAutomodMessageNotice; message = data.message; Reflect.apply(removeAutomodMessageNotice, value, [message == null ? value2 : message.id]); } else { value = importDefault(dependencyMap[29]); value.dismissAutomatedMessage(data.message); } return undefined; } if (action === 'bindTapUsername') { value = importDefault(dependencyMap[20]); object2 = {}; object2.userId = data.userId; object2.channelId = data.messageChannelId; object2.messageId = data.messageId; object2.sourceAnalyticsLocations = [importDefault(dependencyMap[30]).USERNAME]; value(object2); return undefined; } if (action === 'bindTapCommandName') { if ((message == null ? value2 : message.interaction) == null) { return value2; } if (messageChannel == null) { return value2; } value11 = UserStore.getUser(data.userId); if (value11 == null) { return value2; } moduleValue5 = require(dependencyMap[31]); if (moduleValue5.isPrimaryEntryPointCommandMessage(message)) { applicationId = message.applicationId; if (applicationId == null) { return value2; } value12 = ChannelStore.getChannel(data.messageChannelId); if (value12 == null) { return value2; } getSectionBinding = getSection; applicationId = message.applicationId; sectionBinding = getSectionBinding({channel: value12, type: 'channel'}, applicationId); descriptor = sectionBinding.descriptor; if ((descriptor == null ? value2 : descriptor.application) != null) { value16 = chatInputRef == null; if (value16) { r4 = value16; r6 = value2; } else { current = chatInputRef.current; r4 = current == null; r6 = current; } if (!r4) { r6.openCustomKeyboard({type: KeyboardTypes.APP_LAUNCHER, context: {initialRouteName: AppLauncherRouteName.APPLICATION_VIEW, initiallyExpanded: true, application: sectionBinding.descriptor.application, installOnDemand: !sectionBinding.isGuildInstalled && !sectionBinding.isUserInstalled}}); } } else { value14 = chatInputRef == null; if (value14) { r4 = value14; r7 = value2; } else { current = chatInputRef.current; r4 = current == null; r7 = current; } if (!r4) { r7.openCustomKeyboard({type: KeyboardTypes.APP_LAUNCHER, context: {initialRouteName: AppLauncherRouteName.APPLICATION_VIEW, initiallyExpanded: true, applicationId: message.applicationId, installOnDemand: true}}); } } return undefined; } author = message == null ? value2 : message.author; if (author != null) { defaultImport2 = importDefault(dependencyMap[33]); object2 = {}; moduleValue6 = require(dependencyMap[34]); object2.author = moduleValue6.getUserAuthor(message.interaction.user, messageChannel); object2.channelId = data.messageChannelId; object2.chatInputRef = chatInputRef; object2.messageId = data.messageId; object2.user = value11; author = message == null ? value2 : message.author; userRecord = new UserRecord(); object2.applicationUser = userRecord; userRecord = messageChannel.getGuildId(); object2.guildId = userRecord ?? value2; object2.messageType = data.messageType; defaultImport2(object2); } return undefined; } if (action === 'bindTapActivityText') { value6 = ApplicationStore.getApplication(data.applicationUserId); if (value6 == null) { value9 = chatInputRef == null; if (value9) { r4 = value9; r7 = value2; } else { current = chatInputRef.current; r4 = current == null; r7 = current; } if (!r4) { r7.openCustomKeyboard({type: KeyboardTypes.APP_LAUNCHER, context: {initialRouteName: AppLauncherRouteName.APPLICATION_VIEW, applicationId: data.applicationUserId, initiallyExpanded: true}}); } } else { value7 = chatInputRef == null; if (value7) { r4 = value7; r7 = value2; } else { current = chatInputRef.current; r4 = current == null; r7 = current; } if (!r4) { r7.openCustomKeyboard({type: KeyboardTypes.APP_LAUNCHER, context: {initialRouteName: AppLauncherRouteName.APPLICATION_VIEW, application: value6, initiallyExpanded: true}}); } } } else if (action === 'bindOpenThreadChannel') { value5 = ChannelStore.getChannel(data.threadId); if (value5 != null) { handleTransitionToThread(value5 == null ? value2 : value5.guild_id, value5.id, OpenThreadAnalyticsLocations.EMBED); } } else if (action === 'bindJumpToMessage') { importDefault(dependencyMap[29]).jumpToMessage({channelId: data.targetChannelId, messageId: data.targetMessageId, flash: true, returnMessageId: data.messageId}); } else if (action === 'bindOpenRoleSubscriptionOverview') { moduleValue4 = require(dependencyMap[35]); transitionTo = moduleValue4.transitionTo; CHANNEL = Routes.CHANNEL; guildId = data.guildId; Reflect.apply(transitionTo, moduleValue4, [Reflect.apply(CHANNEL, Routes, [guildId, StaticChannelRoute.ROLE_SUBSCRIPTIONS])]); value = require(dependencyMap[36]); trackRoleSubscriptionPurchaseMessageTierClick = value.trackRoleSubscriptionPurchaseMessageTierClick; guildId = data.guildId; Reflect.apply(trackRoleSubscriptionPurchaseMessageTierClick, value, [guildId, data.channelId, data.messageId, data.roleSubscriptionListingId]); } else if (action === 'bindUserSurvey') { getChannel = ChannelStore.getChannel; message = data.message; value3 = Reflect.apply(getChannel, ChannelStore, [message.channel_id]); guild_id = value3 == null ? value2 : value3.guild_id; if (guild_id != null) { notificationType = data.notificationType; if (NotificationTypes.TRENDING_CONTENT_PUSH === notificationType) { moduleValue3 = require(dependencyMap[37]); openGuildHighlightNotificationForPush = moduleValue3.openGuildHighlightNotificationForPush; message = data.message; notificationType = data.notificationType; MESSAGE_EMBED = AnalyticsLocations.MESSAGE_EMBED; value = SummaryStore.selectedSummary(data.message.channel_id); id = value == null ? value2 : value.id; value = 'unknown'; Reflect.apply(openGuildHighlightNotificationForPush, moduleValue3, [guild_id, message, notificationType, MESSAGE_EMBED, {summary_id: id ?? value}]); } else if (NotificationTypes.TOP_MESSAGE_PUSH === notificationType) { moduleValue2 = require(dependencyMap[37]); moduleValue2.openGuildHighlightNotificationForPush(guild_id, data.message, data.notificationType, AnalyticsLocations.MESSAGE_EMBED); } else { value4 = require(dependencyMap[23])(dependencyMap[38], dependencyMap.paths); defaultImport = importDefault(dependencyMap[21]); defaultImport.openLazy(value4, 'NotificationSurvey', {location: AnalyticsLocations.MESSAGE_EMBED, messageId: data.message.id, notificationType: data.notificationType ?? NotificationTypes.TOP_MESSAGE_PUSH}); } } } else if (action === 'bindInsertText') { value = chatInputRef == null; if (value) { r4 = value; r12 = value2; } else { current = chatInputRef.current; r4 = current == null; r12 = current; } if (!r4) { insertText = r12.insertText; text = data.text; addSpace = data.addSpace; Reflect.apply(insertText, r12, [text, null, addSpace == null || addSpace]); } } } }