decord/source/modules/messages/native/handlers/handleMessagesTapLink.tsx

149 lines
5.3 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 10841
// Function ID: 10842
2026-07-20 16:05:17 +00:00
// Name: handleMessagesTapURLLink
2026-08-24 06:08:38 +00:00
// Dependencies: [8487, 4482, 8202, 10590, 1930, 1391, 4363, 4999, 1922, 676, 1499, 1398, 5264, 1235, 10839, 4359, 4373, 10840, 9138, 9133, 8812, 10775, 8966, 4346, 9547, 2008, 4980, 9899, 10842, 9965, 10843, 7465, 7197, 8484, 1627, 10844, 4819, 1222, 8251, 10847, 10870, 2]
2026-07-20 16:05:17 +00:00
// Exports: handleMessagesTapLink
2026-08-24 06:08:38 +00:00
// Module 10841 (handleMessagesTapURLLink)
import set from "set" /* 2 */;
import AbortCodes from "AbortCodes" /* 1235 */;
import set2 from "set" /* 1398 */;
import APP_LAUNCHER_BUILT_IN_SECTION_ICON from "APP_LAUNCHER_BUILT_IN_SECTION_ICON" /* 1499 */;
import parseQueryDefault from "parseQuery" /* 4359 */;
import str2 from "str2" /* 5264 */;
import getIndexKey from "getIndexKey" /* 8487 */;
import isLinkTrusted from "isLinkTrusted" /* 8812 */;
import _mod9133 from "module_9133" /* 9133 */;
import GameProfileEmbedAction from "GameProfileEmbedAction" /* 9138 */;
import isAlertOrActionSheetOpen from "isAlertOrActionSheetOpen" /* 10775 */;
import isLinkTrusted2 from "isLinkTrusted" /* 10839 */;
import closure_4 from "addApplication" /* 4482 */;
import closure_5 from "handleMessageSendFailedAutomod" /* 8202 */;
import closure_6 from "handleQuickSwitcherUpdate" /* 10590 */;
import closure_7 from "createdAt" /* 1930 */;
import closure_8 from "ensureGuildLoaded" /* 1391 */;
import closure_9 from "updateInvite" /* 4363 */;
import closure_10 from "reinjectEphemerals" /* 4999 */;
import closure_11 from "mergeGuildAvatar" /* 1922 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-07-20 16:05:17 +00:00
function handleMessagesTapURLLink(data, channelId) {
let flag = null != data.url;
if (flag) {
flag = "" !== data.url;
}
if (flag) {
const node = data.node;
let flag2 = false;
if (null != node) {
2026-08-24 06:08:38 +00:00
let obj = isLinkTrusted2;
2026-07-20 16:05:17 +00:00
flag2 = false;
if (obj.isLinkTrusted(node)) {
2026-08-24 06:08:38 +00:00
const payload = parseQueryDefault(tmp).payload;
2026-07-20 16:05:17 +00:00
flag2 = false;
2026-07-29 08:29:29 +00:00
if (payload.type === constants.INVITE) {
2026-07-20 16:05:17 +00:00
flag2 = false;
if (null != payload.inviteCode) {
2026-07-23 10:11:24 +00:00
invite = invite.getInvite(payload.inviteCode);
2026-07-29 08:29:29 +00:00
let num = null == invite;
if (!num) {
2026-08-24 06:08:38 +00:00
num = !tmp2(4373).isGuildScheduledEventInviteEmbed(invite);
const tmp2Result = tmp2(4373);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!num) {
2026-08-24 06:08:38 +00:00
tmp4(10840)(invite);
2026-07-29 08:29:29 +00:00
num = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
flag2 = !num;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
tmp4 = importDefault;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp2 = require;
2026-07-20 16:05:17 +00:00
}
if (!flag2) {
2026-08-24 06:08:38 +00:00
const payload2 = parseQueryDefault(data.url).payload;
2026-07-20 16:05:17 +00:00
let flag3 = false;
2026-07-29 08:29:29 +00:00
if (payload2.type === constants.GAME_PROFILE) {
2026-07-20 16:05:17 +00:00
const gameId = payload2.gameId;
2026-07-29 08:29:29 +00:00
let tmp13;
2026-07-20 16:05:17 +00:00
if (null != channelId) {
if (null != data.messageId) {
2026-07-29 08:29:29 +00:00
message = message.getMessage(channelId, data.messageId);
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (message != null) {
2026-07-20 16:05:17 +00:00
id = message.author.id;
}
2026-07-29 08:29:29 +00:00
tmp13 = id;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
obj = { gameId: null, source: null, sourceUserId: null, gameProfileModalChecks: null };
obj[0] = gameId;
2026-08-24 06:08:38 +00:00
obj[1] = GameProfileEmbedAction.GameProfileSources.Deeplink;
2026-07-29 08:29:29 +00:00
obj[2] = tmp13;
obj = { shouldOpenGameProfile: true, gameId: null };
obj[1] = gameId;
obj[3] = obj;
2026-08-24 06:08:38 +00:00
_mod9133.default.openGameProfileModal(obj);
2026-07-20 16:05:17 +00:00
flag3 = true;
2026-08-24 06:08:38 +00:00
const _default = _mod9133.default;
2026-07-20 16:05:17 +00:00
}
flag2 = flag3;
}
flag = true;
if (!flag2) {
2026-08-24 06:08:38 +00:00
obj1 = { href: null, trusted: null, messageId: null, channelId: null };
2026-07-29 08:29:29 +00:00
obj1[0] = data.url;
2026-07-20 16:05:17 +00:00
let isLinkTrustedResult = null != data.node;
if (isLinkTrustedResult) {
2026-08-24 06:08:38 +00:00
isLinkTrustedResult = tmp19(10839).isLinkTrusted(data.node);
const tmp19Result = tmp19(10839);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj1[1] = isLinkTrustedResult;
obj1[2] = data.messageId;
obj1[3] = channelId;
2026-08-24 06:08:38 +00:00
isLinkTrusted.handleClick(obj1);
2026-07-20 16:05:17 +00:00
flag = true;
2026-08-24 06:08:38 +00:00
const obj5 = isLinkTrusted;
2026-07-29 08:29:29 +00:00
tmp19 = require;
2026-07-20 16:05:17 +00:00
}
}
return flag;
}
2026-08-24 06:08:38 +00:00
const getSection = getIndexKey.getSection;
2026-07-29 08:29:29 +00:00
({ AnalyticsLocations: closure_12, LinkingTypes: map1, Routes: closure_14 } = ME);
2026-08-24 06:08:38 +00:00
const AppLauncherRouteName = APP_LAUNCHER_BUILT_IN_SECTION_ICON.AppLauncherRouteName;
const StaticChannelRoute = set2.StaticChannelRoute;
const NotificationTypes = str2.NotificationTypes;
let closure_18 = AbortCodes.OpenThreadAnalyticsLocations;
const result = set.fileFinishedImporting("modules/messages/native/handlers/handleMessagesTapLink.tsx");
2026-07-20 16:05:17 +00:00
export { handleMessagesTapURLLink };
export const handleMessagesTapLink = function handleMessagesTapLink(tapLinkData) {
2026-07-29 08:29:29 +00:00
({ chatInputRef, handleTransitionToThread, message, messageChannel } = tapLinkData);
2026-07-20 16:05:17 +00:00
const data = tapLinkData.tapLinkData.data;
if (true === tapLinkData.allowWithinModal) {
let id;
2026-07-29 08:29:29 +00:00
if (messageChannel != null) {
2026-07-20 16:05:17 +00:00
id = messageChannel.id;
}
2026-07-29 08:29:29 +00:00
if (!tmp4(data, id)) {
2026-07-20 16:05:17 +00:00
if (null != data.action) {
2026-08-15 05:55:55 +00:00
if (chatInputRef != null) {
const current = chatInputRef.current;
if (current != null) {
let flag = data.addSpace;
if (flag == null) {
flag = true;
}
current.insertText(data.text, null, flag);
}
}
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
tmp4 = handleMessagesTapURLLink;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
const obj = isAlertOrActionSheetOpen;
2026-07-20 16:05:17 +00:00
}
};