This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
// Metro module 7792 (f7793).
let c4911_1 = /<\/([^\s]+):(\d+)>(?:\s?(.*))?/;
export function getApplicationCommand(a0) {
const r13 = c4911_1.exec(a0);
if (r13 == null) {
return null;
}
const [, name, id, r17] = r13;
return name == null ? null : id == null ? null : {
content: `/${name}${r17 != null ? ` ${r17}` : ""}`,
name,
id,
hasOptions: r17 != null && r17 !== ""
};
}
@@ -0,0 +1,98 @@
// Metro module 6041 (f6042).
import { NativeModules } from "react-native";
import { isAndroid } from "../../utils/PlatformUtils";
import ForegroundServiceManager_android from "../foreground_service/mobile/ForegroundServiceManager.android";
import { ServiceNotificationPriority, ServiceNotificationType } from "../foreground_service/mobile/ForegroundServiceManagerTypes";
function $mk114850($env) {
return () => {
const r3 = $env[0];
if (r3 !== c3827_5) {
if (isAndroid()) {
ForegroundServiceManager_android.removeServiceHandler(r3);
} else {
NativeModules.DCDBackgroundTaskManager.endBackgroundTask(r3);
}
}
};
}
let c3827_5;
let env3827 = {};
export function startBackgroundTask(a0) {
if (isAndroid()) {
if (a0 == null) {
return new Promise((resolve) => resolve(c3827_5));
}
return ForegroundServiceManager_android.addServiceHandler({
title: a0.title,
content: a0.content,
priority: ServiceNotificationPriority.MEDIUM,
type: ServiceNotificationType.FILE_UPLOAD,
usesGateway: false
});
}
return NativeModules.DCDBackgroundTaskManager.startBackgroundTask();
}
export const backgroundTaskIdentifierInvalid = isAndroid() ? -1 : NativeModules.DCDBackgroundTaskManager.backgroundTaskIdentifierInvalid;
export function endBackgroundTask(a0) {
if (a0 !== c3827_5) {
if (isAndroid()) {
ForegroundServiceManager_android.removeServiceHandler(a0);
} else {
NativeModules.DCDBackgroundTaskManager.endBackgroundTask(a0);
}
}
}
export function backgroundify(c15373_0, c15373_1) {
return async () => {
let r49, r59;
let c25684_0, c25684_1, c25684_2;
let c25684_3 = 0;
const r11 = void 0;
const r10 = env3827;
try {
let env29653;
c25684_1 = r11;
const r14 = env29653 = {
$parent: r10
};
c25684_0 = r14;
env29653[0] = c3827_5;
c25684_3 = 1;
const r33 = await startBackgroundTask(c15373_1);
const r44 = c25684_0;
env29653[0] = r33;
c25684_3 = 0;
r49 = (0, c15373_0)().finally($mk114850(r44));
} catch ($e) {
const r22 = $e;
let r7 = r22;
c25684_2 = r22;
if (c25684_3 !== 0) {
while (true) {
try {
c25684_3 = 0;
r59 = (0, c15373_0)();
} catch (r54) {
r7 = r54;
c25684_2 = r54;
if (c25684_3 === 0) {
break;
}
continue;
}
return r59;
}
}
throw r7;
}
return r49;
};
}
c3827_5 = backgroundTaskIdentifierInvalid;
const r26 = {
backgroundTaskIdentifierInvalid,
backgroundify,
startBackgroundTask,
endBackgroundTask
};
export default r26;
@@ -0,0 +1,24 @@
// Metro module 6133 (f6134).
import { getComplimentaryPaletteForColor } from "../../utils/ColorUtils";
import { memoize } from "../../_bundle/Module12";
const r15 = memoize((a0) => {
let length;
const r4 = 0 < a0.length;
let r0 = 0;
let r6 = 0;
let r7 = 0;
if (r4) {
do {
r6 = (r6 << 5) - r6 + a0.charCodeAt(r0);
r0 = r0 + 1;
length = a0.length;
r7 = r6;
} while (r0 < length);
}
return Math.abs(r7);
});
export function replaceAnimationColors(a0, a1) {
const complimentaryPaletteForColor = getComplimentaryPaletteForColor([a1.r, a1.g, a1.b], 2);
return a0.replace.call(a0, /(\[1,0,0,)/g, `[${complimentaryPaletteForColor[0][0] / 255},${complimentaryPaletteForColor[0][1] / 255},${complimentaryPaletteForColor[0][2] / 255},`).replace(/\[0,0,1,/g, `[${complimentaryPaletteForColor[1][0] / 255},${complimentaryPaletteForColor[1][1] / 255},${complimentaryPaletteForColor[1][2] / 255},`);
}
export { r15 as getBurstAnimationHash };
@@ -0,0 +1,7 @@
// Metro module 10463 (f10464).
const r8 = {
NEW_MESSAGES: "new_messages",
OPT_IN_CHANNEL: "opt_in_channel",
SUMMARIES: "summaries"
};
export { r8 as ChatOverlays };
+22
View File
@@ -0,0 +1,22 @@
// Metro module 11102 (f11103).
import FamilyCenterPendingConnectionStore from "../parent_tools/FamilyCenterPendingConnectionStore";
import * as _useShouldRenderReportFalsePositiveButton from "../explicit_media_redaction/hooks/useShouldRenderReportFalsePositiveButton";
import { useShouldRenderReportFalsePositiveButton } from "../explicit_media_redaction/hooks/useShouldRenderReportFalsePositiveButton";
import * as _AgeVerificationUtils from "../age_assurance/AgeVerificationUtils";
import { isAgeVerificationMessageWithConnectToTeenCta } from "../age_assurance/AgeVerificationUtils";
import { useStateFromStores } from "../../_bundle/Module589";
let c7495_3 = {
MARK_AS_FALSE_POSITIVE: "mark_as_false_positive",
AGE_VERIFICATION_RETRY: "age_verification_retry",
CONNECT_TO_TEEN: "connect_to_teen"
};
export { c7495_3 as CtaButtonType };
export function getCtaButtonType(a0, a1) {
return _useShouldRenderReportFalsePositiveButton.shouldRenderReportFalsePositiveButton(a0) ? c7495_3.MARK_AS_FALSE_POSITIVE : _AgeVerificationUtils.isAgeVerificationMessageWithRetryCta(a1, a0) ? c7495_3.AGE_VERIFICATION_RETRY : isAgeVerificationMessageWithConnectToTeenCta(a1, a0) ? c7495_3.CONNECT_TO_TEEN : void 0;
}
export function useCtaButtonType(a0, a1) {
const shouldRenderReportFalsePositiveButton = useShouldRenderReportFalsePositiveButton(a0);
const isAgeVerificationMessageWithRetryCta = _AgeVerificationUtils.isAgeVerificationMessageWithRetryCta(a1, a0);
const r22 = useStateFromStores([FamilyCenterPendingConnectionStore], () => FamilyCenterPendingConnectionStore.getPendingConnection()) != null && isAgeVerificationMessageWithConnectToTeenCta(a1, a0);
return shouldRenderReportFalsePositiveButton ? c7495_3.MARK_AS_FALSE_POSITIVE : isAgeVerificationMessageWithRetryCta ? c7495_3.AGE_VERIFICATION_RETRY : r22 ? c7495_3.CONNECT_TO_TEEN : void 0;
}
+6
View File
@@ -0,0 +1,6 @@
// Metro module 4523 (f4524).
import { MessageEmbedTypes } from "../../Constants";
const set = new Set([MessageEmbedTypes.AUTO_MODERATION_MESSAGE, MessageEmbedTypes.AUTO_MODERATION_NOTIFICATION, MessageEmbedTypes.RICH, MessageEmbedTypes.SAFETY_POLICY_NOTICE, MessageEmbedTypes.SAFETY_SYSTEM_NOTIFICATION, MessageEmbedTypes.AGE_VERIFICATION_SYSTEM_NOTIFICATION, MessageEmbedTypes.VOICE_CHANNEL, MessageEmbedTypes.POLL_RESULT]);
const set2 = new Set([MessageEmbedTypes.AUTO_MODERATION_MESSAGE, MessageEmbedTypes.AUTO_MODERATION_NOTIFICATION, MessageEmbedTypes.AGE_VERIFICATION_SYSTEM_NOTIFICATION, MessageEmbedTypes.APPLICATION_NEWS, MessageEmbedTypes.POST_PREVIEW, MessageEmbedTypes.SAFETY_POLICY_NOTICE, MessageEmbedTypes.SAFETY_SYSTEM_NOTIFICATION, MessageEmbedTypes.VOICE_CHANNEL, MessageEmbedTypes.POLL_RESULT]);
export { set as EMBED_TYPES_WITH_PARSEABLE_FIELDS };
export { set2 as EMBED_TYPES_WITH_SPECIAL_RENDERER };
@@ -0,0 +1,79 @@
// Metro module 12370 (f12371).
import { useMemo } from "react";
import { intl, t } from "../../intl/index.native";
import * as _ActivitiesInTextUtils from "../activities/ActivitiesInTextUtils";
import { EmbeddedActivityJoinability } from "../activities/utils/getEmbeddedActivityJoinability";
const getJoinOrStartButtonState = function getJoinOrStartButtonState({ embeddedActivity: embeddedActivity2, joinability: joinability2, currentEmbeddedActivity: currentEmbeddedActivity2, channel: channel2 }) {
let tooltip;
const r2 = embeddedActivity2 == null;
const r18 = {
disabled: false,
isJoinAction: !r2,
text: r2 ? intl.string(t.RscU7I) : intl.string(t.sqe0hj),
tooltip: void 0
};
const isActivitiesInTextEnabled = _ActivitiesInTextUtils.isActivitiesInTextEnabled(channel2);
if (embeddedActivity2 != null && currentEmbeddedActivity2 != null && embeddedActivity2.launchId === currentEmbeddedActivity2.launchId) {
return {
...r18,
disabled: true,
text: intl.string(t.DPfdsq),
tooltip: void 0
};
}
if (r2) {
return {
...r18,
disabled: !isActivitiesInTextEnabled,
tooltip: isActivitiesInTextEnabled ? void 0 : intl.string(t.f41E1g)
};
}
if (joinability2 != null && joinability2 !== EmbeddedActivityJoinability.CAN_JOIN) {
L27: {
if (EmbeddedActivityJoinability.NO_USE_EMBEDDED_ACTIVITIES_PERMISSION === joinability2) {
tooltip = intl.string(t.hHGrWz);
} else if (EmbeddedActivityJoinability.ACTIVITY_AGE_GATED === joinability2) {
tooltip = intl.string(t["4WuFRE"]);
} else if (EmbeddedActivityJoinability.ACTIVITIES_FEATURE_NOT_ENABLED_FOR_OS === joinability2) {
tooltip = intl.string(t.uGDCcw);
} else if (EmbeddedActivityJoinability.ACTIVITY_NOT_SUPPORTED_ON_OS === joinability2) {
tooltip = intl.string(t.UXoQTp);
} else if (EmbeddedActivityJoinability.CHANNEL_FULL === joinability2) {
tooltip = intl.string(t.rZfiNq);
} else if (EmbeddedActivityJoinability.NO_CHANNEL_CONNECT_PERMISSION === joinability2) {
tooltip = intl.string(t.w5SAps);
} else {
if (EmbeddedActivityJoinability.NO_CHANNEL !== joinability2 && EmbeddedActivityJoinability.NO_GUILD !== joinability2 && EmbeddedActivityJoinability.NO_USER !== joinability2) {
const IS_AFK_CHANNEL = EmbeddedActivityJoinability.IS_AFK_CHANNEL;
tooltip = void 0;
if (IS_AFK_CHANNEL !== joinability2) {
break L27;
}
}
tooltip = intl.string(t.Etp6uI);
}
}
return {
...r18,
disabled: true,
tooltip
};
}
return r18;
};
const r16 = {
ACTIVE: 0,
0: "ACTIVE",
ENDED: 1,
1: "ENDED"
};
export { r16 as EmbedStates };
export function useJoinOrStartButtonState({ embeddedActivity, joinability, currentEmbeddedActivity, channel }) {
return useMemo(() => getJoinOrStartButtonState({
embeddedActivity,
joinability,
currentEmbeddedActivity,
channel
}), [embeddedActivity, joinability, currentEmbeddedActivity, channel]);
}
export { getJoinOrStartButtonState };
+137
View File
@@ -0,0 +1,137 @@
// Metro module 4408 (f4409).
import ChannelStore from "../../stores/ChannelStore";
import { MessageFlags } from "../../Constants";
import { hasFlag } from "../../_bundle/Module1384";
import { createMessageRecord, updateMessageRecord } from "./MessageRecordUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c2638_4, c2638_5;
const dropChannelIfEmpty = function dropChannelIfEmpty(channelId, a1) {
if (a1.size === 0) {
c2638_5.delete(channelId);
}
};
const clearAll = function clearAll() {
if (c2638_5.size === 0) {
return false;
}
c2638_5.clear();
};
c2638_4 = [];
c2638_5 = new Map();
class EphemeralMessageStore extends Module589.Store {
static displayName = "EphemeralMessageStore";
initialize() {
this.waitFor(ChannelStore);
}
getMessages(a0) {
const r6 = c2638_5.get(a0);
return r6 != null && r6.size !== 0 ? Array.from(r6.values()) : c2638_4;
}
}
const ephemeralMessageStore = new EphemeralMessageStore(Dispatcher, {
MESSAGE_CREATE: function handleMessageCreate({ channelId, message }) {
let flags = message.flags;
if (flags == null) {
flags = 0;
}
if (hasFlag(flags, MessageFlags.EPHEMERAL)) {
let r22 = c2638_5.get(channelId);
if (r22 == null) {
const map = new Map();
c2638_5.set(channelId, map);
r22 = map;
}
r22.set(message.id, createMessageRecord(message));
while (r22.size > 50) {
const r42 = r22.keys().next();
if (r42.done === true) {
break;
}
r22.delete(r42.value);
}
return void 0;
}
return false;
},
MESSAGE_UPDATE: function handleMessageUpdate({ message }) {
const { channel_id, id } = message;
if (channel_id != null && id != null) {
const r9 = c2638_5.get(channel_id);
if (r9 == null) {
return false;
}
const r6 = r9.get(id);
if (r6 == null) {
return false;
}
r9.set(id, updateMessageRecord(r6, message));
return void 0;
}
return false;
},
MESSAGE_DELETE: function handleMessageDelete({ channelId, id }) {
const r9 = c2638_5.get(channelId);
if (r9 != null && r9.delete(id)) {
if (r9.size === 0) {
c2638_5.delete(channelId);
}
return void 0;
}
return false;
},
MESSAGE_DELETE_BULK: function handleMessageDeleteBulk({ channelId, ids }) {
const r24 = c2638_5.get(channelId);
if (r24 == null) {
return false;
}
let r27 = false;
for (const item of ids) {
if (r24.delete(item)) {
r27 = true;
}
}
if (r27) {
dropChannelIfEmpty(channelId, r24);
return void 0;
}
return false;
},
CLEAR_MESSAGES: function handleClearMessages({ channelId }) {
if (c2638_5.has(channelId)) {
c2638_5.delete(channelId);
return void 0;
}
return false;
},
CHANNEL_DELETE: function handleChannelDelete(a0) {
if (c2638_5.delete(a0.channel.id)) {
return void 0;
}
return false;
},
THREAD_DELETE: function handleThreadDelete(a0) {
if (c2638_5.delete(a0.channel.id)) {
return void 0;
}
return false;
},
GUILD_DELETE: function handleGuildDelete() {
if (c2638_5.size === 0) {
return false;
}
let r24 = false;
for (const item of c2638_5.keys()) {
if (ChannelStore.getChannel(item) == null) {
c2638_5.delete(item);
r24 = true;
}
}
return !!r24 && void 0;
},
CACHE_LOADED: clearAll,
CONNECTION_OPEN: clearAll,
OVERLAY_INITIALIZE: clearAll,
LOGOUT: clearAll
});
export default ephemeralMessageStore;
@@ -0,0 +1,107 @@
// Metro module 6046 (f6047).
import GuildStore from "../../stores/GuildStore";
import PermissionStore from "../../stores/PermissionStore";
import { GUILD_OFFICIAL_HIGHLIGHT_ALPHA } from "./MessageConstants";
import { GuildFeatures, Permissions, MessageFlags, ChannelTypes } from "../../Constants";
import { int2hex } from "../../_bundle/int2hslRaw";
import Module689 from "../../_bundle/Module689";
import { getAccessibleForegroundColor } from "../../utils/ColorUtils";
import { WCAGContrastRatios } from "../../design/shared";
import GuildOfficialMessagesExperiment from "./GuildOfficialMessagesExperiment";
import { useStateFromStores } from "../../_bundle/Module589";
import { getIsActiveChannelOrUnarchivableThread } from "../threads/ThreadHooks";
import isSystemMessage from "./isSystemMessage";
function $mk77626($env) {
return () => {
const r4 = $env[0];
return r4 != null ? $env.$parent[3].getGuild(r4) : null;
};
}
let env3830 = {};
export function useCanManageGuildOfficialMessages(a0, a1, a2) {
let env15378;
let guildId = a0;
const r2 = env15378 = {
$parent: env3830
};
env15378[0] = a0;
const stateFromStores = useStateFromStores([GuildStore], $mk77626(r2), [a0]);
if (a0 == null) {
guildId = void 0;
}
const enabled = GuildOfficialMessagesExperiment.useExperiment({
guildId,
location: a2
}).enabled;
let r25 = stateFromStores != null && stateFromStores.features.has(GuildFeatures.VERIFIED) && enabled;
const stateFromStores2 = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.MANAGE_OFFICIAL_MESSAGES, a1), [a1]);
if (r25) {
r25 = stateFromStores2;
}
return r25;
}
export function getAccessibleGuildOfficialTextColor(a0, a1, saturationFactor = 1, r12 = GUILD_OFFICIAL_HIGHLIGHT_ALPHA) {
const r11 = int2hex(a0);
let background = Module689(a1);
const foreground = Module689(r11);
const r28 = Module689.mix(background, r11, r12, "rgb");
if (Module689.contrast(foreground, r28) < Module689.contrast(foreground, background)) {
background = r28;
}
return getAccessibleForegroundColor({
foreground,
background,
ratio: WCAGContrastRatios.Text,
saturationFactor
});
}
export function showGuildOfficialMessageGradient(a0) {
return a0 !== "no_gradient" && a0 !== "hidden";
}
export function showGuildOfficialMessageTextColor(a0) {
return a0 !== "no_text_color" && a0 !== "hidden";
}
export function isGuildOfficialMessagesEnabled(a0, a1) {
return a0 != null && a0.features.has(GuildFeatures.VERIFIED) && GuildOfficialMessagesExperiment.getCurrentConfig({
guildId: a0.id,
location: a1
}).enabled;
}
export function useIsGuildOfficialMessagesEnabled(a0, a1) {
let env15376;
const r3 = env15376 = {
$parent: env3830
};
let guildId = a0;
env15376[0] = a0;
const stateFromStores = useStateFromStores([GuildStore], $mk77626(r3), [a0]);
if (a0 == null) {
guildId = void 0;
}
const enabled = GuildOfficialMessagesExperiment.useExperiment({
guildId,
location: a1
}).enabled;
return stateFromStores != null && stateFromStores.features.has(GuildFeatures.VERIFIED) && enabled;
}
export function canManageGuildOfficialMessages(a0, a1, a2) {
return a0 != null && a0.features.has(GuildFeatures.VERIFIED) && GuildOfficialMessagesExperiment.getCurrentConfig({
guildId: a0.id,
location: a2
}).enabled && PermissionStore.can(Permissions.MANAGE_OFFICIAL_MESSAGES, a1);
}
export function useCanToggleGuildOfficialMessages(a0, a1, a2) {
let guild_id = a1.guild_id;
if (guild_id == null) {
guild_id = void 0;
}
const r8 = useCanManageGuildOfficialMessages(guild_id, a1, a2);
const r9 = r8 ? isSystemMessage(a0) : !r8;
return r9 ? !r9 : a0.hasFlag(MessageFlags.IS_GUILD_OFFICIAL) ? getIsActiveChannelOrUnarchivableThread(a1) : a1 != null && !a1.isPrivate() && getIsActiveChannelOrUnarchivableThread(a1) && a1.type !== ChannelTypes.GUILD_VOICE && a1.type !== ChannelTypes.GUILD_STAGE_VOICE;
}
export function canSendGuildOfficialMessages(a0, a1, a2) {
return a0 != null && a0.features.has(GuildFeatures.VERIFIED) && GuildOfficialMessagesExperiment.getCurrentConfig({
guildId: a0.id,
location: a2
}).enabled && PermissionStore.can(Permissions.MANAGE_OFFICIAL_MESSAGES, a1) && (a1 != null && !a1.isPrivate() && getIsActiveChannelOrUnarchivableThread(a1) && a1.type !== ChannelTypes.GUILD_VOICE && a1.type !== ChannelTypes.GUILD_STAGE_VOICE);
}
@@ -0,0 +1,18 @@
// Metro module 6047 (f6048).
import { createExperiment } from "../experiments/index";
const experiment = createExperiment({
kind: "guild",
id: "2026-03_guild_official_messages",
label: "Guild Official Messages",
defaultConfig: {
enabled: false
},
treatments: [{
id: 1,
label: "Enable official messages",
config: {
enabled: true
}
}]
});
export default experiment;
@@ -0,0 +1,649 @@
// Metro module 12771 (f12772).
import ChannelStore from "../../stores/ChannelStore";
import GuildMemberStore from "../../stores/GuildMemberStore";
import GuildStore from "../../stores/GuildStore";
import RelationshipStore from "../../stores/RelationshipStore";
import UserStore from "../../stores/UserStore";
import { MessageFlags } from "../../Constants";
import { createMessageRecord, updateMessageRecord } from "./MessageRecordUtils";
import * as _Module1384 from "../../_bundle/Module1384";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
import { HermesBuiltin } from "../../_hermes/prelude";
let c8802_8;
const updateGuildState = function updateGuildState(a0, a1) {
const r6 = c8802_8[a0];
if (r6 != null) {
const r10 = {
...c8802_8
};
r10[a0] = {
...r6,
...a1(r6)
};
c8802_8 = r10;
}
};
const handleChannelDelete = function handleChannelDelete({ channel }) {
const guild_id = channel.guild_id;
if (guild_id == null) {
return false;
}
const r28 = c8802_8[guild_id];
if (r28 == null) {
return false;
}
const ids = [];
const messages = {
...r28.messages
};
for (const id3 of r28.ids) {
if (r28.messages[id3]?.channel_id === channel.id) {
delete messages[id3];
} else {
ids.push(id3);
}
}
if (ids.length === r28.ids.length) {
return false;
}
updateGuildState(guild_id, () => ({
ids,
messages
}));
};
const handleRelationshipUpdate = function handleRelationshipUpdate() {
const r1 = {};
let r4 = false;
for (const item of Object.keys(c8802_8)) {
const r45 = c8802_8[item];
let messages4 = null;
for (const id3 of r45.ids) {
const r56 = r45.messages[id3];
if (r56 != null) {
const isBlockedForMessage = RelationshipStore.isBlockedForMessage(r56);
const isIgnoredForMessage = RelationshipStore.isIgnoredForMessage(r56);
if (!(r56.blocked === isBlockedForMessage && r56.ignored === isIgnoredForMessage)) {
if (messages4 == null) {
messages4 = {
...r45.messages
};
}
messages4[id3] = r56.merge({
blocked: isBlockedForMessage,
ignored: isIgnoredForMessage
});
}
}
}
if (messages4 == null) {
r1[item] = r45;
continue;
}
r1[item] = {
...r45,
messages: messages4
};
r4 = true;
}
if (r4) {
c8802_8 = r1;
return void 0;
}
return false;
};
c8802_8 = {};
class GuildOfficialMessagesStore extends Module589.Store {
static displayName = "GuildOfficialMessagesStore";
initialize() {
this.waitFor(ChannelStore, GuildMemberStore, GuildStore, RelationshipStore, UserStore);
}
getState(a0) {
return c8802_8[a0];
}
getMessage(a0, a1) {
const r5 = c8802_8[a0];
return r5 == null ? void 0 : r5.messages[a1];
}
getMessages(a0) {
const r5 = c8802_8[a0];
let c20203_0 = r5;
return r5 == null ? [] : r5.ids.map((id) => c20203_0.messages[id]).filter((item) => item != null);
}
isLoading(a0) {
let r6 = c8802_8[a0]?.loading;
if (r6 == null) {
r6 = false;
}
return r6;
}
isLoaded(a0) {
let r6 = c8802_8[a0]?.loaded;
if (r6 == null) {
r6 = false;
}
return r6;
}
hasMore(a0) {
let r6 = c8802_8[a0]?.hasMore;
if (r6 == null) {
r6 = false;
}
return r6;
}
}
const guildOfficialMessagesStore = new GuildOfficialMessagesStore(Dispatcher, {
CONNECTION_OPEN: function handleConnectionOpen() {
c8802_8 = {};
},
LOAD_OFFICIAL_MESSAGES: function handleLoadOfficialMessages({ guildId, before: before2 }) {
const r7 = c8802_8[guildId];
if (r7?.loading === true) {
return false;
}
if (before2 != null) {
if (r7 == null) {
return false;
}
const r18 = {
...c8802_8
};
r18[guildId] = {
...r7,
loading: true
};
c8802_8 = r18;
} else {
const r14 = {
...c8802_8
};
r14[guildId] = {
ids: [],
messages: {},
hasMore: false,
loading: true,
loaded: false,
error: false
};
c8802_8 = r14;
}
},
LOAD_OFFICIAL_MESSAGES_SUCCESS: function handleLoadOfficialMessagesSuccess({ guildId, messages: messages2, hasMore: hasMore2, before }) {
if (c8802_8[guildId] == null) {
return false;
}
const r7 = c8802_8[guildId];
if (r7 != null) {
const r16 = (a0) => {
const ids3 = before != null ? [...a0.ids] : [];
const messages4 = before != null ? {
...a0.messages
} : {};
for (const item of messages2) {
const messageRecord = createMessageRecord(item);
if (messages4[messageRecord.id] == null) {
ids3.push(messageRecord.id);
}
messages4[messageRecord.id] = messageRecord;
}
return {
ids: ids3,
messages: messages4,
hasMore: hasMore2,
loading: false,
loaded: true,
error: false
};
};
const r17 = {
...c8802_8
};
r17[guildId] = {
...r7,
...r16(r7)
};
c8802_8 = r17;
}
},
LOAD_OFFICIAL_MESSAGES_FAILURE: function handleLoadOfficialMessagesFailure({ guildId, before: before2 }) {
if (c8802_8[guildId] == null) {
return false;
}
const r7 = before2 != null ? () => ({
loading: false
}) : () => ({
loading: false,
error: true
});
const r6 = c8802_8[guildId];
if (r6 != null) {
const r15 = {
...c8802_8
};
r15[guildId] = {
...r6,
...r7(r6)
};
c8802_8 = r15;
}
},
GUILD_DELETE: function handleGuildDelete({ guild }) {
if (c8802_8[guild.id] == null) {
return false;
}
const r9 = {
...c8802_8
};
delete r9[guild.id];
c8802_8 = r9;
},
CHANNEL_DELETE: handleChannelDelete,
THREAD_DELETE: handleChannelDelete,
MESSAGE_CREATE: function handleMessageCreate({ message, guildId, optimistic, isPushNotification }) {
if (!optimistic && !isPushNotification) {
if (guildId != null) {
let flags = message.flags;
if (flags == null) {
flags = 0;
}
if (_Module1384.hasFlag(flags, MessageFlags.IS_GUILD_OFFICIAL)) {
const r24 = c8802_8[guildId];
let r1 = r24 != null;
if (r1) {
let r2 = r24.messages[message.id] == null;
if (r2) {
const messageRecord = createMessageRecord(message);
const r33 = c8802_8[guildId];
const r34 = r33 != null;
r2 = void 0;
if (r34) {
const r35 = {
...c8802_8
};
const r37 = {
...r33
};
const ids3 = [messageRecord.id, ...r33.ids];
const messages4 = {
...r33.messages
};
messages4[messageRecord.id] = messageRecord;
HermesBuiltin.copyDataProperties(r37, {
ids: ids3,
messages: messages4
});
r35[guildId] = r37;
c8802_8 = r35;
r2 = void 0;
}
}
r1 = r2;
}
return r1;
}
}
return false;
}
return false;
},
MESSAGE_UPDATE: function handleMessageUpdate({ message }) {
let id;
id = void 0;
if (message.id == null) {
return false;
}
const channel = ChannelStore.getChannel(message.channel_id);
const r24 = channel == null ? void 0 : channel.getGuildId();
if (r24 == null) {
return false;
}
const r27 = c8802_8[r24];
if (r27 == null) {
return false;
}
const r8 = r27.messages[message.id];
if (message.author == null) {
let r106 = r8 != null;
if (r106) {
const r112 = updateMessageRecord(r8, message);
const r114 = c8802_8[r24];
const r115 = r114 != null;
r106 = void 0;
if (r115) {
const r116 = {
...c8802_8
};
const r120 = {
...r114
};
const messages7 = {
...r114.messages
};
messages7[r112.id] = r112;
HermesBuiltin.copyDataProperties(r120, {
messages: messages7
});
r116[r24] = r120;
c8802_8 = r116;
r106 = void 0;
}
}
return r106;
}
let flags = message.flags;
if (flags == null) {
flags = 0;
}
L21: {
const hasFlag = _Module1384.hasFlag(flags, MessageFlags.IS_GUILD_OFFICIAL);
if (hasFlag && r8 == null) {
const messageRecord = createMessageRecord(message);
const r84 = c8802_8[r24];
if (r84 == null) {
break L21;
}
const r85 = {
...c8802_8
};
const r89 = {
...r84
};
const ids3 = [messageRecord.id, ...r84.ids];
const messages6 = {
...r84.messages
};
messages6[messageRecord.id] = messageRecord;
HermesBuiltin.copyDataProperties(r89, {
ids: ids3,
messages: messages6
});
r85[r24] = r89;
c8802_8 = r85;
} else if (!hasFlag && r8 != null) {
id = message.id;
const r16 = c8802_8[r24];
if (r16 == null) {
break L21;
}
const r38 = {
...c8802_8
};
const r40 = {
...r16
};
const messages4 = {
...r16.messages
};
delete messages4[id];
HermesBuiltin.copyDataProperties(r40, {
ids: r16.ids.filter((a0) => a0 !== id),
messages: messages4
});
r38[r24] = r40;
c8802_8 = r38;
} else {
if (!(hasFlag && r8 != null)) {
return false;
}
const r58 = updateMessageRecord(r8, message);
const r60 = c8802_8[r24];
if (r60 == null) {
break L21;
}
const r61 = {
...c8802_8
};
const r65 = {
...r60
};
const messages5 = {
...r60.messages
};
messages5[r58.id] = r58;
HermesBuiltin.copyDataProperties(r65, {
messages: messages5
});
r61[r24] = r65;
c8802_8 = r61;
}
}
},
MESSAGE_REACTION_ADD: function handleMessageReactionAdd({ channelId, messageId, userId, emoji, optimistic, reactionType, colors }) {
const r22 = UserStore.getCurrentUser()?.id === userId;
if (optimistic && !r22) {
return false;
}
const channel = ChannelStore.getChannel(channelId);
const guildId2 = channel == null ? void 0 : channel.getGuildId();
const r29 = guildId2 == null;
let r30 = null;
if (!r29) {
const r32 = c8802_8[guildId2];
const r33 = r32 == null;
r30 = null;
if (!r33) {
const message = r32.messages[messageId];
r30 = message == null ? null : {
guildId: guildId2,
message
};
}
}
if (r30 == null) {
return false;
}
const r41 = r30.message.addReaction(emoji, r22, colors, reactionType);
const guildId = r30.guildId;
const r44 = c8802_8[guildId];
if (r44 != null) {
const r45 = {
...c8802_8
};
const r49 = {
...r44
};
const messages4 = {
...r44.messages
};
messages4[r41.id] = r41;
HermesBuiltin.copyDataProperties(r49, {
messages: messages4
});
r45[guildId] = r49;
c8802_8 = r45;
}
},
MESSAGE_REACTION_REMOVE: function handleMessageReactionRemove({ channelId, messageId, userId, emoji, optimistic, reactionType }) {
const r19 = UserStore.getCurrentUser()?.id === userId;
if (optimistic && !r19) {
return false;
}
const channel = ChannelStore.getChannel(channelId);
const guildId2 = channel == null ? void 0 : channel.getGuildId();
const r26 = guildId2 == null;
let r27 = null;
if (!r26) {
const r29 = c8802_8[guildId2];
const r30 = r29 == null;
r27 = null;
if (!r30) {
const message = r29.messages[messageId];
r27 = message == null ? null : {
guildId: guildId2,
message
};
}
}
if (r27 == null) {
return false;
}
const r38 = r27.message.removeReaction(emoji, r19, reactionType);
const guildId = r27.guildId;
const r41 = c8802_8[guildId];
if (r41 != null) {
const r42 = {
...c8802_8
};
const r44 = {
...r41
};
const messages4 = {
...r41.messages
};
messages4[r38.id] = r38;
HermesBuiltin.copyDataProperties(r44, {
messages: messages4
});
r42[guildId] = r44;
c8802_8 = r42;
}
},
MESSAGE_REACTION_REMOVE_ALL: function handleMessageReactionRemoveAll({ channelId, messageId }) {
const channel = ChannelStore.getChannel(channelId);
const guildId2 = channel == null ? void 0 : channel.getGuildId();
const r16 = guildId2 == null;
let r17 = null;
if (!r16) {
const r19 = c8802_8[guildId2];
const r20 = r19 == null;
r17 = null;
if (!r20) {
const message = r19.messages[messageId];
r17 = message == null ? null : {
guildId: guildId2,
message
};
}
}
if (r17 == null) {
return false;
}
const r10 = r17.message.set("reactions", []);
const guildId = r17.guildId;
const r9 = c8802_8[guildId];
if (r9 != null) {
const r32 = {
...c8802_8
};
const r34 = {
...r9
};
const messages4 = {
...r9.messages
};
messages4[r10.id] = r10;
HermesBuiltin.copyDataProperties(r34, {
messages: messages4
});
r32[guildId] = r34;
c8802_8 = r32;
}
},
MESSAGE_REACTION_REMOVE_EMOJI: function handleMessageReactionRemoveEmoji({ channelId, messageId, emoji }) {
const channel = ChannelStore.getChannel(channelId);
const guildId2 = channel == null ? void 0 : channel.getGuildId();
const r16 = guildId2 == null;
let r17 = null;
if (!r16) {
const r19 = c8802_8[guildId2];
const r20 = r19 == null;
r17 = null;
if (!r20) {
const message = r19.messages[messageId];
r17 = message == null ? null : {
guildId: guildId2,
message
};
}
}
if (r17 == null) {
return false;
}
const r10 = r17.message.removeReactionsForEmoji(emoji);
const guildId = r17.guildId;
const r30 = c8802_8[guildId];
if (r30 != null) {
const r31 = {
...c8802_8
};
const r33 = {
...r30
};
const messages4 = {
...r30.messages
};
messages4[r10.id] = r10;
HermesBuiltin.copyDataProperties(r33, {
messages: messages4
});
r31[guildId] = r33;
c8802_8 = r31;
}
},
MESSAGE_DELETE: function handleMessageDelete({ id: id2, guildId }) {
let r1 = guildId != null;
if (r1) {
const r6 = c8802_8[guildId];
let r18 = (r6 == null ? void 0 : r6.messages[id2]) != null;
if (r18) {
const r11 = c8802_8[guildId];
const r20 = r11 != null;
r18 = void 0;
if (r20) {
const r21 = {
...c8802_8
};
const r23 = {
...r11
};
const messages4 = {
...r11.messages
};
delete messages4[id2];
HermesBuiltin.copyDataProperties(r23, {
ids: r11.ids.filter((id) => id !== id2),
messages: messages4
});
r21[guildId] = r23;
c8802_8 = r21;
r18 = void 0;
}
}
r1 = r18;
}
return r1;
},
MESSAGE_DELETE_BULK: function handleMessageDeleteBulk({ ids: ids3, guildId }) {
let messages3;
messages3 = void 0;
if (guildId == null) {
return false;
}
const r24 = c8802_8[guildId];
if (r24 == null) {
return false;
}
const set = new Set(ids3);
let c20207_0 = set;
const ids2 = r24.ids.filter((id) => !c20207_0.has(id));
if (ids2.length === r24.ids.length) {
return false;
}
messages3 = {
...r24.messages
};
for (const id3 of r24.ids) {
if (set.has(id3)) {
delete messages3[id3];
}
}
updateGuildState(guildId, () => ({
ids: ids2,
messages: messages3
}));
},
RELATIONSHIP_ADD: handleRelationshipUpdate,
RELATIONSHIP_REMOVE: handleRelationshipUpdate,
RELATIONSHIP_UPDATE: handleRelationshipUpdate
});
export default guildOfficialMessagesStore;
+127
View File
@@ -0,0 +1,127 @@
// Metro module 11173 (f11174).
import EmojiStore from "../emojis/EmojiStore";
import MessageStore from "../../stores/MessageStore";
import { AnalyticEvents, MARKDOWN_SPOILER_WRAPPER, ME } from "../../Constants";
import { EnableTTSCommand } from "../user_settings/UserSettings";
import ChangeNicknameActionCreators from "../../actions/ChangeNicknameActionCreators";
import Module3888 from "../../_bundle/Module3888";
import { addReaction } from "../reactions/ReactionActionCreators";
import { toReactionEmoji } from "../reactions/ReactionUtils";
import MessageActionCreators from "../../actions/MessageActionCreators";
import AppAnalyticsUtils from "../app_analytics/AppAnalyticsUtils";
let c7556_9 = /\\([*?+/])/g;
let c7556_10 = {
tts: {
action: () => ({
tts: EnableTTSCommand.getSetting()
})
},
me: {
action: (a0) => ({
content: `_${a0}_`
})
},
tableflip: {
action: (a0) => ({
content: `${a0} (╯°□°)╯︵ ┻━┻`.trim()
})
},
unflip: {
action: (a0) => ({
content: `${a0} ┬─┬ノ( º _ ºノ)`.trim()
})
},
shrug: {
action: (a0) => ({
content: `${a0} ¯\\_(ツ)_/¯`.trim()
})
},
nick: {
action: (a0, { channel }) => {
if (channel.guild_id != null) {
ChangeNicknameActionCreators.changeNickname(channel.guild_id, channel.id, ME, a0);
return {
content: ""
};
}
}
},
reaction: {
match: Module3888.anyScopeRegex(/^\+:(.+?): *$/),
action: (a0, { isEdit, channel }) => {
if (!isEdit && MessageStore.hasPresent(channel.id)) {
const r17 = MessageStore.getMessages(channel.id).last();
if (r17 != null && r17.id != null) {
const byName = EmojiStore.getDisambiguatedEmojiContext(channel.guild_id).getByName(a0.trim().slice(2, -1));
if (byName != null) {
addReaction(channel.id, r17.id, toReactionEmoji(byName));
return {
content: ""
};
}
}
}
}
},
searchReplace: {
match: Module3888.anyScopeRegex(/^s\/([^\/\\]*(?:\\.[^\/\\]*)*)\/([^\/\\]*(?:\\.[^\/\\]*)*)(?:\/([g]*))?$/),
action: function action(a0, { isEdit, channel }) {
if (isEdit) {
return void 0;
}
const lastEditableMessage = MessageStore.getLastEditableMessage(channel.id);
if (lastEditableMessage != null && lastEditableMessage.id != null) {
const r9 = Array;
let r22 = a0.match(this.match.regex);
if (r22 == null) {
r22 = [];
}
const [, r27, r12, r28] = r9.from(r22);
let r29 = r28 == null ? void 0 : r28.split("");
if (r29 == null) {
r29 = [];
}
const r35 = r27.replace(c7556_9, (a0, a1) => a1);
const r38 = r12.replace(c7556_9, (a0, a1) => a1);
const r41 = r29.includes("g");
const content = lastEditableMessage.content;
const content2 = r41 ? content.replaceAll(r35, r38) : content.replace(r35, r38);
if (!(content2 != null && content2.trim() !== "") && lastEditableMessage.attachments.length === 0) {
MessageActionCreators.deleteMessage(channel.id, lastEditableMessage.id);
} else if (content2 !== lastEditableMessage.content) {
MessageActionCreators.editMessage(channel.id, lastEditableMessage.id, {
content: content2
});
}
return {
content: ""
};
}
return {
content: ""
};
}
},
spoiler: {
action: (a0) => ({
content: MARKDOWN_SPOILER_WRAPPER(a0).trim()
})
}
};
Object.setPrototypeOf(c7556_10, null);
export { c7556_10 as COMMANDS };
export function handleLegacyCommands(a0, a1) {
for (const key in c7556_10) {
const command = key;
const r7 = c7556_10[command];
if (r7.match != null) {
const regex = r7.match.regex;
if (regex == null ? void 0 : regex.test(a0)) {
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SLASH_COMMAND_USED, {
command
});
return r7.action(a0, a1);
}
}
}
}
+401
View File
@@ -0,0 +1,401 @@
// Metro module 7877 (f7878).
import { MessageEmbedTypes, MessageTypes } from "../../Constants";
import { isEmbedInline } from "../../utils/EmbedUtils";
import { isBuildOverrideLink } from "../build_overrides/BuildOverrideUtils";
import { isExperimentEmbedURL } from "../experiments/ExperimentEmbedUtils";
import { parseGameServerShareCode } from "../coded_links/findCodedLinks";
function $mk79369() {
return (a0) => {
let r0 = a0.type !== "emoji" && a0.type !== "customEmoji";
if (r0) {
const content = a0.content;
r0 = typeof content === "string" ? a0.content.trim() !== "" : typeof content !== "string";
}
return r0;
};
}
function $mk79370($env) {
return (a0) => {
const r1 = a0.type !== "emoji" && a0.type !== "customEmoji";
const r8 = $env;
if (!r1) {
r8[0] = r8[0] + 1;
}
if (r8[0] > 30) {
return false;
}
};
}
function $mk79371() {
return (a0) => {
a0.jumboable = true;
};
}
function $mk79372($env) {
return (a0) => {
let r18, r22, r28;
let env26047;
const r12 = $env.$parent;
const r14 = $env[0];
const r5 = env26047 = {
$parent: r12
};
env26047[0] = r14;
if (a0 instanceof Array) {
r18 = a0.some($mk79372(r5));
} else {
r18 = r14(a0);
if (r18 == null) {
if (a0.content instanceof Array) {
let env26048;
const content = a0.content;
const r25 = env26048 = {
$parent: r12
};
env26048[0] = r14;
if (content instanceof Array) {
r28 = content.some($mk79372(r25));
} else {
r28 = r14(content);
if (r28 == null) {
r28 = content.content instanceof Array ? (0, r12[7])(content.content, r14) : content.items instanceof Array && content.items.some($mk79373(r25));
}
}
r22 = r28;
} else {
r22 = a0.items instanceof Array && a0.items.some($mk79373(r5));
}
r18 = r22;
}
}
return r18;
};
}
function $mk79373($env) {
return (a0) => {
let r18, r22, r28;
let env26049;
const r12 = $env.$parent;
const r14 = $env[0];
const r5 = env26049 = {
$parent: r12
};
env26049[0] = r14;
if (a0 instanceof Array) {
r18 = a0.some($mk79372(r5));
} else {
r18 = r14(a0);
if (r18 == null) {
if (a0.content instanceof Array) {
let env26050;
const content = a0.content;
const r25 = env26050 = {
$parent: r12
};
env26050[0] = r14;
if (content instanceof Array) {
r28 = content.some($mk79372(r25));
} else {
r28 = r14(content);
if (r28 == null) {
r28 = content.content instanceof Array ? (0, r12[7])(content.content, r14) : content.items instanceof Array && content.items.some($mk79373(r25));
}
}
r22 = r28;
} else {
r22 = a0.items instanceof Array && a0.items.some($mk79373(r5));
}
r18 = r22;
}
}
return r18;
};
}
function $mk79377() {
return (a0) => a0.type !== "link";
}
function $mk79378($env) {
return (a0) => {
const type = a0.type;
const r0 = a0.target != null;
let r7 = null;
if (r0) {
const r5 = $env.$parent;
r7 = (0, r5[0])(r5[2][4]).parseQuestsEmbedCode(a0.target);
}
return !(type === "link" && r7 != null && !$env[0]);
};
}
function $mk79379($env) {
return (a0) => {
const r1 = $env;
if (r1[5].has(a0.type) && a0.content != null) {
const isArray = Array.isArray(a0.content);
const content = a0.content;
if (isArray) {
content.forEach($mk79379(r1));
} else if (typeof content === "string") {
a0.content = a0.content.replace(/\n/g, " ");
} else {
(0, r1[1])(r1[2][5]).captureMessage(`AST node type:${a0.type} with content typeof ${typeof a0.content}. Keys ${Object.keys(a0)}`);
}
}
};
}
let containsMatchingNode, c4975_4, c4975_5;
let $mk79374 = function() {
return (a0) => {
let r20, r27, r33;
const type = a0.type;
let r4 = null;
if (type === "spoiler") {
let env26051;
const r15 = (a0) => a0.type === "link" || a0.type === "attachmentLink" || null;
const r17 = env26051 = {
$parent: env4975
};
env26051[0] = r15;
if (a0 instanceof Array) {
r20 = a0.some($mk79372(r17));
} else {
r20 = a0.type === "link" || a0.type === "attachmentLink" || null;
if (r20 == null) {
if (a0.content instanceof Array) {
let env26052;
const content = a0.content;
const r30 = env26052 = {
$parent: env4975
};
env26052[0] = r15;
if (content instanceof Array) {
r33 = content.some($mk79372(r30));
} else {
r33 = r15(content);
if (r33 == null) {
r33 = content.content instanceof Array ? containsMatchingNode(content.content, r15) : content.items instanceof Array && content.items.some($mk79373(r30));
}
}
r27 = r33;
} else {
r27 = a0.items instanceof Array && a0.items.some($mk79373(r17));
}
r20 = r27;
}
}
r4 = r20;
}
return r4;
};
}, $mk79375 = function() {
return (a0) => a0.type !== "link" || !isBuildOverrideLink(a0.target);
}, $mk79376 = function() {
return (a0) => a0.type !== "link" || !isExperimentEmbedURL(a0.target);
};
let env4975 = {};
export function checkSpoilerEmbeds(a0, a1) {
let r21, r28, r32, r38, r57, r64, r72;
if (a1) {
let env16067;
const r51 = $mk79374();
const r52 = env16067 = {
$parent: env4975
};
env16067[0] = r51;
if (a0 instanceof Array) {
r57 = a0.some($mk79372(r52));
} else {
r57 = r51(a0);
if (r57 == null) {
if (a0.content instanceof Array) {
let env16068;
const content3 = a0.content;
const r69 = env16068 = {
$parent: env4975
};
env16068[0] = r51;
if (content3 instanceof Array) {
r72 = content3.some($mk79372(r69));
} else {
r72 = r51(content3);
if (r72 == null) {
r72 = content3.content instanceof Array ? containsMatchingNode(content3.content, r51) : content3.items instanceof Array && content3.items.some($mk79373(r69));
}
}
r64 = r72;
} else {
r64 = a0.items instanceof Array && a0.items.some($mk79373(r52));
}
r57 = r64;
}
}
r21 = r57;
} else {
r21 = a0[0].type === "paragraph" && a0[0].content instanceof Array;
if (r21) {
let env16065;
const content = a0[0].content;
const r17 = $mk79374();
const r26 = env16065 = {
$parent: env4975
};
env16065[0] = r17;
if (content instanceof Array) {
r28 = content.some($mk79372(r26));
} else {
r28 = r17(content);
if (r28 == null) {
if (content.content instanceof Array) {
let env16066;
const content2 = content.content;
const r35 = env16066 = {
$parent: env4975
};
env16066[0] = r17;
if (content2 instanceof Array) {
r38 = content2.some($mk79372(r35));
} else {
r38 = r17(content2);
if (r38 == null) {
r38 = content2.content instanceof Array ? containsMatchingNode(content2.content, r17) : content2.items instanceof Array && content2.items.some($mk79373(r35));
}
}
r32 = r38;
} else {
r32 = content.items instanceof Array && content.items.some($mk79373(r26));
}
r28 = r32;
}
}
r21 = r28;
}
}
return r21;
}
containsMatchingNode = function containsMatchingNode(a0, a1) {
let env16069;
const r2 = env16069 = {
$parent: env4975
};
env16069[0] = a1;
if (a0 instanceof Array) {
return a0.some($mk79372(r2));
}
let r11 = a1(a0);
if (r11 == null) {
r11 = a0.content instanceof Array ? containsMatchingNode(a0.content, a1) : a0.items instanceof Array && a0.items.some($mk79373(r2));
}
return r11;
};
c4975_4 = new Set([MessageEmbedTypes.IMAGE, MessageEmbedTypes.GIFV]);
c4975_5 = new Set(["strong", "em", "u", "text", "inlineCode", "s", "spoiler"]);
export function checkForSimpleEmbedMessage(a0, a1) {
if (a0.length === 1 && a1.length === 1) {
const r10 = a0[0];
const r6 = a1[0];
return r10.type !== "link" ? r10.type === "attachmentLink" ? c4975_4.has(r6.type) ? isEmbedInline(r6) ? [] : a0 : a0 : a0 : c4975_4.has(r6.type) ? isEmbedInline(r6) ? [] : a0 : a0;
}
return a0;
}
export function removeBuildOverrideLinks(a0) {
return a0.filter($mk79375());
}
export function removeExperimentLinks(a0) {
return a0.filter($mk79376());
}
export function removeQuestsEmbedLinks(a0) {
let env16070;
const r1 = env16070 = {
$parent: env4975
};
env16070[0] = a0.some($mk79377());
return a0.filter($mk79378(r1));
}
export function removeGameServerShareLinks(a0) {
return a0.filter((item) => {
const type = item.type;
const r1 = item.target != null && parseGameServerShareCode(item.target) != null;
return !(type === "link" && r1);
});
}
export function convertNewlinesInContent(a0) {
a0.forEach.call(a0, $mk79379(env4975));
return a0;
}
export function runMessageMarkupPostProcessors(a0) {
const { ast, inline, hasBailedAst, message } = a0;
let contentMessage = a0.contentMessage;
const { messageContent, hideSimpleEmbedContent, formatInline, toAST } = a0;
let r20 = Array.isArray(ast) ? ast : [ast];
if (hasBailedAst) {
r20 = [{
type: "text",
content: messageContent,
originalMatch: {
index: 0,
0: messageContent
}
}];
}
const r25 = env4975;
let r26 = r20;
if (hideSimpleEmbedContent) {
const embeds = (contentMessage == null ? message : contentMessage).embeds;
const length = r20.length;
let r30 = r20;
if (length === 1) {
const length2 = embeds.length;
r30 = r20;
if (length2 === 1) {
const r32 = r20[0];
const r16 = embeds[0];
r30 = r32.type !== "link" ? r32.type === "attachmentLink" ? c4975_4.has(r16.type) ? isEmbedInline(r16) ? [] : r20 : r20 : r20 : c4975_4.has(r16.type) ? isEmbedInline(r16) ? [] : r20 : r20;
}
}
r26 = r30;
}
if (!(formatInline || message.type === MessageTypes.MEDIA_MENTION_MESSAGE)) {
if (inline) {
if (!r26.some($mk79369())) {
let env16072;
const r78 = env16072 = {};
env16072[0] = 0;
r26.forEach($mk79370(r78));
if (!(env16072[0] > 30)) {
r26.forEach($mk79371());
}
}
} else if (r26[0].type === "paragraph" && r26[0].content instanceof Array) {
let env16071;
const r58 = r26[0];
const content = r26[0].content;
const r61 = env16071 = {};
env16071[0] = void 0;
if (!content.some($mk79369())) {
env16071[0] = 0;
content.forEach($mk79370(r61));
if (!(env16071[0] > 30)) {
content.forEach($mk79371());
}
}
r58.content = content;
}
}
const r88 = toAST ? r26.filter($mk79375()).filter($mk79376()) : r26;
let env16073;
const r94 = env16073 = {
$parent: env4975
};
env16073[0] = r88.some($mk79377());
const ast2 = r88.filter($mk79378(r94));
if (contentMessage == null) {
contentMessage = message;
}
const hasSpoilerEmbeds = contentMessage.embeds.length > 0 ? checkSpoilerEmbeds(ast2, inline) : false;
if (formatInline) {
ast2.forEach($mk79379(r25));
}
return {
ast: ast2,
hasSpoilerEmbeds
};
}
+110
View File
@@ -0,0 +1,110 @@
// Metro module 4377 (f4378).
import { isIOS, isAndroid } from "../../utils/PlatformUtils";
import { isIOSWithWebM } from "./WebViewWebmSupportTest.native";
let r35;
let c2594_8;
let c2594_3 = /\.(png|jpe?g|jfif|webp|gif|heic|heif|dng|avif)$/i;
let c2594_4 = /\.(webp|gif|avif)$/i;
let c2594_5 = isIOS() ? /\.(mp3|m4a|wav|aif|aiff|ogg|opus|flac)$/i : isAndroid() ? /\.(mp3|m4a|wav|ogg|opus|flac)$/i : /\.(mp3|m4a|wav|aif|aiff|ogg|opus|flac)$/i;
let c2594_6 = /\.(webm)$/i;
let c2594_7 = /\.(riv)$/i;
if (isIOS()) {
r35 = /\.(mp4|mov|qt)$/i;
} else {
isAndroid();
r35 = /\.(mp4|webm|mov|qt)$/i;
}
export function urlMatchesFileExtension(a0, a1) {
if (a0 == null) {
return false;
}
const [r12, ] = a0.split(/\?/, 1);
return a1.test(r12);
}
export function isWebPlayerVideoUrl(a0) {
let r13 = isIOSWithWebM();
if (r13) {
const r14 = a0 == null;
let r15 = false;
if (!r14) {
const [r20, ] = a0.split(/\?/, 1);
r15 = c2594_6.test(r20);
}
r13 = r15;
}
return r13;
}
export function isWebPlayerVideoFile(a0) {
return a0 != null && isIOSWithWebM() && c2594_6.test(a0);
}
c2594_8 = r35;
export function isImageUrl(a0) {
const r8 = a0 == null;
let r2 = false;
if (!r8) {
const [r14, ] = a0.split(/\?/, 1);
r2 = c2594_3.test(r14);
}
return r2;
}
export function isImageFile(a0) {
return a0 != null && c2594_3.test(a0);
}
export function isImageContentType(a0) {
const r2 = a0 == null;
let r7 = false;
if (!r2) {
const [r12, ] = a0.split("/");
r7 = r12 === "image";
}
return r7;
}
export function isAnimatedImageUrl(a0) {
const r8 = a0 == null;
let r2 = false;
if (!r8) {
const [r14, ] = a0.split(/\?/, 1);
r2 = c2594_4.test(r14);
}
return r2;
}
export function isAudioFile(a0) {
return a0 != null && c2594_5.test(a0);
}
export function isVideoUrl(a0) {
const r1 = a0 == null;
let r3 = false;
if (!r1) {
const [r16, ] = a0.split(/\?/, 1);
r3 = c2594_8.test(r16);
}
if (!r3) {
let r25 = isIOSWithWebM();
if (r25) {
const r27 = a0 == null;
let r5 = false;
if (!r27) {
const [r34, ] = a0.split(/\?/, 1);
r5 = c2594_6.test(r34);
}
r25 = r5;
}
r3 = r25;
}
return r3;
}
export function isVideoFile(a0) {
return a0 != null && (c2594_8.test(a0) || a0 != null && isIOSWithWebM() && c2594_6.test(a0));
}
export function isRiveFile(a0) {
return a0 != null && c2594_7.test(a0);
}
export function isVideoContentType(a0) {
const r2 = a0 == null;
let r7 = false;
if (!r2) {
const [r12, ] = a0.split("/");
r7 = r12 === "video";
}
return r7;
}
+106
View File
@@ -0,0 +1,106 @@
// Metro module 11189 (f11190).
import PermissionStore from "../../stores/PermissionStore";
import { MessageAttachmentFlags, Permissions } from "../../Constants";
import * as _ObscuredMediaUtils from "../explicit_media_redaction/ObscuredMediaUtils";
import { getMediaObscuredReasonFromBitmask, getEnabledHarmTypesBitmaskForChannelType } from "../explicit_media_redaction/ObscuredMediaUtils";
import { ObscuredMediaTypes, ContentHarmTypeChannel } from "../explicit_media_redaction/ExplicitMediaRedactionModels";
import { ObscureReason } from "../explicit_media_redaction/ObscureMediaModels";
import { hasFlag } from "../../_bundle/Module1384";
import { ForumPostMediaTypes } from "../forums/ForumPostMediaUtils";
import { useStateFromStores } from "../../_bundle/defaultAreStatesEqual";
import { RenderSpoilers } from "../user_settings/UserSettings";
import computeGlobalSpoilerDisplay from "./computeGlobalSpoilerDisplay";
import { intl, t } from "../../intl/index.native";
const getForumPostShouldObscure = function getForumPostShouldObscure(a0, a1, enabledHarmTypesBitmaskForChannelType) {
let r50;
if (a0 == null) {
return [false, void 0];
}
const type = a0.type;
const r10 = ForumPostMediaTypes.EMBED === type ? {
type: ObscuredMediaTypes.Embed,
media: a0
} : ForumPostMediaTypes.ATTACHMENT === type ? {
type: ObscuredMediaTypes.Attachment,
media: a0
} : ForumPostMediaTypes.COMPONENT === type ? {
type: ObscuredMediaTypes.GenericMedia,
media: a0.srcUnfurledMediaItem
} : null;
if (r10 == null) {
return [false, void 0];
}
const mediaObscuredReasonFromBitmask = getMediaObscuredReasonFromBitmask(r10, enabledHarmTypesBitmaskForChannelType);
const isMediaScanPending = _ObscuredMediaUtils.isMediaScanPending(r10, enabledHarmTypesBitmaskForChannelType);
if (mediaObscuredReasonFromBitmask.length > 0) {
r50 = [true, mediaObscuredReasonFromBitmask[0]];
} else {
const r47 = [, ,];
if (isMediaScanPending) {
r47[0] = true;
r47[1] = ObscureReason.POTENTIAL_EXPLICIT_CONTENT;
r50 = r47;
} else if (a0.spoiler) {
r47[0] = a1;
r47[1] = ObscureReason.SPOILER;
r50 = r47;
} else {
r47[0] = false;
r47[1] = void 0;
r50 = r47;
}
}
return r50;
};
export function getObscureReasonForAttachment(a0, a1) {
const flags = a0.flags;
const r8 = flags !== void 0 ? flags : 0;
const mediaObscuredReasonFromBitmask = getMediaObscuredReasonFromBitmask({
type: ObscuredMediaTypes.Attachment,
media: a0
}, a1);
const isMediaScanPending = _ObscuredMediaUtils.isMediaScanPending({
type: ObscuredMediaTypes.Attachment,
media: a0
}, a1);
return mediaObscuredReasonFromBitmask.length > 0 ? mediaObscuredReasonFromBitmask[0] : isMediaScanPending ? ObscureReason.POTENTIAL_EXPLICIT_CONTENT : hasFlag(r8, MessageAttachmentFlags.IS_SPOILER) ? ObscureReason.SPOILER : null;
}
export function getObscureReasonForEmbed(a0, a1, a2, a3) {
const mediaObscuredReasonFromBitmask = getMediaObscuredReasonFromBitmask({
type: ObscuredMediaTypes.Embed,
media: a0
}, a3);
const bot = a1.author.bot;
const r21 = bot ? !bot : _ObscuredMediaUtils.isMediaScanPending({
type: ObscuredMediaTypes.Embed,
media: a0
}, a3);
return mediaObscuredReasonFromBitmask.length > 0 ? mediaObscuredReasonFromBitmask[0] : r21 ? ObscureReason.POTENTIAL_EXPLICIT_CONTENT : a2 ? ObscureReason.SPOILER : null;
}
export function getObscureReasonForUnfurledMediaItem(a0, a1, r5 = false, r6 = false) {
const mediaObscuredReasonFromBitmask = getMediaObscuredReasonFromBitmask({
type: ObscuredMediaTypes.GenericMedia,
media: a0
}, a1);
const r19 = r6 ? !r6 : _ObscuredMediaUtils.isMediaScanPending({
type: ObscuredMediaTypes.GenericMedia,
media: a0
}, a1);
return mediaObscuredReasonFromBitmask.includes(ObscureReason.EXPLICIT_CONTENT) ? ObscureReason.EXPLICIT_CONTENT : mediaObscuredReasonFromBitmask.includes(ObscureReason.GORE_CONTENT) ? ObscureReason.GORE_CONTENT : mediaObscuredReasonFromBitmask.includes(ObscureReason.SELF_HARM_CONTENT) ? ObscureReason.SELF_HARM_CONTENT : r19 ? ObscureReason.POTENTIAL_EXPLICIT_CONTENT : r5 ? ObscureReason.SPOILER : null;
}
export { getForumPostShouldObscure };
export function useShouldObscure({ channel, media }) {
const stateFromStores = useStateFromStores([PermissionStore], () => channel != null && PermissionStore.can(Permissions.MANAGE_MESSAGES, channel));
const setting = RenderSpoilers.useSetting();
const enabledHarmTypesBitmaskForChannelType = getEnabledHarmTypesBitmaskForChannelType(ContentHarmTypeChannel.GUILD);
return getForumPostShouldObscure(media, !computeGlobalSpoilerDisplay(setting, stateFromStores), enabledHarmTypesBitmaskForChannelType);
}
export function getObscuredAlt(a0) {
if (ObscureReason.EXPLICIT_CONTENT !== a0 && ObscureReason.GORE_CONTENT !== a0 && ObscureReason.SELF_HARM_CONTENT !== a0) {
if (ObscureReason.SPOILER === a0) {
return intl.string(t["XpfDH+"]);
}
return void 0;
}
return intl.string(t.SEgHFh);
}
+90
View File
@@ -0,0 +1,90 @@
// Metro module 4182 (f4183).
import { ChannelStreamTypes } from "../../Constants";
import Durations from "../../utils/Durations";
import Backoff from "../../_bundle/Backoff";
const r25 = Object.freeze({
referencedAvatarProfile: false,
referencedUsernameProfile: false,
interactionAvatarProfile: false,
interactionUsernameProfile: false,
interactionData: false,
avatarProfile: false,
usernameProfile: false,
emojiPicker: false,
emojiBurstPicker: false,
moreUtilities: false,
contextMenu: false
});
const r26 = {
ERROR_SOURCE_UNKNOWN: "ERROR_SOURCE_UNKNOWN",
PRECOMPRESSION_SUM_TOO_LARGE: "PRECOMPRESSION_SUM_TOO_LARGE",
PRECOMPRESSION_INDIVIDUAL_FILE_TOO_LARGE: "PRECOMPRESSION_INDIVIDUAL_FILE_TOO_LARGE",
POSTCOMPRESSION_SUM_TOO_LARGE: "POSTCOMPRESSION_SUM_TOO_LARGE",
POSTCOMPRESSION_INDIVIDUAL_FILE_TOO_LARGE: "POSTCOMPRESSION_INDIVIDUAL_FILE_TOO_LARGE",
UPLOAD_ATTACHMENT_MAX_SIZE_ERROR: "UPLOAD_MESSAGE_ATTACHMENT_MAX_SIZE_ERROR",
EXPLICIT_CONTENT: "EXPLICIT_CONTENT"
};
const r34 = {
SYSTEM_DM_TAG_SYSTEM_TYPE: "a",
BOT_TAG_SERVER_TYPE: "b",
BOT_TAG_BOT_TYPE: "d",
POLL_TYPE: "g"
};
const r50 = {
timeout: {
response: 10 * Durations.Millis.SECOND,
deadline: 1 * Durations.Millis.MINUTE
},
backoff: new Backoff(0.5 * Durations.Millis.SECOND, 60 * Durations.Millis.SECOND),
retries: 8
};
const r66 = {
PUSH_NOTIFICATION: "push_notification",
CHAT_INPUT: "chat_input",
SHARE_MODAL: "share_modal",
VOICE_MESSAGE: "voice_message",
THREAD_CREATION: "thread_creation",
FORWARDING: "forwarding",
USER_PROFILE: "user_profile",
RETRY: "explicit_retry",
OVERLAY: "overlay",
ACTIVITY_SHARE: "activity_share",
ICYMI: "icymi",
INSTANT_UPLOAD: "instant_upload",
APP_COMMAND: "app_command",
PRIVATE_MESSAGE_COMMAND: "private_message_command",
POLL_CREATION: "poll_creation",
SHARE_CUSTOM_THEME: "share_custom_theme",
GIF_REPLY: "gif_reply",
STICKER_REPLY: "sticker_reply",
SEND_WAVE: "send_wave",
GIFTING: "gifting",
CONTENT_INVENTORY_MEMBERLIST: "content_inventory_memberlist",
GREET: "greet",
SOCIAL_LAYER_STOREFRONT: "social_layer_storefront",
COLLECTIBLES_SHOP: "collectibles_shop",
GAME_SERVER_SHOP: "game_server_shop",
MEDIA_MENTION: "media_mention",
OTHER: "other"
};
export const MESSAGE_GROUP_SPACING = [0, 4, 8, 16, 24];
export const DEFAULT_COZY_SPACING = 16;
export const DEFAULT_COMPACT_SPACING = 0;
export { r25 as DEFAULT_POPOUTS };
export const MESSAGE_PADDING = 16;
export const PLACEHOLDER_BUFFER = 16;
export const NEW_MESSAGE_BAR_BUFFER = 32;
export const NEW_MESSAGE_BAR_BUFFER_LARGE = 64;
export const NEW_MESSAGE_BAR_ID = "---new-messages-bar";
export const LEGACY_SPOILER_ATTACHMENT_PREFIX = "SPOILER_";
export const DEFAULT_GUILD_OFFICIAL_COLOR = 3447003;
export const GUILD_OFFICIAL_HIGHLIGHT_ALPHA_COLOR = 687865856;
export const GUILD_OFFICIAL_HIGHLIGHT_ALPHA = 0.16;
export { r26 as FileUploadErrorTypes };
export { r34 as MessageTagTypes };
export const DEFAULT_MOBILE_PRE_COMPRESSION_MAX_ATTACHMENT_SIZE = 209715200;
export function isChannelStreamMessage(a0) {
return a0.type === ChannelStreamTypes.MESSAGE;
}
export { r50 as MESSAGE_HTTP_TIMEOUT_RETRY_OPTIONS };
export { r66 as MessageSendLocation };
+455
View File
@@ -0,0 +1,455 @@
// Metro module 9899 (f9900).
import ChannelRTCStore from "../calls/ChannelRTCStore";
import GatewayConnectionStore from "../gateway/GatewayConnectionStore";
import { isTextChannel } from "../../records/ChannelRecord";
import ChannelSectionStore from "../../stores/ChannelSectionStore";
import ChannelStore from "../../stores/ChannelStore";
import GuildStore from "../../stores/GuildStore";
import ReadStateStore from "../../stores/ReadStateStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import SelectedGuildStore from "../../stores/SelectedGuildStore";
import { AbortCodes, CURRENT_APP_CONTEXT, ChannelTypes, ChannelTypesSets, MAX_MESSAGES_PER_CHANNEL, Routes } from "../../Constants";
import { isStaticChannelRoute } from "../channel/ChannelConstants";
import Durations from "../../utils/Durations";
import Logger from "../debug/Logger";
import ChannelMessages from "../../lib/ChannelMessages";
import { messageHasExpiredAttachmentUrl } from "./SignedAttachmentLinkUtils";
import { JumpType } from "../../flow/Client";
import isChangelogChannel from "../changelog/utils/isChangelogChannel";
import MessageActionCreators from "../../actions/MessageActionCreators";
import { getMessageLimit } from "./getAdaptiveMessageLimit.native";
import { Storage } from "../../_bundle/Module595";
import { matchPath } from "../routing/matchPathCompat";
import { getHistory } from "../routing/router_utils";
import { SidebarType } from "../sidebar/SidebarActionTypes";
import AlertActionCreators from "../../actions/AlertActionCreators";
import { intl, t } from "../../intl/index.native";
import Dispatcher from "../../Dispatcher";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
let c6569_20, c6569_21, c6569_23, c6569_24, c6569_25, handleConnectionOpen, loadSelectedChannelIfNecessary, handleChannelSelect, handleVoiceChannelSelect, handleJumpToVoiceChannelMessage, handleChannelSectionStoreChange, handleChannelPreload, handleChannelCreate, handleMessageEditEnd, c6569_35, handleLoadMessagesSuccess, handleUploadFail, handleAppWillBecomeActive;
const fetchMessages = function fetchMessages(a0) {
let r86;
L61: {
const { guildId, channelId, messageId, forceFetch, isPreload, jumpType, skipLocalFetch, avoidInitialScroll, fetchKey } = a0;
if (channelId != null && !isStaticChannelRoute(channelId)) {
const channel = ChannelStore.getChannel(channelId);
if (channel?.type !== ChannelTypes.GUILD_STORE) {
if (channel?.type != null && ChannelTypesSets.GUILD_THREADS_ONLY.has(channel.type)) {
break L61;
}
const orCreate = ChannelMessages.getOrCreate(channelId);
const r47 = orCreate.some(messageHasExpiredAttachmentUrl);
let r48 = orCreate;
if (r47) {
c6569_21.log("Found expired attachment link, clearing messages");
ChannelMessages.clear(channelId);
r48 = ChannelMessages.getOrCreate(channelId);
}
const r60 = r48.jumpTargetId != null && messageId == null;
let r61 = r48;
if (r60) {
const r67 = r48.mutate({
jumpTargetId: null,
jumped: false,
jumpType: JumpType.ANIMATED
});
ChannelMessages.commit(r67);
r61 = r67;
}
const r73 = r61.focusTargetId != null && messageId == null;
let r74 = r61;
if (r73) {
const r77 = r61.mutate({
focusTargetId: null
});
ChannelMessages.commit(r77);
r74 = r77;
}
L31: {
if (isPreload && !GatewayConnectionStore.isConnected()) {
const loadingMore = r74.loadingMore;
r86 = true;
if (!loadingMore) {
break L31;
}
}
L29: {
if (!r74.loadingMore) {
if (r74.ready && !r74.cached) {
break L29;
}
const r90 = guildId != null && GuildStore.getGuild(guildId) == null;
r86 = forceFetch;
if (r90) {
break L31;
}
r86 = true;
break L31;
}
}
r86 = messageId != null ? true : forceFetch;
}
if (isChangelogChannel(channelId) && ReadStateStore.hasUnread(channelId)) {
r86 = true;
}
if (r86) {
ChannelMessages.commit(r74.mutate({
loadingMore: true
}));
if (messageId == null) {
if (channel == null ? void 0 : channel.isThread()) {
const hasOpenedThread = ReadStateStore.hasOpenedThread(channelId);
let r117 = false;
if (!hasOpenedThread) {
if (c6569_23 == null) {
let r125 = Storage.get(c6569_25, {});
if (r125 == null) {
r125 = {};
}
c6569_23 = r125;
}
const r5 = channelId in c6569_23;
r117 = false;
if (!r5) {
c6569_23[channelId] = Date.now();
const r0 = Date.now() - c6569_24;
const r136 = c6569_23;
for (const key in r136) {
if (c6569_23[key] < r0) {
delete c6569_23[key];
}
}
Storage.set(c6569_25, c6569_23);
r117 = true;
}
}
if (r117) {
c6569_21.log(`Jumping to start of thread ${channel.id}`);
return MessageActionCreators.fetchMessages({
channelId,
limit: getMessageLimit("MessageManager.threadStart"),
jump: {
messageId: channelId,
flash: false
},
isPreload,
skipLocalFetch,
avoidInitialScroll,
fetchKey
});
}
}
if ((channel == null ? void 0 : channel.isThread()) && ReadStateStore.hasTrackedUnread(channel.id) && !r74.ready) {
const trackedAckMessageId = ReadStateStore.getTrackedAckMessageId(channel.id);
c6569_21.log(`Jumping to most recent message in thread ${channel.id} - ${trackedAckMessageId}`);
return MessageActionCreators.fetchMessages({
channelId,
limit: getMessageLimit("MessageManager.threadUnread"),
jump: {
messageId: trackedAckMessageId,
flash: false,
offset: 1
},
isPreload,
skipLocalFetch,
avoidInitialScroll,
fetchKey
});
}
return MessageActionCreators.fetchMessages({
channelId,
limit: getMessageLimit("MessageManager.initialFetch"),
isPreload,
skipLocalFetch,
jump: {
jumpType: JumpType.ANIMATED
},
avoidInitialScroll,
fetchKey
});
}
MessageActionCreators.jumpToMessage({
channelId,
messageId,
flash: true,
isPreload,
skipLocalFetch,
jumpType,
avoidInitialScroll
});
}
}
}
}
};
handleConnectionOpen = function handleConnectionOpen() {
const channelId = SelectedChannelStore.getChannelId();
if (channelId != null) {
const [r8] = ChannelRTCStore.getOpenChatChannelIds();
if (r8 != null && r8 !== channelId) {
const channel = ChannelStore.getChannel(r8);
if (channel != null) {
fetchMessages({
guildId: channel.getGuildId(),
channelId: channel.id
});
}
}
const channel2 = ChannelStore.getChannel(channelId);
if (channel2 != null) {
channel2.id;
const r45 = matchPath(getHistory().location.pathname, {
path: Routes.CHANNEL(":guild", ":channel", ":message"),
exact: true
});
const messageId = r45 == null ? void 0 : r45.params?.message;
fetchMessages({
guildId: channel2.getGuildId(),
channelId: channel2.id,
messageId,
avoidInitialScroll: messageId != null
});
const guildId = channel2.getGuildId();
const id = channel2.id;
const currentSidebarChannelId = ChannelSectionStore.getCurrentSidebarChannelId(id);
if (currentSidebarChannelId != null) {
fetchMessages({
guildId,
channelId: currentSidebarChannelId,
messageId: ChannelSectionStore.getCurrentSidebarMessageId(id)
});
}
}
}
};
loadSelectedChannelIfNecessary = function loadSelectedChannelIfNecessary() {
const channelId = SelectedChannelStore.getChannelId();
if (channelId != null) {
const channel = ChannelStore.getChannel(channelId);
if (channel != null) {
if (isTextChannel(channel.type)) {
const orCreate = ChannelMessages.getOrCreate(channelId);
if (!(orCreate.ready && orCreate.hasFetched)) {
fetchMessages({
guildId: channel.getGuildId(),
channelId: channel.id
});
}
const guildId2 = channel.getGuildId();
const id2 = channel.id;
const currentSidebarChannelId2 = ChannelSectionStore.getCurrentSidebarChannelId(id2);
if (currentSidebarChannelId2 != null) {
fetchMessages({
guildId: guildId2,
channelId: currentSidebarChannelId2,
messageId: ChannelSectionStore.getCurrentSidebarMessageId(id2)
});
}
} else {
const guildId = channel.getGuildId();
const id = channel.id;
const currentSidebarChannelId = ChannelSectionStore.getCurrentSidebarChannelId(id);
if (currentSidebarChannelId != null) {
fetchMessages({
guildId,
channelId: currentSidebarChannelId,
messageId: ChannelSectionStore.getCurrentSidebarMessageId(id)
});
}
}
}
}
};
handleChannelSelect = function handleChannelSelect(a0) {
const { guildId, channelId, messageId, jumpType } = a0;
if (a0.skipMessageFetch) {
return false;
}
fetchMessages({
guildId,
channelId,
messageId,
jumpType
});
const currentSidebarChannelId = ChannelSectionStore.getCurrentSidebarChannelId(channelId);
if (currentSidebarChannelId != null) {
fetchMessages({
guildId,
channelId: currentSidebarChannelId,
messageId: ChannelSectionStore.getCurrentSidebarMessageId(channelId)
});
}
};
handleVoiceChannelSelect = function handleVoiceChannelSelect(a0) {
fetchMessages({
guildId: a0.guildId,
channelId: a0.channelId
});
};
handleJumpToVoiceChannelMessage = function handleJumpToVoiceChannelMessage(a0) {
fetchMessages({
guildId: a0.guildId,
channelId: a0.channelId,
messageId: a0.messageId,
jumpType: a0.jumpType
});
};
handleChannelSectionStoreChange = function handleChannelSectionStoreChange() {
const channelId = SelectedChannelStore.getChannelId();
const guildId = SelectedGuildStore.getGuildId();
if (guildId != null && channelId != null) {
if (ChannelSectionStore.getSidebarState(channelId)?.type !== SidebarType.VIEW_CHANNEL) {
const currentSidebarChannelId = ChannelSectionStore.getCurrentSidebarChannelId(channelId);
if (currentSidebarChannelId != null) {
fetchMessages({
guildId,
channelId: currentSidebarChannelId,
messageId: ChannelSectionStore.getCurrentSidebarMessageId(channelId)
});
}
}
}
};
handleChannelPreload = function handleChannelPreload(a0) {
const { guildId, channelId } = a0;
if (a0.context === CURRENT_APP_CONTEXT) {
fetchMessages({
guildId,
channelId
});
const currentSidebarChannelId = ChannelSectionStore.getCurrentSidebarChannelId(channelId);
if (currentSidebarChannelId != null) {
fetchMessages({
guildId,
channelId: currentSidebarChannelId,
messageId: ChannelSectionStore.getCurrentSidebarMessageId(channelId)
});
}
}
};
handleChannelCreate = function handleChannelCreate({ channel, messageId }) {
const guild_id = channel.guild_id;
if (guild_id != null && SelectedChannelStore.getChannelId(guild_id) === channel.id) {
fetchMessages({
guildId: guild_id,
channelId: channel.id,
messageId
});
}
};
handleMessageEditEnd = function handleMessageEditEnd({ response }) {
if (response != null && response.body != null) {
if (response.body.code === AbortCodes.CHANNEL_FOLLOWING_EDIT_RATE_LIMITED) {
const retry_after = response.body.retry_after;
if (retry_after != null) {
AlertActionCreators.show({
title: intl.string(t.Whhv4w),
body: intl.formatToPlainString(t.qoxdQB, {
retryAfterMinutes: Math.ceil(retry_after / 60)
})
});
}
}
return void 0;
}
return null;
};
handleLoadMessagesSuccess = function handleLoadMessagesSuccess(a0) {
const { channelId, jump } = a0;
let isStale = a0.isStale;
let isPreview = a0.isPreview;
if (isPreview === void 0) {
isPreview = false;
}
if (!isPreview) {
let r11 = c6569_35[channelId];
if (r11 == null) {
r11 = 0;
}
if (!(Date.now() - r11 < c6569_20)) {
c6569_35[channelId] = Date.now();
const channelId2 = SelectedChannelStore.getChannelId();
const currentSidebarChannelId = ChannelSectionStore.getCurrentSidebarChannelId(channelId2);
if (isStale) {
isStale = GatewayConnectionStore.isConnected();
}
if (isStale) {
isStale = channelId === channelId2 || channelId === currentSidebarChannelId;
}
if (isStale) {
MessageActionCreators.fetchMessages({
channelId,
limit: getMessageLimit("MessageManager.staleFetch"),
jump
});
}
}
}
};
handleUploadFail = function handleUploadFail(a0) {
const { channelId, messageId } = a0;
let reason = a0.reason;
const { noSendFailed, shouldSendNotification } = a0;
if (messageId != null && noSendFailed !== true) {
if (reason == null) {
reason = null;
}
Dispatcher.dispatch({
type: "MESSAGE_SEND_FAILED",
channelId,
messageId,
reason,
shouldNotify: shouldSendNotification !== false
});
}
};
handleAppWillBecomeActive = function handleAppWillBecomeActive() {
const channelId = SelectedChannelStore.getChannelId();
if (channelId == null) {
return false;
}
MessageActionCreators.fetchNewLocalMessages(channelId, MAX_MESSAGES_PER_CHANNEL);
};
c6569_20 = 10 * Durations.Millis.SECOND;
c6569_21 = new Logger("MessageManager");
c6569_24 = 90 * Durations.Millis.DAY;
c6569_25 = "viewedThreadIds";
c6569_35 = {};
class MessageManager extends AutomaticLifecycleManager {
fetchMessages = fetchMessages;
loadSelectedChannelIfNecessary = loadSelectedChannelIfNecessary;
stores = new Map().set(ChannelSectionStore, handleChannelSectionStoreChange);
actions = {
APP_STATE_UPDATE_WILL_BECOME_ACTIVE: handleAppWillBecomeActive,
OVERLAY_INITIALIZE: handleConnectionOpen,
CHANNEL_SELECT: handleChannelSelect,
VOICE_CHANNEL_SELECT: handleVoiceChannelSelect,
THREAD_CREATE: handleChannelCreate,
THREAD_LIST_SYNC: () => {
loadSelectedChannelIfNecessary();
},
CHANNEL_CREATE: handleChannelCreate,
CHANNEL_PRELOAD: handleChannelPreload,
GUILD_CREATE: () => {
loadSelectedChannelIfNecessary();
},
MESSAGE_END_EDIT: handleMessageEditEnd,
LOAD_MESSAGES_SUCCESS: handleLoadMessagesSuccess,
UPLOAD_FAIL: handleUploadFail,
CHANNEL_DELETE: () => {
loadSelectedChannelIfNecessary();
},
THREAD_DELETE: () => {
loadSelectedChannelIfNecessary();
},
CHANNEL_RTC_JUMP_TO_VOICE_CHANNEL_MESSAGE: handleJumpToVoiceChannelMessage
};
_initialize() {
Dispatcher.subscribe("CONNECTION_OPEN", handleConnectionOpen);
}
_terminate() {
Dispatcher.unsubscribe("CONNECTION_OPEN", handleConnectionOpen);
}
}
const messageManager = new MessageManager();
export default messageManager;
+833
View File
@@ -0,0 +1,833 @@
// Metro module 5967 (f5968).
import EmojiStore from "../emojis/EmojiStore";
import ActiveJoinedThreadsStore from "../threads/ActiveJoinedThreadsStore";
import ChannelStore from "../../stores/ChannelStore";
import GuildChannelStore, { GUILD_SELECTABLE_CHANNELS_KEY } from "../../stores/GuildChannelStore";
import GuildMemberStore from "../../stores/GuildMemberStore";
import GuildRoleStore from "../../stores/GuildRoleStore";
import GuildStore from "../../stores/GuildStore";
import PermissionStore from "../../stores/PermissionStore";
import RelationshipStore from "../../stores/RelationshipStore";
import StreamerModeStore from "../../stores/StreamerModeStore";
import UserStore from "../../stores/UserStore";
import * as _Constants from "../../Constants";
import { Permissions } from "../../Constants";
import { GAME_MENTION_SENTINEL, extractGameMentionIds } from "../channel_autocomplete/ChannelAutocompleteConstants";
import { EmojiIntention } from "../emojis/EmojiConstants";
import { computeChannelName, unescapeChannelName } from "../channel/useChannelName";
import Module3888 from "../../_bundle/Module3888";
import MarkupRules from "../markup/MarkupRules";
import { SILENT_RE } from "../suppress_notifications/parseContentForSuppressNotifications";
import { ConvertEmoticons } from "../user_settings/UserSettings";
import UnicodeEmojis from "../emojis/UnicodeEmojis";
import MarkupTextRule, { textMarkupPatternWithExclusions } from "../markup/MarkupTextRule";
import UserUtils from "../../utils/UserUtils";
import NicknameUtils from "../../utils/NicknameUtils";
import Module12 from "../../_bundle/Module12";
import { soundmojiRawFormatRegex } from "../premium/sounds/soundmoji/utils/getSoundmojiASTFromString";
import { intl, t } from "../../intl/index.native";
import { COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS } from "../../utils/AutocompleteUtils";
import { isNotNullish } from "../../utils/GlobalUtils";
import EmojiUtils from "../../utils/EmojiUtils";
function $mk77526() {
return (a0) => -a0.text.length;
}
function $mk77527($env) {
return ({ text }) => $env[1].toLowerCase().indexOf(text.toLowerCase()) === 1;
}
function $mk77528($env) {
return (a0) => a0.text === $env[3] ? 0 : 1;
}
function $mk77529($env) {
return (a0) => {
const r1 = $env;
return [r1[0] + a0.text, a0.id, r1[2]];
};
}
function $mk77530($env) {
return (a0) => ({
type: $env[0].type,
content: a0[0]
});
}
function $mk77531() {
return (a0) => ({
type: "text",
content: a0[0]
});
}
function $mk77532($env) {
return (a0) => {
L19: {
const r1 = $env;
const r2 = $env.$parent;
const r3 = r1[0];
const r8 = r1[2];
$mk104821(r2)(r3, a0, r8);
if (typeof a0.content === "string") {
const type = a0.type;
if (type === "emoji") {
r1[4].push({
position: r1[3].length,
length: a0.content.length,
id: a0.id
});
r1[3] = r1[3] + a0.content;
} else {
if (type !== "codeBlock" && type !== "inlineCode" && type !== "mention" && type !== "roleMention" && type !== "gameMention" && type !== "channel") {
r1[3] = r1[3] + (0, r1[1])(a0.content);
break L19;
}
if (r3.isNotification === true) {
r1[3] = r1[3] + (0, r2[0])(r2[2][26]).isolate(a0.content);
} else {
r1[3] = r1[3] + a0.content;
}
}
} else if (a0.content.constructor === Array) {
const r33 = (0, r2[24])(a0.content, r3, r1[1], r8);
const content = r33.content;
for (const item of r33.emoji) {
r1[4].push({
position: r1[3].length + item.position,
length: item.length,
id: item.id
});
}
r1[3] = r1[3] + content;
}
}
};
}
function $mk104821($env) {
return function handleEmoji(a0, a1, a2) {
let r36;
L16: {
if (a2 != null) {
if (a1.type === "customEmoticon") {
a2(a1.emoji, false);
}
if (a1.type !== "emoticon" && a1.type !== "text") {
break L16;
}
const r6 = $env;
const r26 = (0, r6[1])(r6[2][19]).translateSurrogatesToInlineEmoji(a1.content);
let r29 = r6[23].exec(r26);
while (r29 !== null) {
L11: {
const r11 = r29[1];
const r10 = r29;
if (r11 != null && r10[1] !== "") {
const emojiContext = a0.emojiContext;
r36 = void 0;
if (!emojiContext) {
break L11;
}
r36 = a0.emojiContext.getById(r10[1]);
} else {
r36 = (0, r6[1])(r6[2][19]).getByName(r10[2]);
}
}
if (r36) {
a2(r36, a1.isShortcut || false);
}
r29 = r6[23].exec(r26);
}
}
}
};
}
let parseAndRebuild, createParserState, NOOP, unparseWithMeta, c3757_19, c3757_20, link, autolink, url, inlineCode, codeBlock, inlineCode2, codeBlock2, c3757_21, c3757_22, c3757_23;
let env3758;
let env3759;
let env3760;
let env3761;
let env3762;
let env3763;
let env3764;
let env3757 = {};
const rebuild = function rebuild(a0, a1, a2, a3) {
let env15323;
const r2 = env15323 = {
$parent: env3757
};
env15323[0] = a1;
env15323[1] = a2;
env15323[2] = a3;
env15323[3] = "";
const emoji = [];
env15323[4] = emoji;
a0.forEach($mk77532(r2));
return {
content: env15323[3],
emoji
};
};
parseAndRebuild = function parseAndRebuild(a0, a1, a2) {
let env15324;
const r5 = c3757_22(a0, a1);
const r11 = env15324 = {
$parent: env3757
};
env15324[0] = a1;
env15324[1] = UnicodeEmojis.translateInlineEmojiToSurrogates;
env15324[2] = a2;
env15324[3] = "";
env15324[4] = [];
r5.forEach($mk77532(r11));
return env15324[3];
};
createParserState = function createParserState(a0, a1) {
let r11;
const guildId = a0 == null ? void 0 : a0.getGuildId();
const guild = guildId != null ? GuildStore.getGuild(guildId) : null;
let c15325_1 = PermissionStore.can(Permissions.MENTION_EVERYONE, a0);
if (a0 == null ? void 0 : a0.isPrivate()) {
const r34 = a0.recipients.map((recipient) => ({
userId: recipient,
nick: null
}));
const currentUser = UserStore.getCurrentUser();
r11 = r34;
if (currentUser != null) {
r34.push({
userId: currentUser.id,
nick: null
});
r11 = r34;
}
} else {
r11 = guildId != null ? GuildMemberStore.getMembers(guildId).map((item) => ({
userId: item.userId,
nick: item.nick
})) : [];
}
const users = Module12(r11.reduce((acc, { userId }) => {
const user = UserStore.getUser(userId);
if (user != null) {
acc.push({
id: userId,
text: user.tag
});
}
return acc;
}, []));
const mentionableRoles = Module12(guild != null ? GuildRoleStore.getSortedRoles(guild.id) : []).filter(({ mentionable }) => c15325_1 || mentionable).map((item) => ({
id: item.id,
text: item.name
}));
const r68 = Module12(GuildChannelStore.getTextChannelNameDisambiguations(guildId)).map((item) => ({
id: item.id,
text: item.name
}));
const r69 = guildId != null ? Module12(COMMAND_SUPPORTED_CHANNEL_TYPE_KEYS).filter((item) => item !== GUILD_SELECTABLE_CHANNELS_KEY).flatMap((item) => GuildChannelStore.getChannels(guildId)[item].map((item) => item.channel.isCategory() ? PermissionStore.can(Permissions.VIEW_CHANNEL, item.channel) ? {
id: item.channel.id,
text: computeChannelName(item.channel, UserStore, RelationshipStore)
} : null : {
id: item.channel.id,
text: computeChannelName(item.channel, UserStore, RelationshipStore)
})).filter(isNotNullish).value() : [];
const r94 = ActiveJoinedThreadsStore.computeAllActiveJoinedThreads(guildId).map((item) => ({
id: item.id,
text: computeChannelName(item, UserStore, RelationshipStore)
}));
const disambiguatedEmojiContext = EmojiStore.getDisambiguatedEmojiContext(guildId);
const escapedCustomEmoticonNames = disambiguatedEmojiContext.getEscapedCustomEmoticonNames();
const customEmoji = disambiguatedEmojiContext.getCustomEmoji();
const customEmoticonRegex = disambiguatedEmojiContext.getCustomEmoticonRegex();
return {
inline: true,
mentionableRoles,
guild,
users,
games: Module12(a1 != null ? Array.from(a1.values()) : []).map((item) => ({
id: item.id,
text: item.name
})),
channels: r68.concat(r69).concat(r94),
emojiContext: disambiguatedEmojiContext,
customEmoticonsRegex: customEmoticonRegex,
customEmoji,
textExclusions: escapedCustomEmoticonNames,
isNotification: false
};
};
NOOP = function NOOP(a0) {
return a0;
};
unparseWithMeta = function unparseWithMeta(a0, a1, a2) {
const channel2 = ChannelStore.getChannel(a1);
const r4 = channel2 != null ? channel2.getGuildId() : null;
const guild = r4 != null ? GuildStore.getGuild(r4) : null;
const r22 = a2 ? c3757_21 : Module12.omit(c3757_21, ["spoiler", "timestamp"]);
const r28 = a2 ? NOOP : UnicodeEmojis.translateSurrogatesToInlineEmoji;
let env15326;
const r30 = {
inline: true,
guild,
channelId: a1,
isNotification: a2
};
const r38 = Module3888.parserFor(r22)(a0, r30);
const r39 = env15326 = {
$parent: env3757
};
env15326[0] = r30;
env15326[1] = r28;
env15326[2] = void 0;
env15326[3] = "";
const emoji = [];
env15326[4] = emoji;
r38.forEach($mk77532(r39));
return {
content: env15326[3],
emoji
};
};
const { MARKDOWN_SPOILER_REGEXP, MARKDOWN_STATIC_ROUTE_NAME_REGEXP } = _Constants;
const r19 = /^<@!?(\d+)>/;
const r18 = /^<@&(\d+)>/;
const r17 = /^<#(\d+)>/;
const r16 = /^<a?:(\w+):(\d+)>/;
c3757_19 = /(@everyone|@here|@Clyde)\b/;
c3757_20 = /^[^\s]+@[^\s]+\.[^\s.]+/;
const link2 = Module3888.defaultRules.link;
const r69 = env3758 = {};
link = link2;
const r73 = {
link: {
order: link2.order,
match: link2.match,
parse: $mk77530(r69)
},
autolink: null,
url: null,
inlineCode: null,
codeBlock: null,
rawUserMention: null,
rawRoleMention: null,
rawChannelMention: null,
rawEmoji: null,
mention: null,
channel: null,
emoticon: null,
emoji: null,
customEmoticons: null,
text: null
};
const autolink2 = Module3888.defaultRules.autolink;
const r78 = env3759 = {};
autolink = autolink2;
r73.autolink = {
order: autolink2.order,
match: autolink2.match,
parse: $mk77530(r78)
};
const url2 = Module3888.defaultRules.url;
const r87 = env3760 = {};
url = url2;
r73.url = {
order: url2.order,
match: url2.match,
parse: $mk77530(r87)
};
const inlineCode3 = MarkupRules.RULES.inlineCode;
const r96 = env3761 = {};
inlineCode = inlineCode3;
r73.inlineCode = {
order: inlineCode3.order,
match: inlineCode3.match,
parse: $mk77530(r96)
};
const codeBlock3 = MarkupRules.RULES.codeBlock;
const r105 = env3762 = {};
codeBlock = codeBlock3;
r73.codeBlock = {
order: codeBlock3.order,
match: codeBlock3.match,
parse: $mk77530(r105)
};
r73.rawUserMention = {
match: Module3888.anyScopeRegex(r19),
parse: $mk77531()
};
r73.rawRoleMention = {
match: Module3888.anyScopeRegex(r18),
parse: $mk77531()
};
r73.rawChannelMention = {
match: Module3888.anyScopeRegex(r17),
parse: $mk77531()
};
r73.rawEmoji = {
match: Module3888.anyScopeRegex(r16),
parse: $mk77531()
};
r73.mention = {
match: (a0, a1, a2) => {
if (c3757_20.test(a2.split(" ").pop() + a0)) {
return null;
}
let env15327;
const games = a1.games;
const r22 = env15327 = {};
env15327[0] = GAME_MENTION_SENTINEL;
env15327[1] = a0;
env15327[2] = "gameMention";
env15327[3] = void 0;
const r5 = a0[0];
let r24 = void 0;
if (r5 === GAME_MENTION_SENTINEL) {
env15327[3] = a0.substring(GAME_MENTION_SENTINEL.length);
r24 = games.sortBy($mk77526()).filter($mk77527(r22)).sortBy($mk77528(r22)).map($mk77529(r22)).first();
}
if (r24 != null) {
return r24;
}
let env15328;
const users = a1.users;
const r41 = env15328 = {};
env15328[0] = "@";
env15328[1] = a0;
env15328[2] = "mention";
env15328[3] = void 0;
const r11 = a0[0];
let r44 = void 0;
if (r11 === "@") {
env15328[3] = a0.substring("@".length);
r44 = users.sortBy($mk77526()).filter($mk77527(r41)).sortBy($mk77528(r41)).map($mk77529(r41)).first();
}
if (r44 != null) {
return r44;
}
let env15329;
const mentionableRoles = a1.mentionableRoles;
const r60 = env15329 = {};
env15329[0] = "@";
env15329[1] = a0;
env15329[2] = "roleMention";
env15329[3] = void 0;
const r62 = a0[0];
let r63 = void 0;
if (r62 === "@") {
env15329[3] = a0.substring("@".length);
r63 = mentionableRoles.sortBy($mk77526()).filter($mk77527(r60)).sortBy($mk77528(r60)).map($mk77529(r60)).first();
}
if (r63 != null) {
return r63;
}
let env15330;
const r83 = a1.users.map((user) => ({
...user,
text: user.text.split("#")[0]
}));
const r84 = env15330 = {};
env15330[0] = "@";
env15330[1] = a0;
env15330[2] = "mention";
env15330[3] = void 0;
const r85 = a0[0];
let r86 = void 0;
if (r85 === "@") {
env15330[3] = a0.substring("@".length);
r86 = r83.sortBy($mk77526()).filter($mk77527(r84)).sortBy($mk77528(r84)).map($mk77529(r84)).first();
}
if (r86 == null) {
return null;
}
const r105 = c3757_19.exec(a0);
if (r105 != null && r86[0].length <= r105[0].length) {
return null;
}
if (a2 === "") {
const r117 = SILENT_RE.exec(a0);
if (r117 != null && r86[0].length <= r117[0].length) {
return null;
}
}
return r86;
},
parse: (a0) => {
const [, r5, type] = a0;
if (type === "gameMention") {
return {
type,
content: `<@\$${r5}>`
};
}
return {
type,
content: `<${type === "roleMention" ? "@&" : "@"}${r5}>`
};
}
};
r73.channel = {
match: (a0, { channels }) => {
let r0, length;
let c15331_0, c15331_1;
c15331_0 = void 0;
c15331_1 = void 0;
const r10 = a0[0];
let r16 = void 0;
if (r10 === "#") {
if (a0[1] !== "\"") {
let env15332;
const r45 = env15332 = {};
env15332[0] = "#";
env15332[1] = a0;
env15332[2] = "channel";
const r47 = a0[0];
let r48 = void 0;
if (r47 === "#") {
env15332[3] = a0.substring("#".length);
r48 = channels.sortBy($mk77526()).filter($mk77527(r45)).sortBy($mk77528(r45)).map($mk77529(r45)).first();
}
r16 = r48;
} else {
const r7 = 2 < a0.length;
let r1 = 2;
let r3 = 2;
if (r7) {
do {
const r19 = a0[r1];
const r2 = r1;
if (r19 !== "\\") {
const r20 = a0[r2];
r0 = r2;
r3 = r0;
if (r20 === "\"") {
break;
}
} else {
r0 = r2 + 1;
}
r1 = r0 + 1;
length = a0.length;
r3 = r1;
} while (r3 < length);
}
c15331_0 = a0.substring(0, r3 + 1);
c15331_1 = unescapeChannelName(a0.substring(2, r3));
r16 = channels.sortBy((channel) => -channel.text.length).filter((item) => c15331_1 === item.text).map((item) => [c15331_0, item.id, "channel"]).first();
}
}
if (r16 == null) {
r16 = null;
}
return r16;
},
parse: (a0) => ({
type: "text",
content: `<#${a0[1]}>`
})
};
r73.emoticon = {
match: (a0, a1, a2) => {
let r26;
if (ConvertEmoticons.getSetting()) {
if (a2.length !== 0 && !/\s$/.test(a2)) {
return null;
}
L10: {
const r23 = UnicodeEmojis.EMOJI_SHORTCUT_RE.exec(a0);
const r25 = r23 == null;
r26 = null;
if (!r25) {
if (r23[0].length !== a0.length && a0[r23[0].length] !== " ") {
const r36 = a0[r23[0].length];
r26 = null;
if (r36 !== "\n") {
break L10;
}
}
r26 = r23;
}
}
return r26;
}
return null;
},
parse: (a0) => ({
type: "emoticon",
content: UnicodeEmojis.convertShortcutToName(a0[1]),
isShortcut: true
})
};
r73.emoji = {
order: MarkupRules.RULES.emoji.order,
match: (a0) => UnicodeEmojis.EMOJI_NAME_RE.exec(a0),
parse: (a0, a1, a2) => {
let r40;
const [content, r33] = a0;
let emoji = a2.customEmoji.get(r33);
if (emoji == null) {
emoji = null;
}
if (emoji != null) {
const r12 = emoji.animated === true ? "a" : "";
let originalName = emoji.originalName;
if (originalName == null) {
originalName = emoji.name;
}
r40 = {
type: "customEmoticon",
content: `<${r12}:${originalName}:${emoji.id}>`,
emoji
};
} else {
r40 = {
type: "text",
content
};
}
return r40;
}
};
r73.customEmoticons = {
match: (a0, { customEmoticonsRegex }) => {
let r6 = customEmoticonsRegex == null ? void 0 : customEmoticonsRegex.exec(a0);
if (r6 == null) {
r6 = null;
}
return r6;
},
parse: (a0, a1, a2) => {
const [content, r33] = a0;
const emoticonByName = a2.emojiContext.getEmoticonByName(r33);
return emoticonByName != null ? {
type: "customEmoticon",
content: `<${emoticonByName.animated === true ? "a" : ""}:${emoticonByName.name}:${emoticonByName.id}>`,
emoji: emoticonByName
} : {
type: "text",
content
};
}
};
r73.text = {
...MarkupTextRule,
match: (a0, a1) => typeof a1.textExclusions === "string" && a1.textExclusions !== "" ? textMarkupPatternWithExclusions(a1.textExclusions).exec(a0) : MarkupTextRule.match != null ? MarkupTextRule.match(a0, a1, "") : null
};
const inlineCode4 = MarkupRules.RULES.inlineCode;
const r162 = env3763 = {};
inlineCode2 = inlineCode4;
const r166 = {
inlineCode: {
order: inlineCode4.order,
match: inlineCode4.match,
parse: $mk77530(r162)
},
codeBlock: null,
mention: null,
roleMention: null,
channel: null,
emoji: null,
soundboard: null,
spoiler: null,
staticRouteLink: null,
timestamp: null,
text: null
};
const codeBlock4 = MarkupRules.RULES.codeBlock;
const r171 = env3764 = {};
codeBlock2 = codeBlock4;
r166.codeBlock = {
order: codeBlock4.order,
match: codeBlock4.match,
parse: $mk77530(r171)
};
r166.mention = {
match: Module3888.anyScopeRegex(r19),
parse: (a0, a1, { isNotification, guild, channelId }) => {
let c15333_0;
c15333_0 = void 0;
const user = UserStore.getUser(a0[1]);
if (user == null) {
return {
content: a0[0]
};
}
const userTag = UserUtils.getUserTag(user, {
identifiable: isNotification ? StreamerModeStore.enabled ? "never" : "always" : "always"
});
if (isNotification) {
let r71 = NicknameUtils.getNickname(guild?.id, channelId, user);
if (r71 == null) {
r71 = UserUtils.getGlobalName(user);
}
return {
content: r71 != null ? `@${r71}` : `@${userTag}`
};
}
if (user.bot) {
return {
content: `@${userTag}`
};
}
const r29 = guild?.id != null;
let r31 = "";
if (r29) {
c15333_0 = userTag.toLowerCase();
r31 = Module12.some(GuildRoleStore.getUnsafeMutableRoles(guild.id), (a0) => c15333_0.startsWith(a0.name.toLowerCase())) ? `#${`${user.discriminator}`.padStart(4, "0")}` : "";
}
return {
content: `@${userTag}${r31}`
};
}
};
r166.roleMention = {
match: Module3888.anyScopeRegex(r18),
parse: (a0, a1, { guild }) => {
if (guild != null) {
const role = GuildRoleStore.getRole(guild.id, a0[1]);
if (role != null) {
return {
content: `@${role.name}`
};
}
}
return {
content: a0[0]
};
}
};
r166.channel = {
match: Module3888.anyScopeRegex(r17),
parse: (a0) => {
const channel2 = ChannelStore.getChannel(a0[1]);
return {
content: channel2 == null ? a0[0] : computeChannelName(channel2, UserStore, RelationshipStore, true, true)
};
}
};
r166.emoji = {
match: Module3888.anyScopeRegex(r16),
parse: (a0, a1, a2) => {
let [, r7, id] = a0;
const guild = a2.guild;
const byId = EmojiStore.getDisambiguatedEmojiContext(guild ? guild.id : null).getById(id);
if (byId != null) {
r7 = byId.name;
}
return {
content: `:${r7}:`,
id
};
}
};
r166.soundboard = {
match: Module3888.anyScopeRegex(soundmojiRawFormatRegex),
parse: (a0) => {
const [, r9, r8] = a0;
return {
content: `<sound:${r9}:${r8}>`
};
}
};
r166.spoiler = {
match: Module3888.anyScopeRegex(MARKDOWN_SPOILER_REGEXP),
parse: () => ({
content: `<${intl.string(t["F+x38C"]).toLowerCase()}>`
})
};
r166.staticRouteLink = {
match: Module3888.anyScopeRegex(MARKDOWN_STATIC_ROUTE_NAME_REGEXP),
parse: (a0) => ({
content: `<id:${a0[1]}>`
})
};
r166.timestamp = {
...MarkupRules.RULES.timestamp,
parse: function parse(...args) {
const timestamp = MarkupRules.RULES.timestamp;
const r19 = timestamp.parse.apply(timestamp, [...args]);
return r19.type === "text" ? {
content: r19.content
} : {
content: r19.formatted
};
}
};
r166.text = {
...MarkupTextRule
};
c3757_21 = r166;
[r73, r166].forEach((item) => {
let c15334_0 = item;
Object.keys(item).forEach((item, index) => {
c15334_0[item].order = index;
});
});
c3757_22 = Module3888.parserFor(r73);
c3757_23 = /(?:<a?:\w+:(\d+)>)|:(?:([^\s:]+?)(?:::skin-tone-\d)?:)/g;
const r244 = {
parse: function parse(a0, a1) {
let r24;
const channel = a0;
let r9 = arguments[2];
if (r9 === void 0) {
r9 = void 0;
}
const r4 = arguments[3];
if (r9 == null) {
r9 = createParserState(a0, r4);
}
const r27 = {
content: a1,
tts: false,
invalidEmojis: [],
validNonShortcutEmojis: []
};
let c15335_1 = r27;
r27.content = parseAndRebuild(r27.content, r9, (a0, a1) => {
if (EmojiUtils.isEmojiPremiumLocked({
emoji: a0,
channel,
intention: EmojiIntention.CHAT
})) {
c15335_1.invalidEmojis.push(a0);
} else if (!a1) {
c15335_1.validNonShortcutEmojis.push(a0);
}
});
if (r4 != null && r4.size > 0) {
const set = new Set((0, extractGameMentionIds)(r27.content));
const mentionGames = [];
let r45 = r4.values()[Symbol.iterator]();
const next = r45.next;
while (true) {
const r48 = r45 === void 0 ? void 0 : (r24 = next.call(r45)).done ? r45 = void 0 : r24.value;
if (r45 === void 0) {
if (!(mentionGames.length > 0)) {
break;
}
r27.mentionGames = mentionGames;
break;
}
try {
if (set.has(r48.id)) {
mentionGames.push({
id: r48.id,
name: r48.name,
icon: r48.icon
});
}
} catch (r59) {
if (r45 !== void 0 && typeof r45.return === "function") {
try {
r45.return();
} catch {}
}
throw r59;
}
}
}
return r27;
},
parsePreprocessor: (a0, a1) => c3757_22(a1, createParserState(a0)),
unparse: (a0, a1, a2) => unparseWithMeta(a0, a1, a2).content,
unparseWithMeta
};
export default r244;
export { parseAndRebuild };
export { createParserState };
+13
View File
@@ -0,0 +1,13 @@
// Metro module 16249 (f16250).
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
import MessageQueue from "../../lib/MessageQueue";
class MessageQueueManager extends AutomaticLifecycleManager {
actions = {
LOGOUT: this.handleLogout
};
handleLogout() {
MessageQueue.clear();
}
}
const messageQueueManager = new MessageQueueManager();
export default messageQueueManager;
@@ -0,0 +1,12 @@
// Metro module 6074 (f6075).
const r14 = {
NORMAL: 0,
0: "NORMAL",
BURST: 1,
1: "BURST",
VOTE: 2,
2: "VOTE"
};
const set = new Set([r14.NORMAL, r14.BURST]);
export { r14 as ReactionTypes };
export { set as NOTIFICATION_REACTION_TYPES };
+361
View File
@@ -0,0 +1,361 @@
// Metro module 4409 (f4410).
import InteractionRecord from "../../records/InteractionRecord";
import MessageRecord, { MessageSnapshotRecord, MinimalMessageRecord } from "../../records/MessageRecord";
import UserRecord from "../../records/UserRecord";
import AuthenticationStore from "../../stores/AuthenticationStore";
import RelationshipStore from "../../stores/RelationshipStore";
import UserStore from "../../stores/UserStore";
import { MessageTypesSets, MessageTypes, MessageFlags } from "../../Constants";
import { transformComponents } from "../interaction_components/InteractionComponentUtils";
import findCodedLinks from "../coded_links/findCodedLinks";
import { getMessageAuthor } from "./useMessageAuthor";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import isMessageMentioned, { isMentioned } from "./isMessageMentioned";
import { isGiftCodeEmbed, findGiftCodes } from "../../utils/GiftCodeUtils";
import transformMessagPoll from "../polls/transformMessagPoll";
import Module3771 from "../../_bundle/Module3771";
import { mergeEmbedsOnURL } from "../../utils/EmbedUtils";
import { getMessageStickers } from "../stickers/StickersUtils";
import { HermesBuiltin } from "../../_hermes/prelude";
function $mk74557($env) {
return (a0) => {
const r1 = $env.$parent;
const r5 = (0, r1[0])(r1[2][15]);
const r9 = $env[0];
return r5.sanitizeEmbed(r9.channel_id, r9.id, a0);
};
}
function $mk74559() {
return (a0) => {
const r2 = {
...a0
};
if (r2.count_details != null) {
let burst = r2.count_details.burst;
if (burst == null) {
burst = 0;
}
r2.burst_count = burst;
let normal = r2.count_details.normal;
if (normal == null) {
normal = 0;
}
r2.count = normal;
}
if (r2.count < 0) {
r2.count = 0;
}
if (r2.burst_count < 0) {
r2.burst_count = 0;
}
return r2;
};
}
let createMessageRecord, c2639_14;
let $mk74560 = function() {
return ({ message, moderator_report }) => new MessageSnapshotRecord({
message: createMinimalMessageRecord(message),
moderator_report
});
};
let env2639 = {};
const createMinimalMessageRecord = function createMinimalMessageRecord(a0) {
const r2 = {
...a0,
timestamp: new Date(a0.timestamp),
editedTimestamp: a0.edited_timestamp != null ? new Date(a0.edited_timestamp) : null
};
let attachments = a0.attachments;
if (attachments == null) {
attachments = [];
}
let env14259;
r2.attachments = attachments;
const r25 = env14259 = {
$parent: env2639
};
env14259[0] = a0;
r2.embeds = a0.embeds == null ? [] : mergeEmbedsOnURL(a0.embeds.map($mk74557(r25)));
let components = a0.components;
if (components == null) {
components = [];
}
r2.components = transformComponents(components);
r2.codedLinks = MessageTypesSets.NON_PARSED.has(a0.type) ? [] : findCodedLinks(a0.content);
return new MinimalMessageRecord(r2);
};
createMessageRecord = function createMessageRecord(a0, r4 = {}) {
let author, reactions2;
let reactions = r4.reactions;
let interactionData = r4.interactionData;
const minimalMessageRecord = createMinimalMessageRecord(a0);
const mentions = a0.mentions;
let mentions2 = mentions == null ? void 0 : mentions.map((mention) => mention.id);
if (mentions2 == null) {
mentions2 = [];
}
let mention_roles = a0.mention_roles;
if (mention_roles == null) {
mention_roles = [];
}
let mention_channels = a0.mention_channels;
if (mention_channels == null) {
mention_channels = [];
}
let mention_games = a0.mention_games;
if (mention_games == null) {
mention_games = [];
}
const message_reference = a0.message_reference;
if (a0.author == null) {
author = c2639_14;
} else if (a0.webhook_id != null) {
author = new UserRecord(a0.author);
} else {
author = UserStore.getUser(a0.author.id);
if (author == null) {
author = new UserRecord(a0.author);
}
}
const messageAuthor = getMessageAuthor({
channel_id: a0.channel_id,
author
});
const gift_info = a0?.gift_info;
const gifting_prompt = a0.gifting_prompt;
const interaction = a0.interaction != null ? InteractionRecord.createFromServer(a0.interaction) : null;
const type = a0.type;
const THREAD_STARTER_MESSAGE = MessageTypes.THREAD_STARTER_MESSAGE;
let r28 = void 0;
if (type === THREAD_STARTER_MESSAGE) {
const referenced_message = a0.referenced_message;
r28 = referenced_message == null ? void 0 : referenced_message.author?.id;
}
let content = a0.content;
const type2 = a0.type;
const PREMIUM_REFERRAL = MessageTypes.PREMIUM_REFERRAL;
let referralTrialOfferId = void 0;
if (type2 === PREMIUM_REFERRAL) {
const r75 = SnowflakeUtils.isProbablyAValidSnowflake(a0.content) ? a0.content : void 0;
content = "";
referralTrialOfferId = r75;
}
const type3 = a0.type;
const PREMIUM_GROUP_INVITE = MessageTypes.PREMIUM_GROUP_INVITE;
let premiumGroupInviteId = void 0;
if (type3 === PREMIUM_GROUP_INVITE) {
const r85 = SnowflakeUtils.isProbablyAValidSnowflake(a0.content) ? a0.content : void 0;
content = "";
premiumGroupInviteId = r85;
}
const r87 = {
...a0,
...messageAuthor,
...minimalMessageRecord.toJS(),
author,
webhookId: a0.webhook_id,
blocked: RelationshipStore.isBlockedForMessage(a0) || r28 != null && RelationshipStore.isBlocked(r28),
ignored: RelationshipStore.isIgnoredForMessage(a0) || r28 != null && RelationshipStore.isIgnored(r28),
mentionEveryone: a0.mention_everyone,
mentions: mentions2,
mentionRoles: mention_roles,
mentionChannels: mention_channels,
mentionGames: mention_games,
messageReference: message_reference
};
const r113 = {
userId: AuthenticationStore.getId(),
channelId: a0.channel_id,
mentionEveryone: null,
mentionUsers: null,
mentionRoles: null
};
let mention_everyone = a0.mention_everyone;
if (mention_everyone == null) {
mention_everyone = false;
}
r113.mentionEveryone = mention_everyone;
r113.mentionUsers = mentions2;
r113.mentionRoles = mention_roles;
r87.mentioned = isMentioned(r113);
r87.giftCodes = isGiftCodeEmbed(a0) ? findGiftCodes(a0 == null ? void 0 : a0.embeds[0].url) : findGiftCodes(a0.content);
r87.content = content;
r87.referralTrialOfferId = referralTrialOfferId;
r87.premiumGroupInviteId = premiumGroupInviteId;
const call = a0.call;
const timestamp = minimalMessageRecord.timestamp;
const r132 = call != null;
let call2 = null;
if (r132) {
const endedTimestamp = call.ended_timestamp != null ? Module3771(new Date(call.ended_timestamp)) : null;
call2 = {
participants: call.participants,
endedTimestamp,
duration: endedTimestamp != null ? Module3771.duration(endedTimestamp.diff(timestamp)) : null
};
}
r87.call = call2;
r87.messageSnapshots = a0.message_snapshots == null ? [] : a0.message_snapshots.map($mk74560());
if (reactions == null) {
reactions = a0.reactions;
}
const poll = a0.poll;
if (reactions == null && poll?.results == null) {
reactions2 = [];
} else {
const r165 = poll == null;
let r166 = void 0;
if (!r165) {
const results = poll.results;
r166 = results == null ? void 0 : results.answer_counts.map((answer_count) => ({
count_details: {
vote: answer_count.count
},
me_vote: answer_count.me_voted,
emoji: {
id: answer_count.id.toString(),
name: "",
animated: false
},
me: false,
me_burst: false,
count: answer_count.count,
burst_count: 0
}));
}
if (reactions == null) {
reactions = [];
}
const r172 = [];
const r175 = HermesBuiltin.arraySpread(r172, reactions, 0);
if (r166 == null) {
r166 = [];
}
HermesBuiltin.arraySpread(r172, r166, r175);
reactions2 = r172.map($mk74559());
}
r87.reactions = reactions2;
r87.interaction = interaction;
if (interactionData == null) {
interactionData = a0.interaction_data;
}
r87.interactionData = interactionData;
r87.interactionMetadata = a0.interaction_metadata;
r87.roleSubscriptionData = a0.role_subscription_data;
r87.purchaseNotification = a0.purchase_notification;
r87.poll = a0.poll == null ? void 0 : transformMessagPoll(a0.poll);
r87.sharedClientTheme = a0.shared_client_theme;
r87.giftInfo = gift_info == null ? void 0 : gift_info;
r87.giftingPrompt = gifting_prompt;
r87.boostingPrompt = a0.boosting_prompt;
return new MessageRecord(r87);
};
c2639_14 = new UserRecord({
id: "???",
username: "???"
});
export { createMessageRecord };
export function updateServerMessage(a0, a1) {
return a1.edited_timestamp != null ? {
...a1,
reactions: a0.reactions,
interaction_data: a0.interaction_data
} : {
...a0,
...a1
};
}
export function updateMessageRecord(a0, a1) {
let r149;
if (a1.edited_timestamp != null) {
return createMessageRecord(a1, {
reactions: a0.reactions,
interactionData: a0.interactionData
});
}
const call2 = a1.call;
let r11 = a0;
if (call2 != null) {
const set = a0.set;
const call = a1.call;
const timestamp = a0.timestamp;
const r1 = call != null;
let r8 = null;
if (r1) {
const endedTimestamp = call.ended_timestamp != null ? Module3771(new Date(call.ended_timestamp)) : null;
r8 = {
participants: call.participants,
endedTimestamp,
duration: endedTimestamp != null ? Module3771.duration(endedTimestamp.diff(timestamp)) : null
};
}
r11 = set.call(a0, "call", r8);
}
const r45 = a1.attachments != null ? r11.set("attachments", a1.attachments) : r11;
const r50 = a1.application != null ? r45.set("application", a1.application) : r45;
const r55 = a1.activity != null ? r50.set("activity", a1.activity) : r50;
const r63 = a1.content != null && a1.content !== "" ? r55.set("content", a1.content) : r55;
const embeds = a1.embeds;
let r68 = r63;
if (embeds != null) {
let env14260;
const r70 = env14260 = {
$parent: env2639
};
env14260[0] = a1;
r68 = r63.set("embeds", a1.embeds == null ? [] : mergeEmbedsOnURL(a1.embeds.map($mk74557(r70))));
}
const r85 = a1.message_snapshots != null ? r68.set.call(r68, "messageSnapshots", a1.message_snapshots == null ? [] : a1.message_snapshots.map($mk74560())) : r68;
const r95 = a1.pinned !== r85.pinned ? r85.set("pinned", a1.pinned) : r85;
const r102 = r95.webhookId != null && a1.author != null ? r95.set("author", new UserRecord(a1.author)) : r95;
const r115 = a1.flags != null && a1.flags !== r102.flags ? r102.set("flags", a1.flags) : r102;
const r120 = a1.components != null ? r115.set("components", transformComponents(a1.components)) : r115;
const r132 = a1.role_subscription_data != null ? r120.set("roleSubscriptionData", a1.role_subscription_data) : r120;
const reactions = a1.reactions;
let r137 = r132;
if (reactions != null) {
let reactions2 = a0.reactions;
if (reactions2 == null) {
reactions2 = a1.reactions;
}
if (reactions2 == null) {
r149 = [];
} else {
if (reactions2 == null) {
reactions2 = [];
}
r149 = [...reactions2, ...[]].map($mk74559());
}
r137 = r132.set("reactions", r149);
}
const r152 = a1.poll != null ? r137.set("poll", transformMessagPoll(a1.poll)) : r137;
const r3 = a1.mentions != null;
let r163 = false;
let r164 = r152;
if (r3) {
r164 = r152.set("mentions", a1.mentions.map((mention) => mention.id));
r163 = true;
}
const mention_everyone = a1.mention_everyone;
let r173 = r164;
if (mention_everyone != null) {
r173 = r164.set("mentionEveryone", a1.mention_everyone);
r163 = true;
}
const mention_roles = a1.mention_roles;
let message = r173;
if (mention_roles != null) {
message = r173.set("mentionRoles", a1.mention_roles);
r163 = true;
}
return r163 ? message.set("mentioned", isMessageMentioned({
message,
userId: AuthenticationStore.getId()
})) : message;
}
export function canEditMessageWithStickers(a0) {
return getMessageStickers(a0).length === 0 || a0.content !== "";
}
export function hasEphemeralAppearance(a0) {
return a0.hasFlag(MessageFlags.EPHEMERAL) && a0.type !== MessageTypes.IN_GAME_MESSAGE_NUX;
}
@@ -0,0 +1,118 @@
// Metro module 5718 (f5719).
import ChannelStore from "../../stores/ChannelStore";
import GuildMemberCountStore from "../../stores/GuildMemberCountStore";
import NetworkStore from "../../stores/NetworkStore";
import { AnalyticEvents } from "../../Constants";
import Logger from "../debug/Logger";
import { getSignalStrength } from "../network/NetStats.android";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import getDeviceMetadata_native from "../device/getDeviceMetadata.native";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c3547_7, c3547_9;
const trackRoundtrip = function trackRoundtrip(a0) {
const basicChannel = ChannelStore.getBasicChannel(a0.channelId);
if (basicChannel != null) {
if (!(Math.random() > 0.1)) {
const api_latency_ms = a0.apiResponseTimestamp == null ? null : a0.apiResponseTimestamp - a0.initialSendTimestamp;
const gateway_latency_ms = a0.gatewaySeenTimestamp == null ? null : a0.gatewaySeenTimestamp - a0.initialSendTimestamp;
const signalStrength = getSignalStrength();
AnalyticsUtils.track(AnalyticEvents.SEND_MESSAGE_ROUNDTRIP, {
...getDeviceMetadata_native(),
api_latency_ms,
gateway_latency_ms,
channel_id: basicChannel.id,
channel_type: basicChannel.type,
guild_id: basicChannel.guild_id,
guild_size: GuildMemberCountStore.getMemberCount(basicChannel.guild_id),
mobile_network_type: NetworkStore.getType(),
num_attachments: a0.attachmentCount,
...signalStrength != null && {
mobile_signal_strength_level: signalStrength
}
});
}
} else {
c3547_7.warn(`Ignoring a messageData for channel ${a0.channelId} because we can't find that channel.`);
}
};
c3547_7 = new Logger("MessageRoundtripTrackerStore");
class MessageRoundtripTrackerStoreClass extends Module589.Store {
pendingMessages = new Map();
initialize() {
this.waitFor(ChannelStore, GuildMemberCountStore, NetworkStore);
}
recordMessageSendAttempt(a0, a1) {
let r5 = arguments[2];
if (r5 === void 0) {
r5 = {};
}
let r7 = r5.attachments?.length;
if (r7 == null) {
r7 = 0;
}
let r15 = r5.attachmentsToUpload?.length;
if (r15 == null) {
r15 = 0;
}
const attachmentCount = r7 + r15;
this.pendingMessages.set(a1, {
initialSendTimestamp: Date.now(),
apiResponseTimestamp: null,
gatewaySeenTimestamp: null,
channelId: a0,
attachmentCount
});
setTimeout(() => {
const pendingMessages = this.pendingMessages;
const r7 = pendingMessages.get(a1);
if (r7 != null) {
trackRoundtrip(r7);
this.pendingMessages.delete(a1);
}
}, 30000);
}
recordMessageSendApiResponse(a0) {
const r10 = this.pendingMessages.get(a0);
if (r10 != null) {
const r11 = {
...r10,
apiResponseTimestamp: Date.now()
};
if (r11.apiResponseTimestamp != null && r11.gatewaySeenTimestamp != null) {
trackRoundtrip(r11);
this.pendingMessages.delete(a0);
} else {
this.pendingMessages.set(a0, r11);
}
}
}
recordGatewayResponse(a0) {
const r10 = this.pendingMessages.get(a0);
if (r10 != null) {
const r11 = {
...r10,
gatewaySeenTimestamp: Date.now()
};
if (r11.apiResponseTimestamp != null && r11.gatewaySeenTimestamp != null) {
trackRoundtrip(r11);
this.pendingMessages.delete(a0);
} else {
this.pendingMessages.set(a0, r11);
}
}
}
}
c3547_9 = new MessageRoundtripTrackerStoreClass(Dispatcher, {
MESSAGE_CREATE: function handleMessageCreate(a0) {
let optimistic = a0.optimistic;
const nonce = a0.message.nonce;
if (!optimistic) {
optimistic = nonce == null;
}
if (!optimistic) {
c3547_9.recordGatewayResponse(nonce);
}
}
});
export default c3547_9;
+16
View File
@@ -0,0 +1,16 @@
// Metro module 10248 (f10249).
import ChannelStore from "../../stores/ChannelStore";
import UserStore from "../../stores/UserStore";
import { isChannelContentGated } from "../age_gate/AgeGateUtils";
export function canViewPotentiallyNSFWChannel(a0) {
const currentUser = UserStore.getCurrentUser();
const channel = ChannelStore.getChannel(a0);
return currentUser != null && channel != null && !isChannelContentGated(channel);
}
export function getGuildIdFromMessage(a0) {
let r9 = ChannelStore.getChannel(a0.channel_id)?.guild_id;
if (r9 == null) {
r9 = void 0;
}
return r9;
}
@@ -0,0 +1,163 @@
// Metro module 9496 (f9497).
import { AnalyticEvents } from "../../Constants";
import { ImpressionNames, ImpressionTypes } from "../../_bundle/Module503";
import AnalyticsLocation from "../app_analytics/AnalyticsLocation";
import { assertNever } from "../../utils/GlobalUtils";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
import LRUCache from "../../_bundle/LRUCache";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
let c6261_4, getMessageViewKey;
const getAnalyticsConfig = function getAnalyticsConfig(item) {
const type = item.type;
if (c6261_4.ANNOUNCEMENT === type) {
return {
event: AnalyticEvents.ANNOUNCEMENT_MESSAGE_VIEWED,
properties: {
message_id: item.messageId,
channel_id: item.channelId,
guild_id: item.guildId,
source_channel_id: item.sourceChannelId,
source_guild_id: item.sourceGuildId
}
};
}
if (c6261_4.APP_EMBED === type) {
return {
event: AnalyticEvents.APP_EMBED_VIEWED,
properties: {
application_id: item.applicationId,
link_type: item.linkType,
message_id: item.messageId,
channel_id: item.channelId,
guild_id: item.guildId
}
};
}
if (c6261_4.OFFICIAL_MESSAGE === type) {
return {
event: AnalyticEvents.OFFICIAL_MESSAGE_VIEWED,
properties: {
message_id: item.messageId,
channel_id: item.channelId,
guild_id: item.guildId
}
};
}
if (c6261_4.VOICE_INVITE_EMBED === type) {
return {
event: ImpressionNames.VOICE_INVITE_EMBED,
properties: {
impression_type: ImpressionTypes.VIEW,
invite_code: item.inviteCode,
invite_guild_id: item.inviteGuildId,
invite_channel_id: item.inviteChannelId,
invite_instance_id: item.inviteInstanceId,
has_active_stream: item.hasActiveStream,
location_stack: item.treatmentRendered ? [AnalyticsLocation.INVITE_EMBED, AnalyticsLocation.VOICE_CHANNEL_LIST_INVITE_EMBED] : [AnalyticsLocation.INVITE_EMBED]
}
};
}
return assertNever(item);
};
getMessageViewKey = function getMessageViewKey(a0) {
return a0.type === c6261_4.VOICE_INVITE_EMBED ? `${a0.messageId}-${a0.inviteCode}-${a0.type}` : `${a0.messageId}-${a0.type}`;
};
c6261_4 = {
ANNOUNCEMENT: "announcement",
APP_EMBED: "app_embed",
OFFICIAL_MESSAGE: "official_message",
VOICE_INVITE_EMBED: "voice_invite_embed"
};
class MessageViewTrackingManager extends AutomaticLifecycleManager {
currentlyVisibleMessageTimers = {};
viewsInCurrentChannel = new Set();
recentViewTimes = new LRUCache({
max: 500,
maxAge: 60000
});
batchBuffer = [];
batchTimerId = null;
actions = {
CHANNEL_SELECT: () => this.handleChannelSelect()
};
handleMessageBecameVisible(a0) {
let c17255_0;
const r23 = a0.type === c6261_4.VOICE_INVITE_EMBED ? `${a0.messageId}-${a0.inviteCode}-${a0.type}` : `${a0.messageId}-${a0.type}`;
L8: {
c17255_0 = r23;
if (this.currentlyVisibleMessageTimers[r23] == null && !this.viewsInCurrentChannel.has(r23)) {
const r35 = this.recentViewTimes.get(r23);
if (r35 != null && Date.now() - r35 < 60000) {
break L8;
}
this.currentlyVisibleMessageTimers[r23] = setTimeout(() => {
const currentlyVisibleMessageTimers = this.currentlyVisibleMessageTimers;
delete currentlyVisibleMessageTimers[c17255_0];
this.viewsInCurrentChannel.add(c17255_0);
this.recentViewTimes.set(c17255_0, Date.now());
this.bufferViewTrack(a0);
}, 1000);
}
}
}
handleMessageLostVisibility(a0, a1, a2) {
const r16 = a2 != null ? `${a0}-${a2}-${a1}` : `${a0}-${a1}`;
const r22 = this.currentlyVisibleMessageTimers[r16];
if (r22 != null) {
clearTimeout(r22);
delete this.currentlyVisibleMessageTimers[r16];
}
}
handleMessageListVisibilityChange(a0, a1) {
for (const item of a0) {
this.handleMessageBecameVisible(item);
}
const r32 = Object.keys(this.currentlyVisibleMessageTimers);
if (r32.length > 0) {
const set = new Set(a0.map(getMessageViewKey));
for (const item2 of r32) {
if (item2.endsWith(`-${a1}`) && !set.has(item2)) {
this.clearTimer(item2);
}
}
}
}
clearTimer(a0) {
const r4 = this.currentlyVisibleMessageTimers[a0];
if (r4 != null) {
clearTimeout(r4);
delete this.currentlyVisibleMessageTimers[a0];
}
}
handleChannelSelect() {
for (const item of Object.values(this.currentlyVisibleMessageTimers)) {
clearTimeout(item);
}
this.currentlyVisibleMessageTimers = {};
this.viewsInCurrentChannel.clear();
this.drainBuffer();
}
drainBuffer() {
for (const item of this.batchBuffer) {
const analyticsConfig = getAnalyticsConfig(item);
AnalyticsUtils.track(analyticsConfig.event, analyticsConfig.properties);
}
this.batchBuffer = [];
if (this.batchTimerId != null) {
clearTimeout(this.batchTimerId);
this.batchTimerId = null;
}
}
bufferViewTrack(a0) {
if (this.batchBuffer.length >= 10) {
this.drainBuffer();
}
this.batchBuffer.push(a0);
if (this.batchTimerId == null) {
this.batchTimerId = setTimeout(() => this.drainBuffer(), 2000);
}
}
}
const messageViewTrackingManager = new MessageViewTrackingManager();
export default messageViewTrackingManager;
export { c6261_4 as MessageViewTrackingType };
+58
View File
@@ -0,0 +1,58 @@
// Metro module 9921 (f9922).
import { MessageAttachmentFlags } from "../../Constants";
import * as _MediaFormatTesters from "./MediaFormatTesters";
import { isImageContentType, isVideoContentType } from "./MediaFormatTesters";
import { hasFlag } from "../../_bundle/Module1384";
import { isPlaintextPreviewableFile } from "./PlaintextFilePreviewHelpers";
let c6588_3 = /\.(mp3|m4a|ogg|opus|wav|flac)$/i;
export function isVisualMedia(a0) {
return a0 === "IMAGE" || a0 === "VIDEO" || a0 === "CLIP" || a0 === "VISUAL_PLACEHOLDER";
}
export function getMosaicMediaTypeForAttachment(a0, a1) {
let r17;
L23: {
const { filename, width, height } = a0;
if (a1 && (width != null && (width > 0 && (height != null && height > 0)))) {
const isImageFile = _MediaFormatTesters.isImageFile(filename);
let r34 = "IMAGE";
if (!isImageFile) {
const isVideoFile = _MediaFormatTesters.isVideoFile(filename);
let r39 = "INVALID";
if (isVideoFile) {
const r41 = a0.proxy_url != null;
r39 = "INVALID";
if (r41) {
let flags = a0.flags;
if (flags == null) {
flags = 0;
}
r39 = hasFlag(flags, MessageAttachmentFlags.IS_CLIP) ? "CLIP" : "VIDEO";
}
}
r34 = r39;
}
r17 = r34;
} else {
if (a1 != null && c6588_3.test(filename)) {
const r2 = a0.url != null;
r17 = "AUDIO";
if (r2) {
break L23;
}
}
r17 = a0.url != null ? isPlaintextPreviewableFile(filename) ? "PLAINTEXT_PREVIEW" : "OTHER" : "OTHER";
}
}
return r17;
}
export function getMosaicMediaTypeForUnfurledMediaItem({ contentType, width, height }) {
if (width != null && width > 0 && height != null && height > 0) {
if (isImageContentType(contentType)) {
return "IMAGE";
}
if (isVideoContentType(contentType)) {
return "VIDEO";
}
}
return "VISUAL_PLACEHOLDER";
}
@@ -0,0 +1,6 @@
// Metro module 9922 (f9923).
let c6589_0 = new Set(["1c", "4d", "abnf", "accesslog", "ada", "arduino", "ino", "armasm", "arm", "avrasm", "actionscript", "as", "ass", "ssa", "alan", "ansi", "i", "log", "ln", "angelscript", "asc", "apache", "apacheconf", "applescript", "osascript", "arcade", "asciidoc", "adoc", "aspectj", "autohotkey", "autoit", "awk", "mawk", "nawk", "gawk", "bash", "sh", "zsh", "basic", "bbcode", "blade", "bnf", "brainfuck", "bf", "csharp", "cs", "c", "h", "cpp", "hpp", "cc", "hh", "c++", "h++", "cxx", "hxx", "cal", "cos", "cls", "cmake", "cmake.in", "coq", "csp", "css", "csv", "capnproto", "capnp", "chaos", "kaos", "chapel", "chpl", "cisco", "clojure", "clj", "coffeescript", "coffee", "cson", "iced", "cpc", "crmsh", "crm", "pcmk", "crystal", "cr", "cypher", "d", "dns", "zone", "bind", "dos", "bat", "cmd", "dart", "delphi", "dpr", "dfm", "pas", "pascal", "freepascal", "lazarus", "lpr", "lfm", "diff", "patch", "django", "jinja", "dockerfile", "docker", "dsconfig", "dts", "dust", "dst", "dylan", "ebnf", "elixir", "ex", "elm", "erlang", "erl", "extempore", "xtlang", "xtm", "fsharp", "fs", "fix", "fortran", "f90", "f95", "gcode", "nc", "gams", "gms", "gauss", "gss", "godot", "gdscript", "gherkin", "gn", "gni", "go", "golang", "gf", "golo", "gololang", "gradle", "groovy", "xml", "html", "xhtml", "rss", "atom", "xjb", "xsd", "xsl", "plist", "svg", "http", "https", "haml", "handlebars", "hbs", "html.hbs", "html.handlebars", "haskell", "hs", "haxe", "hx", "hy", "hylang", "ini", "toml", "inform7", "i7", "irpf90", "json", "java", "jsp", "javascript", "js", "jsx", "jolie", "iol", "ol", "julia", "julia-repl", "kotlin", "kt", "tex", "leaf", "lean", "lasso", "ls", "lassoscript", "less", "ldif", "lisp", "livecodeserver", "livescript", "lock", "ls", "lua", "makefile", "mk", "mak", "make", "markdown", "md", "mkdown", "mkd", "mathematica", "mma", "wl", "matlab", "maxima", "mel", "mercury", "mirc", "mrc", "mizar", "mojolicious", "monkey", "moonscript", "moon", "n1ql", "nsis", "never", "nginx", "nginxconf", "nim", "nimrod", "nix", "ocl", "ocaml", "ml", "objectivec", "mm", "objc", "obj-c", "obj-c++", "objective-c++", "glsl", "openscad", "scad", "ruleslanguage", "oxygene", "pf", "pf.conf", "php", "php3", "php4", "php5", "php6", "php7", "parser3", "perl", "pl", "pm", "plaintext", "txt", "text", "pony", "pgsql", "postgres", "postgresql", "powershell", "ps", "ps1", "processing", "prolog", "properties", "proto", "protobuf", "puppet", "pp", "python", "py", "gyp", "profile", "python-repl", "pycon", "k", "kdb", "qml", "r", "cshtml", "razor", "razor-cshtml", "reasonml", "re", "redbol", "rebol", "red", "red-system", "rib", "rsl", "graph", "instances", "robot", "rf", "rpm-specfile", "rpm", "spec", "rpm-spec", "specfile", "ruby", "rb", "gemspec", "podspec", "thor", "irb", "rust", "rs", "SAS", "sas", "scss", "sql", "p21", "step", "stp", "scala", "scheme", "scilab", "sci", "shexc", "shell", "console", "smali", "smalltalk", "st", "sml", "ml", "solidity", "sol", "stan", "stanfuncs", "stata", "iecst", "scl", "structured-text", "stylus", "styl", "subunit", "supercollider", "sc", "srt", "svelte", "swift", "tcl", "tk", "terraform", "tf", "hcl", "tap", "thrift", "tp", "tsql", "ttml", "twig", "craftcms", "typescript", "ts", "tsx", "unicorn-rails-log", "vbnet", "vb", "vba", "vbscript", "vbs", "vhdl", "vala", "verilog", "v", "vim", "vtt", "axapta", "x++", "x86asm", "xl", "tao", "xquery", "xpath", "xq", "yml", "yaml", "zephir", "zep"]);
export { c6589_0 as PLAINTEXT_FILE_EXTENSIONS };
export function isPlaintextPreviewableFile(a0) {
return c6589_0.has(a0.split(".").slice(-1)[0]);
}
@@ -0,0 +1,30 @@
// Metro module 9564 (f9565).
import { MessageSendLocation } from "./MessageConstants";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c6308_1 = {};
class SendMessageOptionsStore extends Module589.Store {
static displayName = "SendMessageOptionsStore";
getOptions(a0) {
return c6308_1[a0];
}
}
const sendMessageOptionsStore = new SendMessageOptionsStore(Dispatcher, {
MESSAGE_CREATE: function handleMessageCreate({ message, sendMessageOptions }) {
if (sendMessageOptions != null) {
const id = message.id;
let location2 = sendMessageOptions.location;
if (location2 == null) {
location2 = MessageSendLocation.OTHER;
}
c6308_1[id] = {
...sendMessageOptions,
location: location2
};
}
if (message.nonce != null && message.nonce !== message.id && message.nonce in c6308_1) {
delete c6308_1[message.nonce];
}
}
});
export default sendMessageOptionsStore;
@@ -0,0 +1,7 @@
// Metro module 6045 (f6046).
const r9 = {
init: () => {},
donateSentMessage: () => {},
deleteAllInteractions: () => {}
};
export default r9;
@@ -0,0 +1,164 @@
// Metro module 9599 (f9600).
import { Endpoints } from "../../Constants";
import Durations from "../../utils/Durations";
import { isImageProxyURL } from "../image_proxy/ImageProxyUtils";
import URLUtils from "../../utils/URLUtils";
import { HTTP, rejectWithMigratedError } from "../../_bundle/sendRequest";
function $mk82857($env) {
return (a0) => $env[0].pathname.startsWith(a0);
}
let isAttachmentExpired, isEmbedMediaExpiredAttachment, embedHasExpiredAttachmentUrl, c6341_5, c6341_6, c6341_7;
let env6341 = {};
const shouldRefreshAttachmentUrl = function shouldRefreshAttachmentUrl(a0) {
let r10 = a0.searchParams.get("ex");
const r6 = parseInt;
if (r10 == null) {
r10 = "";
}
const r7 = r6(r10, 16);
const r15 = isNaN(r7) ? void 0 : r7 * Durations.Millis.SECOND;
return r15 == null || r15 <= Date.now() + c6341_6;
};
isAttachmentExpired = function isAttachmentExpired(a0) {
const r13 = URLUtils.toURLSafe(a0.url);
let r2 = r13 != null;
if (r2) {
let r17 = r13.searchParams.get("ex");
const r19 = parseInt;
if (r17 == null) {
r17 = "";
}
const r20 = r19(r17, 16);
const r22 = isNaN(r20) ? void 0 : r20 * Durations.Millis.SECOND;
r2 = r22 == null || r22 <= Date.now() + c6341_6;
}
return r2;
};
isEmbedMediaExpiredAttachment = function isEmbedMediaExpiredAttachment(a0) {
if (a0 == null) {
return false;
}
const r17 = URLUtils.toURLSafe(a0.url);
let r3 = r17 != null;
if (r3) {
let env17334;
const r11 = env17334 = {};
env17334[0] = r17;
const r20 = c6341_7.has(r17.hostname);
const r26 = Array.from(c6341_5).some($mk82857(r11));
let r29 = !!(!!r20 && r26);
if (r29) {
let r33 = r17.searchParams.get("ex");
const r34 = parseInt;
if (r33 == null) {
r33 = "";
}
const r35 = r34(r33, 16);
const r38 = isNaN(r35) ? void 0 : r35 * Durations.Millis.SECOND;
r29 = r38 == null || r38 <= Date.now() + c6341_6;
}
r3 = r29;
}
return r3;
};
embedHasExpiredAttachmentUrl = function embedHasExpiredAttachmentUrl(a0) {
let r9 = isEmbedMediaExpiredAttachment(a0.image);
if (!r9) {
const images = a0.images;
r9 = images == null ? void 0 : images.some(isEmbedMediaExpiredAttachment);
}
if (!r9) {
r9 = isEmbedMediaExpiredAttachment(a0.video);
}
return r9;
};
env6341[12] = function _refreshAttachmentUrl() {
const r8 = async (c26481_0) => {
let c30116_0 = await HTTP.post({
url: Endpoints.ATTACHMENTS_REFRESH_URLS,
body: {
attachment_urls: [c26481_0]
},
rejectWithError: rejectWithMigratedError()
});
return c30116_0.ok ? c30116_0.body.refreshed_urls[0].refreshed : void 0;
};
env6341[12] = r8;
return r8.apply(this, arguments);
};
c6341_5 = new Set(["/attachments/", "/ephemeral-attachments/"]);
c6341_6 = 1 * Durations.Millis.HOUR;
const r39 = Set;
const r13 = [window.GLOBAL_ENV.CDN_HOST, ,];
const MEDIA_PROXY_ENDPOINT = window.GLOBAL_ENV.MEDIA_PROXY_ENDPOINT;
const r47 = MEDIA_PROXY_ENDPOINT == null ? void 0 : MEDIA_PROXY_ENDPOINT.substring(2);
export function isAttachmentUrl(a0) {
let env17333;
const r2 = env17333 = {};
env17333[0] = a0;
const r7 = c6341_7.has(a0.hostname);
const r15 = Array.from(c6341_5).some($mk82857(r2));
return !!r7 && r15;
}
export function getSignedAttachmentExpiration(a0) {
let r7 = a0.searchParams.get("ex");
const r9 = parseInt;
if (r7 == null) {
r7 = "";
}
const r11 = r9(r7, 16);
return isNaN(r11) ? void 0 : r11 * Durations.Millis.SECOND;
}
r13[1] = r47;
c6341_7 = new r39(r13.map(function getHostWithoutPort(item) {
return item == null ? void 0 : item.split(":")[0];
}).filter(Boolean));
export function isExternalProxiedAttachmentUrl(a0) {
return isImageProxyURL(a0);
}
export function removeSignedUrlParameters(a0) {
const r23 = URLUtils.toURLSafe(a0);
if (r23 == null) {
return a0;
}
for (const item of ["ex", "is", "hm"]) {
r23.searchParams.delete(item);
}
return r23;
}
export function messageHasExpiredAttachmentUrl(a0) {
return a0.attachments.some(isAttachmentExpired) || a0.embeds.some(embedHasExpiredAttachmentUrl);
}
export async function maybeRefreshAttachmentUrl(value) {
let r52;
let value2, c26482_2;
L17: {
L16: {
let env30117;
const r12 = env30117 = {
$parent: env6341
};
c26482_2 = r12;
env30117[0] = value;
env30117[1] = void 0;
const r28 = URLUtils.toURLSafe(value);
if (r28 == null) {
break L17;
}
if (shouldRefreshAttachmentUrl(r28)) {
env30117[1] = await (function refreshAttachmentUrl() {
return env6341[12].apply(this, arguments);
})(value);
value2 = env30117[1];
if (value2 == null) {
value2 = env30117[0];
}
r52 = value2;
break L16;
}
return value;
}
return r52;
}
return value;
}
@@ -0,0 +1,29 @@
// Metro module 9497 (f9498).
import { createExperiment } from "../experiments/index";
const experiment = createExperiment({
kind: "guild",
id: "2026-05_voice_channel_list_invite_embed",
label: "Voice Channel List Invite Embed",
defaultConfig: {
enabled: false
},
treatments: [{
id: 1,
label: "Enable channel-list-style voice invite embed",
config: {
enabled: true
}
}]
});
export function getVoiceChannelListInviteExperiment(a0) {
return experiment.getCurrentConfig({
guildId: a0.guildId,
location: a0.location
});
}
export function useVoiceChannelListInviteExperiment(a0) {
return experiment.useExperiment({
guildId: a0.guildId,
location: a0.location
});
}
+79
View File
@@ -0,0 +1,79 @@
// Metro module 7846 (f7847).
import { useMemo } from "react";
import UserAffinitiesV2Store from "../user_affinities/UserAffinitiesV2Store";
import ChannelStore from "../../stores/ChannelStore";
import UserStore from "../../stores/UserStore";
import { maybeSortByProbability } from "../user_affinities/maybeSortByProbability";
import { useStateFromStoresArray, useStateFromStores } from "../../_bundle/Module589";
import getHumanizedCallDuration from "./getHumanizedCallDuration";
import { getMessageAuthor, getUserAuthor } from "./useMessageAuthor";
import { intl, t } from "../../intl/index.native";
import { identity } from "../../_bundle/Module12";
function $mk105478($env) {
return (a0, a1) => {
const user = $env.$parent[6].getUser(a1);
return user != null ? user.id !== $env[0].author.id ? [...a0, user] : a0 : a0;
};
}
let env4952 = {};
export function getSortedVoiceSessionParticipants(a0) {
let env16036;
const r3 = env16036 = {
$parent: env4952
};
env16036[0] = a0;
const call = a0.call;
let r7 = call == null ? void 0 : call.participants.reduce($mk105478(r3), []);
if (r7 == null) {
r7 = [];
}
return maybeSortByProbability(r7, UserAffinitiesV2Store.getUserAffinitiesMap(), "VoiceSessionUtils - participants");
}
export function useSortedVoiceSessionParticipants(a0) {
let stateFromStores;
const stateFromStoresArray = useStateFromStoresArray([UserStore], () => a0.call?.participants != null ? a0.call.participants.map((participant) => UserStore.getUser(participant)).filter((item) => item != null).filter((item) => item.id !== a0.author.id) : [], [a0.author.id, a0.call]);
stateFromStores = useStateFromStores([UserAffinitiesV2Store], () => UserAffinitiesV2Store.getUserAffinitiesMap(), []);
return useMemo(() => maybeSortByProbability(stateFromStoresArray, stateFromStores, "VoiceSessionUtils - participants"), [stateFromStoresArray, stateFromStores]);
}
export function getVoiceSessionMessageContent(a0) {
let r70;
let env16040;
const channel = ChannelStore.getChannel(a0.channel_id);
const humanizedCallDuration = getHumanizedCallDuration(a0);
const messageAuthor = getMessageAuthor(a0);
const r24 = env16040 = {
$parent: env4952
};
env16040[0] = a0;
const call = a0.call;
let r13 = call == null ? void 0 : call.participants.reduce($mk105478(r24), []);
if (r13 == null) {
r13 = [];
}
const r38 = maybeSortByProbability(r13, UserAffinitiesV2Store.getUserAffinitiesMap(), "VoiceSessionUtils - participants").map((item) => ({
user: item,
messageAuthor: getUserAuthor(item, channel)
}));
if (humanizedCallDuration == null) {
r70 = intl.formatToPlainString(t.HzBfIN, {
username: messageAuthor.nick,
usernameOnClick: identity
});
} else {
const atbXuX = t.atbXuX;
const r54 = r38[0];
const r61 = r38[1];
r70 = intl.formatToPlainString(atbXuX, {
userCount: r38.length + 1,
username: messageAuthor.nick,
usernameOnClick: identity,
username2: r54 == null ? void 0 : r54.messageAuthor.nick,
username2OnClick: identity,
username3: r61 == null ? void 0 : r61.messageAuthor.nick,
username3OnClick: identity,
otherCount: r38.length - 1,
duration: humanizedCallDuration
});
}
return r70;
}
@@ -0,0 +1,21 @@
// Metro module 4378 (f4379).
import { isIOS } from "../../utils/PlatformUtils";
import { getSocName } from "../../utils/native/DeviceUtils";
let c2595_2 = "ARM64_";
export function isIOSWithWebM() {
if (isIOS()) {
const socName = getSocName();
let r18 = socName == null || !socName.startsWith(c2595_2);
if (!r18) {
const r23 = socName.substring(6);
let r2 = r23[0] !== "T" && r23[0] !== "S";
if (!r2) {
const r30 = r23.substring(1);
r2 = r30[0] !== "7" && (r30[0] !== "8" || parseInt(r30, 10) >= 8101);
}
r18 = r2;
}
return r18;
}
return false;
}
@@ -0,0 +1,19 @@
// Metro module 16658 (f16659).
import { createApexExperiment } from "../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-01-yytext-replacement-ios",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export function shouldEnableYYTextReplacement(a0) {
return apexExperiment.getConfig({
location: a0.location
}).enabled;
}
+44
View File
@@ -0,0 +1,44 @@
// Metro module 9987 (f9988).
import { MessageFlags, MessageStates, MessageTypes } from "../../Constants";
import isSystemMessage from "./isSystemMessage";
import { canEditMessageWithStickers } from "./MessageRecordUtils";
import isForwardMessage from "../forwarding/isForwardMessage";
export default function canEditMessage(a0, a1) {
let r3 = a1 != null;
if (r3) {
let r8 = a0.author.id === a1;
if (r8) {
let r7 = a0.state === MessageStates.SENT;
if (r7) {
const isSystemMessage2 = isSystemMessage(a0);
let r6 = !isSystemMessage2;
if (!isSystemMessage2) {
let r28 = !!canEditMessageWithStickers(a0);
if (r28) {
const hasFlag = a0.hasFlag(MessageFlags.IS_VOICE_MESSAGE);
let r5 = !hasFlag;
if (!hasFlag) {
let r34 = a0.referralTrialOfferId == null;
if (r34) {
const isPoll = a0.isPoll();
let r4 = !isPoll;
if (!isPoll) {
const isForwardMessage2 = isForwardMessage(a0);
r4 = isForwardMessage2 ? !isForwardMessage2 : a0.type !== MessageTypes.MEDIA_MENTION_MESSAGE;
}
r34 = r4;
}
r5 = r34;
}
r28 = r5;
}
r6 = r28;
}
r7 = r6;
}
r8 = r7;
}
r3 = r8;
}
return r3;
};
@@ -0,0 +1,30 @@
// Metro module 10888 (f10889).
import PermissionStore from "../../stores/PermissionStore";
import { Permissions, SpoilerRenderSetting } from "../../Constants";
import { useStateFromStores } from "../../_bundle/defaultAreStatesEqual";
import { RenderSpoilers } from "../user_settings/UserSettings";
export default function computeGlobalSpoilerDisplay(a0, a1) {
if (SpoilerRenderSetting.ALWAYS === a0) {
return true;
}
if (SpoilerRenderSetting.IF_MODERATOR === a0) {
return a1;
}
SpoilerRenderSetting.ON_CLICK;
return false;
};
export function useShouldDisplaySpoilerObscurity(c18337_0) {
const stateFromStores = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.MANAGE_MESSAGES, c18337_0));
const setting = RenderSpoilers.useSetting();
const ALWAYS = SpoilerRenderSetting.ALWAYS;
let r20 = true;
if (ALWAYS !== setting) {
const IF_MODERATOR = SpoilerRenderSetting.IF_MODERATOR;
r20 = stateFromStores;
if (IF_MODERATOR !== setting) {
SpoilerRenderSetting.ON_CLICK;
r20 = false;
}
}
return !r20;
}
+9
View File
@@ -0,0 +1,9 @@
// Metro module 9561 (f9562).
export default function countContentTypes(a0) {
const r1 = a0.content !== "" ? 1 : 0;
const r0 = a0.activity != null ? r1 + 1 : r1;
const r15 = a0.stickers.length > 0 || a0.stickerItems.length > 0 ? r0 + 1 : r0;
const r19 = a0.components.length > 0 ? r15 + 1 : r15;
const r23 = a0.messageSnapshots.length > 0 ? r19 + 1 : r19;
return a0.poll != null ? r23 + 1 : r23;
};
+155
View File
@@ -0,0 +1,155 @@
// Metro module 6038 (f6039).
import ReferencedMessageStore, { ReferencedMessageState } from "../replies/ReferencedMessageStore";
import UserRecord from "../../records/UserRecord";
import UserStore from "../../stores/UserStore";
import { LOCAL_BOT_ID, MessageFlags, MessageStates, MessageTypes, NON_USER_BOT_DISCRIMINATOR } from "../../Constants";
import Module38 from "../../_bundle/Module38";
import { createNonce } from "./createNonce";
export default function createMessage(a0) {
let author, boostingPrompt, changelogId, flags, giftingPrompt, mediaMention, mentionGames, mentions, messageReference, nonce, poll, sharedCustomTheme, state;
const { channelId, content, tts = false, type = MessageTypes.DEFAULT } = a0;
L11: {
messageReference = a0.messageReference;
const allowedMentions = a0.allowedMentions;
author = a0.author;
flags = a0.flags;
nonce = a0.nonce;
poll = a0.poll;
sharedCustomTheme = a0.sharedCustomTheme;
changelogId = a0.changelogId;
giftingPrompt = a0.giftingPrompt;
boostingPrompt = a0.boostingPrompt;
state = a0.state;
mediaMention = a0.mediaMention;
mentionGames = a0.mentionGames;
mentions = [];
if (type === MessageTypes.REPLY) {
Module38(messageReference != null, "Replies must have a message reference");
if (allowedMentions != null && !allowedMentions.replied_user) {
break L11;
}
const messageByReference = ReferencedMessageStore.getMessageByReference(messageReference);
if (messageByReference?.state === ReferencedMessageState.LOADED) {
const author2 = messageByReference.message.author;
mentions.push({
id: author2.id,
username: author2.username,
avatar: author2.avatar,
discriminator: author2.discriminator,
bot: author2.bot,
global_name: author2.globalName,
primary_guild: author2.primaryGuild
});
}
}
}
if (author == null) {
author = UserStore.getCurrentUser();
}
const author3 = author instanceof UserRecord ? {
id: author.id,
username: author.username,
avatar: author.avatar,
discriminator: author.discriminator,
bot: author.bot,
global_name: author.globalName,
primary_guild: author.primaryGuild
} : author;
Module38(author3 != null, "createMessage: author cannot be undefined");
let id = nonce;
if (id == null) {
id = createNonce();
}
const r81 = {
id,
type,
content,
channel_id: channelId,
author: author3,
attachments: [],
embeds: [],
pinned: false,
mentions,
mention_channels: [],
mention_roles: [],
mention_everyone: false,
mention_games: mentionGames,
timestamp: new Date().toISOString(),
state: null,
tts: null,
message_reference: null,
message_snapshots: null,
flags: null,
nonce: null,
poll: null,
shared_client_theme: null,
changelog_id: null,
gifting_prompt: null,
boosting_prompt: null,
media_mention: null
};
if (state == null) {
state = MessageStates.SENDING;
}
r81.state = state;
r81.tts = tts;
r81.message_reference = messageReference;
r81.message_snapshots = [];
r81.flags = flags;
r81.nonce = nonce;
r81.poll = poll;
r81.shared_client_theme = sharedCustomTheme;
r81.changelog_id = changelogId;
r81.gifting_prompt = giftingPrompt;
r81.boosting_prompt = boostingPrompt;
r81.media_mention = mediaMention;
return r81;
};
export function userRecordToServer(a0) {
return {
id: a0.id,
username: a0.username,
avatar: a0.avatar,
discriminator: a0.discriminator,
bot: a0.bot,
global_name: a0.globalName,
primary_guild: a0.primaryGuild
};
}
export function createBotMessage(a0) {
let messageId = a0.messageId;
const { channelId, content } = a0;
let embeds = a0.embeds;
const loggingName = a0.loggingName;
if (messageId == null) {
messageId = createNonce();
}
if (embeds == null) {
embeds = [];
}
return {
id: messageId,
type: MessageTypes.DEFAULT,
flags: MessageFlags.EPHEMERAL,
content,
channel_id: channelId,
author: {
id: LOCAL_BOT_ID,
username: "Clyde",
discriminator: NON_USER_BOT_DISCRIMINATOR,
avatar: "clyde",
bot: true
},
attachments: [],
embeds,
pinned: false,
mentions: [],
mention_channels: [],
mention_roles: [],
mention_everyone: false,
timestamp: new Date().toISOString(),
state: MessageStates.SENT,
tts: false,
loggingName
};
}
+12
View File
@@ -0,0 +1,12 @@
// Metro module 6039 (f6040).
import SnowflakeUtils, { SnowflakeSequence } from "../../utils/SnowflakeUtils";
let c3825_2 = 0;
let c3825_3 = new SnowflakeSequence();
export function createNonce() {
const r4 = Date.now();
if (c3825_2 !== r4) {
c3825_3.reset();
c3825_2 = r4;
}
return SnowflakeUtils.fromTimestampWithSequence(r4, c3825_3);
}
@@ -0,0 +1,8 @@
// Metro module 9900 (f9901).
import { MAX_MESSAGES_PER_CHANNEL } from "../../Constants";
export function getMessageLimit() {
return MAX_MESSAGES_PER_CHANNEL;
}
export function useMessageLimit() {
return MAX_MESSAGES_PER_CHANNEL;
}
@@ -0,0 +1,149 @@
// Metro module 6096 (f6097).
import * as _Module6097 from "../../_bundle/Module6097";
import * as _Module6098 from "../../_bundle/Module6098";
import * as _Module6099 from "../../_bundle/Module6099";
import * as _Module6100 from "../../_bundle/Module6100";
import * as _Module6101 from "../../_bundle/Module6101";
import * as _Module6102 from "../../_bundle/Module6102";
import * as _Module6103 from "../../_bundle/Module6103";
import * as _Module6104 from "../../_bundle/Module6104";
import * as _Module6105 from "../../_bundle/Module6105";
import * as _Module6106 from "../../_bundle/Module6106";
import * as _Module6107 from "../../_bundle/Module6107";
import * as _Module6108 from "../../_bundle/Module6108";
import * as _Module6109 from "../../_bundle/Module6109";
import * as _Module6110 from "../../_bundle/Module6110";
import * as _Module6111 from "../../_bundle/Module6111";
import * as _Module6112 from "../../_bundle/Module6112";
import * as _Module6113 from "../../_bundle/Module6113";
import * as _Module6114 from "../../_bundle/Module6114";
import * as _Module6115 from "../../_bundle/Module6115";
import * as _Module6116 from "../../_bundle/Module6116";
import * as _Module6117 from "../../_bundle/Module6117";
import * as _Module6118 from "../../_bundle/Module6118";
import * as _Module6119 from "../../_bundle/Module6119";
import * as _Module6120 from "../../_bundle/Module6120";
import * as _Module6121 from "../../_bundle/Module6121";
import * as _Module6122 from "../../_bundle/Module6122";
import * as _Module6123 from "../../_bundle/Module6123";
import * as _Module6124 from "../../_bundle/Module6124";
import * as _Module6125 from "../../_bundle/Module6125";
import * as _Module6126 from "../../_bundle/Module6126";
import * as _Module6127 from "../../_bundle/Module6127";
import * as _Module6128 from "../../_bundle/Module6128";
import * as _Module6129 from "../../_bundle/Module6129";
import * as _Module6130 from "../../_bundle/Module6130";
import * as _Module6131 from "../../_bundle/Module6131";
import * as _Module6132 from "../../_bundle/Module6132";
import { getBurstAnimationHash } from "./BurstReactionEffectUtils";
let c3875_3;
let c3876_0;
let env3875 = {};
const c3875_2 = [{
load: () => _Module6097
}, {
load: () => _Module6098
}, {
load: () => _Module6099
}, {
load: () => _Module6100
}, {
load: () => _Module6101
}, {
load: () => _Module6102
}, {
load: () => _Module6103
}, {
load: () => _Module6104
}, {
load: () => _Module6105
}, {
load: () => _Module6106
}, {
load: () => _Module6107
}, {
load: () => _Module6108
}, {
load: () => _Module6109
}, {
load: () => _Module6110
}, {
load: () => _Module6111
}, {
load: () => _Module6112
}, {
load: () => _Module6113
}, {
load: () => _Module6114
}];
c3875_3 = [{
load: () => _Module6115
}, {
load: () => _Module6116
}, {
load: () => _Module6117
}, {
load: () => _Module6118
}, {
load: () => _Module6119
}, {
load: () => _Module6120
}, {
load: () => _Module6121
}, {
load: () => _Module6122
}, {
load: () => _Module6123
}, {
load: () => _Module6124
}, {
load: () => _Module6125
}, {
load: () => _Module6126
}, {
load: () => _Module6127
}, {
load: () => _Module6128
}, {
load: () => _Module6129
}, {
load: () => _Module6130
}, {
load: () => _Module6131
}, {
load: () => _Module6132
}];
c3876_0 = void 0;
c3876_0 = async function(c25715_0, c25715_1, c25715_2, c25715_3) {
let r63, r64;
let c25715_5;
let c29670_3, c29670_4;
c25715_5 = void 0;
c29670_3 = void 0;
let c29670_0 = c25715_0;
let c29670_1 = c25715_1;
let c29670_2 = c25715_2;
if (c25715_3 !== void 0) {
c29670_3 = c25715_3;
c29670_4 = void 0;
} else {
c29670_3 = false;
c29670_4 = void 0;
}
await void 0;
c29670_4 = getBurstAnimationHash(`${c29670_0}${c29670_1}${c29670_2}`);
const r60 = c29670_3;
const r61 = c25715_5;
if (r60) {
r63 = c3875_2;
r64 = r61;
} else {
r63 = c3875_3;
r64 = r61;
}
return r63[c29670_4 % c3875_3.length].load();
};
export const getBurstAnimation = function() {
const apply = c3876_0.apply;
return c3876_0.apply(this, arguments);
};
+8
View File
@@ -0,0 +1,8 @@
// Metro module 7996 (f7997).
export default function getDisplayFilename(a0) {
if (a0.title != null && a0.filename != null) {
const r6 = a0.filename.lastIndexOf(".");
return a0.title + (r6 > 0 ? a0.filename.substr(r6) : "");
}
return a0.filename;
};
@@ -0,0 +1,74 @@
// Metro module 9418 (f9419).
import { EmojiSourceDataTypes } from "../emojis/records/ExpressionSourceRecord";
import { intl, t } from "../../intl/index.native";
let c6208_3 = {
DEFAULT: "Custom Emoji Popout",
CROSS_SERVER: "Custom Emoji Popout (Cross-Server)",
UPSELL_CURRENT_SERVER_JOINED: "Custom Emoji Popout (Upsell Joined Current-Server)",
UPSELL_CROSS_SERVER_JOINED: "Custom Emoji Popout (Upsell Joined Cross-Server)",
UPSELL_CROSS_SERVER_JOINABLE: "Custom Emoji Popout (Upsell Not-Joined Cross-Server)",
UPSELL_CROSS_SERVER_UNJOINABLE: "Custom Emoji Popout (Soft Upsell)"
};
let c6208_4 = {
GET_PREMIUM: "GET_PREMIUM",
JOIN_GUILD: "JOIN_GUILD",
UNAVAILABLE: "UNAVAILABLE"
};
export { c6208_4 as EmojiPopoutType };
export function getEmojiPopoutData(a0) {
let r189, CROSS_SERVER;
const { sourceType, expressionSourceApplication, isPremium, hasJoinedEmojiSourceGuild, isUnusableRoleSubscriptionEmoji, isDiscoverable, emojiComesFromCurrentGuild, userIsRoleSubscriber, isRoleSubscriptionEmoji, shouldHideRoleSubscriptionCTA, onOpenPremiumSettings } = a0;
const emojiDescription = sourceType === EmojiSourceDataTypes.APPLICATION && expressionSourceApplication != null ? intl.formatToPlainString(t.uERlTd, {
appName: expressionSourceApplication.name
}) : isPremium ? hasJoinedEmojiSourceGuild ? isRoleSubscriptionEmoji ? shouldHideRoleSubscriptionCTA && isUnusableRoleSubscriptionEmoji ? intl.string(t.xFb68j) : isUnusableRoleSubscriptionEmoji ? userIsRoleSubscriber ? intl.string(t.vLklfF) : intl.string(t["g8i/bf"]) : intl.string(t.Eoynp0) : emojiComesFromCurrentGuild ? intl.string(t.hU4kIe) : intl.string(t.GM0xaX) : isDiscoverable ? intl.string(t.xE9WGt) : intl.string(t["0LMpW+"]) : hasJoinedEmojiSourceGuild ? shouldHideRoleSubscriptionCTA && isUnusableRoleSubscriptionEmoji ? intl.string(t.xFb68j) : isUnusableRoleSubscriptionEmoji ? userIsRoleSubscriber ? intl.string(t.vLklfF) : intl.string(t["g8i/bf"]) : emojiComesFromCurrentGuild ? intl.string(t.ICPhqa) : intl.string(t.jQy3aM) : isDiscoverable ? intl.string(t.FJ6Z01) : intl.format(t.U6vLcA, {
openPremiumSettings: onOpenPremiumSettings
});
let isPremium2 = a0.isPremium;
const { hasJoinedEmojiSourceGuild: hasJoinedEmojiSourceGuild2, isUnusableRoleSubscriptionEmoji: isUnusableRoleSubscriptionEmoji2, emojiComesFromCurrentGuild: emojiComesFromCurrentGuild2, isDiscoverable: isDiscoverable2 } = a0;
const DEFAULT = c6208_3.DEFAULT;
if (isPremium2 && (!hasJoinedEmojiSourceGuild2 && isDiscoverable2)) {
CROSS_SERVER = c6208_3.CROSS_SERVER;
} else if (!isPremium2 && (hasJoinedEmojiSourceGuild2 && !isUnusableRoleSubscriptionEmoji2)) {
CROSS_SERVER = emojiComesFromCurrentGuild2 ? c6208_3.UPSELL_CURRENT_SERVER_JOINED : c6208_3.UPSELL_CROSS_SERVER_JOINED;
} else {
if (!isPremium2) {
isPremium2 = hasJoinedEmojiSourceGuild2;
}
CROSS_SERVER = isPremium2 ? DEFAULT : isDiscoverable2 ? c6208_3.UPSELL_CROSS_SERVER_JOINABLE : c6208_3.UPSELL_CROSS_SERVER_UNJOINABLE;
}
const { isPremium: isPremium3, hasJoinedEmojiSourceGuild: hasJoinedEmojiSourceGuild3, isUnusableRoleSubscriptionEmoji: isUnusableRoleSubscriptionEmoji3, isDiscoverable: isDiscoverable3 } = a0;
const r186 = hasJoinedEmojiSourceGuild3 ? !hasJoinedEmojiSourceGuild3 : isDiscoverable3;
L78: {
if (isPremium3 && r186) {
r189 = {
type: c6208_4.JOIN_GUILD,
text: intl.string(t.riu2R5),
description: null
};
} else {
L75: {
if (!isPremium3) {
if (!(hasJoinedEmojiSourceGuild3 && !isUnusableRoleSubscriptionEmoji3) && !r186) {
break L75;
}
r189 = {
type: c6208_4.GET_PREMIUM,
text: intl.string(t["gl/XHJ"]),
description: null
};
break L78;
}
}
r189 = {
type: c6208_4.UNAVAILABLE,
text: null,
description: null
};
}
}
return {
...r189,
emojiDescription,
analyticsType: CROSS_SERVER
};
}
@@ -0,0 +1,5 @@
// Metro module 12354 (f12355).
import { intl, t } from "../../intl/index.native";
export function getHeaderTextForInvite({ isVoiceChannel, isHubGuild, isOwnInvite, isGuest, isStage, isStream }) {
return isVoiceChannel ? isOwnInvite ? isStream ? intl.string(t.N85DCl) : isStage ? intl.string(t.TJQcNv) : isGuest ? intl.string(t.mJyBir) : intl.string(t.lxTgP9) : isStream ? intl.string(t.Mnvc3C) : isStage ? intl.string(t.FdPNr5) : isGuest ? intl.string(t.f4gmrf) : intl.string(t.H39rEY) : isHubGuild ? isOwnInvite ? intl.string(t.UxmnHx) : intl.string(t.sigPEf) : isOwnInvite ? intl.string(t["oU/lsl"]) : intl.string(t.BoQUFf);
}
@@ -0,0 +1,5 @@
// Metro module 7761 (f7762).
export default function getHumanizedCallDuration(a0) {
const r4 = a0.call != null ? a0.call.duration : null;
return r4 != null ? r4.humanize() : null;
};
@@ -0,0 +1,11 @@
// Metro module 9642 (f9643).
import { Endpoints } from "../../Constants";
import { HTTP } from "../../_bundle/sendRequest";
import { makeDiscoverableGuild } from "../../utils/GuildDiscoveryUtils";
export default function getStickerDiscoverableGuild(a0) {
return HTTP.get({
url: Endpoints.STICKER_GUILD_DATA(a0),
oldFormErrors: true,
rejectWithError: true
}).then((result) => result?.body != null ? makeDiscoverableGuild(result.body) : null).catch(() => null);
};
+6
View File
@@ -0,0 +1,6 @@
// Metro module 7818 (f7819).
import { MessageFlags, MessageReferenceTypes, MessageTypes } from "../../Constants";
import { hasFlag } from "../../_bundle/Module1384";
export default function isCrosspost(a0) {
return a0.type === MessageTypes.DEFAULT && hasFlag(a0.flags, MessageFlags.IS_CROSSPOST) && a0.messageReference != null && a0.messageReference.type !== MessageReferenceTypes.FORWARD;
};
+66
View File
@@ -0,0 +1,66 @@
// Metro module 4423 (f4424).
import ChannelStore from "../../stores/ChannelStore";
import GuildMemberStore from "../../stores/GuildMemberStore";
import GuildStore from "../../stores/GuildStore";
const isMentioned = function isMentioned({ userId, channelId, mentionEveryone, mentionUsers, mentionRoles, suppressEveryone = false, suppressRoles = false }) {
let member;
member = void 0;
if (mentionEveryone && !suppressEveryone) {
return true;
}
if (mentionUsers.includes(userId)) {
return true;
}
if (!suppressRoles && mentionRoles != null && mentionRoles.length !== 0) {
const channel = ChannelStore.getChannel(channelId);
if (channel == null) {
return false;
}
const guildId = channel.getGuildId();
if (guildId == null) {
return false;
}
if (GuildStore.getGuild(guildId) == null) {
return false;
}
member = GuildMemberStore.getMember(guildId, userId);
return member != null && mentionRoles.some((mentionRole) => member.roles.includes(mentionRole));
}
return false;
};
export default function isMessageMentioned({ message, userId, suppressEveryone = false, suppressRoles = false }) {
return isMentioned({
userId,
channelId: message.channel_id,
mentionEveryone: message.mentionEveryone,
mentionUsers: message.mentions,
mentionRoles: message.mentionRoles,
suppressEveryone,
suppressRoles
});
};
export function isRawMessageMentioned({ rawMessage, userId, suppressEveryone = false, suppressRoles = false }) {
let mention_everyone = rawMessage.mention_everyone;
if (mention_everyone == null) {
mention_everyone = false;
}
const mentions = rawMessage.mentions;
let mentionUsers = mentions == null ? void 0 : mentions.map((mention) => mention.id);
if (mentionUsers == null) {
mentionUsers = [];
}
let mention_roles = rawMessage.mention_roles;
if (mention_roles == null) {
mention_roles = [];
}
return isMentioned({
userId,
channelId: rawMessage.channel_id,
mentionEveryone: mention_everyone,
mentionUsers,
mentionRoles: mention_roles,
suppressEveryone,
suppressRoles
});
}
export { isMentioned };
+29
View File
@@ -0,0 +1,29 @@
// Metro module 9560 (f9561).
import PermissionStore from "../../stores/PermissionStore";
import { ChannelTypes, Permissions } from "../../Constants";
import isSystemMessage from "./isSystemMessage";
import { getIsActiveChannelOrUnarchivableThread } from "../threads/ThreadHooks";
export default function isMessagePinnable(a0, a1) {
const isSystemDM = a1.isSystemDM();
let r8 = isSystemDM ? !isSystemDM : !isSystemMessage(a0);
let r16 = PermissionStore.can(Permissions.PIN_MESSAGES, a1) && PermissionStore.can(Permissions.READ_MESSAGE_HISTORY, a1);
if (r8) {
if (!r16) {
r16 = a1.isPrivate();
}
r8 = r16;
}
if (r8) {
r8 = getIsActiveChannelOrUnarchivableThread(a1);
}
if (r8) {
r8 = a1.type !== ChannelTypes.GUILD_VOICE;
}
if (r8) {
r8 = a1.type !== ChannelTypes.GUILD_STAGE_VOICE;
}
if (r8) {
r8 = a1.type !== ChannelTypes.MEDIA_THREAD;
}
return r8;
};
+82
View File
@@ -0,0 +1,82 @@
// Metro module 9503 (f9504).
import { ChannelStreamTypes, MessageFlags, MessageTypes } from "../../Constants";
import Durations from "../../utils/Durations";
import isSystemMessage from "./isSystemMessage";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import * as _DateUtils from "../../utils/DateUtils";
let c6267_6;
const isNewMessageGroup = function isNewMessageGroup(a0, content, a2) {
let r40;
const hasFlag = a2.hasFlag(MessageFlags.HAS_THREAD);
const r1 = hasFlag ? !hasFlag : !a2.isCommandType();
let r9 = !r1;
if (r1) {
let r31 = content.blocked !== a2.blocked || content.ignored !== a2.ignored;
if (!r31) {
if (a2.type > MessageTypes.DEFAULT) {
const isSystemMessage2 = isSystemMessage(content);
r40 = isSystemMessage2 ? a2.type === MessageTypes.REPLY : !isSystemMessage2;
} else {
r40 = !!isSystemMessage(content);
if (!r40) {
let r2 = content.author.id !== a2.author.id;
if (!r2) {
let r13 = content.hasFlag(MessageFlags.EPHEMERAL) !== a2.hasFlag(MessageFlags.EPHEMERAL);
if (!r13) {
let r6 = a2.webhookId != null && content.author.username !== a2.author.username;
if (!r6) {
const r55 = a0 == null ? void 0 : a0.isForumPost();
const r3 = r55 ? content.id !== SnowflakeUtils.castChannelIdAsMessageId(a0.id) : !r55;
let r63 = !r3;
if (r3) {
const isSameDay = _DateUtils.isSameDay(content.timestamp, a2.timestamp);
let r70 = !isSameDay;
if (isSameDay) {
const isWithinInterval = _DateUtils.isWithinInterval(content.timestamp, a2.timestamp, c6267_6);
let r78 = !isWithinInterval;
if (isWithinInterval) {
const hasFlag2 = a2.hasFlag(MessageFlags.SUPPRESS_NOTIFICATIONS);
const r82 = hasFlag2 ? content.hasFlag(MessageFlags.SUPPRESS_NOTIFICATIONS) : !hasFlag2;
let r12 = !r82;
if (r82) {
const hasFlag3 = content.hasFlag(MessageFlags.SUPPRESS_NOTIFICATIONS);
const r88 = (hasFlag3 ? a2.hasFlag(MessageFlags.SUPPRESS_NOTIFICATIONS) : !hasFlag3) || !(a2.mentions.length > 0 || a2.mentionRoles.length > 0 || a2.mentionEveryone);
let r11 = !r88;
if (r88) {
let r10 = a2.applicationId !== content.applicationId;
if (!r10) {
const additionalName = a2.additionalName;
const r99 = additionalName == null ? null : additionalName !== "" ? additionalName : null;
const additionalName2 = content.additionalName;
r10 = r99 !== (additionalName2 == null ? null : additionalName2 !== "" ? additionalName2 : null);
}
r11 = r10;
}
r12 = r11;
}
r78 = r12;
}
r70 = r78;
}
r63 = r70;
}
r6 = r63;
}
r13 = r6;
}
r2 = r13;
}
r40 = r2;
}
}
r31 = r40;
}
r9 = r31;
}
return r9;
};
c6267_6 = 7 * Durations.Millis.MINUTE;
export default isNewMessageGroup;
export function isNewGroupItem(a0, a1, a2) {
return a1 == null || (a1.type === ChannelStreamTypes.MESSAGE && a1.content.id === a1.content.channel_id || (a1.type !== ChannelStreamTypes.MESSAGE && a1.type !== ChannelStreamTypes.THREAD_STARTER_MESSAGE || isNewMessageGroup(a0, a1.content, a2)));
}
+26
View File
@@ -0,0 +1,26 @@
// Metro module 5763 (f5764).
import UserStore from "../../stores/UserStore";
import { ChannelTypes, UserFlags } from "../../Constants";
import { isAutomodMessageRecord } from "../guild_automod/AutomodMessageUtils";
export function isSpamSupported(a0) {
return a0 !== void 0 && a0.type !== ChannelTypes.DM;
}
export function isSpammer(a0) {
const user = UserStore.getUser(a0);
let r7 = user == null ? void 0 : user.hasFlag(UserFlags.SPAMMER);
if (r7 == null) {
r7 = false;
}
return r7;
}
export function isSpam(a0) {
const user = UserStore.getUser(a0.author.id);
let r10 = user == null ? void 0 : user.hasFlag(UserFlags.SPAMMER);
if (r10 == null) {
r10 = false;
}
if (r10) {
r10 = !isAutomodMessageRecord(a0);
}
return r10;
}
+5
View File
@@ -0,0 +1,5 @@
// Metro module 5923 (f5924).
import { MessageTypesSets } from "../../_bundle/Module686";
export default function isSystemMessage(a0) {
return !MessageTypesSets.USER_MESSAGE.has(a0.type);
};
@@ -0,0 +1,30 @@
// Metro module 6154 (f6155).
import { AnalyticEvents } from "../../Constants";
import { trackWithMetadata } from "../app_analytics/AppAnalyticsUtils";
function $mk77835() {
return ({ mimeType }) => {
if (mimeType == null) {
mimeType = "unknown";
}
return mimeType;
};
}
export function logMessageSendFailure(a0) {
const attachment_mimetypes = a0.fileItems != null ? a0.fileItems.map($mk77835()) : [];
let errorMessage = a0.errorMessage;
if (errorMessage == null) {
errorMessage = void 0;
}
let failureCode = a0.failureCode;
if (failureCode == null) {
failureCode = void 0;
}
trackWithMetadata(AnalyticEvents.SEND_MESSAGE_FAILURE, {
failure_code: failureCode,
error_message: errorMessage,
attachment_mimetypes
});
}
export function getAttachmentMimeTypes(a0) {
return a0.map($mk77835());
}
+94
View File
@@ -0,0 +1,94 @@
// Metro module 9885 (f9886).
import JoinedThreadsStore from "../threads/JoinedThreadsStore";
import ChannelStore from "../../stores/ChannelStore";
import MessageStore from "../../stores/MessageStore";
import { shouldBadgeMessage } from "../../stores/ReadStateStore";
import UserStore from "../../stores/UserStore";
import { Endpoints } from "../../Constants";
import Logger from "../debug/Logger";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import ThreadActionCreators from "../threads/ThreadActionCreators";
import { HTTP } from "../../_bundle/sendRequest";
let env6556 = {};
const c6556_10 = new Logger("markUnread");
export default async function markUnread(c26558_0, c26558_1) {
let c26558_2, c26558_3;
L27: {
L22: {
let env30154;
const r33 = env6556;
c26558_3 = r33;
const r13 = env30154 = {
$parent: r33
};
c26558_2 = r13;
env30154[0] = c26558_0;
env30154[1] = c26558_1;
env30154[2] = void 0;
env30154[3] = void 0;
env30154[4] = void 0;
env30154[5] = void 0;
const currentUser = UserStore.getCurrentUser();
env30154[2] = currentUser;
if (currentUser == null) {
break L27;
}
const messages = MessageStore.getMessages(c26558_0);
const r47 = messages.toArray().filter((item) => SnowflakeUtils.compare(item.id, env30154[1]) < 0).sort((a, b) => SnowflakeUtils.compare(a.id, b.id)).reverse()[0];
env30154[3] = r47 == null ? SnowflakeUtils.atPreviousMillisecond(c26558_1) : r47.id;
env30154[4] = 0;
messages.forAll((a0) => {
if (SnowflakeUtils.compare(a0.id, env30154[3]) > 0 && (0, shouldBadgeMessage)(a0, env30154[2])) {
env30154[4] = env30154[4] + 1;
}
});
const channel = ChannelStore.getChannel(c26558_0);
env30154[5] = channel;
const r60 = channel != null && channel.isThread();
L14: {
if (r60) {
if (channel.isArchivedThread()) {
await ThreadActionCreators.unarchiveThread(channel, false);
if (!JoinedThreadsStore.hasJoined(env30154[0])) {
await ThreadActionCreators.joinThread(env30154[5], "Mark Unread");
}
} else {
if (JoinedThreadsStore.hasJoined(env30154[0])) {
break L14;
}
await ThreadActionCreators.joinThread(env30154[5], "Mark Unread");
}
c6556_10.log("Marking unread", {
channelId: env30154[0],
messageId: env30154[1]
});
HTTP.post({
url: Endpoints.MESSAGE_ACK(env30154[0], env30154[3]),
body: {
manual: true,
mention_count: env30154[4]
},
oldFormErrors: true,
rejectWithError: true
});
break L22;
}
}
c6556_10.log("Marking unread", {
channelId: env30154[0],
messageId: env30154[1]
});
HTTP.post({
url: Endpoints.MESSAGE_ACK(env30154[0], env30154[3]),
body: {
manual: true,
mention_count: env30154[4]
},
oldFormErrors: true,
rejectWithError: true
});
break L27;
}
return void 0;
}
};
@@ -0,0 +1,36 @@
// Metro module 10902 (f10903).
import { AnalyticEvents } from "../../../Constants";
import { trackClickstream } from "../../app_analytics/clickstream/Clickstream";
class ChannelLatestMessageLoadingStatsManager {
static seenChannelIds = new Set();
constructor(a0) {
this.label = a0;
}
start(a0) {
this.latestChannelMessagesLoad = {
channelId: a0.channelId,
startMs: Date.now()
};
}
cancel() {
this.latestChannelMessagesLoad = void 0;
}
finish(a0) {
const latestChannelMessagesLoad = this.latestChannelMessagesLoad;
if (latestChannelMessagesLoad != null && latestChannelMessagesLoad.channelId === a0.channelId) {
const load_duration_ms = Date.now() - latestChannelMessagesLoad.startMs;
const r18 = ChannelLatestMessageLoadingStatsManager.seenChannelIds.has(a0.channelId);
const is_first_load = !r18;
if (!r18) {
ChannelLatestMessageLoadingStatsManager.seenChannelIds.add(a0.channelId);
}
trackClickstream(AnalyticEvents.CHANNEL_LATEST_MESSAGES_LOADED_CLICKSTREAM, {
load_duration_ms,
were_messages_cached: a0.areMessagesCached,
is_first_load
});
this.latestChannelMessagesLoad = void 0;
}
}
}
export default ChannelLatestMessageLoadingStatsManager;
+242
View File
@@ -0,0 +1,242 @@
// Metro module 10462 (f10463).
import { useEffect, useCallback } from "react";
import { View, StyleSheet } from "react-native";
import GatewayConnectionStore from "../../gateway/GatewayConnectionStore";
import ReadStateStore from "../../../stores/ReadStateStore";
import { ChatOverlays } from "../ChatOverlayConstants";
import { AnalyticEvents, AnalyticsObjectTypes, AnalyticsObjects, AnalyticsSections } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useShowChannelOptInNotice from "../../opt_in_channels/useShowChannelOptInNotice";
import useAllowedChatOverlays from "../useAllowedChatOverlays";
import { useStateFromStores, useStateFromStoresObject } from "../../../_bundle/Module589";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import MobileVisualRefreshExperiment from "../../themes/experiments/MobileVisualRefreshExperiment";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { collectGuildAnalyticsMetadata, collectChannelAnalyticsMetadata } from "../../app_analytics/AppAnalyticsUtils";
import { setOptInChannel } from "../../opt_in_channels/OptInChannelsActionCreators";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { useCanUnarchiveThread, useIsThreadModerator } from "../../threads/ThreadHooks";
import ThreadActionCreators from "../../threads/ThreadActionCreators";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import { ack } from "../../../actions/ReadStateActionCreators";
import { XSmallBoldIcon } from "../../../design/components/Icon/native/redesign/generated/XSmallBoldIcon";
let useStyles, ArchivedLockedThreadChatBanner, LockedThreadChatBanner, NewMessagesChatBar;
const OptInChannelBanner = function OptInChannelBanner(props) {
const { channel, ctaProps, topBorder } = props;
const styles = useStyles();
const r12 = MobileVisualRefreshExperiment("OptInChannelBanner");
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.CHANNEL_BANNER_VIEWED, {
...collectGuildAnalyticsMetadata(channel.getGuildId()),
...collectChannelAnalyticsMetadata(channel),
banner_type: "channel_opt_in"
});
}, [channel]);
const callback = useCallback(() => {
AnalyticsUtils.track(AnalyticEvents.CHANNEL_BANNER_CTA_CLICKED, {
...collectGuildAnalyticsMetadata(channel.getGuildId()),
...collectChannelAnalyticsMetadata(channel),
banner_type: "channel_opt_in",
cta_type: "add channel"
});
setOptInChannel(channel.guild_id, channel.id, true, {
section: AnalyticsSections.CHANNEL
});
}, [channel]);
return <View style={[styles.optInChannelBannerContainer, r12 ? null : styles.optInChannelBannerLegacyBorder, topBorder ? styles.topBorder : null]}>
<Text lineClamp={2} style={styles.optInChannelBannerText} variant="text-sm/semibold">
{intl.string(t.iOWmmB)}
</Text>
<View style={styles.optInChannelBannerButtonContainer}>
<Button {...ctaProps} onPress={callback} size="sm" text={intl.string(t["TD/+zP"])} />
</View>
</View>;
};
ArchivedLockedThreadChatBanner = function ArchivedLockedThreadChatBanner(props) {
const channel2 = props.channel;
const styles = useStyles();
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.CHANNEL_BANNER_VIEWED, {
...collectGuildAnalyticsMetadata(channel2.getGuildId()),
...collectChannelAnalyticsMetadata(channel2),
banner_type: "thread"
});
}, [channel2]);
let r22 = useCanUnarchiveThread(channel2);
const r41 = [<Text lineClamp={4} style={styles.threadBannerTitle} variant="text-sm/medium" color="text-default">
{channel2.isForumPost() ? intl.string(t["833FDn"]) : intl.string(t.rEeodK)}
</Text>, ,];
if (r22) {
r22 = <View style={styles.threadBannerButton}>
<Button variant="secondary" size="sm" text={intl.string(t["0dvvEi"])} onPress={function onPress() {
AnalyticsUtils.track(AnalyticEvents.CHANNEL_BANNER_CTA_CLICKED, {
...collectGuildAnalyticsMetadata(channel2.getGuildId()),
...collectChannelAnalyticsMetadata(channel2),
banner_type: "thread",
cta_type: "unarchive"
});
ThreadActionCreators.unarchiveThread(channel2, false);
}} />
</View>;
}
r41[1] = r22;
return <View style={styles.threadBannerContainer}>{r41}</View>;
};
LockedThreadChatBanner = function LockedThreadChatBanner(props) {
const channel3 = props.channel;
const styles = useStyles();
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.CHANNEL_BANNER_VIEWED, {
...collectGuildAnalyticsMetadata(channel3.getGuildId()),
...collectChannelAnalyticsMetadata(channel3),
banner_type: "thread"
});
}, [channel3]);
let r22 = useIsThreadModerator(channel3);
const r41 = [<Text lineClamp={4} style={styles.threadBannerTitle} variant="text-sm/medium" color="text-default">
{channel3.isForumPost() ? intl.string(t.E7oO8u) : intl.string(t["V/JF2N"])}
</Text>, ,];
if (r22) {
r22 = <View style={styles.threadBannerButton}>
<Button variant="secondary" size="sm" text={intl.string(t.zA9d1J)} onPress={function onPress() {
AnalyticsUtils.track(AnalyticEvents.CHANNEL_BANNER_CTA_CLICKED, {
...collectGuildAnalyticsMetadata(channel3.getGuildId()),
...collectChannelAnalyticsMetadata(channel3),
banner_type: "thread",
cta_type: "unlock"
});
ThreadActionCreators.unlockThread(channel3);
}} />
</View>;
}
r41[1] = r22;
return <View style={styles.threadBannerContainer}>{r41}</View>;
};
NewMessagesChatBar = function NewMessagesChatBar(props) {
const { channel: channel4, unreadCount, oldestUnreadTimestamp, handleScrollToNewMessages } = props;
const styles = useStyles();
return useStateFromStores([GatewayConnectionStore], () => GatewayConnectionStore.isConnected(), []) ? unreadCount <= 0 ? null : <View style={styles.newMessageBar}>
<PressableOpacity accessibilityRole="button" style={styles.newMessageBarTextContainer} onPress={handleScrollToNewMessages}>
<Text variant="text-sm/semibold" color="text-overlay-light">
{intl.format(ReadStateStore.isEstimated(channel4.id) ? t.wvtbbG : t["BctFH/"], {
count: unreadCount,
timestamp: oldestUnreadTimestamp
})}
</Text>
</PressableOpacity>
<PressableOpacity style={styles.newMessageBarCloseButton} accessibilityRole="button" accessibilityLabel={intl.string(t.e6RscS)} onPress={() => ack(channel4.id, {
section: AnalyticsSections.NEW_MESSAGES_BANNER,
object: AnalyticsObjects.MARK_CHANNEL_AS_READ_BUTTON,
objectType: AnalyticsObjectTypes.ACK_MANUAL
})}>
<XSmallBoldIcon size="sm" color={Module712.colors.WHITE} />
</PressableOpacity>
</View> : null;
};
useStyles = createStyles({
threadBannerContainer: {
alignSelf: "stretch",
minHeight: 60,
flexDirection: "row",
paddingHorizontal: 16,
paddingVertical: 12,
alignItems: "center",
flexGrow: 0,
zIndex: 100,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
threadBannerTitle: {
flex: 1,
lineHeight: 18
},
threadBannerButton: {
flexGrow: 0,
paddingVertical: 7,
paddingHorizontal: 16,
marginLeft: 16
},
newMessageBar: {
backgroundColor: Module712.colors.BACKGROUND_BRAND,
flexDirection: "row",
justifyContent: "center",
alignItems: "center",
overflow: "hidden",
zIndex: 100,
minHeight: 45
},
newMessageBarTextContainer: {
flex: 1,
paddingLeft: 16,
paddingVertical: 10
},
newMessageBarCloseButton: {
paddingHorizontal: 12
},
optInChannelBannerContainer: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
overflow: "hidden",
padding: 8,
paddingLeft: 16,
paddingRight: 16,
zIndex: 100,
backgroundColor: Module712.colors.CHAT_BANNER_BG,
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: Module712.colors.CHAT_BORDER
},
optInChannelBannerLegacyBorder: {
borderBottomWidth: 1,
borderBottomColor: Module712.colors.BORDER_SUBTLE
},
topBorder: {
borderTopWidth: StyleSheet.hairlineWidth,
borderTopColor: Module712.colors.CHAT_BORDER
},
optInChannelBannerText: {
flex: 1
},
optInChannelBannerButtonContainer: {
flexShrink: 0,
marginLeft: 8
}
});
export default function ChatBanner(props) {
let r36;
let channel5;
L13: {
channel5 = props.channel;
const handleScrollToNewMessages = props.handleScrollToNewMessages;
const showChannelOptInNotice = useShowChannelOptInNotice(channel5);
const allowedChatOverlays = useAllowedChatOverlays();
const stateFromStoresObject = useStateFromStoresObject([ReadStateStore], () => {
let oldestUnreadTimestamp = ReadStateStore.getOldestUnreadTimestamp(channel5.id);
const r12 = {
unreadCount: ReadStateStore.getUnreadCount(channel5.id),
oldestUnreadTimestamp: null
};
if (oldestUnreadTimestamp === 0) {
oldestUnreadTimestamp = SnowflakeUtils.extractTimestamp(channel5.id);
}
r12.oldestUnreadTimestamp = oldestUnreadTimestamp;
return r12;
}, [channel5.id]);
const { unreadCount, oldestUnreadTimestamp } = stateFromStoresObject;
if (channel5.isArchivedLockedThread()) {
r36 = <ArchivedLockedThreadChatBanner channel={channel5} />;
} else if (channel5.isLockedThread()) {
r36 = <LockedThreadChatBanner channel={channel5} />;
} else {
if (unreadCount > 0 && allowedChatOverlays.includes(ChatOverlays.NEW_MESSAGES)) {
r36 = <NewMessagesChatBar unreadCount={unreadCount} oldestUnreadTimestamp={oldestUnreadTimestamp} channel={channel5} handleScrollToNewMessages={handleScrollToNewMessages} />;
break L13;
}
r36 = showChannelOptInNotice ? allowedChatOverlays.includes(ChatOverlays.OPT_IN_CHANNEL) ? <OptInChannelBanner channel={channel5} /> : null : null;
}
}
return r36;
};
export { OptInChannelBanner };
@@ -0,0 +1,252 @@
// Metro module 11423 (f11424).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { useEffect, useState, useCallback } from "react";
import { View } from "react-native";
import StickersStore from "../../stickers/StickersStore";
import MessageStore from "../../../stores/MessageStore";
import UserStore from "../../../stores/UserStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { GradientPercentage, useGradientValue } from "../../client_themes/native/ClientThemesUtils";
import { useToken } from "../../../design/tokens/native/useToken";
import { hexWithOpacity } from "../../../utils/ColorUtils";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import Module11424 from "../../../_bundle/Module11424";
import { trackWaveCtaClicked } from "../../channel/trackWaveCtaClicked";
import MessageActionCreators from "../../../actions/MessageActionCreators";
import { intl, t } from "../../../intl/index.native";
import { useStateFromStores } from "../../../_bundle/Module589";
import { MessageTypes } from "../../../_bundle/Module686";
import UserUtils from "../../../utils/UserUtils";
import { useShowConvoStarterInDM } from "../useShowConvoStarterInDM";
import { fetchStickerPack } from "../../stickers/StickersActionCreators";
import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import * as _timing from "../../../design/animation/reanimated/timing/timing";
import * as _native from "../../../design/void/native";
import { useShouldAnimateSticker } from "../../stickers/StickersHooks";
import Module4611 from "../../../_bundle/Module4611";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import Sticker from "../../stickers/native/Sticker";
import { Text } from "../../../design/components/Text/native/Text";
import { Button } from "../../../design/components/Button/native/Button.native";
let c7772_14, END, c7772_16;
let env7772 = {};
const useStyles = createStyles((a0) => ({
container: {
backgroundColor: a0 == null ? Module712.colors.BACKGROUND_BASE_LOWER : a0,
alignItems: "center",
paddingHorizontal: 16,
paddingBottom: 16,
paddingTop: 8
},
stickerContainer: {
paddingBottom: 16
},
toastContainer: {
flexDirection: "row",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
justifyContent: "center",
alignItems: "center",
gap: 8,
height: 48,
paddingHorizontal: 16,
borderRadius: Module712.radii.xxl
},
toastContent: {
lineHeight: 20
},
gradient: {
position: "absolute",
right: 0,
left: 0,
top: 0,
height: 30
}
}));
c7772_14 = "749054660769218631";
END = GradientPercentage.END;
c7772_16 = {
code: "function DMMessageStickerGreetingTsx1(){const{styles,isRendered,hasInputText,hasMessages,HEIGHT_COMPACT,HEIGHT_FULL,withDelay,withTiming,STANDARD_EASING}=this.__closure;const gradientOverlayOffset=styles.gradient.height;const hasHeight=isRendered&&!hasInputText;const heightExpanded=(hasMessages?HEIGHT_COMPACT:HEIGHT_FULL)-1;const targetHeight=hasHeight?heightExpanded+gradientOverlayOffset:0;const targetMargin=hasHeight?-gradientOverlayOffset:0;function generateAnimationConfig(value){return withDelay(300,withTiming(value,{easing:STANDARD_EASING,duration:250}));}return{justifyContent:'flex-end',overflow:'hidden',marginTop:generateAnimationConfig(targetMargin),height:generateAnimationConfig(targetHeight)};}"
};
export default function DMMessageStickerGreeting(props) {
let showConvoStarterInDM, state;
const { channel, hasInputText } = props;
showConvoStarterInDM = void 0;
state = void 0;
const styles = useStyles(useGradientValue(END));
let c18822_2 = styles;
const stateFromStores = useStateFromStores([MessageStore], () => MessageStore.getMessages(channel.id).filter((item) => item.type !== MessageTypes.FRIEND_REQUEST_ACCEPTED).length > 0);
let username = UserUtils.useName(useStateFromStores([UserStore], () => UserStore.getUser(channel.getRecipientId())));
if (username == null) {
username = intl.string(t.y1Wu2f);
}
let env18823;
let setState;
const text = intl.formatToPlainString(t.m0zYbV, {
username
});
showConvoStarterInDM = useShowConvoStarterInDM(channel);
const stateFromStores2 = useStateFromStores([StickersStore], () => showConvoStarterInDM ? StickersStore.getStickerById(c7772_14) : null, [showConvoStarterInDM]);
useEffect(() => {
if (showConvoStarterInDM) {
fetchStickerPack("847199849233514549", true);
}
}, [showConvoStarterInDM]);
env18823 = {
$parent: env7772
};
env18823[0] = channel;
env18823[1] = void 0;
env18823[2] = void 0;
env18823[3] = void 0;
env18823[4] = void 0;
const r80 = _slicedToArray(useState(null), 2);
const r20 = r80[0];
env18823[1] = r20;
env18823[2] = r80[1];
const r84 = _slicedToArray(useState(false), 2);
const r22 = r84[0];
env18823[3] = r22;
env18823[4] = r84[1];
useEffect(() => {
(0, env18823[2])(null);
}, [channel.id]);
const callback = useCallback(async () => {
let c30405_0, c30405_1, c30405_2;
let c30405_3 = 0;
const r10 = env18823;
L17: {
L15: {
try {
let env31626;
c30405_1 = r10;
const r33 = env31626 = {
$parent: r10
};
c30405_0 = r33;
const showErrorToast = function showErrorToast(a0) {
if (env18823[1] !== a0) {
(0, env18823[2])(a0);
}
ToastActionCreators.open({
key: "HANDLE_WAVE_PRESS_TOAST",
content: a0,
icon: Module11424
});
};
env31626[0] = showErrorToast;
if (env18823[3]) {
break L17;
}
(0, env18823[4])(true);
const r38 = env18823[1];
if (r38 === null) {
c30405_3 = 1;
const r44 = env18823[0];
trackWaveCtaClicked({
channelId: r44.id,
source: "In-channel greet"
});
await MessageActionCreators.sendGreetMessage(r44.id, c7772_14);
c30405_3 = 0;
(0, env18823[4])(false);
break L15;
}
(0, env18823[4])(false);
showErrorToast(r38);
} catch ($e) {
const r31 = $e;
let r7 = r31;
c30405_2 = r31;
if (c30405_3 !== 0) {
while (true) {
try {
const r84 = c30405_2;
c30405_3 = 0;
env31626[1] = r84;
if (!(env31626[1].ok || env31626[1].status !== 429)) {
env31626[0](intl.string(t.Whhv4w));
}
(0, env18823[4])(false);
break L15;
} catch (r81) {
r7 = r81;
c30405_2 = r81;
if (c30405_3 === 0) {
break;
}
}
}
}
throw r7;
}
return void 0;
}
return void 0;
}
}, [r22, r20, channel.id]);
setState = void 0;
let state2;
[state2, setState] = useState(false);
const callback2 = useCallback(() => {
setState(true);
}, [setState]);
state = state2;
const w = function w() {
const height = c18822_2.gradient.height;
let r4 = state;
if (state) {
r4 = !hasInputText;
}
const r9 = r4 ? (stateFromStores ? 72 : 180) - 1 + height : 0;
return {
justifyContent: "flex-end",
overflow: "hidden",
marginTop: _ReanimatedRexport.withDelay(300, _timing.withTiming(r4 ? -height : 0, {
easing: _native.STANDARD_EASING,
duration: 250
})),
height: _ReanimatedRexport.withDelay(300, _timing.withTiming(r9, {
easing: _native.STANDARD_EASING,
duration: 250
}))
};
};
w.__closure = {
styles,
isRendered: state,
hasInputText,
hasMessages: stateFromStores,
HEIGHT_COMPACT: 72,
HEIGHT_FULL: 180,
withDelay: _ReanimatedRexport.withDelay,
withTiming: _timing.withTiming,
STANDARD_EASING: _native.STANDARD_EASING
};
w.__workletHash = 6327401707106;
w.__initData = c7772_16;
const animatedStyle = useAnimatedStyle(w);
let r127 = useGradientValue(END);
if (r127 == null) {
r127 = Module712.colors.BACKGROUND_BASE_LOWER;
}
const token = useToken(r127);
const colors = [hexWithOpacity(token, 0), token];
const shouldAnimateSticker = useShouldAnimateSticker(false);
const r145 = showConvoStarterInDM ? <ReanimatedRexport.View style={animatedStyle} onLayout={callback2}>
<Module4611 style={styles.gradient} colors={colors} />
<View style={styles.container}>
{stateFromStores ? <PressableOpacity style={styles.toastContainer} accessibilityRole="button" accessibilityLabel={intl.string(t.pJObYI)} onPress={callback}>
{stateFromStores2 != null ? <Sticker sticker={stateFromStores2} size={24} animated={shouldAnimateSticker} /> : null}
<Text style={styles.toastContent} variant="text-md/bold">{text}</Text>
</PressableOpacity> : <>
{stateFromStores2 != null ? <View style={styles.stickerContainer}>
<Sticker sticker={stateFromStores2} size={100} animated={shouldAnimateSticker} />
</View> : null}
<Button text={text} onPress={callback} shrink />
</>}
</View>
</ReanimatedRexport.View> : null;
return r145;
};
@@ -0,0 +1,107 @@
// Metro module 7749 (f7750).
import GuildVerificationStore from "../../../stores/GuildVerificationStore";
import PermissionStore from "../../../stores/PermissionStore";
import { Permissions } from "../../../Constants";
import { DoubleTapReactionEmoji } from "../../user_settings/UserSettings";
import { disambiguatedEmojiFromSettingsValue } from "../../double_tap_to_react/native/DoubleTapToReactUtils";
import { intl, t } from "../../../intl/index.native";
import { canReplyToMessage } from "../../replies/canReplyToMessage";
let c4876_5 = {
VIEW_PROFILE: "view_profile",
ADD_REACTION: "add_reaction",
ADD_QUICK_REACTION: "add_quick_reaction",
REPLY: "reply",
MESSAGE_ACTIONS_MENU: "message_actions_menu",
EDIT_GDM: "edit_gdm",
OPEN_PINS: "open_pins",
JUMP_TO_MESSAGE: "jump_to_message"
};
export { c4876_5 as MessageAccessibilityAction };
export function getMessageAccessibilityActionFromLabel(a0) {
let r87;
const r4 = {};
r4[intl.string(t.iXAna6)] = c4876_5.VIEW_PROFILE;
r4[intl.string(t.lfIHs4)] = c4876_5.ADD_REACTION;
r4[intl.string(t["5IEsGx"])] = c4876_5.REPLY;
r4[intl.string(t.ChPNkN)] = c4876_5.MESSAGE_ACTIONS_MENU;
r4[intl.string(t["5Q9+/L"])] = c4876_5.EDIT_GDM;
r4[intl.string(t["mp1N/2"])] = c4876_5.OPEN_PINS;
r4[intl.string(t["+TSRGD"])] = c4876_5.JUMP_TO_MESSAGE;
const setting = DoubleTapReactionEmoji.getSetting();
const disableDoubleTap = setting?.disableDoubleTap;
L7: {
r87 = null;
if (disableDoubleTap !== true) {
if (setting != null) {
const r91 = disambiguatedEmojiFromSettingsValue(setting);
if (r91 != null) {
r87 = intl.formatToPlainString(t.eQIttH, {
emojiName: r91.name
});
break L7;
}
}
r87 = intl.formatToPlainString(t.eQIttH, {
emojiName: "heart"
});
}
}
if (r87 != null) {
r4[r87] = c4876_5.ADD_QUICK_REACTION;
}
return r4[a0];
}
export function createMessageAccessibilityActions(a0, a1) {
let label;
if (a1 == null) {
return [];
}
const guildId = a1.getGuildId();
const r14 = guildId != null && GuildVerificationStore.canChatInGuild(guildId) && PermissionStore.can(Permissions.ADD_REACTIONS, a1) || a1.isPrivate();
const r31 = [{
label: intl.string(t.iXAna6),
name: c4876_5.VIEW_PROFILE
}];
if (r14) {
r31.push({
label: intl.string(t.lfIHs4),
name: c4876_5.ADD_REACTION
});
const setting = DoubleTapReactionEmoji.getSetting();
const disableDoubleTap = setting?.disableDoubleTap;
L15: {
label = null;
if (disableDoubleTap !== true) {
if (setting != null) {
const r13 = disambiguatedEmojiFromSettingsValue(setting);
if (r13 != null) {
label = intl.formatToPlainString(t.eQIttH, {
emojiName: r13.name
});
break L15;
}
}
label = intl.formatToPlainString(t.eQIttH, {
emojiName: "heart"
});
}
}
if (label != null) {
r31.push({
label,
name: c4876_5.ADD_QUICK_REACTION
});
}
}
if (canReplyToMessage(a1, a0)) {
r31.push({
label: intl.string(t["5IEsGx"]),
name: c4876_5.REPLY
});
}
r31.push({
label: intl.string(t.ChPNkN),
name: c4876_5.MESSAGE_ACTIONS_MENU
});
return r31;
}
@@ -0,0 +1,72 @@
// Metro module 11008 (f11009).
import { View } from "react-native";
import ApplicationStore from "../../applications/ApplicationStore";
import { HelpdeskArticles } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { isAndroid } from "../../../utils/PlatformUtils";
import Module712 from "../../../_bundle/Module712";
import { useStateFromStores } from "../../../_bundle/Module589";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { Icon } from "../../../design/void/native";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
const useStyles = createStyles({
contentWrapper: {
paddingHorizontal: 24,
paddingTop: 8,
paddingBottom: isAndroid() ? 16 : 0
},
gameDescriptionWrapper: {
flexDirection: "column",
justifyContent: "flex-start",
flex: 1
},
gameIcon: {
width: 56,
height: 56,
marginRight: 8,
borderRadius: Module712.radii.sm
},
gameDescriptionWrapperOuter: {
flexDirection: "row"
},
timestamp: {
marginBottom: 4
}
});
export default function MessageGameIconActionSheet(props) {
const { applicationId, messageTimestamp } = props;
const styles = useStyles();
const stateFromStores = useStateFromStores([ApplicationStore], () => ApplicationStore.getApplication(applicationId));
const r3 = stateFromStores == null;
let r30 = null;
if (!r3) {
let uri = stateFromStores == null ? void 0 : stateFromStores.getIconURL(56);
if (uri == null) {
uri = "";
}
r30 = <BottomSheet startExpanded>
<View style={styles.contentWrapper}>
<View style={styles.gameDescriptionWrapperOuter}>
<Icon style={styles.gameIcon} resizeMode="contain" source={{
uri
}} disableColor />
<View style={styles.gameDescriptionWrapper}>
<Text style={styles.timestamp} variant="text-xs/medium" color="text-muted">{messageTimestamp}</Text>
<Text variant="text-sm/medium">
{intl.format(t.J3s8JP, {
applicationName: stateFromStores.name
})}
{" "}
{intl.format(t.BPDKoA, {
helpdeskArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.SOCIAL_LAYER_CONNECTIONS)
})}
</Text>
</View>
</View>
</View>
</BottomSheet>;
}
return r30;
};
@@ -0,0 +1,207 @@
// Metro module 9495 (f9496).
import { useMemo } from "react";
import InviteStore from "../../../stores/InviteStore";
import SortedVoiceStateStore from "../../../stores/views/SortedVoiceStateStore";
import { ChannelTypes, GuildFeatures, InviteStates, MessageFlags } from "../../../Constants";
import { LinkType } from "../../applications/message_embed/MessageEmbedConstants";
import { InviteTypes } from "../../instant_invite/Constants";
import MessageViewTrackingManager, { MessageViewTrackingType } from "../MessageViewTrackingManager";
import { useIsGuildOfficialMessagesEnabled } from "../GuildOfficialMessageUtils";
import { CodedLinkType } from "../../coded_links/CodedLink";
import { getInviteType, getGuildInviteExtendedType, GuildInviteExtendedType } from "../../instant_invite/InviteTypeUtils";
import { getVoiceChannelListInviteExperiment } from "../VoiceChannelListInviteExperiment";
import { canShowVoiceChannelListInviteEmbed } from "./renderer/row_data/embeds/coded_links/invite/VoiceChannelListInviteEmbed";
import { getInviteInstanceId } from "../../instant_invite/InviteCodeUtils";
const getVoiceInviteEmbedRenderInfo = function getVoiceInviteEmbedRenderInfo(invite) {
if (invite.state !== InviteStates.RESOLVING && invite.state !== InviteStates.EXPIRED && invite.state !== InviteStates.BANNED && invite.state !== InviteStates.ERROR) {
if (getInviteType(invite) !== InviteTypes.GUILD) {
return null;
}
if (getGuildInviteExtendedType(invite) !== GuildInviteExtendedType.VOICE_CHANNEL) {
return null;
}
const id = invite.guild?.id;
return id == null ? null : {
treatmentRendered: getVoiceChannelListInviteExperiment({
guildId: id,
location: "mobile_invite_embed_impression"
}).enabled && canShowVoiceChannelListInviteEmbed(invite)
};
}
return null;
};
export function useShouldTrackAnnouncementMessageViews({ guild, channel, messages, isMessagesReady }) {
const r2 = guild == null;
let r9 = void 0;
if (!r2) {
const features = guild.features;
r9 = features == null ? void 0 : features.has(GuildFeatures.COMMUNITY);
}
if (r9 == null) {
r9 = false;
}
let c17246_3 = r9;
return useMemo(() => {
let r8 = channel.type === ChannelTypes.GUILD_ANNOUNCEMENT && c17246_3;
let r9 = isMessagesReady;
if (isMessagesReady) {
r9 = messages.some((message) => message.messageReference != null && message.webhookId != null && message.hasFlag(MessageFlags.IS_CROSSPOST) && channel.guild_id != null);
}
if (!r8) {
r8 = r9;
}
return r8;
}, [channel.type, channel.guild_id, r9, isMessagesReady, messages]);
}
export function useShouldTrackRichPresenceInviteEmbedViews({ messages: messages2, isMessagesReady: isMessagesReady2 }) {
return useMemo(() => {
let r1 = isMessagesReady2;
if (isMessagesReady2) {
r1 = messages2.some((item) => item.activity != null && item.activity.party_id != null && item.application != null);
}
return r1;
}, [messages2, isMessagesReady2]);
}
export function handleAnnouncementMessageViewTracking(a0, a1, a2, c17248_1) {
let c17248_2;
const guildId = a2;
if (a1 && a2 != null) {
const r4 = [];
c17248_2 = r4;
a0.forEach(({ message }) => {
const r14 = message.messageReference?.guild_id != null && message.webhookId != null && message.hasFlag(MessageFlags.IS_CROSSPOST);
L24: {
if (!message.hasFlag(MessageFlags.EPHEMERAL)) {
if (c17248_1.type !== ChannelTypes.GUILD_ANNOUNCEMENT && !r14) {
break L24;
}
c17248_2.push({
type: MessageViewTrackingType.ANNOUNCEMENT,
messageId: r14 && message.messageReference != null ? message.messageReference.message_id : message.id,
channelId: c17248_1.id,
guildId,
sourceChannelId: r14 && message.messageReference != null ? message.messageReference.channel_id : c17248_1.id,
sourceGuildId: r14 ? message.messageReference?.guild_id != null ? message.messageReference.guild_id : guildId : guildId
});
}
}
});
MessageViewTrackingManager.handleMessageListVisibilityChange(r4, MessageViewTrackingType.ANNOUNCEMENT);
}
}
export function handleRichPresenceInviteEmbedViewTracking(a0, a1, guildId2, c17249_1) {
let c17249_2;
if (a1) {
const r4 = [];
c17249_2 = r4;
a0.forEach(({ message }) => {
if (!(message.hasFlag(MessageFlags.EPHEMERAL) || message.activity == null || message.activity.party_id == null || message.application == null)) {
c17249_2.push({
type: MessageViewTrackingType.APP_EMBED,
messageId: message.id,
channelId: c17249_1.id,
guildId: guildId2,
applicationId: message.application.id,
linkType: LinkType.RICH_PRESENCE_INVITE
});
}
});
MessageViewTrackingManager.handleMessageListVisibilityChange(r4, MessageViewTrackingType.APP_EMBED);
}
}
export function useShouldTrackOfficialMessageViews({ guild, messages: messages3, isMessagesReady: isMessagesReady3 }) {
let r14 = guild?.id;
if (r14 == null) {
r14 = null;
}
const isGuildOfficialMessagesEnabled = useIsGuildOfficialMessagesEnabled(r14, "useShouldTrackOfficialMessageViews");
return useMemo(() => {
let r0 = isGuildOfficialMessagesEnabled;
if (isGuildOfficialMessagesEnabled) {
r0 = isMessagesReady3;
}
if (r0) {
r0 = messages3.some((item) => item.hasFlag(MessageFlags.IS_GUILD_OFFICIAL));
}
return r0;
}, [isGuildOfficialMessagesEnabled, isMessagesReady3, messages3]);
}
export function handleOfficialMessageViewTracking(a0, a1, a2, c17251_1) {
let c17251_2;
const guildId3 = a2;
if (a1 && a2 != null) {
const r4 = [];
c17251_2 = r4;
a0.forEach(({ message }) => {
const hasFlag = message.hasFlag(MessageFlags.EPHEMERAL);
if (hasFlag ? !hasFlag : message.hasFlag(MessageFlags.IS_GUILD_OFFICIAL)) {
c17251_2.push({
type: MessageViewTrackingType.OFFICIAL_MESSAGE,
messageId: message.id,
channelId: c17251_1.id,
guildId: guildId3
});
}
});
MessageViewTrackingManager.handleMessageListVisibilityChange(r4, MessageViewTrackingType.OFFICIAL_MESSAGE);
}
}
export function useShouldTrackVoiceInviteEmbedViews({ messages: messages4, isMessagesReady: isMessagesReady4 }) {
return useMemo(() => {
let r0 = isMessagesReady4;
if (isMessagesReady4) {
r0 = messages4.some((item) => item.codedLinks.some((codedLink) => codedLink.type === CodedLinkType.INVITE));
}
return r0;
}, [messages4, isMessagesReady4]);
}
export function handleVoiceInviteEmbedViewTracking(a0, a1, guildId4, c17253_1) {
let c17253_2;
if (a1) {
const r4 = [];
c17253_2 = r4;
a0.forEach(({ message }) => {
if (!message.hasFlag(MessageFlags.EPHEMERAL)) {
for (const codedLink of message.codedLinks) {
const r41 = codedLink;
if (codedLink.type === CodedLinkType.INVITE) {
const invite = InviteStore.getInvite(r41.code);
if (invite != null) {
const voiceInviteEmbedRenderInfo = getVoiceInviteEmbedRenderInfo(invite);
if (voiceInviteEmbedRenderInfo != null) {
let r59 = invite.channel?.id;
if (r59 == null) {
r59 = null;
}
const inviteChannelId = r59;
let r64 = invite.guild?.id;
if (r64 == null) {
r64 = null;
}
const inviteGuildId = r64;
const hasActiveStream = inviteChannelId != null && inviteGuildId != null && SortedVoiceStateStore.getVoiceStatesForChannelAlt(inviteChannelId, inviteGuildId).some((item) => item.voiceState.selfStream);
let inviteInstanceId = getInviteInstanceId(r41.code, message.id);
if (inviteInstanceId == null) {
inviteInstanceId = null;
}
c17253_2.push({
type: MessageViewTrackingType.VOICE_INVITE_EMBED,
messageId: message.id,
channelId: c17253_1.id,
guildId: guildId4,
inviteCode: r41.code,
inviteGuildId,
inviteChannelId,
inviteInstanceId,
treatmentRendered: voiceInviteEmbedRenderInfo.treatmentRendered,
hasActiveStream
});
}
}
}
}
}
});
MessageViewTrackingManager.handleMessageListVisibilityChange(r4, MessageViewTrackingType.VOICE_INVITE_EMBED);
}
}
@@ -0,0 +1,65 @@
// Metro module 16656 (f16657).
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import SelectedGuildStore from "../../../stores/SelectedGuildStore";
import UserStore from "../../../stores/UserStore";
import AppStateStore from "../../../stores/native/AppStateStore";
import { InAppNotificationTypes, MessageStates } from "../../../Constants";
import { LocalNotificationTypes } from "../../local_push_notification/native/Constants";
import InAppNotificationActionCreators from "../../../actions/native/InAppNotificationActionCreators";
import { generateInAppNotificationId } from "../../in_app_notifications/native/InAppNotificationUtils";
import PushNotification from "../../../lib/pushnotification/PushNotification";
import { intl, t } from "../../../intl/index.native";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
let handleMessageCreate;
const handleMessageSendFailure = function handleMessageSendFailure(a0) {
const { channelId, messageId } = a0;
if (a0.shouldNotify) {
if (AppStateStore.getState() !== "active") {
PushNotification.presentLocalNotification({
category: "local",
alertTitle: intl.string(t.LdlH2M),
alertBody: intl.string(t.xxRPOT),
userInfo: {
channelId,
messageId,
type: LocalNotificationTypes.MESSAGE_SEND_FAILED
}
});
} else {
if (channelId === SelectedChannelStore.getChannelId(SelectedGuildStore.getGuildId())) {
return void 0;
}
InAppNotificationActionCreators.enqueueNotification({
type: InAppNotificationTypes.MESSAGE_FAILED_TO_SEND,
channelId,
messageId,
key: channelId + "-" + messageId,
duration: 5000,
onDismiss: () => {
InAppNotificationActionCreators.clearNotification();
},
inAppNotificationId: generateInAppNotificationId()
});
}
}
};
handleMessageCreate = function handleMessageCreate(a0) {
const message = a0.message;
if (a0.sendMessageOptions?.isHydratingExpiredPendingMessage && message.state === MessageStates.SEND_FAILED && UserStore.getCurrentUser()?.id === message.author?.id) {
setTimeout(() => {
handleMessageSendFailure({
channelId: message.channel_id,
messageId: message.id,
shouldNotify: true
});
}, 3000);
}
};
class MessageSendFailureNotificationManager extends AutomaticLifecycleManager {
actions = {
MESSAGE_CREATE: handleMessageCreate,
MESSAGE_SEND_FAILED: handleMessageSendFailure
};
}
const messageSendFailureNotificationManager = new MessageSendFailureNotificationManager();
export default messageSendFailureNotificationManager;
+401
View File
@@ -0,0 +1,401 @@
// Metro module 10467 (f10468).
import { forwardRef, useMemo, useRef, useEffect } from "react";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import EmbeddedActivitiesStore from "../../activities/EmbeddedActivitiesStore";
import ApplicationAssetsStore from "../../applications/ApplicationAssetsStore";
import ApplicationStore from "../../applications/ApplicationStore";
import BuildOverrideStore from "../../build_overrides/BuildOverrideStore";
import CacheStore from "../../cache/CacheStore";
import ChannelRTCStore from "../../calls/ChannelRTCStore";
import VoiceChannelStartTimeStore from "../../channel/VoiceChannelStartTimeStore";
import EmojiStore from "../../emojis/EmojiStore";
import ExperimentStore from "../../experiments/ExperimentStore";
import ExplicitMediaStore from "../../explicit_media_redaction/ExplicitMediaStore";
import ApplicationDirectoryApplicationsStore from "../../global_discovery_apps/stores/ApplicationDirectoryApplicationsStore";
import BasicGuildStore from "../../guild/BasicGuildStore";
import GuildAutomodMessageStore from "../../guild_automod/GuildAutomodMessageStore";
import GuildScheduledEventStore from "../../guild_scheduled_events/GuildScheduledEventStore";
import GuildTemplateStore from "../../guild_templates/GuildTemplateStore";
import LocalInteractionComponentStateStore from "../../interaction_components/LocalInteractionComponentStateStore";
import InteractionStore from "../../interactions/InteractionStore";
import MediaPostEmbedStore from "../../media_channel/MediaPostEmbedStore";
import MediaPostSharePromptStore from "../../media_channel/MediaPostSharePromptStore";
import AuthorizedAppsStore from "../../oauth2/AuthorizedAppsStore";
import FamilyCenterPendingConnectionStore from "../../parent_tools/FamilyCenterPendingConnectionStore";
import { useChannelPollInteractions, useMessagePollInteractions } from "../../polls/PollsInteractionStore";
import ReferralTrialStore from "../../premium/ReferralTrialStore";
import PushFeedbackStore from "../../push_feedback/PushFeedbackStore";
import PendingReplyStore from "../../replies/PendingReplyStore";
import ReferencedMessageStore from "../../replies/ReferencedMessageStore";
import SummaryStore from "../../summaries/SummaryStore";
import JoinedThreadsStore from "../../threads/JoinedThreadsStore";
import ThreadMessageStore from "../../threads/ThreadMessageStore";
import LocaleStore from "../../user_settings/LocaleStore";
import ThemeStore from "../../user_settings/ThemeStore";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import ChannelStore from "../../../stores/ChannelStore";
import EditMessageStore from "../../../stores/EditMessageStore";
import GiftCodeStore from "../../../stores/GiftCodeStore";
import GuildMemberStore from "../../../stores/GuildMemberStore";
import GuildStore from "../../../stores/GuildStore";
import GuildVerificationStore from "../../../stores/GuildVerificationStore";
import InviteStore from "../../../stores/InviteStore";
import MessageStore from "../../../stores/MessageStore";
import PermissionStore from "../../../stores/PermissionStore";
import PresenceStore from "../../../stores/PresenceStore";
import RTCConnectionStore from "../../../stores/RTCConnectionStore";
import ReadStateStore from "../../../stores/ReadStateStore";
import SessionsStore from "../../../stores/SessionsStore";
import UploadStore from "../../../stores/UploadStore";
import UserStore from "../../../stores/UserStore";
import VoiceStateStore from "../../../stores/VoiceStateStore";
import SKUStore from "../../../stores/game_store/SKUStore";
import ActivityLauncherStore from "../../../stores/views/ActivityLauncherStore";
import SortedVoiceStateStore from "../../../stores/views/SortedVoiceStateStore";
import { ActivityActionTypes, ChannelTypesSets, ME, MessageTypes, Permissions } from "../../../Constants";
import { PREMIUM_TIER_2_REFERRAL_TRIAL_ID, PremiumTypes } from "../../premium/PremiumConstants";
import { useStateFromStores, useStateFromStoresObject, useStateFromStoresArray } from "../../../_bundle/Module589";
import Module12 from "../../../_bundle/Module12";
import { areArraysShallowEqual } from "../../../_bundle/shallowEqual";
import ApplicationActionCreators from "../../applications/ApplicationActionCreators";
import { isNotNullish } from "../../../utils/GlobalUtils";
import { InlineAttachmentMedia, InlineEmbedMedia, RenderEmbeds, RenderReactions, DeveloperMode, AnimateEmoji, AnimateStickers, GifAutoPlay, TimestampHourCycle } from "../../user_settings/UserSettings";
import MobileVisualRefreshExperiment from "../../themes/experiments/MobileVisualRefreshExperiment";
import { useIsMessageSwipeActionsEnabled } from "../../../experiments/SwipeToReplyExperiment";
import useSubscribeMissingActivities from "../../activities/useSubscribeMissingActivities";
import { useFetchVoiceChannelInviteStartTimes } from "./MessagesHooks";
import { useCodedLinksExperimentEmbeds } from "../../experiments/client_override_hooks/useCodedLinksExperimentEmbeds";
import { useQuests } from "../../quests/hooks/QuestHooks";
import { useTrialOffer } from "../../premium/useTrialOffer";
import PremiumUtils from "../../../utils/PremiumUtils";
import useIsCallActive from "../../calls/mobile/useIsCallActive";
import { isVersionEqual } from "../../../utils/SecondaryIndexMapUtils";
import { useIsSpamMessageRequest } from "../../message_request/hooks/useIsSpamMessageRequest";
import { useIsMessageRequest } from "../../message_request/hooks/useIsMessageRequest";
import { useCurrentUserCommunicationDisabled } from "../../guild_communication_disabled/useUserCommunicationDisabled";
import { useIsPaymentsBlocked } from "../../billing/experiments/BlockedPaymentsCountryExperiment";
import { useMessageJumpAndroidKeyboardHeight } from "../../../components_native/chat/getMessageJumpData";
import useKeyboardType from "../../keyboard/native/useKeyboardType";
import { useChannelSummariesExperiment } from "../../../experiments/ChannelSummariesExperiment";
import DimensionActionCreators from "../../../actions/DimensionActionCreators";
import { useShouldTrackAnnouncementMessageViews, useShouldTrackRichPresenceInviteEmbedViews, useShouldTrackOfficialMessageViews, useShouldTrackVoiceInviteEmbedViews } from "./MessageImpressionAnalyticsHelpers";
import { useShouldDisplaySpoilerObscurity } from "../computeGlobalSpoilerDisplay";
import { useIsAgeVerified } from "../../age_assurance/AgeVerificationUtils";
import MessageViewTrackingManager from "../MessageViewTrackingManager";
import { useShouldDisableInteractiveComponents } from "../../interaction_components/ComponentStateContext";
import useChatWidth from "../../chat/native/useChatWidth";
import useLoadMessageContentEntries from "../../interaction_components/content_inventory_entry/native/useLoadMessageContentEntries";
import { useColorStore } from "../../avatar/useAvatarColor";
import { getVoiceStateChannelSummaryFromVoiceStates } from "./MessagesUtils";
import { isVoiceChannelInvite } from "../../instant_invite/InviteTypeUtils";
import { useFetchSocialLayerStorefrontProductDetailsEmbedData } from "../../slayer_storefront/native/createSocialLayerStorefrontProductDetailsEmbed";
import StartupProfiler, { Profiles } from "../../app_startup/StartupProfiler";
import ThemedGradient from "../../client_themes/native/ThemedGradient";
import MessagesRenderer from "./MessagesRenderer";
const r140 = forwardRef((a0, a1) => {
let id, guildId, stateFromStores2, stateFromStores3, c17979_6, channelSummariesExperiment, c17979_8, stateFromStoresArray;
const channel = a0.channel;
const stateFromStores = useStateFromStores([MessageStore], () => MessageStore.getMessages(channel.id), [channel.id]);
id = channel.id;
guildId = channel.getGuildId();
stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
const systemChannelFlags = stateFromStores2?.systemChannelFlags;
let stateFromStores4, memo;
stateFromStores3 = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId(), []);
const setting5 = InlineAttachmentMedia.useSetting();
const setting4 = InlineEmbedMedia.useSetting();
const setting3 = RenderEmbeds.useSetting();
const setting2 = RenderReactions.useSetting();
const setting = DeveloperMode.useSetting();
const setting9 = AnimateEmoji.useSetting();
const setting8 = AnimateStickers.useSetting();
const setting7 = GifAutoPlay.useSetting();
const setting6 = TimestampHourCycle.useSetting();
const stateFromStores38 = useStateFromStores([ThemeStore], () => ThemeStore.theme, []);
const isVisualRefreshEnabled = MobileVisualRefreshExperiment("Messages");
const isMessageSwipeActionsEnabled = useIsMessageSwipeActionsEnabled();
stateFromStores4 = stateFromStores;
memo = void 0;
memo = useMemo(() => {
const r0 = {};
let c30220_0 = r0;
stateFromStores4.forEach((item) => {
if (item.author != null && item.activity != null) {
c30220_0[item.author.id] = null;
}
});
return r0;
}, [stateFromStores]);
const stateFromStoresObject3 = useStateFromStoresObject([PresenceStore], () => Module12.mapValues(memo, (a0, a1) => PresenceStore.getPrimaryActivity(a1)), [memo]);
const application_id2 = channel.linkedLobby?.application_id;
let ref;
const stateFromStores5 = stateFromStores;
const application_id = application_id2;
const memo2 = useMemo(() => {
const set = new Set();
let c30221_0 = set;
stateFromStores5.forEach((item) => {
if (item.applicationId != null && item.application == null) {
c30221_0.add(item.applicationId);
}
});
if (application_id != null) {
set.add(application_id);
}
return Array.from(set);
}, [stateFromStores, application_id]);
ref = useRef([]);
useEffect(() => {
if (!areArraysShallowEqual(memo2, ref.current)) {
ApplicationActionCreators.fetchApplications(Module12(memo2).filter(isNotNullish).uniq().value(), false);
ref.current = memo2;
}
}, [memo2]);
const [activityInviteMessageIds, ] = useSubscribeMissingActivities(stateFromStores, channel);
const stateFromStores36 = useStateFromStores([InviteStore], () => InviteStore.getInvites(), []);
useFetchVoiceChannelInviteStartTimes(stateFromStores36);
const stateFromStoresObject4 = useStateFromStoresObject([ApplicationDirectoryApplicationsStore], () => ({
appDirectoryEmbedApplications: ApplicationDirectoryApplicationsStore.getApplications(),
invalidAppDirectoryEmbedApplicationIds: ApplicationDirectoryApplicationsStore.getInvalidApplicationIds(),
appDirectoryEmbedApplicationFetchStates: ApplicationDirectoryApplicationsStore.getApplicationFetchStates()
}), []);
const { appDirectoryEmbedApplications, invalidAppDirectoryEmbedApplicationIds, appDirectoryEmbedApplicationFetchStates } = stateFromStoresObject4;
const stateFromStoresArray9 = useStateFromStoresArray([ApplicationStore], () => ApplicationStore.getFetchingOrFailedFetchingIds());
const stateFromStoresArray8 = useStateFromStoresArray([ApplicationAssetsStore], () => ApplicationAssetsStore.getFetchingIds());
const stateFromStoresArray3 = useStateFromStoresArray([SKUStore], () => SKUStore.getFetchingSkuIds());
const stateFromStoresArray6 = useStateFromStoresArray([EmbeddedActivitiesStore], () => EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(id).map((item) => item.launchId).filter(isNotNullish), [id]);
const stateFromStoresArray4 = useStateFromStoresArray([EmbeddedActivitiesStore, PresenceStore], () => {
const r0 = [];
let c26674_0 = r0;
const embeddedActivitiesForChannel = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(id);
const _loop = function _loop(a0) {
let c30222_0 = a0;
const r16 = PresenceStore.findActivity(a0.userIds.values().next().value, (a0) => a0.application_id === c30222_0.applicationId);
if (r16?.details != null) {
c26674_0.push(`${a0.launchId}:${r16.details}`);
}
};
for (const item of embeddedActivitiesForChannel) {
_loop(item);
}
return r0;
});
const stateFromStoresArray5 = useStateFromStoresArray([EmbeddedActivitiesStore], () => {
const set = new Set();
let c26675_0 = set;
EmbeddedActivitiesStore.getEmbeddedActivitiesByChannel().forEach((a0, c30223_0) => {
a0.forEach((item) => {
item.userIds.forEach((userId) => {
c26675_0.add(`${c30223_0}:${userId}`);
});
});
});
return Array.from(set);
});
const stateFromStoresArray7 = useStateFromStoresArray([EmbeddedActivitiesStore], () => {
const launchStates = EmbeddedActivitiesStore.getLaunchStates();
const r24 = [];
for (const item of launchStates) {
const [, r31] = item;
if (r31.isLaunching && r31.componentId != null && r31.componentId.length > 0) {
r24.push(r31.componentId);
}
}
return r24;
});
const stateFromStores35 = useStateFromStores([MediaPostEmbedStore], () => MediaPostEmbedStore.getMediaPostEmbeds());
const stateFromStores34 = useStateFromStores([GuildTemplateStore], () => GuildTemplateStore.getGuildTemplates(), []);
const stateFromStores33 = useStateFromStores([BuildOverrideStore], () => BuildOverrideStore.getBuildOverrides(), []);
const codedLinksExperimentEmbeds = useCodedLinksExperimentEmbeds();
const quests2 = useQuests({
fetchPolicy: "cache-or-network",
callerSource: "messages_native"
});
const { quests, isFetchingCurrentQuests } = quests2;
c17979_6 = stateFromStores.filter((stateFromStore) => stateFromStore.type === MessageTypes.PREMIUM_REFERRAL).map((item) => item.referralTrialOfferId).filter(isNotNullish);
const stateFromStoresArray2 = useStateFromStoresArray([ReferralTrialStore], () => c17979_6.map((item) => ReferralTrialStore.getRelevantUserTrialOffer(item)?.id).filter(isNotNullish));
const trialOffer = useTrialOffer(PREMIUM_TIER_2_REFERRAL_TRIAL_ID);
const stateFromStores6 = useStateFromStores([UserStore], () => PremiumUtils.isPremiumExactly(UserStore.getCurrentUser(), PremiumTypes.TIER_2));
const stateFromStores32 = useStateFromStores([EditMessageStore], () => EditMessageStore.getEditingMessageId(id), [id]);
const stateFromStores31 = useStateFromStores([PendingReplyStore], () => {
const pendingReply = PendingReplyStore.getPendingReply(id);
return pendingReply == null ? void 0 : pendingReply.message.id;
}, [id]);
const stateFromStores30 = useStateFromStores([ReadStateStore], () => ReadStateStore.getOldestUnreadMessageId(id), [id]);
const stateFromStores29 = useStateFromStores([GuildVerificationStore], () => guildId != null && GuildVerificationStore.canChatInGuild(guildId), [guildId]);
const stateFromStores28 = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.SEND_MESSAGES, channel), [channel]);
const isCallActive = useIsCallActive(id);
const stateFromStores27 = useStateFromStores([VoiceStateStore], () => VoiceStateStore.getUserVoiceChannelId(ME, stateFromStores3), [stateFromStores3]);
const stateFromStores26 = useStateFromStores([RTCConnectionStore], () => RTCConnectionStore.getChannelId(), []);
const stateFromStores7 = useStateFromStores([ReferencedMessageStore], () => ChannelTypesSets.THREADS.has(channel.type) ? channel.parent_id != null ? ReferencedMessageStore.getMessageByReference({
channel_id: channel.parent_id,
message_id: channel.id,
guild_id: channel.guild_id
}).message : null : null, [channel]);
const stateFromStoresObject5 = useStateFromStoresObject([GiftCodeStore], () => ({
resolvingGiftCodes: GiftCodeStore.getResolvingCodes(),
resolvedGiftCodes: GiftCodeStore.getResolvedCodes(),
acceptingGiftCodes: GiftCodeStore.getAcceptingCodes()
}), []);
const { resolvingGiftCodes, resolvedGiftCodes, acceptingGiftCodes } = stateFromStoresObject5;
const stateFromStores24 = useStateFromStores([ChannelRTCStore], () => ChannelRTCStore.getParticipants(id).length, [id]);
const stateFromStores23 = useStateFromStores([UploadStore], () => UploadStore.getFiles(id), [id]);
const stateFromStores22 = useStateFromStores([ReferencedMessageStore], () => ReferencedMessageStore.getReplyIdsForChannel(id), [id]);
const stateFromStoresObject6 = useStateFromStoresObject([AccessibilityStore], () => ({
useReducedMotion: AccessibilityStore.useReducedMotion,
roleStyle: AccessibilityStore.roleStyle,
officialMessageStyle: AccessibilityStore.officialMessageStyle,
saturation: AccessibilityStore.saturation,
displayNameStylesEnabled: AccessibilityStore.displayNameStylesEnabled
}), []);
const { useReducedMotion, roleStyle, officialMessageStyle, saturation, displayNameStylesEnabled } = stateFromStoresObject6;
const stateFromStores21 = useStateFromStores([ThreadMessageStore], () => ThreadMessageStore.getChannelThreadsVersion(id), [id]);
const stateFromStoresObject = useStateFromStoresObject([InteractionStore], () => InteractionStore.getMessageInteractionStates());
const [interactionComponentStates, interactionComponentStatesVersion] = useStateFromStores([LocalInteractionComponentStateStore], () => [LocalInteractionComponentStateStore.getInteractionComponentStates(), LocalInteractionComponentStateStore.getInteractionComponentStateVersion()], [], isVersionEqual);
let hasLoadedExperiments = useStateFromStores([ExperimentStore], () => ExperimentStore.hasLoadedExperiments);
const isSpamMessageRequest = useIsSpamMessageRequest(channel.id);
const isMessageRequest = useIsMessageRequest(channel.id);
const isMessagesReady = stateFromStores != null && (stateFromStores.ready || stateFromStores.cached);
const isMessagesCached = stateFromStores != null && stateFromStores.cached;
const isMessagesAckable = stateFromStores != null && stateFromStores.ready && !stateFromStores.loadingMore;
const stateFromStores20 = useStateFromStores([GuildScheduledEventStore], () => GuildScheduledEventStore.getRsvpVersion());
const stateFromStores19 = useStateFromStores([GuildAutomodMessageStore], () => GuildAutomodMessageStore.getMessagesVersion());
const stateFromStores18 = useStateFromStores([GuildMemberStore], () => GuildMemberStore.getCommunicationDisabledVersion());
const stateFromStoresObject2 = useStateFromStoresObject([GuildMemberStore], () => {
if (guildId != null && stateFromStores != null) {
const r6 = {};
let c26676_0 = r6;
stateFromStores.forEach((stateFromStore) => {
if (stateFromStore.author?.id != null) {
const member = GuildMemberStore.getMember(guildId, stateFromStore.author.id);
if (member != null) {
c26676_0[stateFromStore.author.id] = member;
}
}
});
return r6;
}
return {};
}, [guildId, stateFromStores]);
const stateFromStores16 = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.MODERATE_MEMBERS, stateFromStores2));
const [, currentUserCommunicationDisabled] = useCurrentUserCommunicationDisabled(stateFromStores2?.id);
const stateFromStores15 = useStateFromStores([LocaleStore], () => LocaleStore.locale);
const isPaymentsBlocked = useIsPaymentsBlocked();
const stateFromStores14 = useStateFromStores([JoinedThreadsStore], () => !!channel.isForumPost() && JoinedThreadsStore.hasJoined(id));
const stateFromStores13 = useStateFromStores([MediaPostSharePromptStore], () => MediaPostSharePromptStore.shouldDisplayPrompt(id));
const stateFromStores11 = useStateFromStores([PushFeedbackStore], () => PushFeedbackStore.isEligible());
const stateFromStores12 = useStateFromStores([CacheStore], () => CacheStore.getLazyCacheStatus());
const messageJumpAndroidKeyboardHeight = useMessageJumpAndroidKeyboardHeight();
const keyboardType = useKeyboardType();
channelSummariesExperiment = useChannelSummariesExperiment(channel);
const stateFromStores10 = useStateFromStores([SummaryStore], () => channelSummariesExperiment ? SummaryStore.selectedSummary(channel.id) : null, [channelSummariesExperiment, channel.id]);
useEffect(() => {
const ready = stateFromStores.ready;
if (!((ready ? stateFromStores.length !== 0 : !ready) || stateFromStores.hasMoreBefore || stateFromStores.hasMoreAfter)) {
DimensionActionCreators.updateChannelDimensions(channel.id, Date.now(), 1, 1, 0);
}
}, [channel.id, stateFromStores.hasMoreAfter, stateFromStores.hasMoreBefore, stateFromStores.length, stateFromStores.ready]);
const shouldTrackAnnouncementMessageViews = useShouldTrackAnnouncementMessageViews({
guild: stateFromStores2,
channel,
messages: stateFromStores,
isMessagesReady
});
const shouldTrackRichPresenceInviteEmbedViews = useShouldTrackRichPresenceInviteEmbedViews({
messages: stateFromStores,
isMessagesReady
});
const shouldTrackOfficialMessageViews = useShouldTrackOfficialMessageViews({
guild: stateFromStores2,
messages: stateFromStores,
isMessagesReady
});
const shouldTrackVoiceInviteEmbedViews = useShouldTrackVoiceInviteEmbedViews({
messages: stateFromStores,
isMessagesReady
});
const shouldDisplaySpoilerObscurity = useShouldDisplaySpoilerObscurity(channel);
const isAgeVerified = useIsAgeVerified();
useEffect(() => {
MessageViewTrackingManager.handleChannelSelect();
return () => {
MessageViewTrackingManager.handleChannelSelect();
};
}, [id, guildId]);
const shouldDisableInteractiveComponents = useShouldDisableInteractiveComponents(channel.id);
const channelPollInteractions = useChannelPollInteractions(channel.id);
const r596 = [];
c17979_8 = r596;
stateFromStores.forEach((stateFromStore) => {
const message_id = stateFromStore.messageReference?.message_id;
if (message_id != null) {
c17979_8.push(message_id);
}
});
const messagePollInteractions = useMessagePollInteractions(r596);
const stateFromStores9 = useStateFromStores([ExplicitMediaStore], () => ExplicitMediaStore.getChannelFpInfo(id), [id]);
const stateFromStores8 = useStateFromStores([FamilyCenterPendingConnectionStore], () => FamilyCenterPendingConnectionStore.getPendingConnection());
const chatWidth = useChatWidth();
const loadMessageContentEntries = useLoadMessageContentEntries(stateFromStores);
const { unloadedContentEntryMessageIds, unloadableContentEntryMessageIds } = loadMessageContentEntries;
const stateFromStores37 = useStateFromStores([UserStore], () => {
const currentUser = UserStore.getCurrentUser();
let r6 = currentUser == null ? void 0 : currentUser.isStaff();
if (r6 == null) {
r6 = false;
}
return r6;
});
const stateFromStores17 = useStateFromStores([BasicGuildStore], () => BasicGuildStore.getVersion());
const colorStore = useColorStore((a0) => Object.keys(a0.palette).length);
const stateFromStores39 = useStateFromStores([EmojiStore], () => EmojiStore.getGuildEmoji(guildId));
const stateFromStores25 = useStateFromStores([VoiceStateStore], () => {
if (guildId == null) {
return null;
}
return getVoiceStateChannelSummaryFromVoiceStates(VoiceStateStore.getVoiceStates(guildId));
}, [guildId]);
const stateFromStoresObject7 = useStateFromStoresObject([SortedVoiceStateStore, VoiceChannelStartTimeStore, InviteStore, ChannelStore], () => {
const r0 = {};
for (const item of InviteStore.getInvites().values()) {
if (item.channel?.id != null && isVoiceChannelInvite(item)) {
const id3 = item.channel.id;
const id2 = item.guild?.id;
const r61 = SortedVoiceStateStore.getVoiceStatesForChannelAlt(id3, id2).map((item) => `${item.voiceState.selfStream ? "*" : ""}${item.user.id}`).join(",");
let r65 = VoiceChannelStartTimeStore.getStartTime(ChannelStore.getChannel(id3));
if (r65 == null) {
r65 = "";
}
r0[id3] = `${r61}:${r65}`;
}
}
return r0;
});
stateFromStoresArray = useStateFromStoresArray([SessionsStore], () => [...SessionsStore.getRemoteActivities(), ...SessionsStore.getHiddenActivities()].filter(isNotNullish));
const stateFromStoresObject8 = useStateFromStoresObject([ActivityLauncherStore], () => stateFromStoresArray.reduce((acc, item) => {
if (item.application_id == null) {
return acc;
}
const state = ActivityLauncherStore.getState(item.application_id, ActivityActionTypes.JOIN);
if (state != null) {
acc[item.application_id] = state;
}
return acc;
}, {}));
const stateFromStoresArray10 = useStateFromStoresArray([AuthorizedAppsStore], () => [AuthorizedAppsStore.getNewestTokens(), AuthorizedAppsStore.getApplicationFetchStateVersion()], []);
const stateFromStores40 = useStateFromStores([UserStore], () => UserStore.getCurrentUser()?.displayNameStyles);
useFetchSocialLayerStorefrontProductDetailsEmbedData(stateFromStores);
const r704 = [channel.isThread() && <ThemedGradient absolute />, ,];
if (hasLoadedExperiments) {
hasLoadedExperiments = isMessagesReady;
}
const id2 = trialOffer?.id;
let officialMessageColor = stateFromStores2?.officialMessageColor;
if (officialMessageColor == null) {
officialMessageColor = void 0;
}
r704[1] = <MessagesRenderer ref={a1} theme={stateFromStores38} saturation={saturation} isVisualRefreshEnabled={isVisualRefreshEnabled} isStaff={stateFromStores37} animateEmoji={setting9} animateStickers={setting8} containerWidth={chatWidth} gifAutoPlay={setting7} timestampHourCycle={setting6} inlineAttachmentMedia={setting5} inlineEmbedMedia={setting4} renderEmbeds={setting3} renderReactions={setting2} developerMode={setting} roleStyle={roleStyle} officialMessageStyle={officialMessageStyle} guildId={guildId} currentUserId={stateFromStores3} channelId={id} isMessagesReady={isMessagesReady} isMessagesCached={isMessagesCached} isMessagesAckable={isMessagesAckable} isMessageRequest={isMessageRequest} isSpamMessageRequest={isSpamMessageRequest} messageAuthorActivities={stateFromStoresObject3} invites={stateFromStores36} appDirectoryEmbedApplications={appDirectoryEmbedApplications} invalidAppDirectoryEmbedApplicationIds={invalidAppDirectoryEmbedApplicationIds} invalidApplicationIds={stateFromStoresArray9} applicationAssetFetchingIds={stateFromStoresArray8} messages={stateFromStores} messagesWithActivitiesLaunching={stateFromStoresArray7} activityInstanceIds={stateFromStoresArray6} activityParticipants={stateFromStoresArray5} activityInstancePresenceDetails={stateFromStoresArray4} appDirectoryEmbedApplicationFetchStates={appDirectoryEmbedApplicationFetchStates} mediaPostPreviewEmbeds={stateFromStores35} guildTemplates={stateFromStores34} buildOverrides={stateFromStores33} fetchingSkuIds={stateFromStoresArray3} experimentEmbeds={codedLinksExperimentEmbeds} quests={quests} isFetchingCurrentQuests={isFetchingCurrentQuests} editingMessageId={stateFromStores32} replyingMessageId={stateFromStores31} oldestUnreadMessageId={stateFromStores30} canChat={stateFromStores29} canSendMessages={stateFromStores28} isCallActive={isCallActive} voiceStatePrivateChannelId={stateFromStores27} currentClientVoiceChannelId={stateFromStores26} voiceStateChannelIdSummaryForGuild={stateFromStores25} resolvingGiftCodes={resolvingGiftCodes} resolvedGiftCodes={resolvedGiftCodes} acceptingGiftCodes={acceptingGiftCodes} participantsLength={stateFromStores24} uploads={stateFromStores23} repliedIds={stateFromStores22} useReducedMotion={useReducedMotion} displayNameStylesEnabled={displayNameStylesEnabled} channelThreadsVersion={stateFromStores21} rsvpVersion={stateFromStores20} failedMessagesVersion={stateFromStores19} communicationDisabledVersion={stateFromStores18} messageAuthorMembers={stateFromStoresObject2} forwardGuildsVersion={stateFromStores17} interactionStates={stateFromStoresObject} interactionComponentStates={interactionComponentStates} interactionComponentStatesVersion={interactionComponentStatesVersion} hasLoadedExperiments={hasLoadedExperiments} guildSystemChannelFlags={systemChannelFlags} currentUserCommunicationDisabled={currentUserCommunicationDisabled} renderCommunicationDisabled={stateFromStores16} userSettingsLocale={stateFromStores15} paymentsBlocked={isPaymentsBlocked} isFollowingForumPost={stateFromStores14} showMediaPostSharePrompt={stateFromStores13} showPushFeedback={stateFromStores11} cacheStoreLoaded={stateFromStores12 !== "initializing"} androidKeyboardHeight={messageJumpAndroidKeyboardHeight} selectedSummary={stateFromStores10} keyboardType={keyboardType} shouldTrackAnnouncementMessageViews={shouldTrackAnnouncementMessageViews} shouldTrackRichPresenceInviteEmbedViews={shouldTrackRichPresenceInviteEmbedViews} shouldTrackOfficialMessageViews={shouldTrackOfficialMessageViews} shouldTrackVoiceInviteEmbedViews={shouldTrackVoiceInviteEmbedViews} shouldObscureSpoiler={shouldDisplaySpoilerObscurity} shouldDisableInteractiveComponents={shouldDisableInteractiveComponents} channelPolls={channelPollInteractions} messageReferencePolls={messagePollInteractions} explicitMediaFalsePositiveInfo={stateFromStores9} familyCenterPendingConnection={stateFromStores8} threadStartingReferenceMessage={stateFromStores7} unloadedContentEntryMessageIds={unloadedContentEntryMessageIds} unloadableContentEntryMessageIds={unloadableContentEntryMessageIds} resolvedReferralTrialOfferIds={stateFromStoresArray2} referralTrialOfferId={id2} isPremiumTier2User={stateFromStores6} activityInviteMessageIds={activityInviteMessageIds} guildInviteColorsFetched={colorStore} isAgeVerified={isAgeVerified} guildEmojis={stateFromStores39} enableSwipeActions={isMessageSwipeActionsEnabled} selfActivities={stateFromStoresArray} activityLaunchJoinStates={stateFromStoresObject8} authorizedAppsTokens={stateFromStoresArray10} currentUserDisplayNameStyles={stateFromStores40} voiceInviteDataByChannelId={stateFromStoresObject7} officialMessageColor={officialMessageColor} {...a0} />;
return <StartupProfiler profile={Profiles.Messages}>{r704}</StartupProfiler>;
});
r140.displayName = "MessagesConnected";
export default r140;
File diff suppressed because it is too large. Load diff
+130
View File
@@ -0,0 +1,130 @@
// Metro module 10485 (f10486).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { useMemo, useRef, useEffect, useState, useCallback } from "react";
import { findNodeHandle } from "react-native";
import VoiceChannelStartTimeStore from "../../channel/VoiceChannelStartTimeStore";
import { updateShouldShowJumpToPresentButton } from "../../chat_input/native/useChatBottomManagerUIStore";
import GuildAvailabilityStore from "../../../stores/GuildAvailabilityStore";
import GuildStore from "../../../stores/GuildStore";
import PresenceStore from "../../../stores/PresenceStore";
import { useStateFromStoresObject } from "../../../_bundle/Module589";
import Module12 from "../../../_bundle/Module12";
import { areArraysShallowEqual } from "../../../_bundle/shallowEqual";
import ApplicationActionCreators from "../../applications/ApplicationActionCreators";
import { isNotNullish } from "../../../utils/GlobalUtils";
import { isVoiceChannelInvite } from "../../instant_invite/InviteTypeUtils";
import { fetchChannelInfo } from "../../channel/ChannelInfoActionCreators";
import { syncMessageDisplay, recordTimings } from "./MessagesUtils";
import ChatUpdatesQueue from "../../chat/native/ChatUpdatesQueue";
export function useMessageAuthorActivities(a0) {
let c18001_0 = a0;
const memo = useMemo(() => {
const r0 = {};
let c26685_0 = r0;
c18001_0.forEach((item) => {
if (item.author != null && item.activity != null) {
c26685_0[item.author.id] = null;
}
});
return r0;
}, [a0]);
return useStateFromStoresObject([PresenceStore], () => Module12.mapValues(memo, (a0, a1) => PresenceStore.getPrimaryActivity(a1)), [memo]);
}
export function useFetchMessageApplications(a0) {
let ref;
const memo2 = useMemo(() => {
const set = new Set();
let c26686_0 = set;
a0.forEach((item) => {
if (item.applicationId != null && item.application == null) {
c26686_0.add(item.applicationId);
}
});
return Array.from(set);
}, [a0]);
ref = useRef([]);
useEffect(() => {
if (!areArraysShallowEqual(memo2, ref.current)) {
ApplicationActionCreators.fetchApplications(Module12(memo2).filter(isNotNullish).uniq().value(), false);
ref.current = memo2;
}
}, [memo2]);
}
export function useFetchVoiceChannelInviteStartTimes(a0) {
const stateFromStoresObject = useStateFromStoresObject([GuildStore, GuildAvailabilityStore], () => {
const r0 = {};
for (const item of a0.values()) {
if (item.guild != null && isVoiceChannelInvite(item)) {
const id = item.guild.id;
r0[id] = GuildStore.getGuild(id) != null && !GuildAvailabilityStore.isUnavailable(id);
}
}
return r0;
}, [a0]);
useEffect(() => {
for (const item of a0.values()) {
if (item.guild != null && isVoiceChannelInvite(item)) {
const id = item.guild.id;
if (!(stateFromStoresObject[id] !== true || VoiceChannelStartTimeStore.hasRequestedStartTimes(id))) {
fetchChannelInfo(id);
}
}
}
}, [a0, stateFromStoresObject]);
}
export function useMessagesLifecycle({ messages, isMessagesReady, oldestUnreadMessageId, channelId, screenIndex, updateRows, scrollToMessageId }) {
useEffect(() => {
syncMessageDisplay({
messages,
isMessagesReady,
oldestUnreadMessageId,
channelId,
screenIndex,
updateRows,
scrollToMessageId
});
recordTimings(channelId, messages);
}, []);
useEffect(() => () => {
updateShouldShowJumpToPresentButton(channelId, screenIndex, false);
}, [channelId, screenIndex]);
}
export function useScrollState() {
const [state, setState] = useState({
animated: false,
hasHandledScroll: false,
isAtBottom: false,
isNearBottom: false,
isNearTop: false,
decelerating: false,
dragging: false,
hasMoreMessagesAfterForLastUpdate: false,
_loaded: false
});
return [state, useCallback((c26687_0) => {
setState((prevState) => ({
...prevState,
...c26687_0
}));
}, [])];
}
export function useChatUpdatesQueue(a0, a1) {
let c18006_0 = a0;
const memo3 = useMemo(() => new ChatUpdatesQueue(() => c18006_0.current !== null ? findNodeHandle(c18006_0.current) : null, (a0) => {
a1(a0);
}), [a0, a1]);
useEffect(() => () => {
memo3.cleanup();
}, [memo3]);
return memo3;
}
export function useMessagesState() {
const [shouldForceRender, setShouldForceRender] = useState(false);
const r13 = _slicedToArray(useState(false), 2);
return {
shouldForceRender,
hasJumpedToOriginalPost: r13[0],
setHasJumpedToOriginalPost: r13[1],
setShouldForceRender
};
}
@@ -0,0 +1,913 @@
// Metro module 10897 (f10898).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { forwardRef, useState, useRef, useCallback, useImperativeHandle, useEffect, useLayoutEffect, memo } from "react";
import { updateShouldShowJumpToPresentButton } from "../../chat_input/native/useChatBottomManagerUIStore";
import { getUserCommunicationDisabledVersion } from "../../../stores/GuildMemberStore";
import PermissionStore from "../../../stores/PermissionStore";
import ReadStateStore from "../../../stores/ReadStateStore";
import SKUStore from "../../../stores/game_store/SKUStore";
import { Changeset } from "./renderer/RowGeneratorConstants";
import { MAX_MESSAGES_PER_CHANNEL, Permissions, MessageTypes, ActivityActionTypes, MessageFlags } from "../../../Constants";
import TTITracker from "../../tti_analytics/TTITracker";
import openMediaModalOverlayAltTextSheet from "../../media_viewer/native/components/overlay/openMediaModalOverlayAltTextSheet";
import * as _MessagesUtils from "./MessagesUtils";
import { getVisibleMessages, getVoiceChannelIdChangedAuthorIds } from "./MessagesUtils";
import DimensionActionCreators from "../../../actions/DimensionActionCreators";
import ChatManager from "./renderer/ChatManager";
import RowGenerator from "./renderer/RowGenerator";
import NativeChatUtils from "../../chat/native/NativeChatUtils";
import { useChatUpdatesQueue } from "./MessagesHooks";
import Module12 from "../../../_bundle/Module12";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import useChannelLoading from "./hooks/useChannelLoading";
import { questsVisibleMobileMessagesChanged } from "../../quests/QuestActionCreators";
import { handleAnnouncementMessageViewTracking, handleOfficialMessageViewTracking, handleRichPresenceInviteEmbedViewTracking, handleVoiceInviteEmbedViewTracking } from "./MessageImpressionAnalyticsHelpers";
import { findMessageRowIndex } from "../../chat/native/computeScrollData";
import useScrollHandlers from "./hooks/useScrollHandlers";
import MessageActionCreators from "../../../actions/MessageActionCreators";
import { MessagesHandlers } from "./MessagesHandlers";
import useRowManager from "./hooks/useRowManager";
import { JumpType } from "../../../flow/Client";
import SentryUtils_native from "../../../utils/SentryUtils.native";
import { getChangesetIdForChat } from "../../chat/native/ChatChangesetUpdateTracker";
import getMessageJumpData from "../../../components_native/chat/getMessageJumpData";
import shallowEqual, { areArraysShallowEqual } from "../../../_bundle/shallowEqual";
import { CodedLinkType } from "../../coded_links/CodedLink";
import { isVoiceChannelInvite } from "../../instant_invite/InviteTypeUtils";
import MessagesUtils2 from "../../../utils/native/MessagesUtils";
import Chat_android from "../../chat/native/Chat.android";
import { getNativeSyntheticEventData } from "./snowflake/MessageDataSnowflakeUtils";
import { isIOS } from "../../../utils/PlatformUtils";
import { KeyboardTypes } from "../../keyboard/native/KeyboardTypes";
import { QuestsVisibleMessagesChangedSource } from "../../quests/QuestTypes";
import { ChatTTITracker } from "../../chat/native/ChatTTITracker";
function $mk85738() {
return (a0) => a0.id;
}
function $mk118285($env) {
return () => (0, $env.$parent[25])(!$env[0]);
}
let handleMediaPlayFinishedAnalytics, isLoadingAtTop;
let env7335 = {};
const handleTapShowAltText = function handleTapShowAltText(a0) {
openMediaModalOverlayAltTextSheet({
description: a0.nativeEvent.description
});
};
handleMediaPlayFinishedAnalytics = function handleMediaPlayFinishedAnalytics(a0) {
_MessagesUtils.handleMediaPlayFinishedAnalytics(a0.nativeEvent);
};
isLoadingAtTop = function isLoadingAtTop(a0, a1) {
if (!a1) {
return false;
}
for (const item of a0) {
if (item.changeType !== Changeset.INSERT) {
continue;
}
return item.index <= 1;
}
return false;
};
const r51 = forwardRef((a0, a1) => {
let env18347 = {
$parent: env7335
};
env18347[0] = a0;
const handleVisibleMessagesChange = function handleVisibleMessagesChange({ firstVisibleMessageRowIndex, firstVisibleMessagePercentVisible, lastVisibleMessageRowIndex, lastVisibleMessagePercentVisible, source }) {
const r22 = env18347[0];
const visibleMessages = getVisibleMessages({
firstVisibleMessageRowIndex,
lastVisibleMessageRowIndex,
firstVisibleMessagePercentVisible,
lastVisibleMessagePercentVisible,
chatManager: env18347[1],
channelId: r22.channelId
});
if (!(visibleMessages.length <= 0)) {
questsVisibleMobileMessagesChanged({
visibleMessages,
source
});
handleAnnouncementMessageViewTracking(visibleMessages, r22.shouldTrackAnnouncementMessageViews, r22.guildId, r22.channel);
handleOfficialMessageViewTracking(visibleMessages, r22.shouldTrackOfficialMessageViews, r22.guildId, r22.channel);
handleRichPresenceInviteEmbedViewTracking(visibleMessages, r22.shouldTrackRichPresenceInviteEmbedViews, r22.guildId, r22.channel);
handleVoiceInviteEmbedViewTracking(visibleMessages, r22.shouldTrackVoiceInviteEmbedViews, r22.guildId, r22.channel);
}
};
env18347[16] = handleVisibleMessagesChange;
const findMessageIndex = function findMessageIndex(a0) {
if (a0 != null) {
return findMessageRowIndex(env18347[1].getPreviousRows(), a0);
}
};
env18347[17] = findMessageIndex;
env18347[28] = function _handleTapNavBar() {
const r9 = async () => {
let c30301_0;
L19: {
L18: {
L14: {
let env31598;
const r12 = env31598 = {
$parent: env18347
};
c30301_0 = r12;
env31598[0] = void 0;
const r32 = env18347[0];
const { channel, useReducedMotion } = r32;
env31598[0] = useReducedMotion;
if (!channel.isForumPost()) {
break L19;
}
if (env18347[21].current) {
break L19;
}
if (env18347[13](SnowflakeUtils.castChannelIdAsMessageId(channel.id)) == null) {
await MessageActionCreators.fetchMessages({
channelId: channel.id,
jump: {
messageId: channel.id,
flash: false
},
limit: MAX_MESSAGES_PER_CHANNEL
});
setTimeout($mk118285(c30301_0), 50);
break L18;
}
const r58 = (0, env18347[17])(SnowflakeUtils.castChannelIdAsMessageId(channel.id));
if (r58 == null) {
break L14;
}
NativeChatUtils.scrollTo(env18347[11].current, r58, {
animated: !useReducedMotion
});
setTimeout(() => (0, env18347[25])(!env31598[0]), 10 * r58);
break L19;
}
return void 0;
}
return void 0;
}
};
env18347[28] = r9;
return r9.apply(this, arguments);
};
env18347[29] = function scrollToBottom(r5 = true) {
(0, env18347[26])({
eventTimestamp: Date.now(),
isAtBottom: true
});
const current = env18347[11].current;
if (r5) {
r5 = !env18347[0].useReducedMotion;
}
NativeChatUtils.scrollToBottom(current, r5);
};
env18347[30] = function jumpToPresent() {
const r4 = env18347[0];
const { messages: messages2, channel } = r4;
const jumpReturnTargetId = messages2.jumpReturnTargetId;
if (jumpReturnTargetId == null) {
if (!messages2.loadingMore) {
if (messages2.hasMoreAfter) {
MessageActionCreators.fetchMessages({
channelId: channel.id,
limit: MAX_MESSAGES_PER_CHANNEL,
jump: {
present: true
}
});
} else {
(0, env18347[26])({
eventTimestamp: Date.now(),
isAtBottom: true
});
NativeChatUtils.scrollToBottom(env18347[11].current, !r4.useReducedMotion);
}
}
} else {
MessageActionCreators.jumpToMessage({
channelId: channel.id,
messageId: jumpReturnTargetId,
flash: true
});
}
};
env18347[31] = function scrollToNewMessages() {
const r6 = env18347[0];
let messageId = ReadStateStore.ackMessageId(r6.channel.id);
if (messageId == null) {
messageId = r6.channel.id;
}
MessageActionCreators.jumpToMessage({
channelId: r6.channel.id,
messageId,
offset: 1,
context: "Mark As Read"
});
};
env18347[32] = function getChatRef() {
return env18347[11];
};
env18347[35] = function clearRowsState(a0) {
env18347[6].current = false;
env18347[18].current = false;
env18347[20].current = false;
env18347[19].current = false;
env18347[21].current = false;
env18347[22].current = false;
env18347[23].current = false;
env18347[7].current = false;
env18347[8].current = [];
env18347[10].current = false;
env18347[9].current = null;
const r35 = env18347[12];
const length2 = r35.queue.length;
const size = r35.blockers.size;
const r4 = env18347[1];
const length = r4.getPreviousRows().length;
r4.clear();
r35.clear();
const r8 = env18347[11];
NativeChatUtils.clearRows(r8.current);
SentryUtils_native.addBreadcrumb({
category: "chat.queue.clear",
message: `clearRows (${a0}): queue=${length2} blockers=${size} jsRows=${length}`,
data: {
reason: a0,
changesetUpdateId: getChangesetIdForChat(r8.current),
queueLength: length2,
blockers: size,
chatManagerRows: length
}
});
};
env18347[36] = function clearRows() {
(0, env18347[35])("channel-change");
const r8 = env18347[0];
updateShouldShowJumpToPresentButton(r8.channelId, r8.screenIndex, false);
};
const [chatManager] = useState(() => new ChatManager());
env18347[1] = chatManager;
const [rowGenerator] = useState(() => new RowGenerator());
const r49 = _slicedToArray(useState(false), 2);
env18347[2] = r49[0];
env18347[3] = r49[1];
const r54 = _slicedToArray(useState(false), 2);
const shouldForceRender = r54[0];
env18347[4] = shouldForceRender;
env18347[5] = r54[1];
const ref4 = useRef(false);
env18347[6] = ref4;
const ref3 = useRef(false);
env18347[7] = ref3;
const ref2 = useRef([]);
env18347[8] = ref2;
const ref6 = useRef(null);
env18347[9] = ref6;
const ref5 = useRef(false);
env18347[10] = ref5;
const ref = useRef(null);
env18347[11] = ref;
const callback = useCallback(({ rows: rows2, hasMoreMessagesAfter, scrollData, HACK_iOSForceAnimations, forceReload, isAnimated, rows }) => {
const r14 = env18347[7];
NativeChatUtils.updateRows(env18347[11].current, {
rows: rows2,
isLoadingAtTop: isLoadingAtTop(rows, r14.current),
scrollData,
HACK_iOSForceAnimations,
forceReload,
isAnimated
});
r14.current = hasMoreMessagesAfter;
}, []);
const chatUpdatesQueue = useChatUpdatesQueue(ref, callback);
env18347[12] = chatUpdatesQueue;
const callback3 = useCallback(() => {
const r1 = env18347[0];
return r1.canChat && PermissionStore.can(Permissions.ADD_REACTIONS, r1.channel) || r1.channel.isPrivate();
}, [a0.canChat, a0.channel]);
const callback4 = useCallback((c26843_0) => Module12.find(env18347[0].messages.toArray(), ({ id, nonce }) => id === c26843_0 || nonce === c26843_0), [a0.messages]);
env18347[13] = callback4;
const callback2 = useCallback((a0) => {
const r2 = env18347[0];
return r2.channel.isForumPost() && SnowflakeUtils.castChannelIdAsMessageId(r2.channelId) === r2.messages.jumpTargetId && !a0;
}, [a0.channel, a0.channelId, a0.messages.jumpTargetId]);
env18347[14] = callback2;
const channelLoading = useChannelLoading({
channelId: a0.channelId,
jumpTargetId: a0.messages.jumpTargetId,
oldestUnreadMessageId: a0.oldestUnreadMessageId,
shouldJumpToOriginalPost: callback2
});
const channelLatestMessageLoadingStatsManager = channelLoading.channelLatestMessageLoadingStatsManager;
env18347[15] = channelLoading.startOrCancelLatestMessagesLoad;
const scrollHandlers = useScrollHandlers({
chatRef: ref,
chatManager,
chatUpdatesQueue,
pendingUpdatesQueueRef: ref2,
animatedRef: ref4,
fetchMoreBefore: function fetchMoreBefore() {
const r8 = env18347[0];
const { channelId, messages: messages2 } = r8;
if (messages2.hasMoreBefore && !messages2.loadingMore) {
MessageActionCreators.fetchMessages({
channelId,
before: messages2.first()?.id,
limit: MAX_MESSAGES_PER_CHANNEL
});
}
},
fetchMoreAfter: function fetchMoreAfter() {
const r8 = env18347[0];
const { channelId, messages: messages2 } = r8;
if (messages2.hasMoreAfter && !messages2.loadingMore) {
MessageActionCreators.fetchMessages({
channelId,
after: messages2.last()?.id,
limit: MAX_MESSAGES_PER_CHANNEL
});
}
},
handleVisibleMessagesChange,
applyNativeRowsUpdate: callback,
messages: a0.messages,
channel: a0.channel,
channelId: a0.channelId,
screenIndex: a0.screenIndex,
onScroll: a0.onScroll,
useReducedMotion: a0.useReducedMotion,
isStaff: a0.isStaff,
visibleMessagesWindowHandler: a0.visibleMessagesWindowHandler
});
env18347[18] = scrollHandlers.hasHandledScrollRef;
env18347[19] = scrollHandlers.isAtBottomRef;
env18347[20] = scrollHandlers.isNearBottomRef;
env18347[21] = scrollHandlers.isNearTopRef;
env18347[22] = scrollHandlers.deceleratingRef;
env18347[23] = scrollHandlers.draggingRef;
env18347[24] = scrollHandlers.firstIgnoredScrollEventTimestampRef;
const { loadMoreBefore, loadMoreAfter } = scrollHandlers;
env18347[25] = scrollHandlers.scrollToTop;
const { scrollToTopMessage, updateNativeRows } = scrollHandlers;
env18347[26] = scrollHandlers.handleScrollCallbacks;
const handleScrollPosition = scrollHandlers.handleScrollPosition;
const ref7 = useRef(null);
env18347[27] = ref7;
ref7.current = {
getMessage: callback4,
chatInputRef: a0.chatInputRef,
selectedChannelId: a0.channelId,
revealedMessageId: a0.messages.revealedMessageId,
uploads: a0.uploads,
paymentsBlocked: a0.paymentsBlocked,
loadMoreBefore,
loadMoreAfter
};
const [r133] = useState(() => new MessagesHandlers(() => env18347[27].current));
useImperativeHandle(a1, () => ({
scrollToBottom: env18347[29],
jumpToPresent: env18347[30],
scrollToNewMessages: env18347[31],
getChatRef: env18347[32]
}));
const rowManager = useRowManager({
chatManager,
rowGenerator,
animatingStickerMessageIdRef: ref6,
canAddNewReactions: callback3,
channel: a0.channel,
messages: a0.messages,
isMessagesReady: a0.isMessagesReady,
uploads: a0.uploads,
roleStyle: a0.roleStyle,
oldestUnreadMessageId: a0.oldestUnreadMessageId,
replyingMessageId: a0.replyingMessageId,
inlineAttachmentMedia: a0.inlineAttachmentMedia,
inlineEmbedMedia: a0.inlineEmbedMedia,
renderEmbeds: a0.renderEmbeds,
renderReactions: a0.renderReactions,
animateEmoji: a0.animateEmoji,
gifAutoPlay: a0.gifAutoPlay,
timestampHourCycle: a0.timestampHourCycle,
currentUserId: a0.currentUserId,
renderCommunicationDisabled: a0.renderCommunicationDisabled,
selectedSummary: a0.selectedSummary,
enableSwipeActions: a0.enableSwipeActions,
isResourceChannel: a0.isResourceChannel,
shouldObscureSpoiler: a0.shouldObscureSpoiler,
shouldDisableInteractiveComponents: a0.shouldDisableInteractiveComponents,
unloadableContentEntryMessageIds: a0.unloadableContentEntryMessageIds,
containerWidth: a0.containerWidth,
chatRef: ref,
loadedRef: ref5,
animatedRef: ref4,
hasMoreMessagesAfterForLastUpdateRef: ref3,
updateNativeRows,
isLoadingAtTop,
channelLatestMessageLoadingStatsManager,
channelId: a0.channelId,
isMessagesCached: a0.isMessagesCached,
chatUpdatesQueue,
shouldJumpToOriginalPost: callback2,
findMessageIndex,
scrollToTopMessage,
useReducedMotion: a0.useReducedMotion
});
env18347[33] = rowManager.updateRows;
env18347[34] = rowManager.scrollToMessageId;
useEffect(() => {
const r4 = env18347[0];
const { messages, isMessagesReady, oldestUnreadMessageId } = r4;
const r12 = env18347[33];
if (isMessagesReady) {
const hasJumpedToOriginalPost = env18347[2];
r12({
scrollToMessageId: messages.jumpTargetId,
jumpTargetId: messages.jumpTargetId,
jumpType: JumpType.INSTANT,
focusTargetId: messages.focusTargetId,
hasJumpedToOriginalPost
});
if (messages.jumpTargetId != null) {
(0, env18347[34])({
scrollToMessageId: messages.jumpTargetId,
jumpTargetId: messages.jumpTargetId,
jumpType: JumpType.INSTANT,
hasJumpedToOriginalPost
});
} else if (oldestUnreadMessageId != null) {
setTimeout(() => (0, env18347[34])({
scrollToMessageId: oldestUnreadMessageId,
jumpTargetId: messages.jumpTargetId,
jumpType: JumpType.INSTANT,
hasJumpedToOriginalPost: env18347[2]
}), 50);
}
} else {
r12({
hasJumpedToOriginalPost: env18347[2]
});
}
const { channelId, messages: messages2 } = r4;
TTITracker.recordMessageRender(channelId, messages2.map($mk85738()), messages2.hasFetched || messages2.ready && !messages2.cached, messages2.hasMoreAfter);
const { channelId: channelId2, messages: messages3 } = r4;
TTITracker.recordMessageRender(channelId2, messages3.map($mk85738()), messages3.hasFetched || messages3.ready && !messages3.cached, messages3.hasMoreAfter);
return () => {
(0, env18347[35])("unmount");
};
}, []);
useEffect(() => () => {
const r6 = env18347[0];
updateShouldShowJumpToPresentButton(r6.channelId, r6.screenIndex, false);
}, [a0.channelId, a0.screenIndex]);
env18347[37] = useRef({
props: a0,
shouldForceRender
});
useLayoutEffect(() => {
let props, c26845_1, c26845_2, c26845_3, c26845_4, c26845_5, c26845_6, c26845_7, c26845_8, c26845_9, c26845_10, c26845_11, c26845_12, c26845_13, c26845_14, c26845_15, c26845_16, c26845_17, c26845_18, c26845_19, c26845_20, c26845_21, c26845_22, c26845_23, c26845_24, c26845_25, c26845_26, c26845_27, c26845_28, c26845_29, c26845_30, c26845_31, c26845_32, cacheStoreLoaded, voiceChannelIdChangedAuthorIds;
L202: {
const r29 = env18347[37];
const current = r29.current;
props = current.props;
const shouldForceRender = current.shouldForceRender;
const props2 = env18347[0];
const shouldForceRender2 = env18347[4];
r29.current = {
props: props2,
shouldForceRender: shouldForceRender2
};
if (props2.currentUserId != null) {
const messages3 = props2.messages;
const messages2 = props.messages;
const r9 = props.channelId !== props2.channelId;
if (r9) {
(0, env18347[3])(false);
}
const hasJumpedToOriginalPost = r9 ? !r9 : env18347[2];
const channelId = props.channelId;
const channelId2 = props2.channelId;
const r71 = {
clearRows: env18347[36],
startOrCancelChannelLatestMessagesLoad: env18347[15],
hasJumpedToOriginalPost,
firstIgnoredScrollEventTimestampRef: env18347[24]
};
if (channelId !== channelId2) {
r71.clearRows();
DimensionActionCreators.clearChannelDimensions(channelId2);
r71.startOrCancelChannelLatestMessagesLoad(r71.hasJumpedToOriginalPost);
r71.firstIgnoredScrollEventTimestampRef.current = void 0;
}
const isMessagesAckable = props.isMessagesAckable;
const isMessagesAckable2 = props2.isMessagesAckable;
const r90 = env18347[18];
if (isMessagesAckable ? !isMessagesAckable : isMessagesAckable2) {
r90.current = false;
}
const r93 = env18347[14];
const r94 = env18347[25];
const r95 = env18347[3];
if (r93(hasJumpedToOriginalPost)) {
r94(false);
if (messages2.jumpSequenceId === messages3.jumpSequenceId) {
r95(true);
}
}
const messagesNewlyLoaded = props2.isMessagesReady && !props2.isMessagesCached && props.isMessagesCached;
const messageJumpData = getMessageJumpData(props2, {
isAtBottom: env18347[19].current,
hasPreviousMessages: env18347[1].getPreviousMessages() != null
}, props);
const { scrollToMessageId, jumpTargetId, jumpType, minimizeScrolling, focusTargetId, shouldInitialScroll } = messageJumpData;
let forceReload = props.theme !== props2.theme || props.saturation !== props2.saturation || props.isVisualRefreshEnabled !== props2.isVisualRefreshEnabled;
const forceRender = props.theme !== props2.theme || props.saturation !== props2.saturation || props.isVisualRefreshEnabled !== props2.isVisualRefreshEnabled || props.inlineAttachmentMedia !== props2.inlineAttachmentMedia || props.inlineEmbedMedia !== props2.inlineEmbedMedia || props.renderEmbeds !== props2.renderEmbeds || props.renderReactions !== props2.renderReactions || props.animateEmoji !== props2.animateEmoji || props.animateStickers !== props2.animateStickers || props.gifAutoPlay !== props2.gifAutoPlay || props.timestampHourCycle !== props2.timestampHourCycle || props.containerWidth !== props2.containerWidth || props.guildSystemChannelFlags !== props2.guildSystemChannelFlags || props.userSettingsLocale !== props2.userSettingsLocale || props.roleStyle !== props2.roleStyle || props.officialMessageStyle !== props2.officialMessageStyle || props.canSendMessages !== props2.canSendMessages || props.showPushFeedback !== props2.showPushFeedback || props.selectedSummary !== props2.selectedSummary || props.shouldObscureSpoiler !== props2.shouldObscureSpoiler || props.explicitMediaFalsePositiveInfo !== props2.explicitMediaFalsePositiveInfo || props.familyCenterPendingConnection !== props2.familyCenterPendingConnection || props.isStaff !== props2.isStaff || props.isAgeVerified !== props2.isAgeVerified || shouldForceRender !== shouldForceRender2 && shouldForceRender2 || props.displayNameStylesEnabled !== props2.displayNameStylesEnabled;
const r5 = props.resolvingGiftCodes !== props2.resolvingGiftCodes || props.resolvedGiftCodes !== props2.resolvedGiftCodes || props.acceptingGiftCodes !== props2.acceptingGiftCodes;
c26845_1 = r5;
const uploads2 = props.uploads;
const uploads = props2.uploads;
const r50 = shallowEqual(props.interactionStates, props2.interactionStates);
c26845_2 = !r50;
const r17 = props.channelPolls !== props2.channelPolls;
c26845_3 = r17;
const r18 = props.messageReferencePolls !== props2.messageReferencePolls;
c26845_4 = r18;
const r16 = props.interactionComponentStatesVersion !== props2.interactionComponentStatesVersion;
c26845_5 = r16;
c26845_6 = props.shouldDisableInteractiveComponents !== props2.shouldDisableInteractiveComponents;
const r12 = props.communicationDisabledVersion !== props2.communicationDisabledVersion;
c26845_7 = r12;
const r13 = props.messageAuthorMembers !== props2.messageAuthorMembers;
c26845_8 = r13;
const r14 = props.failedMessagesVersion !== props2.failedMessagesVersion;
c26845_9 = r14;
const r15 = props.renderCommunicationDisabled !== props2.renderCommunicationDisabled;
c26845_10 = r15;
const forwardGuildsVersion2 = props.forwardGuildsVersion;
const forwardGuildsVersion = props2.forwardGuildsVersion;
const r49 = props2.channel.isForumPost() && props.isFollowingForumPost !== props2.isFollowingForumPost;
c26845_11 = r49;
const r19 = props.showMediaPostSharePrompt !== props2.showMediaPostSharePrompt;
c26845_12 = r19;
const r20 = props.unloadedContentEntryMessageIds !== props2.unloadedContentEntryMessageIds;
c26845_13 = r20;
const r216 = props.invalidApplicationIds !== props2.invalidApplicationIds;
c26845_14 = r216;
const r1 = props.activityInstanceIds !== props2.activityInstanceIds || props.activityParticipants !== props2.activityParticipants || props.applicationAssetFetchingIds !== props2.applicationAssetFetchingIds || props.activityInstancePresenceDetails !== props2.activityInstancePresenceDetails || props.messagesWithActivitiesLaunching !== props2.messagesWithActivitiesLaunching || r216;
c26845_15 = r1;
const r48 = areArraysShallowEqual(props.activityInviteMessageIds, props2.activityInviteMessageIds);
c26845_16 = !r48;
const r240 = areArraysShallowEqual(props.resolvedReferralTrialOfferIds, props2.resolvedReferralTrialOfferIds);
const r6 = (r240 ? props.referralTrialOfferId !== props2.referralTrialOfferId : !r240) || props.isPremiumTier2User !== props2.isPremiumTier2User;
c26845_17 = r6;
const r21 = props.guildInviteColorsFetched !== props2.guildInviteColorsFetched;
c26845_18 = r21;
const guildEmojis = props.guildEmojis;
const guildEmojis2 = props2.guildEmojis;
const r22 = props.selfActivities !== props2.selfActivities;
c26845_19 = r22;
const r11 = props.currentClientVoiceChannelId !== props2.currentClientVoiceChannelId;
c26845_20 = r11;
const r254 = props.voiceStateChannelIdSummaryForGuild !== props2.voiceStateChannelIdSummaryForGuild;
c26845_21 = r254;
const voiceStatePrivateChannelId2 = props.voiceStatePrivateChannelId;
const voiceStatePrivateChannelId = props2.voiceStatePrivateChannelId;
const r23 = props.activityLaunchJoinStates !== props2.activityLaunchJoinStates;
c26845_22 = r23;
const r24 = props.authorizedAppsTokens !== props2.authorizedAppsTokens;
c26845_23 = r24;
const displayNameStylesEnabled = props.displayNameStylesEnabled;
const displayNameStylesEnabled2 = props2.displayNameStylesEnabled;
const fontId = props.currentUserDisplayNameStyles?.fontId;
const fontId2 = props2.currentUserDisplayNameStyles?.fontId;
const r264 = voiceStatePrivateChannelId2 !== voiceStatePrivateChannelId;
const r25 = fontId !== fontId2;
c26845_24 = r25;
const r271 = areArraysShallowEqual(props.fetchingSkuIds, props2.fetchingSkuIds);
c26845_25 = !r271;
const r274 = props.voiceInviteDataByChannelId !== props2.voiceInviteDataByChannelId;
c26845_26 = r274;
if (!forceRender && !r5 && uploads2 === uploads && !r1 && props.messages === props2.messages && props.editingMessageId === props2.editingMessageId && props.replyingMessageId === props2.replyingMessageId && !r264 && props.messageAuthorActivities === props2.messageAuthorActivities && props.oldestUnreadMessageId === props2.oldestUnreadMessageId && props.invites === props2.invites && props.appDirectoryEmbedApplications === props2.appDirectoryEmbedApplications && props.invalidAppDirectoryEmbedApplicationIds === props2.invalidAppDirectoryEmbedApplicationIds && props.appDirectoryEmbedApplicationFetchStates === props2.appDirectoryEmbedApplicationFetchStates && props.guildTemplates === props2.guildTemplates && props.buildOverrides === props2.buildOverrides && props.experimentEmbeds === props2.experimentEmbeds && props.quests === props2.quests && props.isFetchingCurrentQuests === props2.isFetchingCurrentQuests && props.participantsLength === props2.participantsLength && props.isMessagesReady === props2.isMessagesReady && props.channelThreadsVersion === props2.channelThreadsVersion && props.rsvpVersion === props2.rsvpVersion && props.repliedIds === props2.repliedIds && props.hasLoadedExperiments === props2.hasLoadedExperiments && props.isMessageRequest === props2.isMessageRequest && props.isSpamMessageRequest === props2.isSpamMessageRequest && props.currentUserCommunicationDisabled === props2.currentUserCommunicationDisabled && props.userSettingsLocale === props2.userSettingsLocale && props.selectedSummary === props2.selectedSummary && props.showPushFeedback === props2.showPushFeedback && props.cacheStoreLoaded === props2.cacheStoreLoaded && !r11 && !r12 && !r13 && !r14 && forwardGuildsVersion2 === forwardGuildsVersion && !r15 && r50 && !r16 && !r49 && jumpTargetId == null && focusTargetId == null && props.androidKeyboardHeight === props2.androidKeyboardHeight && props.mediaPostPreviewEmbeds === props2.mediaPostPreviewEmbeds && props.shouldObscureSpoiler === props2.shouldObscureSpoiler && props.shouldDisableInteractiveComponents === props2.shouldDisableInteractiveComponents && !r17 && !r18 && !r19 && props.threadStartingReferenceMessage === props2.threadStartingReferenceMessage && !r20 && r48 && !r6 && !r21 && guildEmojis === guildEmojis2 && !r22 && !r23 && !r24 && displayNameStylesEnabled === displayNameStylesEnabled2 && !r25 && !r254 && !r274 && r271) {
const { channelId: channelId3, messages: messages4 } = props2;
TTITracker.recordMessageRender(channelId3, messages4.map($mk85738()), messages4.hasFetched || messages4.ready && !messages4.cached, messages4.hasMoreAfter);
break L202;
}
const set = new Set();
c26845_27 = set;
if (props.editingMessageId !== props2.editingMessageId) {
if (props2.editingMessageId != null) {
set.add(props2.editingMessageId);
}
if (props.editingMessageId != null) {
set.add(props.editingMessageId);
}
}
if (props.replyingMessageId !== props2.replyingMessageId) {
if (props2.replyingMessageId != null) {
set.add(props2.replyingMessageId);
}
if (props.replyingMessageId != null) {
set.add(props.replyingMessageId);
}
}
if (!(props.isMessagesReady === props2.isMessagesReady && (props.isCallActive === props2.isCallActive && (!r264 && props.participantsLength === props2.participantsLength)))) {
const r396 = Module12.find(props2.messages.toArray().reverse(), (a0) => a0.type === MessageTypes.CALL);
if (r396 != null) {
set.add(r396.id);
}
}
c26845_28 = props.channelThreadsVersion !== props2.channelThreadsVersion;
c26845_29 = props.rsvpVersion !== props2.rsvpVersion;
c26845_30 = props.repliedIds !== props2.repliedIds;
c26845_31 = props.hasLoadedExperiments !== props2.hasLoadedExperiments;
let communicationDisabledVersion = props.communicationDisabledVersion;
if (communicationDisabledVersion == null) {
communicationDisabledVersion = -1;
}
c26845_32 = communicationDisabledVersion;
const cacheStoreLoaded2 = props.cacheStoreLoaded;
cacheStoreLoaded = cacheStoreLoaded2 ? !cacheStoreLoaded2 : props2.cacheStoreLoaded;
let r415 = null;
if (r254) {
let voiceStateChannelIdSummaryForGuild = props.voiceStateChannelIdSummaryForGuild;
if (voiceStateChannelIdSummaryForGuild == null) {
voiceStateChannelIdSummaryForGuild = null;
}
let voiceStateChannelIdSummaryForGuild2 = props2.voiceStateChannelIdSummaryForGuild;
if (voiceStateChannelIdSummaryForGuild2 == null) {
voiceStateChannelIdSummaryForGuild2 = null;
}
r415 = getVoiceChannelIdChangedAuthorIds(voiceStateChannelIdSummaryForGuild, voiceStateChannelIdSummaryForGuild2);
}
voiceChannelIdChangedAuthorIds = r415;
props2.messages.forEach((message) => {
L149: {
if (c26845_21 && (voiceChannelIdChangedAuthorIds != null && (message.author != null && voiceChannelIdChangedAuthorIds.has(message.author.id)))) {
c26845_27.add(message.id);
} else {
if (c26845_20) {
if (message.activity?.type === ActivityActionTypes.STREAM_REQUEST) {
c26845_27.add(message.id);
break L149;
}
}
if (c26845_31 && message.type === MessageTypes.USER_JOIN) {
c26845_27.add(message.id);
} else {
if (c26845_30 && message.type === MessageTypes.REPLY) {
const messageReference = message.messageReference;
if (messageReference != null && env18347[0].repliedIds.has(messageReference.message_id)) {
c26845_27.add(message.id);
return void 0;
}
}
if (c26845_28 && message.hasFlag(MessageFlags.HAS_THREAD)) {
c26845_27.add(message.id);
} else if (c26845_29 && message.codedLinks.length > 0) {
c26845_27.add(message.id);
} else {
if (c26845_26 && message.codedLinks.length > 0) {
for (const codedLink of message.codedLinks) {
const { type, code } = codedLink;
if (type !== CodedLinkType.INVITE) {
continue;
}
const r94 = env18347[0].invites.get(code);
if (r94 == null) {
continue;
}
if (r94.channel == null) {
continue;
}
if (!isVoiceChannelInvite(r94)) {
continue;
}
const id = r94.channel.id;
if (props.voiceInviteDataByChannelId[id] === env18347[0].voiceInviteDataByChannelId[id]) {
continue;
}
c26845_27.add(message.id);
return void 0;
}
}
L142: {
if (!c26845_10) {
if (c26845_7 && env18347[0].guildId != null && (0, getUserCommunicationDisabledVersion)(env18347[0].guildId, message.author.id) > c26845_32) {
break L142;
}
if (c26845_8 && env18347[0].guildId != null) {
if (message.author?.id != null) {
if (env18347[0].messageAuthorMembers[message.author.id] === props.messageAuthorMembers[message.author.id]) {
break L149;
}
c26845_27.add(message.id);
break L149;
}
}
if (c26845_9 && message.author.id === env18347[0].currentUserId) {
c26845_27.add(message.id);
break L149;
}
if (c26845_2 && props.interactionStates[message.id] !== env18347[0].interactionStates[message.id]) {
c26845_27.add(message.id);
break L149;
}
if (c26845_5 && props.interactionComponentStates.get(message.id) !== env18347[0].interactionComponentStates.get(message.id)) {
c26845_27.add(message.id);
break L149;
}
if (c26845_6 && message.components.length !== 0) {
c26845_27.add(message.id);
break L149;
}
if (c26845_3 && props.channelPolls[message.id] !== env18347[0].channelPolls[message.id]) {
c26845_27.add(message.id);
break L149;
}
if (c26845_4) {
const message_id = message.messageReference?.message_id;
if (message_id != null && props.messageReferencePolls[message_id] !== env18347[0].messageReferencePolls[message_id]) {
c26845_27.add(message.id);
return void 0;
}
}
if (c26845_13 && props.unloadedContentEntryMessageIds.has(message.id) !== env18347[0].unloadedContentEntryMessageIds.has(message.id)) {
c26845_27.add(message.id);
break L149;
}
L61: {
if (env18347[0].channel.isForumPost()) {
if (!c26845_11 && !c26845_12) {
break L61;
}
if (message.id === SnowflakeUtils.castChannelIdAsMessageId(env18347[0].channelId)) {
c26845_27.add(message.id);
break L149;
}
}
}
if (c26845_15 && message.activityInstance != null) {
c26845_27.add(message.id);
break L149;
}
if (c26845_16 && message.activity?.party_id != null) {
c26845_27.add(message.id);
}
if (c26845_23 && message.application != null) {
c26845_27.add(message.id);
break L149;
}
if (c26845_24) {
if (message.author?.id === env18347[0].currentUserId) {
c26845_27.add(message.id);
break L149;
}
}
if (!(!c26845_25 && !c26845_14) && message.codedLinks.length > 0) {
for (const codedLink2 of message.codedLinks) {
const { type: type2, code: code2 } = codedLink2;
if (type2 !== CodedLinkType.SOCIAL_LAYER_STOREFRONT && type2 !== CodedLinkType.SOCIAL_LAYER_STOREFRONT_APP) {
continue;
}
const [r290] = code2.split("-");
if (!props.fetchingSkuIds.includes(r290)) {
const r300 = SKUStore.get(r290);
if (r300 == null) {
continue;
}
if (!props.invalidApplicationIds.includes(r300.applicationId)) {
continue;
}
c26845_27.add(message.id);
return void 0;
}
c26845_27.add(message.id);
return void 0;
}
}
if (message.author == null) {
break L149;
}
L128: {
if (!MessagesUtils2.messageAuthorActivitiesChanged(message, props, env18347[0]) && !MessagesUtils2.codedLinksChanged(message, props, env18347[0])) {
if (c26845_1 && MessagesUtils2.giftCodesChanged(message, props, env18347[0])) {
break L128;
}
if (!MessagesUtils2.mediaPostPreviewEmbedsChanged(message, props, env18347[0])) {
let r358 = cacheStoreLoaded;
if (cacheStoreLoaded) {
r358 = message.embeds.length > 0;
}
if (r358) {
c26845_27.add(message.id);
}
if (message.type === MessageTypes.THREAD_STARTER_MESSAGE && props.threadStartingReferenceMessage !== env18347[0].threadStartingReferenceMessage) {
c26845_27.add(message.id);
}
if (c26845_14 && message.applicationId != null && props.invalidApplicationIds.includes(message.applicationId)) {
c26845_27.add(message.id);
}
if (c26845_17) {
const referralTrialOfferId = message.referralTrialOfferId;
if (referralTrialOfferId != null && env18347[0].resolvedReferralTrialOfferIds.includes(referralTrialOfferId)) {
c26845_27.add(message.id);
}
}
if (c26845_18 && message.codedLinks.length > 0) {
c26845_27.add(message.id);
}
if (!((c26845_19 || c26845_22) && message.activity?.party_id != null)) {
break L149;
}
c26845_27.add(message.id);
break L149;
}
}
}
c26845_27.add(message.id);
break L149;
}
}
c26845_27.add(message.id);
}
}
}
}
});
const isAnimated = props.channelId !== props2.channelId || messages2.suppressRowAnimationSequenceId === messages3.suppressRowAnimationSequenceId;
const r431 = env18347[33];
if (!forceReload) {
forceReload = r9;
}
r431({
forceRender,
forceReload,
updateMessageIds: set,
scrollToMessageId,
jumpTargetId,
jumpType,
focusTargetId,
ignoreEmbedDescriptionCache: cacheStoreLoaded,
messagesNewlyLoaded,
shouldInitialScroll,
minimizeScrolling,
isAnimated,
hasJumpedToOriginalPost
});
(0, env18347[5])(false);
const { channelId: channelId4, messages: messages5 } = props2;
TTITracker.recordMessageRender(channelId4, messages5.map($mk85738()), messages5.hasFetched || messages5.ready && !messages5.cached, messages5.hasMoreAfter);
}
}
});
return <>
<Chat_android ref={ref} style={a0.style} inverted channelId={a0.channelId} alwaysRespectKeyboard={a0.alwaysRespectKeyboard} onChatScrollPosition={handleScrollPosition} onTapImage={r133.handleTapImage} onTapChannel={r133.handleTapChannel} onLongPressChannel={r133.handleLongPressChannel} onTapAttachmentLink={r133.handleTapAttachmentLink} onLongPressAttachmentLink={r133.handleLongPressAttachmentLink} onTapCall={r133.handleTapCall} onTapMention={r133.handleTapMention} onTapCommandMention={r133.handleTapCommandMention} onLongPressCommandMention={r133.handleLongPressCommandMention} onTapGameMention={r133.handleTapGameMention} onTapLink={r133.handleTapLink} onLongPressLink={r133.handleLongPressLink} onTapReaction={r133.handleTapReaction} onLongPressReaction={r133.handleLongPressReaction} onTapAvatar={r133.handleTapAvatar} onTapUsername={r133.handleTapUsername} onLongPressUsername={r133.handleLongPressUsername} onTapSticker={r133.handleOpenSticker} onLongPressSticker={function handleLongPressSticker(event) {
const messageId = getNativeSyntheticEventData(event).messageId;
const r15 = env18347[9];
const current = r15.current;
const set = new Set([messageId]);
if (current != null) {
set.add(current);
}
r15.current = current !== messageId ? messageId : null;
(0, env18347[33])({
forceRender: true,
updateMessageIds: set
});
}} onLongPressMessage={r133.handleLongPressMessage} onInitiateReply={r133.handleInitiateReply} onInitiateEdit={r133.handleInitiateEdit} onInitiateThread={r133.handleInitiateThread} onTapMessage={r133.handleTapMessage} onDoubleTapMessage={r133.handleDoubleTapMessage} onTapSeparator={r133.handleTapSeparator} onTapInviteEmbed={r133.handleTapInviteEmbed} onTapInviteEmbedAccept={r133.handleTapInviteEmbedAccept} onTapJoinActivity={r133.handleTapJoinActivity} onTapJoinRichPresence={r133.handleTapJoinRichPresence} onPressKey={a0.onPressKey} animateEmoji={a0.animateEmoji} onTapGiftCodeEmbed={r133.handleTapGiftCodeEmbed} onTapCancelUploadItem={r133.handleTapCancelUploadItem} onTapMessageReply={r133.handleTapReply} onTapSummary={r133.handleTapSummary} onTapSummaryJump={r133.handleTapSummaryJump} onTapGiftCodeAccept={r133.handleTapGiftCodeAccept} onTapReferralRedeem={r133.handleTapReferralRedeem} onGiftIntentCardViewed={r133.handleGiftIntentCardViewed} onTapGiftIntentPrimaryCta={r133.handleTapGiftIntentPrimaryCta} onTapGiftIntentSecondaryCta={r133.handleTapGiftIntentSecondaryCta} onTapThreadEmbed={r133.handleTapThreadEmbed} onTapEmoji={r133.handleTapEmoji} onTapTimestamp={r133.handleTapTimestamp} onTapInlineCode={r133.handleTapInlineCode} onTapRoleIcon={r133.handleTapRoleIcon} onTapVoiceChannelBadge={r133.handleTapVoiceChannelBadge} onTapGameIcon={r133.handleTapGameIcon} onTapSuppressNotificationsIcon={r133.handleTapSuppressNotificationsIcon} onTapConnectionsRoleTag={r133.handleTapConnectionsRoleTag} onTapTimeoutIcon={r133.handleTapTimeoutIcon} onTapButtonActionComponent={r133.handleTapButtonActionComponent} onTapSelectActionComponent={r133.handleTapSelectActionComponent} onTapWelcomeReply={r133.handleTapWelcomeReply} onTapInviteToSpeak={r133.handleTapInviteToSpeak} onTapAutoModerationActions={r133.handleTapAutoModerationActions} onTapAutoModerationFeedback={r133.handleTapAutoModerationFeedback} onTapFollowForumPost={r133.handleTapFollowForumPost} onTapShareForumPost={r133.handleTapShareForumPost} onTapReactionOverflow={r133.handleTapReactionOverflow} onTapNavBar={function handleTapNavBar() {
return env18347[28].apply(this, arguments);
}} onTapCopyText={r133.handleCopyText} onTapOpTag={r133.handleTapOpTag} onTapTag={r133.handleTapTag} onMediaAttachmentPlaybackEnded={r133.handleMediaAttachmentPlaybackEnded} onMediaAttachmentPlaybackStarted={r133.handleMediaAttachmentPlaybackStarted} onVoiceMessagePlaybackFailed={r133.handleVoiceMessagePlaybackFailed} onTapShowAltText={handleTapShowAltText} onTapPostPreviewEmbed={r133.handleTapPostPreviewEmbed} onTapDismissMediaPostSharePrompt={r133.handleTapDismissMediaPostSharePrompt} onTapObscuredMediaLearnMore={r133.handleTapObscuredMediaLearnMore} onTapObscuredMediaToggle={r133.onTapObscuredMediaToggle} onTapSafetyPolicyNoticeEmbed={r133.handleTapSafetyPolicyNoticeEmbed} onTapSafetySystemNotificationCta={r133.handleTapSafetySystemNotificationCta} onTapPollAnswer={r133.handleTapPollAnswer} onTapPollSubmitVote={r133.handleTapPollSubmitVote} onTapPollAction={r133.handleTapPollAction} onLongPressPollImage={r133.handleLongPressPollImage} onTapCtaButton={r133.handleTapCtaButton} onMessageAccessibilityAction={r133.handleMessageAccessibilityAction} onTapForwardFooter={r133.handleTapForwardFooter} onTapInlineForward={r133.handleTapInlineForward} onTapClanTagChiplet={r133.handleTapClanTagChiplet} onTapContentInventoryEntryEmbed={r133.handleTapContentInventoryEntryEmbed} onTapCheckpointCard={r133.handleTapCheckpointCard} onTapSoundmoji={r133.handleTapSoundmoji} onTapAppMessageEmbed={r133.handleTapAppMessageEmbed} onTapPreviewSharedClientTheme={r133.handleTapPreviewSharedClientTheme} onSharedClientThemeViewed={r133.handleSharedClientThemeViewed} HACK_fixModalInteraction={a0.HACK_fixModalInteraction} onTapTableView={function handleTapTableView() {
if (isIOS() && env18347[0].keyboardType !== KeyboardTypes.SYSTEM) {
const current = env18347[0].chatInputRef.current;
if (current != null) {
current.closeCustomKeyboard();
}
}
}} onFirstLayout={function handleFirstLayout({ nativeEvent }) {
(0, env18347[16])({
firstVisibleMessageRowIndex: nativeEvent.firstVisibleMessageIndex,
lastVisibleMessageRowIndex: nativeEvent.lastVisibleMessageIndex,
firstVisibleMessagePercentVisible: nativeEvent.firstVisibleMessagePercentVisible,
lastVisibleMessagePercentVisible: nativeEvent.lastVisibleMessagePercentVisible,
source: QuestsVisibleMessagesChangedSource.FIRST_LAYOUT
});
}} onMediaPlayFinishedAnalytics={handleMediaPlayFinishedAnalytics} onMessageVisibilityChanged={function handleMessageVisibilityChanged({ nativeEvent }) {
(0, env18347[16])({
firstVisibleMessageRowIndex: nativeEvent.firstVisibleMessageIndex,
lastVisibleMessageRowIndex: nativeEvent.lastVisibleMessageIndex,
firstVisibleMessagePercentVisible: nativeEvent.firstVisibleMessagePercentVisible,
lastVisibleMessagePercentVisible: nativeEvent.lastVisibleMessagePercentVisible,
source: QuestsVisibleMessagesChangedSource.VISIBILITY_CHANGED
});
}}>{a0.children}</Chat_android>
<ChatTTITracker messages={a0.messages} />
</>;
});
r51.displayName = "Messages";
const r55 = memo(r51, (a0, a1) => !!shallowEqual(a0, a1, ["interactionStates"], {
shouldWarnLargeObjects: false
}) && !!shallowEqual(a0.interactionStates, a1.interactionStates));
export default r55;
+763
View File
@@ -0,0 +1,763 @@
// Metro module 9309 (f9310).
import { updateShouldShowJumpToPresentButton } from "../../chat_input/native/useChatBottomManagerUIStore";
import ReferencedMessageStore from "../../replies/ReferencedMessageStore";
import ChannelStore from "../../../stores/ChannelStore";
import GuildMemberStore from "../../../stores/GuildMemberStore";
import GuildVerificationStore from "../../../stores/GuildVerificationStore";
import MessageStore from "../../../stores/MessageStore";
import NetworkStore from "../../../stores/NetworkStore";
import PermissionStore from "../../../stores/PermissionStore";
import ReadStateStore from "../../../stores/ReadStateStore";
import UserStore from "../../../stores/UserStore";
import { RowType, Changeset } from "./renderer/RowGeneratorConstants";
import { MessageTypes, MessageEmbedTypes, AnalyticEvents, Permissions, MAX_MESSAGES_PER_CHANNEL } from "../../../Constants";
import { isVideoFile, isAudioFile, isImageFile, isVideoContentType } from "../MediaFormatTesters";
import { flattenComponents } from "../../interaction_components/InteractionComponentUtils";
import { ComponentType } from "../../../flow/Server";
import { ObscuredMediaTypes } from "../../explicit_media_redaction/ExplicitMediaRedactionModels";
import { ReactionLocations, addReaction, removeReaction } from "../../reactions/ReactionActionCreators";
import { shouldShowMembershipVerificationGate } from "../../guild_member_verification/hooks/useShowMemberVerificationGate";
import * as _CommunicationDisabledUtils from "../../guild_communication_disabled/CommunicationDisabledUtils";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import { intl, t } from "../../../intl/index.native";
import Module9311 from "../../../_bundle/Module9311";
import { handleOutOfSuperReactions, handleAddNewReactions } from "../../reactions/native/ReactionUtils";
import { isPremium } from "../../../utils/PremiumTypeUtils";
import { triggerHapticFeedback } from "../../haptics/HapticUtils.native";
import HapticFeedbackTypes from "../../haptics/HapticFeedbackTypes";
import { openMemberVerificationModal } from "../../guild_member_verification/MemberVerificationModalActionCreators";
import ThreadActionCreators from "../../threads/ThreadActionCreators";
import { trackForumPostLinkCopied } from "../../forums/tracking/Tracking";
import { trackWithMetadata } from "../../app_analytics/AppAnalyticsUtils";
import { copy } from "../../../utils/ClipboardUtils.native";
import { getChannelPermalink, getChannelLinkToCopy } from "../../../utils/ChannelUtils";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import { presentLinkCopied } from "../../toast/native/ToastUtils";
import { findMessageRowIndex } from "../../chat/native/computeScrollData";
import TTITracker from "../../tti_analytics/TTITracker";
import Module12 from "../../../_bundle/Module12";
import { isIOS } from "../../../utils/PlatformUtils";
import { KeyboardTypes } from "../../keyboard/native/KeyboardTypes";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import NativeChatUtils, { ChatScrollPosition } from "../../chat/native/NativeChatUtils";
import MessageActionCreators from "../../../actions/MessageActionCreators";
import { QuestsVisibleMessagesChangedSource } from "../../quests/QuestTypes";
import { JumpType } from "../../../flow/Client";
import { questsVisibleMobileMessagesChanged } from "../../quests/QuestActionCreators";
import { handleAnnouncementMessageViewTracking, handleOfficialMessageViewTracking, handleRichPresenceInviteEmbedViewTracking, handleVoiceInviteEmbedViewTracking } from "./MessageImpressionAnalyticsHelpers";
function $mk82284() {
return (a0) => a0.id;
}
function $mk82287($env) {
return () => {
const r9 = $env;
const r3 = r9[2];
const scrollToMessageId3 = r9[0];
const r7 = r3(scrollToMessageId3);
if (r7 != null) {
const r11 = r9[1];
if (r11.current != null) {
const r12 = r9[4];
let r13 = false;
if (r12) {
const r5 = r9[3];
const r15 = $env.$parent;
r5({
scrollToMessageId: scrollToMessageId3,
jumpTargetId: scrollToMessageId3,
jumpType: r9[5],
focusTargetId: scrollToMessageId3,
overrideScrollJumpType: (0, r15[0])(r15[2][45]).JumpType.INSTANT,
isRescrolling: true
});
r13 = true;
}
if (!r13) {
const r23 = $env.$parent;
(0, r23[1])(r23[2][42]).scrollTo(r11.current, r7, {
animated: r9[5] === (0, r23[0])(r23[2][45]).JumpType.ANIMATED
});
}
}
}
};
}
function $mk115464($env) {
return () => {
const r3 = $env;
return (0, r3[1])(!r3[0]);
};
}
let getMessage, parseVoiceStateChannelIdSummary;
let env6129 = {};
export function getVisibleMessages({ firstVisibleMessageRowIndex, lastVisibleMessageRowIndex, firstVisibleMessagePercentVisible, lastVisibleMessagePercentVisible, chatManager, channelId }) {
let percentVisible;
if (firstVisibleMessageRowIndex != null && lastVisibleMessageRowIndex != null && !(firstVisibleMessageRowIndex < 0) && !(lastVisibleMessageRowIndex < 0) && chatManager._rows != null && chatManager._messages != null) {
const r21 = [];
let r6 = firstVisibleMessageRowIndex;
while (r6 >= lastVisibleMessageRowIndex) {
const r15 = chatManager._rows[r6];
const r23 = r6;
if (r15 != null && r15.type === RowType.MESSAGE) {
if (r15.message?.id != null) {
if (r23 === firstVisibleMessageRowIndex) {
percentVisible = firstVisibleMessagePercentVisible;
if (percentVisible == null) {
percentVisible = r23 === lastVisibleMessageRowIndex && lastVisibleMessagePercentVisible != null ? lastVisibleMessagePercentVisible : 1;
}
} else {
percentVisible = r23 === lastVisibleMessageRowIndex && lastVisibleMessagePercentVisible != null ? lastVisibleMessagePercentVisible : 1;
}
const message = MessageStore.getMessage(channelId, r15.message.id);
if (message != null) {
r21.push({
message,
percentVisible,
state: message.state
});
}
}
}
r6 = r23 - 1;
}
return r21;
}
return [];
}
getMessage = function getMessage(a0, c17128_0) {
return Module12.find(a0.toArray(), ({ id, nonce }) => id === c17128_0 || nonce === c17128_0);
};
parseVoiceStateChannelIdSummary = function parseVoiceStateChannelIdSummary(a0) {
const map = new Map();
if (a0 != null && a0 !== "") {
for (const item of a0.split("|")) {
const [r40, r42] = item.split(":");
if (r40 != null) {
let r44 = r42;
if (r44 == null) {
r44 = "";
}
map.set(r40, r44);
}
}
return map;
}
return map;
};
export function getLongPressSelectedMedia(a0, a1, a2, a3, a4) {
const type = a0.type;
const THREAD_STARTER_MESSAGE = MessageTypes.THREAD_STARTER_MESSAGE;
let r3 = a0;
if (type === THREAD_STARTER_MESSAGE) {
const messageReference = a0.messageReference;
r3 = a0;
if (messageReference != null) {
const message = ReferencedMessageStore.getMessageByReference(a0.messageReference).message;
r3 = message ?? a0;
}
}
if (a2 === "attachment") {
let source3 = r3.attachments[a1];
if (source3 == null) {
const contentMessage = r3.getContentMessage();
source3 = contentMessage == null ? void 0 : contentMessage.attachments[a1];
}
const r99 = source3 == null;
let r100 = null;
if (!r99) {
const mediaType = isVideoFile(source3.filename) ? "video" : isAudioFile(source3.filename) ? "audio" : isImageFile(source3.filename) ? "image" : "file";
let content_type = source3.content_type;
if (content_type == null) {
content_type = void 0;
}
r100 = {
sourceType: "attachment",
source: source3,
mediaType,
mediaUrl: source3.url,
contentType: content_type
};
}
return r100;
}
if (a2 === "embed") {
const source2 = r3.embeds[a1];
if (source2 == null) {
return null;
}
if (source2.type === MessageEmbedTypes.IMAGE && source2.url != null) {
return {
sourceType: "embed",
source: source2,
mediaType: "image",
mediaUrl: source2.url,
contentType: void 0
};
}
if (source2.type === MessageEmbedTypes.GIFV) {
if (source2.video?.url != null) {
return {
sourceType: "embed",
source: source2,
mediaType: "video",
mediaUrl: source2.video.proxyURL != null && source2.video.proxyURL !== "" ? source2.video.proxyURL : source2.video.url,
contentType: source2.video.contentType
};
}
}
if (source2.type === MessageEmbedTypes.RICH) {
if (source2.image?.url != null) {
return {
sourceType: "embed",
source: source2,
mediaType: "image",
mediaUrl: source2.image.url,
contentType: source2.image.contentType
};
}
if (source2.video?.url != null) {
return {
sourceType: "embed",
source: source2,
mediaType: "video",
mediaUrl: source2.video.url,
contentType: source2.video.contentType
};
}
}
return null;
}
if (a2 === "component") {
if (a3 == null) {
return null;
}
const source = flattenComponents(r3.components).get(a3);
if (source == null) {
return null;
}
if (source.type === ComponentType.MEDIA_GALLERY) {
if (a4 == null) {
return null;
}
const r38 = source.items[a4];
if (r38 == null) {
return null;
}
const media = r38.media;
return {
sourceType: "component",
source,
mediaType: isVideoContentType(media.contentType) ? "video" : "image",
mediaUrl: media.url
};
}
return null;
}
return null;
}
export function toObscuredMedia(a0) {
return a0.sourceType === "attachment" ? {
type: ObscuredMediaTypes.Attachment,
media: a0.source
} : a0.sourceType === "embed" ? {
type: ObscuredMediaTypes.Embed,
media: a0.source
} : null;
}
export function handleAddOrRemoveReaction(a0, a1, a2, burst = false, location2 = ReactionLocations.MESSAGE) {
const guildId = a1.getGuildId();
const currentUser = UserStore.getCurrentUser();
const id = currentUser?.id;
const r8 = guildId != null && GuildVerificationStore.canChatInGuild(guildId);
const r33 = guildId != null && shouldShowMembershipVerificationGate(guildId);
const r14 = guildId != null ? id != null ? GuildMemberStore.getMember(guildId, id) : null : null;
L38: {
const isMemberCommunicationDisabled = _CommunicationDisabledUtils.isMemberCommunicationDisabled(r14);
if (a1.isArchivedLockedThread()) {
ToastActionCreators.open({
key: "ARCHIVED_POST_REACTIONS_DISABLED_TOAST",
content: a1.isForumPost() ? intl.string(t.EJQrFq) : intl.string(t.X2L3Oa),
icon: Module9311
});
} else {
if (a2 != null) {
if (burst && !a2.me_burst === true && !isPremium(currentUser)) {
return handleOutOfSuperReactions();
}
L33: {
if (a2.me !== true) {
if (burst && a2.me_burst === true) {
break L33;
}
L30: {
if (!r33) {
if (!a1.isPrivate() && !r8) {
break L30;
}
if (!isMemberCommunicationDisabled) {
addReaction(a1.id, a0, a2.emoji, location2, {
burst
});
if (!burst) {
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
}
return void 0;
}
}
}
if (!r33) {
break L38;
}
const guildId2 = a1.getGuildId();
if (guildId2 == null) {
break L38;
}
return openMemberVerificationModal(guildId2);
}
}
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
removeReaction({
channelId: a1.id,
messageId: a0,
emoji: a2.emoji,
location: location2,
options: {
burst
}
});
return void 0;
}
handleAddNewReactions(a1, a0, location2, {
burst
});
}
}
}
export function handleToggleFollowForumPost(a0, a1) {
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
if (a1) {
ThreadActionCreators.leaveThread(a0, "iOS Forum Toolbar");
} else {
ThreadActionCreators.joinThread(a0, "iOS Forum Toolbar");
}
}
export function handleCopyLinkForumPost(a0, a1, a2) {
const channel2 = ChannelStore.getChannel(a1);
const channel = ChannelStore.getChannel(channel2?.parent_id);
let r16 = channel == null ? void 0 : channel.isMediaChannel();
if (r16 == null) {
r16 = false;
}
trackForumPostLinkCopied({
postId: a1,
location: a2
});
if (r16) {
trackWithMetadata(AnalyticEvents.MEDIA_POST_SHARE_PROMPT_CLICKED, {
media_post_id: a1
});
}
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
if (channel2 == null) {
copy(getChannelPermalink(a0, a1, r16 === true ? SnowflakeUtils.castChannelIdAsMessageId(a1) : void 0));
} else {
copy(getChannelLinkToCopy(channel2, channel));
}
presentLinkCopied();
}
export function findMessageIndex(a0, a1) {
if (a1 != null) {
return findMessageRowIndex(a0, a1);
}
}
export function shouldJumpToOriginalPost(a0, a1, a2, a3) {
return a0.isForumPost() && SnowflakeUtils.castChannelIdAsMessageId(a1) === a2.jumpTargetId && !a3;
}
export function startOrCancelChannelLatestMessagesLoad(a0) {
if (a0.jumpTargetId == null && (a0.oldestUnreadMessageId == null && !a0.shouldJumpToOriginalPost)) {
a0.tracker.start({
channelId: a0.channelId
});
} else {
a0.tracker.cancel();
}
}
export function recordTimings(a0, a1) {
TTITracker.recordMessageRender(a0, a1.map($mk82284()), a1.hasFetched || a1.ready && !a1.cached, a1.hasMoreAfter);
}
export function findMessageIndexInRows(a0, a1) {
if (a0 != null) {
return findMessageRowIndex(a1, a0);
}
}
export { getMessage };
export function isLoadingAtTop(a0, a1) {
if (!a1) {
return false;
}
for (const item of a0) {
if (item.changeType !== Changeset.INSERT) {
continue;
}
return item.index <= 1;
}
return false;
}
export function handleTapTableView(a0, a1) {
if (isIOS() && a1 !== KeyboardTypes.SYSTEM) {
const current = a0.current;
if (current != null) {
current.closeCustomKeyboard();
}
}
}
export function handleMediaPlayFinishedAnalytics(a0) {
AnalyticsUtils.track(AnalyticEvents.MEDIA_PLAY_FINISHED, {
play_time_sec: a0.playWallTimeMs / 1000,
play_wall_time_ms: a0.playWallTimeMs,
first_play_waiting_ms: Math.min(a0.firstPlayWaitingMs, 600000),
stall_count: a0.stallCount,
stall_ms: a0.stallMs,
seek_count: a0.seekCount,
seek_waiting_ms: null,
media_source: a0.mediaSource,
mime_type: a0.mimeType != null ? a0.mimeType !== "" ? a0.mimeType : null : null,
file_size: null,
file_duration_sec: a0.fileDurationSec,
connection_type: NetworkStore.getType(),
effective_connection_speed: NetworkStore.getEffectiveConnectionSpeed(),
service_provider: NetworkStore.getServiceProvider()
});
}
export function scrollToBottom(a0, a1, a2, r5 = true) {
a2({
eventTimestamp: Date.now(),
isAtBottom: true
});
const current = a0.current;
if (r5) {
r5 = !a1;
}
NativeChatUtils.scrollToBottom(current, r5);
}
export function scrollToTop({ current }, a1, r5 = true) {
if (r5) {
r5 = !a1;
}
NativeChatUtils.scrollToTop(current, r5);
}
export function scrollToRelativeOffset({ current }, a1, a2, r6 = true) {
if (r6) {
r6 = !a1;
}
NativeChatUtils.scrollToRelativeOffset(current, a2, r6);
}
export function scrollToTopMessage(a0, a1) {
const previousRows = a1.getPreviousRows();
if (previousRows.length > 0) {
NativeChatUtils.scrollTo(a0.current, previousRows.length - 1);
}
}
export function canAddNewReactions(a0, a1) {
return (a1 ? PermissionStore.can(Permissions.ADD_REACTIONS, a0) : a1) || a0.isPrivate();
}
export function loadMoreBefore(a0, a1, a2) {
a2(true);
if (a1.hasMoreBefore && !a1.loadingMore) {
MessageActionCreators.fetchMessages({
channelId: a0,
before: a1.first()?.id,
limit: MAX_MESSAGES_PER_CHANNEL
});
}
}
export function loadMoreAfter(a0, a1, a2) {
a2(true);
if (a1.hasMoreAfter && !a1.loadingMore) {
MessageActionCreators.fetchMessages({
channelId: a0,
after: a1.last()?.id,
limit: MAX_MESSAGES_PER_CHANNEL
});
}
}
export function clearRows(a0, a1, a2, a3, a4) {
a4({
animated: false,
hasHandledScroll: false,
isNearBottom: false,
isAtBottom: false,
isNearTop: false,
decelerating: false,
dragging: false,
hasMoreMessagesAfterForLastUpdate: false,
pendingUpdatesQueue: [],
_loaded: false,
animatingStickerMessageId: null
});
a1.clear();
(0, updateShouldShowJumpToPresentButton)(a2, a3, false);
NativeChatUtils.clearRows(a0.current);
}
export function handleFirstLayout(a0, a1, a2, a3, a4) {
a0({
firstVisibleMessageRowIndex: a1,
lastVisibleMessageRowIndex: a2,
firstVisibleMessagePercentVisible: a3,
lastVisibleMessagePercentVisible: a4,
source: QuestsVisibleMessagesChangedSource.FIRST_LAYOUT
});
}
export function handleMessageVisibilityChanged(a0, a1, a2, a3, a4) {
a0({
firstVisibleMessageRowIndex: a1,
lastVisibleMessageRowIndex: a2,
firstVisibleMessagePercentVisible: a3,
lastVisibleMessagePercentVisible: a4,
source: QuestsVisibleMessagesChangedSource.VISIBILITY_CHANGED
});
}
export function handleLongPressSticker(a0, a1, a2) {
const set = new Set([a0]);
if (a1 != null) {
set.add(a1);
}
const r14 = a1 !== a0 ? a0 : null;
a2({
forceRender: true,
updateMessageIds: set
});
return r14;
}
export async function handleTapNavBar(c26422_0) {
let c26422_1;
L19: {
L18: {
L14: {
let env30085;
const r13 = env30085 = {};
c26422_1 = r13;
env30085[0] = void 0;
env30085[1] = void 0;
const { channel, useReducedMotion } = c26422_0;
env30085[0] = useReducedMotion;
const { isNearTop, messages: messages2, findMessageIndex: findMessageIndex2 } = c26422_0;
env30085[1] = c26422_0.scrollToTop;
const chatRef2 = c26422_0.chatRef;
if (!channel.isForumPost()) {
break L19;
}
if (isNearTop) {
break L19;
}
if (getMessage(messages2, SnowflakeUtils.castChannelIdAsMessageId(channel.id)) == null) {
await MessageActionCreators.fetchMessages({
channelId: channel.id,
jump: {
messageId: channel.id,
flash: false
},
limit: MAX_MESSAGES_PER_CHANNEL
});
setTimeout($mk115464(c26422_1), 50);
break L18;
}
const r60 = findMessageIndex2(SnowflakeUtils.castChannelIdAsMessageId(channel.id));
if (r60 == null) {
break L14;
}
NativeChatUtils.scrollTo(chatRef2.current, r60, {
animated: !useReducedMotion
});
setTimeout(() => (0, env30085[1])(!env30085[0]), 10 * r60);
break L19;
}
return void 0;
}
return void 0;
}
}
export function jumpToPresent(a0, a1, a2) {
const jumpReturnTargetId = a0.jumpReturnTargetId;
if (jumpReturnTargetId == null) {
if (!a0.loadingMore) {
if (a0.hasMoreAfter) {
MessageActionCreators.fetchMessages({
channelId: a1.id,
limit: MAX_MESSAGES_PER_CHANNEL,
jump: {
present: true
}
});
} else {
a2();
}
}
} else {
MessageActionCreators.jumpToMessage({
channelId: a1.id,
messageId: jumpReturnTargetId,
flash: true
});
}
}
export function scrollToNewMessages({ channel }) {
let messageId = ReadStateStore.ackMessageId(channel.id);
if (messageId == null) {
messageId = channel.id;
}
MessageActionCreators.jumpToMessage({
channelId: channel.id,
messageId,
offset: 1,
context: "Mark As Read"
});
}
export function syncMessageDisplay({ messages, isMessagesReady, oldestUnreadMessageId, channelId, updateRows, scrollToMessageId }) {
if (isMessagesReady) {
updateRows({
scrollToMessageId: messages.jumpTargetId,
jumpTargetId: messages.jumpTargetId,
jumpType: JumpType.INSTANT,
focusTargetId: messages.focusTargetId
});
if (messages.jumpTargetId != null) {
scrollToMessageId({
scrollToMessageId: messages.jumpTargetId,
jumpTargetId: messages.jumpTargetId,
jumpType: JumpType.INSTANT
});
} else if (oldestUnreadMessageId != null) {
setTimeout(() => scrollToMessageId({
scrollToMessageId: oldestUnreadMessageId,
jumpTargetId: messages.jumpTargetId,
jumpType: JumpType.INSTANT
}), 50);
}
} else {
updateRows({});
}
TTITracker.recordMessageRender(channelId, messages.map($mk82284()), messages.hasFetched || messages.ready && !messages.cached, messages.hasMoreAfter);
}
export function getChatRef(a0) {
return a0;
}
export function maybeRescrollToMessageId(a0, a1) {
let env17129;
const r3 = env17129 = {
$parent: env6129
};
env17129[0] = a0;
env17129[1] = a1.chatRef;
env17129[2] = a1.findMessageIndex;
env17129[3] = a1.updateRows;
const updateRowsEnabled = a1.updateRowsEnabled;
env17129[4] = updateRowsEnabled !== void 0 && updateRowsEnabled;
let jumpType = a1.jumpType;
if (jumpType === void 0) {
jumpType = JumpType.INSTANT;
}
env17129[5] = jumpType;
if (a0 != null) {
setTimeout($mk82287(r3), 50);
}
}
export function scrollToMessageIdWithRescroll(a0) {
let animated, c17131_4;
const { scrollToMessageId: scrollToMessageId2, jumpTargetId = null, jumpType = JumpType.ANIMATED, scrollPosition = ChatScrollPosition.TOP, minimizeScrolling = false, isRescrolling = false } = a0;
let useReducedMotion = a0.useReducedMotion;
const { chatRef, findMessageIndex: findMessageIndex2, updateRows } = a0;
if (!useReducedMotion) {
useReducedMotion = jumpType === JumpType.INSTANT;
}
L25: {
animated = !useReducedMotion;
if (isIOS() && !isRescrolling) {
let r46 = useReducedMotion ? JumpType.INSTANT : JumpType.ANIMATED;
let env17132;
const r47 = env17132 = {
$parent: env6129
};
env17132[0] = scrollToMessageId2;
env17132[1] = chatRef;
env17132[2] = findMessageIndex2;
env17132[3] = updateRows;
env17132[4] = true;
if (r46 === void 0) {
r46 = JumpType.INSTANT;
}
env17132[5] = r46;
if (scrollToMessageId2 == null) {
break L25;
}
setTimeout($mk82287(r47), 50);
} else {
const r55 = findMessageIndex2(scrollToMessageId2);
c17131_4 = r55;
if (r55 != null) {
if (minimizeScrolling) {
setTimeout(() => {
NativeChatUtils.scrollIntoView(chatRef.current, c17131_4, {
animated,
highlight: jumpTargetId === scrollToMessageId2
});
}, 5);
} else {
NativeChatUtils.scrollTo(chatRef.current, r55, {
animated,
highlight: jumpTargetId === scrollToMessageId2,
position: scrollPosition
});
}
}
}
}
}
export function handleVisibleMessagesChange({ firstVisibleMessageRowIndex, firstVisibleMessagePercentVisible, lastVisibleMessageRowIndex, lastVisibleMessagePercentVisible, source, chatManager, shouldTrackAnnouncementMessageViews, shouldTrackOfficialMessageViews, shouldTrackRichPresenceInviteEmbedViews, shouldTrackVoiceInviteEmbedViews, guildId, channelId, channel }) {
if (firstVisibleMessageRowIndex != null && lastVisibleMessageRowIndex != null && firstVisibleMessagePercentVisible != null && lastVisibleMessagePercentVisible != null) {
const visibleMessages = getVisibleMessages({
firstVisibleMessageRowIndex,
lastVisibleMessageRowIndex,
firstVisibleMessagePercentVisible,
lastVisibleMessagePercentVisible,
chatManager,
channelId
});
if (!(visibleMessages.length <= 0)) {
questsVisibleMobileMessagesChanged({
visibleMessages,
source
});
handleAnnouncementMessageViewTracking(visibleMessages, shouldTrackAnnouncementMessageViews, guildId, channel);
handleOfficialMessageViewTracking(visibleMessages, shouldTrackOfficialMessageViews, guildId, channel);
handleRichPresenceInviteEmbedViewTracking(visibleMessages, shouldTrackRichPresenceInviteEmbedViews, guildId, channel);
handleVoiceInviteEmbedViewTracking(visibleMessages, shouldTrackVoiceInviteEmbedViews, guildId, channel);
}
}
}
export function getVoiceStateChannelSummaryFromVoiceStates(a0) {
return Object.entries(a0).filter((item) => {
const [, r13] = item;
return r13.discoverable !== false;
}).map((item) => {
const [r7, r24] = item;
let channelId = r24.channelId;
if (channelId == null) {
channelId = "";
}
return `${r7}:${channelId}`;
}).sort().join("|");
}
export function getVoiceChannelIdChangedAuthorIds(a0, a1) {
const r4 = parseVoiceStateChannelIdSummary(a0);
const r3 = parseVoiceStateChannelIdSummary(a1);
const set = new Set();
const r29 = Set;
const r31 = [...r4.keys(), ...r3.keys()];
for (const item of new r29(r31)) {
if (r4.get(item) !== r3.get(item)) {
set.add(item);
}
}
return set;
}
@@ -0,0 +1,81 @@
// Metro module 10906 (f10907).
import { useEffect, useMemo } from "react";
import { View } from "react-native";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import { EVERYONE_CHANNEL_ID } from "../../../stores/ChannelMemberStore";
import GuildRoleStore from "../../../stores/GuildRoleStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import { requestMembersForRole } from "../../guild_settings/GuildRoleMemberActionCreators";
import { useStateFromStores } from "../../../_bundle/Module589";
import useGuildRoleMemberCounts from "../../guild_role_subscriptions/useGuildRoleMemberCounts";
import { RoleDot } from "../../../design/void/native";
import { Text } from "../../../design/components/Text/native/Text";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import GuildChannelUserList from "../../main_tabs_v2/native/shared_components/user_list/GuildChannelUserList";
const useStyles = createStyles({
header: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_4,
paddingTop: Module712.space.PX_12,
paddingBottom: Module712.space.PX_4,
paddingHorizontal: Module712.space.PX_16
},
headerText: {
flex: 1
},
roleDot: {
paddingTop: 0
},
memberCount: {
color: Module712.colors.TEXT_MUTED
}
});
export default function RoleMembersActionSheet(props) {
let stateFromStores, c18359_4, children;
const { guildId, roleId } = props;
let channelId = props.channelId;
stateFromStores = void 0;
c18359_4 = void 0;
children = void 0;
const styles = useStyles();
useEffect(() => {
if (roleId !== SnowflakeUtils.castGuildIdAsEveryoneGuildRoleId(guildId)) {
requestMembersForRole(guildId, roleId);
}
}, [guildId, roleId]);
stateFromStores = useStateFromStores([GuildRoleStore], () => GuildRoleStore.getRole(guildId, roleId), [guildId, roleId]);
const r1 = useStateFromStores([AccessibilityStore], () => AccessibilityStore.roleStyle) === "dot" && stateFromStores?.colorString != null;
c18359_4 = r1;
const r40 = SnowflakeUtils.castGuildIdAsEveryoneGuildRoleId(guildId);
const guildRoleMemberCounts = useGuildRoleMemberCounts(guildId);
let r45 = null;
if (roleId !== r40) {
let r47 = guildRoleMemberCounts == null ? void 0 : guildRoleMemberCounts[roleId];
if (r47 == null) {
r47 = null;
}
r45 = r47;
}
children = r45;
const memo = useMemo(() => <View style={styles.header}>
{c18359_4 ? <RoleDot color={stateFromStores.colorString} colors={stateFromStores.colorStrings} size="small" containerStyles={styles.roleDot} /> : null}
<Text variant="text-sm/semibold" style={styles.headerText}>
{stateFromStores?.name}
</Text>
{children != null ? <Text variant="text-sm/medium" style={styles.memberCount}>{children}</Text> : null}
</View>, [r1, stateFromStores, children, styles]);
const r52 = stateFromStores == null;
let r53 = null;
if (!r52) {
if (channelId == null) {
channelId = EVERYONE_CHANNEL_ID;
}
r53 = <BottomSheet scrollable header={memo}>
<GuildChannelUserList guildId={guildId} channelId={channelId} roleId={roleId} headerShown={false} inActionSheet disableStickySections disableThemedGradient />
</BottomSheet>;
}
return r53;
};
@@ -0,0 +1,95 @@
// Metro module 10414 (f10415).
import { RowType } from "./renderer/RowGeneratorConstants";
export default class VisibleMessagesWindowHandler {
data = null;
callback = null;
setCallback = (a0) => {
this.callback = a0;
if (this.data != null) {
this.callback(this.data);
}
};
clearCallback = () => {
this.callback = null;
this.data = null;
};
handleScrollPosition = ({ rows, firstVisibleMessageRowIndex, lastVisibleMessageRowIndex }) => {
let r54, r87;
if (this.callback != null) {
const r1 = firstVisibleMessageRowIndex != null;
let topVisibleMessage = null;
if (r1) {
const r2 = firstVisibleMessageRowIndex >= 0;
let r20 = firstVisibleMessageRowIndex;
topVisibleMessage = null;
if (r2) {
do {
const r14 = rows[r20];
const r21 = r14 != null;
const r10 = r20;
topVisibleMessage = r21 ? "rowType" in r14 ? r14.rowType === RowType.MESSAGE ? r14.message.id : void 0 : r14.type === RowType.MESSAGE ? r14.message?.id : void 0 : void 0;
if (topVisibleMessage != null) {
break;
}
r20 = r10 - 1;
topVisibleMessage = null;
} while (r20 >= 0);
}
}
const r31 = lastVisibleMessageRowIndex != null;
let bottomVisibleMessage = null;
if (r31) {
const r34 = lastVisibleMessageRowIndex < rows.length;
let r37 = lastVisibleMessageRowIndex;
bottomVisibleMessage = null;
if (r34) {
do {
const r38 = rows[r37];
const r39 = r38 != null;
const r40 = r37;
bottomVisibleMessage = r39 ? "rowType" in r38 ? r38.rowType === RowType.MESSAGE ? r38.message.id : void 0 : r38.type === RowType.MESSAGE ? r38.message?.id : void 0 : void 0;
if (bottomVisibleMessage != null) {
break;
}
const r52 = r40 + 1;
r54 = r52 < rows.length;
r37 = r52;
bottomVisibleMessage = null;
} while (r54);
}
}
const r55 = firstVisibleMessageRowIndex != null;
let middleVisibleMessage = null;
if (r55) {
const r57 = lastVisibleMessageRowIndex != null;
middleVisibleMessage = null;
if (r57) {
let r65 = firstVisibleMessageRowIndex + Math.floor((lastVisibleMessageRowIndex - firstVisibleMessageRowIndex) / 2);
const r67 = r65 < rows.length;
middleVisibleMessage = null;
if (r67) {
do {
const r70 = rows[r65];
const r71 = r70 != null;
const r72 = r65;
middleVisibleMessage = r71 ? "rowType" in r70 ? r70.rowType === RowType.MESSAGE ? r70.message.id : void 0 : r70.type === RowType.MESSAGE ? r70.message?.id : void 0 : void 0;
if (middleVisibleMessage != null) {
break;
}
const r85 = r72 + 1;
r87 = r85 < rows.length;
r65 = r85;
middleVisibleMessage = null;
} while (r87);
}
}
}
this.data = {
topVisibleMessage,
middleVisibleMessage,
bottomVisibleMessage
};
this.callback(this.data);
}
};
};
@@ -0,0 +1,35 @@
// Metro module 6137 (f6138).
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useBurstReactionAnimationSource } from "./BurstReactionEffectUtils";
import { useStateFromStores } from "../../../../_bundle/Module589";
import FadeOutLottieAnimation from "./FadeOutLottieAnimation";
import LottieAnimationView from "../../../../components_native/common/LottieAnimationView";
const useStyles = createStyles({
content: {
width: "100%"
}
});
export default function BurstReactionAnimation(props) {
const { channelId, messageId, emoji, isFullscreen, onComplete, withFadeOut = true, ...props2 } = props;
const styles = useStyles();
const burstReactionAnimationSource = useBurstReactionAnimationSource({
emoji,
messageId,
channelId,
isFullscreen
});
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
if (burstReactionAnimationSource == null) {
return null;
}
return withFadeOut ? <FadeOutLottieAnimation style={styles.content} loop={false} speed={stateFromStores ? 0.5 : 1.2} {...props2} {...withFadeOut ? {
onComplete
} : {
onAnimationFinish: onComplete
}} source={burstReactionAnimationSource} /> : <LottieAnimationView style={styles.content} loop={false} speed={stateFromStores ? 0.5 : 1.2} {...props2} {...withFadeOut ? {
onComplete
} : {
onAnimationFinish: onComplete
}} source={burstReactionAnimationSource} />;
};
@@ -0,0 +1,155 @@
// Metro module 15739 (f15740).
import { useState, useRef, useEffect } from "react";
import { TouchableOpacity, View, StyleSheet } from "react-native";
import { ContentDismissActionType } from "../../../dismissible_content/DismissibleContentConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { BACKDROP_OPACITY } from "./BurstReactionEffectUtils";
import { triggerHapticFeedback } from "../../../haptics/HapticUtils.native";
import HapticFeedbackTypes from "../../../haptics/HapticFeedbackTypes";
import Dispatcher from "../../../../Dispatcher";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import SelectedDismissibleContent from "../../../dismissible_content/native/SelectedDismissibleContent";
import { DismissibleContent } from "../../../../_bundle/Module1358";
import { OverlayView } from "../../../../design/void/native";
import BurstReactionAnimation from "./BurstReactionAnimation";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { ThemeContextProvider } from "../../../../_bundle/Module3901";
let useStyles, __initData, __initData2;
const BurstReactionAnimationContainerInner = function BurstReactionAnimationContainerInner() {
let styles, ref, animatedStyle;
const handleComponentFinish2 = function handleComponentFinish() {
if (ref.current === false) {
setState(null);
}
};
styles = useStyles();
const [state, setState] = useState(null);
const [state2, setState2] = useState(false);
ref = useRef(false);
useEffect(() => {
const handleEffectReceived2 = function handleEffectReceived(a0) {
setState({
channelId: a0.channelId,
emoji: a0.emoji,
messageId: a0.messageId
});
setState2(true);
ref.current = true;
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_HEAVY);
};
Dispatcher.subscribe("BURST_REACTION_EFFECT_SEND", handleEffectReceived2);
return () => {
Dispatcher.unsubscribe("BURST_REACTION_EFFECT_SEND", handleEffectReceived2);
};
}, []);
const y = function y() {
let r29;
if (state == null) {
r29 = {
opacity: 0
};
} else {
const r3 = {
opacity: null
};
const r21 = {
duration: 300
};
if (state2) {
r3.opacity = _timing.withTiming(1, r21);
r29 = r3;
} else {
const n = function n(a0) {
if (a0) {
_ReanimatedRexport.runOnJS(handleComponentFinish2)();
}
};
n.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
handleComponentFinish: handleComponentFinish2
};
n.__workletHash = 9326347209552;
n.__initData = __initData2;
r3.opacity = _timing.withTiming(0, r21, "respect-motion-settings", n);
r29 = r3;
}
}
return r29;
};
y.__closure = {
animationData: state,
showAnimation: state2,
withTiming: _timing.withTiming,
runOnJS: _ReanimatedRexport.runOnJS,
handleComponentFinish: handleComponentFinish2
};
y.__workletHash = 12044515783370;
y.__initData = __initData;
animatedStyle = useAnimatedStyle(y);
return state == null ? null : <SelectedDismissibleContent contentTypes={[DismissibleContent.SUPER_REACTIONS_MOBILE_FULLSCREEN_TAP_TO_DISMISS]}>
{({ visibleContent, markAsDismissed }) => <OverlayView style={styles.fill}>
<ReanimatedRexport.View style={[styles.fill, animatedStyle]}>
<TouchableOpacity activeOpacity={BACKDROP_OPACITY} onPress={() => {
setState2(false);
ref.current = false;
markAsDismissed(ContentDismissActionType.UNKNOWN);
}} style={styles.fill}>
<View style={styles.background} />
<View style={styles.fill}>
{state2 ? <BurstReactionAnimation isFullscreen channelId={state.channelId} messageId={state.messageId} emoji={state.emoji} loop={false} withFadeOut={false} onComplete={() => {
setState2(false);
ref.current = false;
}} /> : null}
</View>
{visibleContent === DismissibleContent.SUPER_REACTIONS_MOBILE_FULLSCREEN_TAP_TO_DISMISS && <>
<Text style={styles.dismissTextContainer} variant="text-sm/medium">
{intl.string(t.QpPMih)}
</Text>
<View style={styles.dismissTextBackground} />
</>}
</TouchableOpacity>
</ReanimatedRexport.View>
</OverlayView>}
</SelectedDismissibleContent>;
};
useStyles = createStyles({
background: {
...StyleSheet.absoluteFillObject,
backgroundColor: Module712.colors.BLACK,
opacity: BACKDROP_OPACITY
},
fill: {
...StyleSheet.absoluteFillObject,
flex: 1,
alignItems: "center",
justifyContent: "center"
},
dismissTextContainer: {
position: "absolute",
bottom: 48,
zIndex: 1
},
dismissTextBackground: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGHEST,
borderRadius: Module712.radii.round,
position: "absolute",
bottom: -600,
height: 700,
width: 700
}
});
__initData = {
code: "function BurstReactionAnimationContainerTsx1(){const{animationData,showAnimation,withTiming,runOnJS,handleComponentFinish}=this.__closure;if(animationData==null){return{opacity:0};}if(!showAnimation){return{opacity:withTiming(0,{duration:300},'respect-motion-settings',function(finished){if(finished)runOnJS(handleComponentFinish)();})};}return{opacity:withTiming(1,{duration:300})};}"
};
__initData2 = {
code: "function BurstReactionAnimationContainerTsx2(finished){const{runOnJS,handleComponentFinish}=this.__closure;if(finished)runOnJS(handleComponentFinish)();}"
};
export default function BurstReactionAnimationContainer() {
return <ThemeContextProvider theme={Module712.themes.DARKER}>
<BurstReactionAnimationContainerInner />
</ThemeContextProvider>;
};
@@ -0,0 +1,7 @@
// Metro module 6136 (f6137).
import { ReactionTypes } from "../../MessageReactionsTypes";
import BurstReactionAnimation from "./BurstReactionAnimation";
export default function BurstReactionAnimationPreview(props) {
const { channelId, emoji, messageId } = props;
return props.reactionType === ReactionTypes.BURST ? <BurstReactionAnimation isFullscreen channelId={channelId} messageId={messageId} emoji={emoji} /> : null;
};
@@ -0,0 +1,226 @@
// Metro module 6095 (f6096).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useState, useEffect } from "react";
import { NativeModules, Image } from "react-native";
import { getEmojiUrl } from "../../../../utils/EmojiUtils";
import { getBurstAnimation } from "../../getBurstAnimation.native";
import { makeSource } from "../../../../utils/AvatarUtils";
import { isAndroid } from "../../../../utils/PlatformUtils";
import { replaceAnimationColors } from "../../BurstReactionEffectUtils";
let env3874 = {};
env3874[7] = function _generateAnimationSource() {
const r8 = async (c25711_0, c25711_1, c25711_2, c25711_3) => {
let r165, r234;
let emojiUrl;
let c25711_8 = 0;
let c29668_0, c29668_1, c29668_2, c29668_3, c29668_4, c29668_5, c29668_6, c29668_7, c29668_8, c29668_9, c29668_10, c29668_11;
try {
c29668_0 = c25711_2;
c29668_1 = void 0;
c29668_2 = void 0;
c29668_3 = void 0;
c29668_4 = void 0;
c29668_5 = void 0;
c29668_6 = void 0;
c29668_7 = void 0;
c29668_8 = void 0;
c29668_9 = void 0;
c29668_10 = void 0;
c29668_11 = void 0;
c25711_8 = 1;
const emojiUrl2 = getEmojiUrl({
...c25711_2,
animated: false
}, 128);
emojiUrl = emojiUrl2;
if (emojiUrl2 == null) {
emojiUrl = "";
}
c29668_2 = emojiUrl;
c29668_3 = await getBurstAnimation(c25711_0, c25711_1, c25711_2.name, c25711_3);
if (c29668_2 !== "") {
c29668_1 = makeSource(c29668_2);
c29668_4 = await NativeModules.ImageManager.getAvatarBase64(c29668_1);
c29668_3.assets[0].p = `data:image/png;base64,${c29668_4}`;
c29668_6 = JSON.stringify(c29668_3);
if (c29668_0.id == null) {
c29668_6 = c29668_6.replace(/"a":{"a":0,"k":\[64,64/, "\"a\":{\"a\":0,\"k\":[36,36");
if (isAndroid()) {
c29668_6 = c29668_6.replace(/"w":128,"h":128/, "\"w\":72,\"h\":72");
}
}
r165 = NativeModules.ImageManager.getDominantColors(c29668_1);
} else {
c29668_5 = `data:image/png;base64,${await NativeModules.ImageManager.getEmojiBase64(c29668_0.name, 128)}`;
c29668_3.assets[0].p = c29668_5;
c29668_1 = makeSource(c29668_5);
c29668_6 = JSON.stringify(c29668_3);
if (c29668_0.id == null) {
c29668_6 = c29668_6.replace(/"a":{"a":0,"k":\[64,64/, "\"a\":{\"a\":0,\"k\":[36,36");
if (isAndroid()) {
c29668_6 = c29668_6.replace(/"w":128,"h":128/, "\"w\":72,\"h\":72");
}
}
r165 = NativeModules.ImageManager.getDominantColors(c29668_1);
}
c29668_7 = await r165;
c29668_8 = (0, _slicedToArray)(c29668_7[0], 3);
c29668_9 = c29668_8[0];
c29668_10 = c29668_8[1];
c29668_11 = c29668_8[2];
c29668_6 = replaceAnimationColors(c29668_6, {
r: c29668_9,
g: c29668_10,
b: c29668_11
});
r234 = JSON.parse(c29668_6);
c25711_8 = 0;
} catch ($e) {
let r7 = $e;
if (c25711_8 !== 0) {
while (true) {
try {
c25711_8 = 0;
} catch ($e) {
r7 = $e;
if (c25711_8 === 0) {
break;
}
continue;
}
return null;
}
}
throw r7;
}
return r234;
};
env3874[7] = r8;
return r8.apply(this, arguments);
};
env3874[8] = function _generateAnimationSourceFromLocalImage() {
const r8 = async (c25712_0) => {
let r150;
let c25712_4 = 0;
let c29669_0, c29669_1, c29669_2, c29669_3, c29669_4, c29669_5, c29669_6, c29669_7, c29669_8, c29669_9, c29669_10;
try {
c29669_0 = void 0;
c29669_1 = void 0;
c29669_0 = c25712_0.animationSource;
c29669_1 = c25712_0.localImageSource;
c29669_2 = void 0;
c29669_3 = void 0;
c29669_4 = void 0;
c29669_5 = void 0;
c29669_6 = void 0;
c29669_7 = void 0;
c29669_8 = void 0;
c29669_9 = void 0;
c29669_10 = void 0;
await void 0;
c25712_4 = 1;
c29669_2 = Image.resolveAssetSource(c29669_1).uri;
c29669_3 = makeSource(c29669_2);
c29669_4 = await NativeModules.ImageManager.getAvatarBase64(c29669_3);
c29669_0.assets[0].p = `data:image/png;base64,${c29669_4}`;
c29669_5 = JSON.stringify(c29669_0);
c29669_6 = await NativeModules.ImageManager.getDominantColors(c29669_3);
c29669_7 = (0, _slicedToArray)(c29669_6[0], 3);
c29669_8 = c29669_7[0];
c29669_9 = c29669_7[1];
c29669_10 = c29669_7[2];
c29669_5 = replaceAnimationColors(c29669_5, {
r: c29669_8,
g: c29669_9,
b: c29669_10
});
r150 = JSON.parse(c29669_5);
c25712_4 = 0;
} catch ($e) {
let r7 = $e;
if (c25712_4 !== 0) {
while (true) {
try {
c25712_4 = 0;
} catch ($e) {
r7 = $e;
if (c25712_4 === 0) {
break;
}
continue;
}
return null;
}
}
throw r7;
}
return r150;
};
env3874[8] = r8;
return r8.apply(this, arguments);
};
export function useBurstReactionAnimationSource({ channelId, messageId, emoji, isFullscreen }) {
const [state, setState] = useState(null);
useEffect(() => {
let _getSource3 = function _getSource() {
const r9 = async () => {
let c31390_0, c31390_1;
L13: {
let env31948;
c31390_1 = void 0;
const r10 = env31948 = {
$parent: env3874
};
c31390_0 = r10;
env31948[0] = void 0;
if (emoji != null) {
env31948[0] = await (function generateAnimationSource(a0, a1, a2, a3) {
return env3874[7].apply(this, arguments);
})(channelId, messageId, emoji, isFullscreen);
(0, setState)(env31948[0]);
break L13;
}
return void 0;
}
};
_getSource3 = r9;
return r9.apply(this, arguments);
};
(function getSource() {
return _getSource3.apply(this, arguments);
})();
}, [channelId, messageId, emoji, isFullscreen]);
return state;
}
export function useSuperReactionAnimationSourceFromLocalImage({ animationSource, localImageSource }) {
const [state, setState2] = useState(null);
useEffect(() => {
let _getSource22 = function _getSource2() {
const r9 = async () => {
let c31391_1;
let env31949;
c31391_1 = void 0;
const r9 = env31949 = {
$parent: env3874
};
let c31391_0 = r9;
env31949[0] = void 0;
env31949[0] = await (function generateAnimationSourceFromLocalImage(a0) {
return env3874[8].apply(this, arguments);
})({
animationSource,
localImageSource
});
(0, setState2)(env31949[0]);
};
_getSource22 = r9;
return r9.apply(this, arguments);
};
(function getSource() {
return _getSource22.apply(this, arguments);
})();
}, [animationSource, localImageSource]);
return state;
}
export const EMOJI_IN_ANIMATION_SIZE = 128;
export const BACKDROP_OPACITY = 0.8;
@@ -0,0 +1,97 @@
// Metro module 6138 (f6139).
import { useState, useEffect } from "react";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../_bundle/Module589";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import LottieAnimationView from "../../../../components_native/common/LottieAnimationView";
const useStyles = createStyles({
content: {
width: "100%"
}
});
const __initData = {
code: "function FadeOutLottieAnimationTsx1(){const{isAnimationComplete,isFadeOut,withTiming,runOnJS,setIsFadeOut}=this.__closure;if(!isAnimationComplete){return{opacity:1};}if(isFadeOut){return{opacity:withTiming(0,{duration:300},'respect-motion-settings',function(finished){if(finished)runOnJS(setIsFadeOut)(false);})};}return{opacity:0};}"
};
const __initData2 = {
code: "function FadeOutLottieAnimationTsx2(finished){const{runOnJS,setIsFadeOut}=this.__closure;if(finished)runOnJS(setIsFadeOut)(false);}"
};
export default function FadeOutLottieAnimation(props) {
let r55;
let onComplete, state, setState, state2, setState2;
L5: {
onComplete = props.onComplete;
const { onComplete: _onComplete, ...props2 } = props;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
const styles = useStyles();
[state, setState] = useState(false);
[state2, setState2] = useState(true);
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
useEffect(() => {
setState(false);
}, []);
const T = function T() {
let r18, r19;
if (state) {
if (state2) {
const t = function t(a0) {
if (a0) {
_ReanimatedRexport.runOnJS(setState2)(false);
}
};
t.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setIsFadeOut: setState2
};
t.__workletHash = 14133863353798;
t.__initData = __initData2;
r19 = {
opacity: _timing.withTiming(0, {
duration: 300
}, "respect-motion-settings", t)
};
} else {
r19 = {
opacity: 0
};
}
r18 = r19;
} else {
r18 = {
opacity: 1
};
}
return r18;
};
T.__closure = {
isAnimationComplete: state,
isFadeOut: state2,
withTiming: _timing.withTiming,
runOnJS: _ReanimatedRexport.runOnJS,
setIsFadeOut: setState2
};
T.__workletHash = 1137618554665;
T.__initData = __initData;
const animatedStyle = useAnimatedStyle(T);
if (state) {
r55 = null;
if (!state2) {
break L5;
}
}
r55 = <ReanimatedRexport.View style={animatedStyle}>
<LottieAnimationView style={styles.content} speed={stateFromStores ? 0.5 : 1} onAnimationFinish={(event) => {
if (onComplete != null) {
onComplete(event);
}
setState(true);
}} {...props2} />
</ReanimatedRexport.View>;
}
return r55;
};
@@ -0,0 +1,22 @@
// Metro module 9334 (f9335).
import { useSuperReactionAnimationSourceFromLocalImage } from "./BurstReactionEffectUtils";
import FadeOutLottieAnimation from "./FadeOutLottieAnimation";
import { HermesBuiltin } from "../../../../_hermes/prelude";
export default function SuperReactionLocalImageAnimation(props) {
const { localImageSource, animationSource } = props;
const r13 = {};
let r2 = null;
const props2 = HermesBuiltin.copyDataProperties(r13, props, {
__proto__: null,
localImageSource: 0,
animationSource: 0
});
const superReactionAnimationSourceFromLocalImage = useSuperReactionAnimationSourceFromLocalImage({
animationSource,
localImageSource
});
if (superReactionAnimationSourceFromLocalImage != null) {
r2 = <FadeOutLottieAnimation loop source={superReactionAnimationSourceFromLocalImage} {...props2} />;
}
return r2;
};
@@ -0,0 +1,72 @@
// Metro module 9313 (f9314).
import { useMemo } from "react";
import { View, StyleSheet } from "react-native";
import UserStore from "../../../../stores/UserStore";
import { AnalyticsPages } from "../../../../Constants";
import { DismissibleContent } from "../../../../_bundle/Module1358";
import * as _Module9314 from "../../../../_bundle/Module9314";
import * as _Module9315 from "../../../../_bundle/Module9315";
import * as _Module9316 from "../../../../_bundle/Module9316";
import * as _Module9317 from "../../../../_bundle/Module9317";
import * as _Module9318 from "../../../../_bundle/Module9318";
import * as _Module9319 from "../../../../_bundle/Module9319";
import * as _Module9320 from "../../../../_bundle/Module9320";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useAnalyticsLocations from "../../../app_analytics/useAnalyticsLocations";
import { useStateFromStores } from "../../../../_bundle/Module589";
import * as _PremiumUtils from "../../../../utils/PremiumUtils";
import openPremiumModal from "../../../../components_native/premium/openPremiumModal";
import { PremiumFeatureCardOrder } from "../../../user_settings/premium/native/PremiumFeaturesCards";
import Module12 from "../../../../_bundle/Module12";
import SuperReactionLocalImageAnimation from "./SuperReactionLocalImageAnimation";
import * as _Module6106 from "../../../../_bundle/Module6106";
import PremiumUpsellTooltipActionSheet from "../../../upsell_tooltip/native/PremiumUpsellTooltipActionSheet";
import { intl, t } from "../../../../intl/index.native";
import { BACKDROP_OPACITY } from "./BurstReactionEffectUtils";
import { NitroWheel } from "../../../../design/void/native";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
const SUPER_REACTIONS_COACHMARK_MOBILE = DismissibleContent.SUPER_REACTIONS_COACHMARK_MOBILE;
let c6132_9 = [_Module9314, _Module9315, _Module9316, _Module9317, _Module9315, _Module9318, _Module9319, _Module9320];
const useStyles = createStyles({
fill: {
...StyleSheet.absoluteFillObject,
flex: 1,
alignItems: "center",
justifyContent: "center",
top: -150
},
nitroIcon: {
tintColor: Module712.colors.WHITE,
width: 32,
height: 32,
marginVertical: -8,
marginRight: -4
},
description: {
paddingHorizontal: 16
}
});
export default function SuperReactionCoachmarkActionSheet(props) {
const onDismiss = props.onDismiss;
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations().analyticsLocations;
const analyticsLocation = {
page: AnalyticsPages.PREMIUM_UPSELL_BURST_REACTIONS
};
const isPremium = _PremiumUtils.isPremium(useStateFromStores([UserStore], () => UserStore.getCurrentUser()));
const memo = useMemo(() => <View style={styles.fill}>
<SuperReactionLocalImageAnimation localImageSource={c6132_9[Module12.random(0, c6132_9.length - 1)]} animationSource={_Module6106} />
</View>, [styles]);
return isPremium ? null : <PremiumUpsellTooltipActionSheet title={intl.string(t.Wfl5zp)} backdropProps={{
backdropOpacity: BACKDROP_OPACITY,
backdropChildren: memo
}} description={intl.string(t.eikz43)} descriptionStyle={styles.description} dismissibleContent={SUPER_REACTIONS_COACHMARK_MOBILE} primaryButtonText={intl.string(t.sEAnVH)} primaryButtonIcon={() => <NitroWheel style={styles.nitroIcon} />} onPrimaryButtonPress={() => {
ActionSheetActionCreators.hideActionSheet();
openPremiumModal({
analyticsLocation,
analyticsLocations,
premiumFeatureCardOrder: PremiumFeatureCardOrder.TIER_2_LEADING
});
}} secondaryButtonText={intl.string(t.TulDPl)} onDismiss={onDismiss} />;
};
@@ -0,0 +1,284 @@
// Metro module 11145 (f11146).
import PushFeedbackStore from "../../push_feedback/PushFeedbackStore";
import EditMessageStore from "../../../stores/EditMessageStore";
import UploadStore from "../../../stores/UploadStore";
import { Changeset, LoadingType, RowType, SeparatorType } from "./renderer/RowGeneratorConstants";
import { MessageFlags } from "../../../Constants";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import isNewMessageGroup from "../isNewMessageGroup";
import { tryCreateInjectedMessage } from "../tryInjectMessage";
import { intl, t } from "../../../intl/index.native";
import { isSameDay, dateFormat } from "../../../utils/DateUtils";
import { canReplyToMessage } from "../../replies/canReplyToMessage";
import canEditMessage from "../canEditMessage";
import { isNonModInLockedThread } from "../../threads/ThreadHooks";
export default function createChannelStream({ channel, messages, uploads, oldestUnreadMessageId, replyingMessageId, currentUserId, canAddNewReactions, selectedSummary, chatManager, roleStyle, forceRender, updateMessageIds, isResourceChannel, unloadableContentEntryMessageIds }) {
let c18560_13, c18560_14, c18560_16, insertMessage2, determineChangeType2;
c18560_16 = void 0;
const unreadFilter2 = function unreadFilter(a0) {
const isForumPost = channel.isForumPost();
const r2 = a0.id === oldestUnreadMessageId;
return isForumPost ? r2 ? a0.id !== SnowflakeUtils.castChannelIdAsMessageId(channel.id) : r2 : r2;
};
insertMessage2 = function insertMessage(a0) {
L11: {
const r5 = c18560_16[0];
if (r5 != null) {
const isForumPost = channel.isForumPost();
const r3 = a0.id === oldestUnreadMessageId;
if (!(isForumPost ? r3 ? a0.id !== SnowflakeUtils.castChannelIdAsMessageId(channel.id) : r3 : r3)) {
if (isNewMessageGroup(channel, r5[r5.length - 1], a0)) {
c18560_16.unshift([a0]);
break L11;
}
r5.unshift(a0);
} else {
c18560_16.unshift([a0]);
}
} else {
c18560_16.unshift([a0]);
}
}
};
determineChangeType2 = function determineChangeType(a0, r0 = false) {
return chatManager.determineChangeType({
message: a0,
updateMessageIds,
forceRender
}, r0);
};
const r39 = [];
c18560_13 = r39;
const r10 = {};
c18560_14 = r10;
for (const item of uploads.slice().reverse()) {
const messageForFile = UploadStore.getMessageForFile(item.id);
if (messageForFile?.nonce != null) {
r10[messageForFile.nonce] = item;
}
}
const r59 = [];
c18560_16 = r59;
messages.forEach((message) => {
const r14 = tryCreateInjectedMessage(message, channel);
if (r14 != null && r14.position === "before") {
insertMessage2(r14.message);
if (oldestUnreadMessageId === message.id) {
oldestUnreadMessageId = r14.message.id;
}
}
insertMessage2(message);
if (r14 != null && r14.position === "after") {
insertMessage2(r14.message);
}
});
r59.forEach((a0, index) => {
let r260, r296;
let c26953_0 = a0;
const message = a0[a0.length - 1];
let c26953_1 = message;
const r2 = c18560_16.length - 1;
if (index === 0 && messages.hasMoreAfter) {
c18560_13.push({
rowType: LoadingType.LOAD_AFTER,
changeType: forceRender ? Changeset.UPDATE : Changeset.NOOP,
roleStyle,
isLoading: messages.loadingMore,
text: intl.string(t.XBlaiC)
});
}
const r72 = index === r2;
let r74 = messages.hasMoreBefore && r72;
let r76 = unreadFilter2(message);
const r78 = r72 ? null : c18560_16[index + 1][0].timestamp;
const r90 = r72 ? channel.isDM() && !messages.hasMoreBefore && r72 || channel.isThread() && !channel.isForumPost() && !messages.hasMoreBefore && r72 ? true : false : isSameDay(message.timestamp, r78) ? channel.isDM() && !messages.hasMoreBefore && r72 || channel.isThread() && !channel.isForumPost() && !messages.hasMoreBefore && r72 ? true : false : true;
const processHiddenMessageRow = function processHiddenMessageRow(a0) {
for (const item of c26953_0) {
const message = item;
if (determineChangeType2(item) !== Changeset.NOOP && a0.changeType === Changeset.NOOP) {
a0.changeType = Changeset.UPDATE;
}
a0.content.unshift({
rowType: RowType.MESSAGE,
changeType: Changeset.NOOP,
roleStyle,
message,
isSystemDM: channel.isSystemDM() && message.isSystemDM(),
isFirst: message === c26953_1,
canAddNewReactions
});
}
a0.revealed = c26953_1.id === messages.revealedMessageId;
a0.context = c26953_1.id;
return a0;
};
const r106 = {
roleStyle,
message,
isFirst: true,
content: [],
text: "",
revealed: false
};
let r111 = c18560_13[c18560_13.length - 1];
if (message.hasFlag(MessageFlags.HIDDEN_SUSPENDED_USER)) {
if (!(r111 != null && r111.rowType === RowType.SUSPENDED_USER_GROUP)) {
const r336 = {
...r106,
rowType: RowType.SUSPENDED_USER_GROUP,
changeType: determineChangeType2(message),
canUncollapse: false
};
c18560_13.push(r336);
r111 = r336;
}
processHiddenMessageRow(r111);
r111.text = intl.formatToPlainString(t.rHRovo, {
count: r111.content.length
});
} else if (message.blocked) {
L88: {
if (r111 != null) {
const rowType2 = r111.rowType;
const BLOCKED_GROUP = RowType.BLOCKED_GROUP;
r296 = r111;
if (rowType2 === BLOCKED_GROUP) {
break L88;
}
}
let changeType3 = determineChangeType2(message);
if (changeType3 === Changeset.NOOP && chatManager.getBlocked(message)) {
changeType3 = Changeset.INSERT;
}
const r305 = {
...r106,
rowType: RowType.BLOCKED_GROUP,
changeType: changeType3
};
c18560_13.push(r305);
r296 = r305;
}
processHiddenMessageRow(r296);
r296.text = intl.formatToPlainString(t["+FcYM/"], {
count: r296.content.length
});
} else if (message.ignored) {
L80: {
if (r111 != null) {
const rowType = r111.rowType;
const IGNORED_GROUP = RowType.IGNORED_GROUP;
r260 = r111;
if (rowType === IGNORED_GROUP) {
break L80;
}
}
let changeType2 = determineChangeType2(message);
if (changeType2 === Changeset.NOOP && chatManager.getIgnored(message)) {
changeType2 = Changeset.INSERT;
}
const r269 = {
...r106,
rowType: RowType.IGNORED_GROUP,
changeType: changeType2
};
c18560_13.push(r269);
r260 = r269;
}
processHiddenMessageRow(r260);
r260.text = intl.formatToPlainString(t["VFWjc+"], {
count: r260.content.length
});
} else {
for (const item of a0) {
const message2 = item;
const r125 = item !== message;
const isEditing = EditMessageStore.isEditing(channel.id, item.id) || replyingMessageId === message2.id;
const pushFeedback = PushFeedbackStore.getPushFeedback(message2.channel_id, message2.id);
const canReplyToMessage2 = canReplyToMessage(channel, message2);
const r159 = canEditMessage(message2, currentUserId) && !isNonModInLockedThread(channel);
const changeType = c18560_14.hasOwnProperty(message2.id) ? chatManager.determineChangeTypeForUploadProgress(c18560_14[message2.id]) : determineChangeType2(message2, true);
if (selectedSummary != null && selectedSummary.endId === message2.id && selectedSummary.count > 1) {
c18560_13.push({
rowType: SeparatorType.SUMMARY,
changeType: determineChangeType2(message2),
roleStyle,
summary: selectedSummary,
isBeforeContent: false
});
}
const isSystemDM = channel.isSystemDM() && message2.isSystemDM();
c18560_13.push({
roleStyle,
message: message2,
isSystemDM,
isFirst: message2 === message,
isEditing,
separatorBefore: (r125 ? !r125 : !isResourceChannel) && (r90 || r76 || r74),
canAddNewReactions,
alwaysShowAddReaction: channel.isForumPost() && message2.id === SnowflakeUtils.castChannelIdAsMessageId(channel.id),
renderContentOnly: isResourceChannel,
pushFeedbackType: pushFeedback?.pushType,
canReply: isResourceChannel ? !isResourceChannel : canReplyToMessage2,
canEdit: isResourceChannel ? !isResourceChannel : r159,
rowType: RowType.MESSAGE,
changeType,
showContentInventoryEntryFallbackEmbed: unloadableContentEntryMessageIds == null ? void 0 : unloadableContentEntryMessageIds.has(message2.id)
});
if (selectedSummary != null && selectedSummary.startId === message2.id && selectedSummary.count > 1) {
c18560_13.push({
rowType: SeparatorType.SUMMARY,
changeType: determineChangeType2(message2),
roleStyle,
summary: selectedSummary,
isBeforeContent: true
});
}
}
}
if (r90 && !isResourceChannel) {
let changeType4 = determineChangeType2(message);
if (changeType4 === Changeset.UPDATE) {
changeType4 = Changeset.NOOP;
}
c18560_13.push({
rowType: SeparatorType.DAY,
changeType: changeType4,
roleStyle,
text: dateFormat(message.timestamp, "LL")
});
}
if (r76) {
r76 = !isResourceChannel;
}
if (r76) {
c18560_13.push({
rowType: SeparatorType.UNREAD,
changeType: determineChangeType2(message),
roleStyle,
text: intl.string(t.q7hm3m).toUpperCase()
});
}
if (r74) {
r74 = !isResourceChannel;
}
if (r74) {
c18560_13.push({
rowType: LoadingType.LOAD_BEFORE,
changeType: forceRender ? Changeset.UPDATE : Changeset.NOOP,
roleStyle,
isLoading: messages.loadingMore,
text: intl.string(t.XBlaiC)
});
}
});
if (r59.length === 0 && !messages.loadingMore && (messages.hasMoreAfter || messages.hasMoreBefore)) {
r39.push({
rowType: messages.hasMoreBefore ? LoadingType.LOAD_BEFORE : LoadingType.LOAD_AFTER,
changeType: forceRender ? Changeset.UPDATE : Changeset.NOOP,
roleStyle,
isLoading: messages.loadingMore,
text: intl.string(t.XBlaiC)
});
}
return r39;
};
@@ -0,0 +1,339 @@
// Metro module 9417 (f9418).
import { useMemo } from "react";
import { Pressable, View } from "react-native";
import SubscriptionRoleStore from "../../../guild_role_subscriptions/SubscriptionRoleStore";
import SelectedGuildStore from "../../../../stores/SelectedGuildStore";
import UserStore from "../../../../stores/UserStore";
import { AnalyticEvents, AnalyticsPages, AnalyticsSections, UserSettingsSections } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import PremiumUtils from "../../../../utils/PremiumUtils";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import openPremiumModal from "../../../../components_native/premium/openPremiumModal";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { useSharedMessageEmojiStyles } from "./useSharedMessageEmojiStyles";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useAnalyticsLocations from "../../../app_analytics/useAnalyticsLocations";
import * as _RoleSubscriptionEmojiUtils from "../../../guild_role_subscriptions/RoleSubscriptionEmojiUtils";
import { isPurchasableRoleSubscriptionEmoji } from "../../../guild_role_subscriptions/RoleSubscriptionEmojiUtils";
import { EmojiTypes } from "../../../emojis/EmojiTypes";
import { shouldHideGuildPurchaseEntryPoints } from "../../../creator_monetization_review/CreatorMonetizationRestrictionsUtils";
import { useIsFavoriteEmoji } from "../../../emoji_picker/EmojiPickerUtils";
import TidaWebformExperiment from "../../../guild/TidaWebformExperiment";
import { DeveloperMode } from "../../../user_settings/UserSettings";
import { getEmojiPopoutData, EmojiPopoutType } from "../../getEmojiPopoutMessage";
import { openUserSettings } from "../../../user_settings/core/native/openUserSettings";
import { useTrackOpenPopout } from "../../../emojis/useTrackOpenPopout";
import { StarIcon } from "../../../../design/components/Icon/native/redesign/generated/StarIcon";
import { StarOutlineIcon } from "../../../../design/components/Icon/native/redesign/generated/StarOutlineIcon";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { unfavoriteEmoji, favoriteEmoji } from "../../../../actions/EmojiActionCreators";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import { MoreHorizontalIcon } from "../../../../design/components/Icon/native/redesign/generated/MoreHorizontalIcon";
import { NitroWheel } from "../../../../design/void/native";
import { Button } from "../../../../design/components/Button/native/Button.native";
import FastImage from "../../../../components_native/common/FastImage";
import { handleJoinGuild } from "../../../guild/GuildUtils";
import { FormDivider } from "../../../../design/void/Form/native/index";
import ExpressionGuildDetails from "./ExpressionGuildDetails";
import { EmojiGrid } from "./EmojiGrid";
import { HermesBuiltin } from "../../../../_hermes/prelude";
const useStyles = createStyles({
nitroWheel: {
height: 32,
width: 32
},
nitroWheelPurple: {
tintColor: Module712.colors.CONTROL_BRAND_FOREGROUND_NEW
},
emojiDescriptionWrapperOuter: {
flexDirection: "row",
flex: 1,
alignItems: "center",
gap: 8
},
starIcon: {
height: 32,
width: 32,
margin: 0,
padding: 0,
flex: 0
},
starIconSelected: {
tintColor: Module712.colors.ICON_FEEDBACK_WARNING
},
starIconUnselected: {
tintColor: Module712.colors.INTERACTIVE_TEXT_DEFAULT
},
moreMenuIcon: {
height: 32,
width: 32,
justifyContent: "center",
alignItems: "center",
color: Module712.colors.INTERACTIVE_ICON_DEFAULT
},
bottomCtaButton: {
marginTop: 24
},
ctaDescriptionWrapper: {
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "flex-start",
marginTop: 8
},
betaTag: {
backgroundColor: Module712.colors.WHITE
},
betaTagTextAddPack: {
color: Module712.unsafe_rawColors.BRAND_530
},
betaTagTextRemovePack: {
color: Module712.unsafe_rawColors.PRIMARY_500
},
favoriteButtonContainer: {
paddingTop: Module712.space.PX_4
}
});
export default function CustomEmojiContent(props) {
let r258, r304, r305;
let stateFromStores2, analyticsLocations, isFavoriteEmoji, analyticsLocation;
const { emojiNode, sourceType, expressionSourceApplication, expressionSourceGuild, customEmojiFromJoinedGuild, hasJoinedEmojiSourceGuild, nonce } = props;
stateFromStores2 = void 0;
analyticsLocations = void 0;
isFavoriteEmoji = void 0;
analyticsLocation = void 0;
const r16 = {
...useStyles(),
...useSharedMessageEmojiStyles()
};
let c17207_4 = r16;
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const isPremium = PremiumUtils.isPremium(stateFromStores);
stateFromStores2 = useStateFromStores([SelectedGuildStore], () => SelectedGuildStore.getGuildId());
const emojiComesFromCurrentGuild = stateFromStores2 != null && stateFromStores2 === expressionSourceGuild?.id;
analyticsLocations = useAnalyticsLocations().analyticsLocations;
const memo = useMemo(() => {
let r3;
if (customEmojiFromJoinedGuild == null) {
r3 = {
isRoleSubscriptionEmoji: false,
isUnusableRoleSubscriptionEmoji: false,
userIsRoleSubscriber: false
};
} else {
r3 = {
isRoleSubscriptionEmoji: isPurchasableRoleSubscriptionEmoji(customEmojiFromJoinedGuild),
isUnusableRoleSubscriptionEmoji: null,
userIsRoleSubscriber: null
};
let r16 = stateFromStores2;
if (stateFromStores2 == null) {
r16 = void 0;
}
r3.isUnusableRoleSubscriptionEmoji = _RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmoji(customEmojiFromJoinedGuild, r16);
r3.userIsRoleSubscriber = SubscriptionRoleStore.getUserSubscriptionRoles(customEmojiFromJoinedGuild.guildId).size > 0;
}
return r3;
}, [customEmojiFromJoinedGuild, stateFromStores2]);
const { isRoleSubscriptionEmoji, isUnusableRoleSubscriptionEmoji, userIsRoleSubscriber } = memo;
const r76 = isUnusableRoleSubscriptionEmoji ? customEmojiFromJoinedGuild?.type !== EmojiTypes.GUILD : !isUnusableRoleSubscriptionEmoji;
const shouldHideRoleSubscriptionCTA = r76 ? !r76 : shouldHideGuildPurchaseEntryPoints(customEmojiFromJoinedGuild?.guildId);
isFavoriteEmoji = useIsFavoriteEmoji(stateFromStores2, customEmojiFromJoinedGuild);
const tidaWebformEnabled = TidaWebformExperiment.useExperiment({
location: "CustomEmojiContent"
}, {
autoTrackExposure: false
}).tidaWebformEnabled;
const setting = DeveloperMode.useSetting();
let isDiscoverable = expressionSourceGuild == null ? void 0 : expressionSourceGuild.isDiscoverable();
if (isDiscoverable == null) {
isDiscoverable = false;
}
analyticsLocation = {
page: stateFromStores2 != null ? AnalyticsPages.GUILD_CHANNEL : AnalyticsPages.DM_CHANNEL,
section: AnalyticsSections.EMOJI_UPSELL_POPOUT
};
const emojiPopoutData = getEmojiPopoutData({
sourceType,
expressionSourceApplication,
isPremium,
hasJoinedEmojiSourceGuild,
isRoleSubscriptionEmoji,
isUnusableRoleSubscriptionEmoji,
userIsRoleSubscriber,
shouldHideRoleSubscriptionCTA,
emojiComesFromCurrentGuild,
isDiscoverable,
onOpenPremiumSettings: () => {
ActionSheetActionCreators.hideAllActionSheets();
AnalyticsUtils.track(AnalyticEvents.CLOSE_POPOUT, {
nonce
});
AnalyticsUtils.track(AnalyticEvents.PREMIUM_PROMOTION_OPENED, {
location_page: analyticsLocation.page,
location_section: analyticsLocation.section
});
openUserSettings({
screen: UserSettingsSections.PREMIUM,
params: {
analyticsLocation
}
});
}
});
useTrackOpenPopout({
emojiId: emojiNode.id,
currentGuildId: stateFromStores2,
popoutData: emojiPopoutData,
emojiSourceGuildId: expressionSourceGuild?.id,
nonce
});
const { emojiDescription, type } = emojiPopoutData;
const r122 = isUnusableRoleSubscriptionEmoji ? !isUnusableRoleSubscriptionEmoji : hasJoinedEmojiSourceGuild;
const title = hasJoinedEmojiSourceGuild ? intl.string(t.ohTzZH) : intl.string(t["eLfh+a"]);
const JOIN_GUILD = EmojiPopoutType.JOIN_GUILD;
const style = {
...[EmojiPopoutType.GET_PREMIUM, EmojiPopoutType.JOIN_GUILD].includes(type) ? r16.ctaButton : r16.bottomCtaButton,
borderRadius: Module712.radii.xl
};
const style2 = {
...r16.emojiContainer,
marginTop: 8
};
const r172 = [<FastImage style={r16.emojiIcon} source={{
uri: emojiNode.src
}} />, ,];
const r184 = [<Text variant="text-md/bold" color="mobile-text-heading-primary">
{`:${emojiNode.alt}:`}
</Text>, ,];
const r185 = emojiDescription != null && <Text variant="text-sm/medium">{emojiDescription}</Text>;
const handleAddRemoveFavorite = function handleAddRemoveFavorite() {
const content = function content() {
return <Text style={{
marginLeft: 8,
marginTop: 2
}} variant="text-md/bold">
{isFavoriteEmoji ? intl.string(t.in1rga) : intl.string(t.mE2e8A)}
</Text>;
};
ActionSheetActionCreators.hideAllActionSheets();
AnalyticsUtils.track(AnalyticEvents.CLOSE_POPOUT, {
nonce
});
if (isFavoriteEmoji) {
unfavoriteEmoji(customEmojiFromJoinedGuild);
ToastActionCreators.open({
key: "EMOJI_UNFAVORITED",
icon: () => {
const style = {};
HermesBuiltin.copyDataProperties(style, c17207_4.starIcon);
HermesBuiltin.copyDataProperties(style, c17207_4.starIconUnselected);
return <StarOutlineIcon style={style} />;
},
content
});
} else {
favoriteEmoji(customEmojiFromJoinedGuild);
ToastActionCreators.open({
key: "EMOJI_FAVORITED",
icon: () => {
const style = {};
HermesBuiltin.copyDataProperties(style, c17207_4.starIcon);
HermesBuiltin.copyDataProperties(style, c17207_4.starIconSelected);
return <StarIcon style={style} />;
},
content
});
}
};
r184[1] = r185;
const r192 = [<View style={r16.emojiDescriptionWrapper}>{r184}</View>, r122 ? tidaWebformEnabled ? null : <Pressable accessibilityLabel={isFavoriteEmoji ? intl.string(t.aBUcp3) : intl.string(t.yZFibY)} style={r16.moreMenuIcon} onPress={handleAddRemoveFavorite}>
{isFavoriteEmoji ? <StarIcon style={{
...r16.starIcon,
...r16.starIconSelected
}} /> : <StarOutlineIcon style={{
...r16.starIcon,
...r16.starIconUnselected
}} />}
</Pressable> : null, ,];
const r227 = tidaWebformEnabled ? setting ? <Pressable accessibilityLabel={intl.string(t.PdRCRg)} style={r16.moreMenuIcon} onPress={function handleOpenEmojiOptionsMenu() {
ActionSheetActionCreators.openLazy(import("./EmojiOptionsActionSheet"), "EmojiOptionsActionSheet", {
emojiSrc: emojiNode.src
}, "stack");
}}>
<MoreHorizontalIcon color={Module712.colors.INTERACTIVE_TEXT_DEFAULT} />
</Pressable> : null : null;
const showingJoinGuildCta = type === JOIN_GUILD;
r192[2] = r227;
r172[1] = <View style={r16.emojiDescriptionWrapperOuter}>{r192}</View>;
const r253 = [<View style={style2}>{r172}</View>, , , ,];
if (type === EmojiPopoutType.GET_PREMIUM) {
const GET_PREMIUM = EmojiPopoutType.GET_PREMIUM;
let r279 = null;
if (type === GET_PREMIUM) {
let shouldTintPurple = ({
shouldTintPurple: false
}).shouldTintPurple;
if (shouldTintPurple === void 0) {
shouldTintPurple = false;
}
const nitroWheel = r16.nitroWheel;
r279 = <View style={style}>
<Button icon={<NitroWheel style={shouldTintPurple ? {
...nitroWheel,
...r16.nitroWheelPurple
} : nitroWheel} />} text={emojiPopoutData.text} variant="active" size="md" grow onPress={() => {
if (!(stateFromStores == null || PremiumUtils.canUseEmojisEverywhere(stateFromStores))) {
ActionSheetActionCreators.hideAllActionSheets();
AnalyticsUtils.track(AnalyticEvents.CLOSE_POPOUT, {
nonce
});
AnalyticsUtils.track(AnalyticEvents.PREMIUM_PROMOTION_OPENED, {
location_page: analyticsLocation.page,
location_section: analyticsLocation.section
});
openPremiumModal({
analyticsLocation,
analyticsLocations
});
}
}} />
</View>;
}
r258 = r279;
} else {
r258 = showingJoinGuildCta ? <View style={style}>
<Button text={intl.string(t.riu2R5)} size="md" grow onPress={() => {
handleJoinGuild(expressionSourceGuild?.id);
}} />
</View> : null;
}
r253[1] = r258;
if (!hasJoinedEmojiSourceGuild) {
r304 = null;
if (isDiscoverable) {
r305 = expressionSourceGuild == null;
r304 = r305 ? null : <>
<FormDivider style={r16.divider} />
<ExpressionGuildDetails guild={expressionSourceGuild} hasJoinedGuild={hasJoinedEmojiSourceGuild} title={title} showingJoinGuildCta={showingJoinGuildCta} />
{hasJoinedEmojiSourceGuild ? !hasJoinedEmojiSourceGuild : <EmojiGrid expressionSourceGuild={expressionSourceGuild} doNotDisplayEmojiIds={[emojiNode.id]} />}
</>;
}
} else {
r305 = expressionSourceGuild == null;
r304 = r305 ? null : <>
<FormDivider style={r16.divider} />
<ExpressionGuildDetails guild={expressionSourceGuild} hasJoinedGuild={hasJoinedEmojiSourceGuild} title={title} showingJoinGuildCta={showingJoinGuildCta} />
{hasJoinedEmojiSourceGuild ? !hasJoinedEmojiSourceGuild : <EmojiGrid expressionSourceGuild={expressionSourceGuild} doNotDisplayEmojiIds={[emojiNode.id]} />}
</>;
}
r253[2] = r304;
r253[3] = r122 ? tidaWebformEnabled ? <>
{[<FormDivider style={r16.divider} />, <View style={r16.favoriteButtonContainer}>
<Button text={isFavoriteEmoji ? intl.string(t.Ay49KA) : intl.string(t.nNsr67)} variant={isFavoriteEmoji ? "tertiary" : "primary"} size="md" onPress={handleAddRemoveFavorite} />
</View>]}
</> : null : null;
return <>{r253}</>;
};
@@ -0,0 +1,62 @@
// Metro module 9426 (f9427).
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import EmojiUtils from "../../../../utils/EmojiUtils";
import AvatarUtils from "../../../../utils/AvatarUtils";
import Emoji2 from "../../../emojis/native/Emoji";
import { useSharedMessageEmojiStyles } from "./useSharedMessageEmojiStyles";
import chunk from "../../../../_bundle/chunk";
import { GappedList } from "../../../guild_role_subscriptions/native/components/LayoutUtils";
let useStyles;
const Emoji = function Emoji(props) {
const guildEmoji = props.guildEmoji;
const styles = useStyles();
return <Emoji2 key={guildEmoji.id} src={guildEmoji.id == null ? EmojiUtils.getURL(guildEmoji.name) : AvatarUtils.getEmojiURL({
id: guildEmoji.id,
animated: guildEmoji.animated,
size: 48
})} fastImageStyle={styles.gridEmojiFastImage} textEmojiStyle={styles.gridEmojiText} name={guildEmoji.name} />;
};
useStyles = createStyles({
gridEmojiFastImage: {
height: 40,
width: 40,
borderRadius: Module712.radii.sm
},
gridEmojiText: {
fontSize: 18,
lineHeight: 44
},
emojiGridRowContainer: {
marginTop: 16,
flexDirection: "row"
},
emojiGridContainer: {
marginTop: 8,
alignItems: "center"
}
});
export function EmojiGrid(props) {
const { expressionSourceGuild, doNotDisplayEmojiIds = [] } = props;
let c17211_0 = doNotDisplayEmojiIds;
const { numberToShow = 10, maxPerRow = 5 } = props;
const r10 = {
...useSharedMessageEmojiStyles(),
...useStyles()
};
let c17211_1 = r10;
let r24 = expressionSourceGuild?.emojis;
if (r24 == null) {
r24 = [];
}
return <View style={r10.emojiGridContainer}>
<GappedList gap={8}>
{chunk(r24.slice(0, numberToShow + 1).filter((item) => !c17211_0.includes(item.id)).slice(0, numberToShow), maxPerRow).map((a0, index) => <View key={index} style={c17211_1.emojiGridRowContainer}>
<GappedList gap={32}>
{a0.map((item) => <Emoji key={item.id} guildEmoji={item} />)}
</GappedList>
</View>)}
</GappedList>
</View>;
}
@@ -0,0 +1,23 @@
// Metro module 9423 (f9424).
import { useCallback } from "react";
import { copy } from "../../../../utils/ClipboardUtils.native";
import { presentCopiedToClipboard } from "../../../toast/native/ToastUtils";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { ActionSheet } from "../../../../design/components/Sheet/native/ActionSheet.native";
import { TableRowGroup } from "../../../../design/components/TableRow/native/TableRowGroup.native";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import { LinkIcon } from "../../../../design/components/Icon/native/redesign/generated/LinkIcon";
import { intl, t } from "../../../../intl/index.native";
export default function EmojiOptionsActionSheet(props) {
const emojiSrc = props.emojiSrc;
const callback = useCallback(() => {
copy(emojiSrc);
presentCopiedToClipboard();
ActionSheetActionCreators.hideActionSheet();
}, [emojiSrc]);
return <ActionSheet>
<TableRowGroup hasIcons>
<TableRow icon={<LinkIcon />} label={intl.string(t.cIoudn)} onPress={callback} />
</TableRowGroup>
</ActionSheet>;
};
@@ -0,0 +1,104 @@
// Metro module 9425 (f9426).
import { View } from "react-native";
import { ExpressionSourceGuildRecord } from "../../../emojis/records/ExpressionSourceRecord";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import GuildIcon, { GuildIconSizes } from "../../../guild/native/GuildIcon";
import AvatarUtils from "../../../../utils/AvatarUtils";
import FastImage from "../../../../components_native/common/FastImage";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { handleJoinGuild } from "../../../guild/GuildUtils";
import GuildBadge from "../../../guild/native/GuildBadge";
import { Icon } from "../../../../design/void/native";
const useStyles = createStyles({
guildDetailsContainer: {
flexDirection: "column"
},
guildDetailsContent: {
flexDirection: "row",
marginTop: 8,
alignItems: "center"
},
guildIcon: {
width: 40,
height: 40,
borderRadius: Module712.radii.sm,
marginRight: 12
},
guildNameAndOnlineMembers: {
flexDirection: "column"
},
guildNameWrapper: {
flexDirection: "row",
alignItems: "center",
marginRight: 32
},
guildPartnerIcon: {
marginRight: 8
},
guildDescriptionSection: {
flexDirection: "row",
alignItems: "center",
marginTop: 4
},
dotSeparator: {
width: 4,
height: 4,
borderRadius: Module712.radii.xs,
marginRight: 8,
marginLeft: 8,
backgroundColor: Module712.colors.BACKGROUND_MOD_MUTED
},
joinGuildButton: {
borderRadius: Module712.radii.sm,
borderColor: Module712.colors.BORDER_STRONG,
borderWidth: 1,
paddingHorizontal: 4,
paddingBottom: 2
}
});
export const ExpressionGuildDetails = (props) => {
const { guild, title, hasJoinedGuild, showingJoinGuildCta } = props;
const styles = useStyles();
const fromGuildType = ExpressionSourceGuildRecord.createFromGuildType(guild);
const isDiscoverable = fromGuildType.isDiscoverable();
const r39 = !isDiscoverable && !hasJoinedGuild ? <FastImage style={styles.guildIcon} source={AvatarUtils.getGuildIconSource({
id: guild.id,
icon: guild.icon,
canAnimate: true,
size: 32
})} /> : <GuildIcon style={styles.guildIcon} guild={fromGuildType} size={GuildIconSizes.XLARGE} animate />;
const r62 = [<Text variant="eyebrow" color="text-default">{title}</Text>, ,];
r62[1] = <View style={styles.guildDetailsContent}>
{r39}
<View style={styles.guildNameAndOnlineMembers}>
<View style={styles.guildNameWrapper}>
<GuildBadge guild={guild} style={styles.guildPartnerIcon} size={Icon.Sizes.REFRESH_SMALL_16} disableColor />
<Text variant="text-md/bold" color="mobile-text-heading-primary">{guild.name}</Text>
</View>
<View style={styles.guildDescriptionSection}>
{isDiscoverable && fromGuildType.presenceCount != null ? <>
<Text variant="text-xs/medium" color="text-default">
{intl.format(t["LC+S+m"], {
membersOnline: fromGuildType.presenceCount
})}
</Text>
<View style={styles.dotSeparator} />
{!hasJoinedGuild && !showingJoinGuildCta ? <PressableOpacity style={styles.joinGuildButton} onPress={() => handleJoinGuild(guild.id)}>
<Text variant="text-xs/medium" color="text-default">
{intl.string(t.riu2R5)}
</Text>
</PressableOpacity> : <Text variant="text-xs/medium" color="text-default">
{intl.string(t.inyJqO)}
</Text>}
</> : <Text variant="text-xs/medium" color="text-default">
{intl.string(t.H29mx4)}
</Text>}
</View>
</View>
</View>;
return <View style={styles.guildDetailsContainer}>{r62}</View>;
};
export default ExpressionGuildDetails;
@@ -0,0 +1,57 @@
// Metro module 9409 (f9410).
import { View } from "react-native";
import { AnalyticEvents } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { isAndroid } from "../../../../utils/PlatformUtils";
import { v4 } from "../../../../_bundle/Module514";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import StandardEmojiContent from "./StandardEmojiContent";
import { useEmojiAndSource } from "../../../emojis/hooks/useEmojiAndSource";
import CustomEmojiContent from "./CustomEmojiContent";
let useStyles, MessageCustomEmojiActionSheet;
const MessageStandardEmojiActionSheet = function MessageStandardEmojiActionSheet(props) {
const emojiNode = props.emojiNode;
const styles = useStyles();
const nonce = v4();
return <BottomSheet startExpanded onDismiss={() => {
AnalyticsUtils.track(AnalyticEvents.CLOSE_POPOUT, {
nonce
});
}}>
<View style={styles.contentWrapper}>
<StandardEmojiContent emojiNode={emojiNode} nonce={nonce} />
</View>
</BottomSheet>;
};
MessageCustomEmojiActionSheet = function MessageCustomEmojiActionSheet(props) {
const emojiNode = props.emojiNode;
const styles = useStyles();
const emojiAndSource = useEmojiAndSource({
emojiId: emojiNode.id
});
const { sourceType, expressionSourceGuild, expressionSourceApplication, hasJoinedEmojiSourceGuild, emoji } = emojiAndSource;
if (emojiAndSource.isFetching) {
return null;
}
const nonce2 = v4();
return <BottomSheet startExpanded onDismiss={() => {
AnalyticsUtils.track(AnalyticEvents.CLOSE_POPOUT, {
nonce: nonce2
});
}}>
<View style={styles.contentWrapper}>
<CustomEmojiContent emojiNode={emojiNode} sourceType={sourceType} expressionSourceApplication={expressionSourceApplication} expressionSourceGuild={expressionSourceGuild} customEmojiFromJoinedGuild={emoji} hasJoinedEmojiSourceGuild={hasJoinedEmojiSourceGuild} nonce={nonce2} />
</View>
</BottomSheet>;
};
useStyles = createStyles({
contentWrapper: {
paddingHorizontal: 16,
paddingBottom: isAndroid() ? 16 : 0
}
});
export default function MessageEmojiActionSheet(props) {
const emojiNode = props.emojiNode;
return "surrogate" in emojiNode ? <MessageStandardEmojiActionSheet emojiNode={emojiNode} /> : <MessageCustomEmojiActionSheet emojiNode={emojiNode} />;
};
@@ -0,0 +1,79 @@
// Metro module 9410 (f9411).
import { useMemo } from "react";
import { View } from "react-native";
import SelectedGuildStore from "../../../../stores/SelectedGuildStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useSharedMessageEmojiStyles } from "./useSharedMessageEmojiStyles";
import EmojiUtils from "../../../../utils/EmojiUtils";
import FastImage from "../../../../components_native/common/FastImage";
import { Text } from "../../../../design/components/Text/native/Text";
import { useTrackOpenPopout } from "../../../emojis/useTrackOpenPopout";
import UnicodeEmojis from "../../../emojis/UnicodeEmojis";
import { useIsFavoriteEmoji } from "../../../emoji_picker/EmojiPickerUtils";
import useMaybeAddReactionMarketingEasterEggNote from "../../useMaybeAddReactionMarketingEasterEggNote";
import { intl, t } from "../../../../intl/index.native";
import { FormDivider } from "../../../../design/void/Form/native/index";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { unfavoriteEmoji, favoriteEmoji } from "../../../../actions/EmojiActionCreators";
let useStyles;
const Emoji = function Emoji(props) {
const surrogate = props.surrogate;
const r7 = {
...useStyles(),
...useSharedMessageEmojiStyles()
};
const uRL = EmojiUtils.getURL(surrogate);
return <View style={r7.emojiWrapper}>
{uRL !== "" ? <FastImage style={r7.emojiIcon} resizeMode="contain" source={{
uri: uRL
}} /> : <Text style={r7.emojiSurrogate} variant="text-md/medium">{surrogate}</Text>}
</View>;
};
useStyles = createStyles({
emojiSurrogate: {
lineHeight: 48,
fontSize: 40,
margin: 8
},
ctaContainer: {
paddingTop: Module712.space.PX_4
}
});
export default function StandardEmojiContent(props) {
let isFavoriteEmoji;
const { emojiNode, nonce } = props;
isFavoriteEmoji = void 0;
const r9 = {
...useStyles(),
...useSharedMessageEmojiStyles()
};
const guildId = SelectedGuildStore.getGuildId();
useTrackOpenPopout({
currentGuildId: guildId,
nonce
});
const memo = useMemo(() => UnicodeEmojis.convertSurrogateToBase(emojiNode.surrogate), [emojiNode.surrogate]);
isFavoriteEmoji = useIsFavoriteEmoji(guildId, memo);
return <>
{[<View style={r9.emojiContainer}>
<Emoji surrogate={emojiNode.surrogate} />
<View style={r9.emojiDescriptionWrapper}>
<Text variant="text-md/bold" color="mobile-text-heading-primary">
{useMaybeAddReactionMarketingEasterEggNote(emojiNode.content)}
</Text>
<Text variant="text-sm/medium">
{intl.string(t.sXdH8c)}
</Text>
</View>
</View>, <FormDivider style={r9.divider} />, <View style={r9.ctaContainer}>
<Button text={isFavoriteEmoji ? intl.string(t.Ay49KA) : intl.string(t.nNsr67)} variant={isFavoriteEmoji ? "tertiary" : "primary"} onPress={() => {
if (isFavoriteEmoji) {
unfavoriteEmoji(memo);
} else {
favoriteEmoji(memo);
}
}} />
</View>]}
</>;
};
@@ -0,0 +1,35 @@
// Metro module 9411 (f9412).
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
const useStyles = createStyles({
emojiContainer: {
flexDirection: "row",
alignItems: "center"
},
emojiDescriptionWrapper: {
flexDirection: "column",
flex: 1
},
emojiWrapper: {
marginLeft: -8,
marginRight: 8
},
emojiIcon: {
width: 40,
height: 40,
marginRight: 12,
borderRadius: Module712.radii.sm,
resizeMode: "contain"
},
divider: {
marginTop: Module712.space.PX_16,
marginBottom: Module712.space.PX_16,
marginLeft: 0,
backgroundColor: Module712.colors.BORDER_SUBTLE,
height: 0.5
},
ctaButton: {
marginTop: 16
}
});
export { useStyles as useSharedMessageEmojiStyles };
@@ -0,0 +1,12 @@
// Metro module 9308 (f9309).
export default function getEmbeddedActivityKey(a0) {
return `${a0.location.id}:${a0.applicationId}:${a0.launchId}`;
};
export function parseEmbeddedActivityKey(a0) {
const r6 = a0.split(":");
return r6.length < 3 ? null : {
channelId: r6[0],
applicationId: r6[1],
instanceId: r6[2]
};
}
@@ -0,0 +1,20 @@
// Metro module 10032 (f10033).
import { getChannelPermalink } from "../../../../utils/ChannelUtils";
import showLongPressURLActionSheet from "../../../links/native/showLongPressURLActionSheet";
export function handleMessagesLongPressChannel({ data }) {
const { guildId, channelId, messageId } = data;
let originalLink = data.originalLink;
if (!(channelId == null && originalLink == null)) {
if (originalLink == null) {
originalLink = getChannelPermalink(guildId, channelId, messageId);
}
if (originalLink != null) {
showLongPressURLActionSheet({
urlString: originalLink,
guildId,
channelId,
messageId
});
}
}
}
@@ -0,0 +1,293 @@
// Metro module 9990 (f9991).
import { isGuildVocalChannelType } from "../../../../records/ChannelRecord";
import { isGuildLurker } from "../../../../records/GuildRecord";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import GuildRoleStore from "../../../../stores/GuildRoleStore";
import GuildStore from "../../../../stores/GuildStore";
import PermissionStore from "../../../../stores/PermissionStore";
import { ChannelTypes, GuildFeatures, Permissions, Routes } from "../../../../Constants";
import { StaticChannelRoute } from "../../../channel/ChannelConstants";
import { GuildOnboardingTab } from "../../../guild_onboarding/GuildOnboardingPromptsConstants";
import { CHANNELS_AND_ROLES_MODAL_KEY } from "../../../guild_onboarding/native/GuildOnboardingConstants";
import { startLurking } from "../../../../utils/GuildDiscoveryUtils";
import LinkAnalyticsUtils from "../../../links/LinkAnalyticsUtils";
import { isStaticRouteIconType } from "../../../markup/MarkupRulesUtils";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import "../../../../_bundle/asyncRequire";
import safeTransitionTo_native from "../../../links/safeTransitionTo.native";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { assertNever } from "../../../../utils/GlobalUtils";
import { canViewChannel } from "../../../links/LinkUtils";
import { openChannelCallModal } from "../../../../utils/native/PrivateChannelCallUtils";
import SelectedChannelActionCreators from "../../../../actions/SelectedChannelActionCreators";
const maybeStartLurking = async function maybeStartLurking(c26586_0, c26586_1, channelId, messageId) {
let c26586_6 = 0;
L13: {
L10: {
try {
if (c26586_0 != null && !isGuildLurker(c26586_0)) {
break L10;
}
c26586_6 = 1;
await startLurking(c26586_1, {}, {
channelId,
messageId
});
c26586_6 = 0;
break L13;
} catch ($e) {
let r27 = $e;
if (c26586_6 !== 0) {
while (true) {
try {
c26586_6 = 0;
} catch ($e) {
r27 = $e;
if (c26586_6 === 0) {
break;
}
continue;
}
return false;
}
}
throw r27;
}
}
return false;
}
return true;
};
export async function handleMessagesTapChannel(c26587_0) {
let c26587_2;
let c30175_0, c30175_1, c30175_2, c30175_3, c30175_4, c30175_5, c30175_6, c30175_7, c30175_8, c30175_9, c30175_10, c30175_11;
L30: {
L91: {
L75: {
L68: {
L57: {
L48: {
L47: {
L44: {
L41: {
L38: {
c26587_2 = void 0;
c30175_0 = void 0;
c30175_1 = void 0;
c30175_2 = void 0;
c30175_3 = void 0;
c30175_0 = c26587_0.data;
const navigationReplace = c26587_0.navigationReplace;
if (navigationReplace !== void 0) {
c30175_1 = navigationReplace;
c30175_2 = c26587_0.onBeforeNavigate;
c30175_3 = c26587_0.dismissKeyboard;
c30175_4 = void 0;
c30175_5 = void 0;
c30175_6 = void 0;
c30175_7 = void 0;
c30175_8 = void 0;
c30175_9 = void 0;
c30175_10 = void 0;
c30175_11 = void 0;
} else {
c30175_1 = false;
c30175_2 = c26587_0.onBeforeNavigate;
c30175_3 = c26587_0.dismissKeyboard;
c30175_4 = void 0;
c30175_5 = void 0;
c30175_6 = void 0;
c30175_7 = void 0;
c30175_8 = void 0;
c30175_9 = void 0;
c30175_10 = void 0;
c30175_11 = void 0;
}
await void 0;
c30175_4 = c30175_0.channelId;
c30175_5 = c30175_0.guildId;
c30175_6 = c30175_0.messageId;
c30175_7 = c30175_4 != null ? ChannelStore.getChannel(c30175_4) : null;
c30175_8 = GuildStore.getGuild(c30175_5);
LinkAnalyticsUtils.trackDiscordLinkClicked({
guildId: c30175_5,
channelId: c30175_4,
messageId: c30175_6
});
if (c30175_5 != null && c30175_4 != null) {
if (isStaticRouteIconType(c30175_4)) {
if (c30175_8 == null) {
break L48;
}
const r107 = c30175_4;
if (r107 === "browse") {
if (c30175_8.features.has(GuildFeatures.COMMUNITY)) {
ModalActionCreators.pushLazy(import("../../../guild_onboarding/native/ChannelsAndRolesModal"), {
guildId: c30175_5,
defaultTab: GuildOnboardingTab.BROWSE
}, CHANNELS_AND_ROLES_MODAL_KEY);
break L30;
}
break L47;
}
if (r107 === "customize") {
if (c30175_8.features.has(GuildFeatures.COMMUNITY)) {
ModalActionCreators.pushLazy(import("../../../guild_onboarding/native/ChannelsAndRolesModal"), {
guildId: c30175_5,
defaultTab: GuildOnboardingTab.CUSTOMIZE
}, CHANNELS_AND_ROLES_MODAL_KEY);
break L30;
}
break L44;
}
if (r107 !== "home" && r107 !== "guide") {
if (r107 === "linked-roles") {
c30175_9 = c30175_6;
if (c30175_9 != null) {
c30175_10 = GuildMemberStore.getSelfMember(c30175_5);
if (c30175_10 == null) {
break L38;
}
c30175_11 = GuildRoleStore.getRole(c30175_5, c30175_9);
if (c30175_11 != null) {
if (!c30175_10.roles.includes(c30175_11.id)) {
ActionSheetActionCreators.openLazy(import("../../../connections/native/GuildRoleConnectionsConnectAccountsActionSheet"), `GuildRoleConnectionsConnectAccountsActionSheet-${c30175_11.id}`, {
role: c30175_11,
guildId: c30175_5
});
break L30;
}
}
ModalActionCreators.pushLazy(import("../../../connections/native/GuildRoleConnectionsModal"), {
guildId: c30175_5
});
break L30;
}
ModalActionCreators.pushLazy(import("../../../connections/native/GuildRoleConnectionsModal"), {
guildId: c30175_5
});
break L30;
}
assertNever(c30175_4);
break L30;
}
if (c30175_8.features.has(GuildFeatures.COMMUNITY)) {
safeTransitionTo_native(Routes.CHANNEL(c30175_5, StaticChannelRoute.GUILD_HOME), {
navigationReplace: c30175_1,
openChannel: true
});
break L30;
}
break L41;
}
}
if (c30175_6 != null && c30175_7 != null) {
if (!c30175_7.isPrivate()) {
if (await (0, maybeStartLurking)(c30175_8, c30175_7.guild_id, c30175_7.id, c30175_6)) {
break L57;
}
}
const r303 = c30175_2;
if (r303 != null) {
r303();
}
safeTransitionTo_native(Routes.CHANNEL(c30175_7.guild_id, c30175_7.id, c30175_6), {
navigationReplace: c30175_1,
openChannel: true
});
break L30;
}
if (c30175_7 != null && c30175_5 != null) {
if (!c30175_7.isPrivate()) {
if (await (0, maybeStartLurking)(c30175_8, c30175_5, c30175_7.id, c30175_6)) {
break L68;
}
}
if ((0, isGuildVocalChannelType)(c30175_7.type)) {
if (canViewChannel(c30175_7)) {
if (c30175_7.type === ChannelTypes.GUILD_STAGE_VOICE) {
if (!PermissionStore.can(Permissions.CONNECT, c30175_7)) {
break L75;
}
}
const r402 = c30175_3;
if (r402 != null) {
r402();
}
const r414 = c30175_2;
if (r414 != null) {
r414();
}
openChannelCallModal(c30175_7);
break L30;
}
}
const r384 = c30175_2;
if (r384 != null) {
r384();
}
safeTransitionTo_native(Routes.CHANNEL(c30175_5, c30175_7.id), {
navigationReplace: c30175_1,
openChannel: true
});
break L30;
}
if (c30175_4 != null && c30175_5 != null) {
if (await (0, maybeStartLurking)(c30175_8, c30175_5, c30175_4, c30175_6)) {
break L91;
}
const r471 = c30175_2;
if (r471 != null) {
r471();
}
safeTransitionTo_native(Routes.CHANNEL(c30175_5, c30175_4, c30175_6), {
navigationReplace: c30175_1,
openChannel: true
});
break L30;
}
if (c30175_7 != null && c30175_7.isPrivate()) {
const r499 = c30175_3;
if (r499 != null) {
r499();
}
const r501 = c30175_2;
if (r501 != null) {
r501();
}
SelectedChannelActionCreators.selectVoiceChannel(c30175_4);
break L30;
}
if (!(c30175_4 != null && c30175_5 == null)) {
break L30;
}
const r516 = c30175_2;
if (r516 != null) {
r516();
}
safeTransitionTo_native(Routes.CHANNEL(c30175_5, c30175_4, c30175_6), {
navigationReplace: c30175_1,
openChannel: true
});
break L30;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
}
@@ -0,0 +1,13 @@
// Metro module 10928 (f10929).
import GameProfileActionCreators_native from "../../../game_profile/GameProfileActionCreators.native";
import { GameProfileSources } from "../../../game_profile/GameProfileAnalyticUtils";
export function handleMessagesTapGameMention({ gameId }) {
GameProfileActionCreators_native.openGameProfileModal({
gameId,
gameProfileModalChecks: {
shouldOpenGameProfile: true,
gameId
},
source: GameProfileSources.GameMention
});
}
@@ -0,0 +1,162 @@
// Metro module 9989 (f9990).
import ReferencedMessageStore from "../../../replies/ReferencedMessageStore";
import RelationshipStore from "../../../../stores/RelationshipStore";
import UserStore from "../../../../stores/UserStore";
import { MessageTypes } from "../../../../Constants";
import { markPortalAlive } from "../../../../components_native/common/NativePortalView";
import { isAlertOrActionSheetOpen } from "../../../../components_native/chat/isAlertOrActionSheetOpen";
import { MessageReferenceTypes } from "../../../../_bundle/Module694";
import { isThumbnailAttachment, extractMediaFromAttachment, extractMediaSourcesFromEmbed, setMediaSourcePortal, extractMediaSourcesFromComponent, extractMediaSourcesFromMessage, flattenSource } from "../../../media_viewer/native/MediaSourceUtil";
import Linking from "../../../../lib/native/Linking";
import { asComponentId } from "../../../interaction_components/InteractionComponentTypes";
import { openMediaModal } from "../../../media_viewer/native/components/openMediaModal";
import { computeChannelName } from "../../../channel/useChannelName";
import { getChannelIcon } from "../../../../utils/native/ChannelUtils";
export function handleMessagesTapImage(a0) {
let r99, r134, length;
let initialIndex;
const tapImageData = a0.tapImageData;
const { index, type, layout, portal, embedIndex, componentId, componentMediaIndex, embedId } = tapImageData;
const { allowWithinModal, message, messageChannel, selectedChannelId, showContextName } = a0;
initialIndex = void 0;
if (portal != null) {
markPortalAlive(portal);
}
L61: {
if (!(allowWithinModal !== true && isAlertOrActionSheetOpen(selectedChannelId))) {
if (type !== "attachment" && type !== "embed" && type !== "sticker" && type !== "component") {
throw new Error(`Unsupported thumbnail type: ${type}`);
}
const type2 = message.type;
const THREAD_STARTER_MESSAGE = MessageTypes.THREAD_STARTER_MESSAGE;
let r27 = message;
if (type2 === THREAD_STARTER_MESSAGE) {
const messageReference = message.messageReference;
r27 = message;
if (messageReference != null) {
const message2 = ReferencedMessageStore.getMessageByReference(message.messageReference).message;
r27 = message2 ?? message;
}
}
const type3 = r27.messageReference?.type;
const FORWARD = MessageReferenceTypes.FORWARD;
let r26 = r27;
if (type3 === FORWARD) {
r26 = r27.messageSnapshots[0]?.message;
if (r26 == null) {
break L61;
}
}
const r81 = r27.attachments.filter((attachment) => !isThumbnailAttachment(attachment));
if (type === "attachment" && index < r81.length) {
const r83 = r81[index];
if (extractMediaFromAttachment(r83, r27, index, messageChannel.guild_id) == null && r83.url != null && r83.url !== "") {
Linking.openURL(r83.url);
return void 0;
}
}
L53: {
initialIndex = -1;
if (type === "embed" && embedIndex != null) {
const r160 = r26.embeds[index];
initialIndex = embedIndex;
const r169 = extractMediaSourcesFromEmbed(r27, r26, r160, index, messageChannel.guild_id);
const length2 = r169.length;
r99 = r169;
if (!(initialIndex < length2)) {
break L53;
}
setMediaSourcePortal(r169[initialIndex], portal);
r99 = r169;
} else {
if (type === "component") {
if (componentId == null) {
return null;
}
L44: {
if (embedId != null && embedId !== "") {
const r132 = r26.embeds.find((embed) => embed.id === embedId);
const r133 = r132 == null;
r134 = void 0;
if (r133) {
break L44;
}
r134 = r132.components;
} else {
r134 = r26.components;
}
}
if (r134 != null && r134.length !== 0) {
const r148 = extractMediaSourcesFromComponent(r27, r134, messageChannel.guild_id, asComponentId(componentId), componentMediaIndex);
if (r148 == null) {
return void 0;
}
const sources = r148.sources;
initialIndex = r148.initialIndex;
setMediaSourcePortal(sources[initialIndex], portal);
r99 = sources;
break L53;
}
return void 0;
}
const r29 = extractMediaSourcesFromMessage(r27, r26, messageChannel.guild_id);
const r98 = 0 < r29.length;
let r0 = 0;
r99 = r29;
if (r98) {
do {
const r103 = flattenSource(r29[r0]);
const r1 = r0;
if (r103 != null && r103.accessoryType === type) {
let mediaViewIndex = r103.mediaViewIndex;
if (mediaViewIndex == null) {
mediaViewIndex = r103.mediaIndex;
}
if (mediaViewIndex === index) {
if (r103.noCarousel) {
const r120 = [r29[r1]];
initialIndex = 0;
setMediaSourcePortal(r120[0], portal);
r99 = r120;
break;
}
initialIndex = r1;
setMediaSourcePortal(r29[r1], portal);
r99 = r29.filter((item, index) => {
const r10 = flattenSource(item);
const r12 = r10 != null && !r10.noCarousel;
if (r12 ? !r12 : initialIndex >= index) {
initialIndex = initialIndex - 1;
}
return r12;
});
break;
}
}
r0 = r1 + 1;
length = r29.length;
r99 = r29;
} while (r0 < length);
}
}
}
const disableDownload = r99.some((item) => {
const r9 = flattenSource(item, true);
return r9 != null && r9.disableDownload;
});
const initialSources = r99;
if (initialIndex !== -1) {
openMediaModal({
disableDownload,
initialSources,
initialIndex,
originViewOrOriginLayout: layout,
analyticsSource: "Channel",
channelId: messageChannel.id,
contextName: showContextName ? computeChannelName(messageChannel, UserStore, RelationshipStore, false) : void 0,
contextIcon: showContextName ? getChannelIcon(messageChannel) : void 0
});
}
}
}
}
@@ -0,0 +1,344 @@
// Metro module 9504 (f9505).
import { getSection } from "../../../application_commands/ApplicationCommandIndexStore";
import ApplicationStore from "../../../applications/ApplicationStore";
import GuildAutomodMessageStore from "../../../guild_automod/GuildAutomodMessageStore";
import SummaryStore from "../../../summaries/SummaryStore";
import UserRecord from "../../../../records/UserRecord";
import ChannelStore from "../../../../stores/ChannelStore";
import InviteStore from "../../../../stores/InviteStore";
import MessageStore from "../../../../stores/MessageStore";
import UserStore from "../../../../stores/UserStore";
import { AnalyticsLocations, LinkingTypes, Routes } from "../../../../Constants";
import { AppLauncherRouteName } from "../../../app_launcher/native/AppLauncherNativeConstants";
import { StaticChannelRoute } from "../../../channel/ChannelConstants";
import { NotificationTypes } from "../../../push_notifications/PushNotificationConstants";
import { OpenThreadAnalyticsLocations } from "../../../threads/ThreadConstants";
import * as _MarkupReactLinkUtils from "../../../markup/MarkupReactLinkUtils";
import parseURL from "../../../../utils/native/parseURL";
import { isGuildScheduledEventInviteEmbed } from "../../../instant_invite/InviteTypeUtils";
import handleAcceptEventInstantInvite from "../../../guild_scheduled_events/native/handleAcceptEventInstantInvite";
import { GameProfileSources } from "../../../game_profile/GameProfileAnalyticUtils";
import * as _GameProfileActionCreators_native from "../../../game_profile/GameProfileActionCreators.native";
import { handleClick } from "../../../../utils/MaskedLinkUtils";
import { isAlertOrActionSheetOpen } from "../../../../components_native/chat/isAlertOrActionSheetOpen";
import showUserProfileActionSheet from "../../../user_profile/native/showUserProfileActionSheet";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import SelectedChannelActionCreators from "../../../../actions/SelectedChannelActionCreators";
import { watchStreamAndTransitionToStream } from "../../../../actions/StreamActionCreators";
import openPinnedMessages from "../openPinnedMessages";
import showChatGDMCustomizeActionSheet from "../../../group_dm/native/showChatGDMCustomizeActionSheet";
import { removeAutomodMessageNotice } from "../../../guild_automod/GuildAutomodMessageActionCreators";
import MessageActionCreators from "../../../../actions/MessageActionCreators";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import { isPrimaryEntryPointCommandMessage } from "../../../applications/ApplicationInteractionInfoUtils";
import { KeyboardTypes } from "../../../keyboard/native/KeyboardTypes";
import showExecutedApplicationCommandPopout from "../../../application_commands/native/showExecutedApplicationCommandPopout";
import { getUserAuthor } from "../../useMessageAuthor";
import { transitionTo } from "../../../routing/router_utils";
import { trackRoleSubscriptionPurchaseMessageTierClick } from "../../../guild_role_subscriptions/GuildRoleSubscriptionSystemMessageUtils";
import { openGuildHighlightNotificationForPush } from "../../../notifications/native/GuildHighlightsNotificationsActionCreators";
const handleMessagesTapURLLink = function handleMessagesTapURLLink(data, a1) {
let r3 = data.url != null && data.url !== "";
if (r3) {
const { url, node } = data;
const r1 = node == null;
let r2 = false;
if (!r1) {
const isLinkTrusted = _MarkupReactLinkUtils.isLinkTrusted(node);
r2 = false;
if (isLinkTrusted) {
const payload = parseURL(url).payload;
const type = payload.type;
const INVITE = LinkingTypes.INVITE;
r2 = false;
if (type === INVITE) {
const r31 = payload.inviteCode == null;
r2 = false;
if (!r31) {
const invite = InviteStore.getInvite(payload.inviteCode);
let r36 = invite == null || !isGuildScheduledEventInviteEmbed(invite);
if (!r36) {
handleAcceptEventInstantInvite(invite);
r36 = 0;
}
r2 = !r36;
}
}
}
}
if (!r2) {
const payload2 = parseURL(data.url).payload;
const type2 = payload2.type;
const GAME_PROFILE = LinkingTypes.GAME_PROFILE;
let r4 = false;
if (type2 === GAME_PROFILE) {
const gameId = payload2.gameId;
const r57 = a1 != null;
let sourceUserId = void 0;
if (r57) {
const r60 = data.messageId != null;
sourceUserId = void 0;
if (r60) {
const message = MessageStore.getMessage(a1, data.messageId);
sourceUserId = message == null ? void 0 : message.author.id;
}
}
_GameProfileActionCreators_native.default.openGameProfileModal({
gameId,
source: GameProfileSources.Deeplink,
sourceUserId,
gameProfileModalChecks: {
shouldOpenGameProfile: true,
gameId
}
});
r4 = true;
}
r2 = r4;
}
r3 = true;
if (!r2) {
handleClick({
href: data.url,
trusted: data.node != null && _MarkupReactLinkUtils.isLinkTrusted(data.node),
messageId: data.messageId,
channelId: a1
});
r3 = true;
}
}
return r3;
};
export { handleMessagesTapURLLink };
export function handleMessagesTapLink(a0) {
L90: {
const { allowWithinModal, chatInputRef, handleTransitionToThread, message, messageChannel, selectedChannelId } = a0;
const data = a0.tapLinkData.data;
if (!(allowWithinModal !== true && isAlertOrActionSheetOpen(selectedChannelId)) && !handleMessagesTapURLLink(data, messageChannel?.id) && data.action != null) {
switch (data.action) {
case "bindUserMenu":
showUserProfileActionSheet({
userId: data.userId,
channelId: data.messageChannelId,
messageId: data.messageId
});
break L90;
case "bindGuildMenu":
if (data.messageReference == null) {
return void 0;
}
const guild_id2 = data.messageReference.guild_id;
if (guild_id2 == null) {
return void 0;
}
ActionSheetActionCreators.openLazy(import("../../../guild_profile/native/components/GuildProfileActionSheet"), `GuildProfileActionSheet:${guild_id2}`, {
guildId: guild_id2
});
break L90;
case "bindJoinStream":
const stream = data.stream;
if (stream == null) {
return void 0;
}
SelectedChannelActionCreators.selectVoiceChannel(stream.channelId);
watchStreamAndTransitionToStream(stream);
break L90;
case "bindOpenPins":
openPinnedMessages(data.messageChannelId, "pinned-message-system-message");
break L90;
case "bindOpenGdmCustomizeActionSheet":
showChatGDMCustomizeActionSheet({
channelId: data.messageChannelId
});
break L90;
case "bindDismissMessage":
if (GuildAutomodMessageStore.getMessage(data.message?.id)?.isBlockedEdit) {
removeAutomodMessageNotice(data.message?.id);
break L90;
}
MessageActionCreators.dismissAutomatedMessage(data.message);
break L90;
case "bindTapUsername":
showUserProfileActionSheet({
userId: data.userId,
channelId: data.messageChannelId,
messageId: data.messageId,
sourceAnalyticsLocations: [AnalyticsLocation.USERNAME]
});
break L90;
case "bindTapCommandName":
if (message?.interaction != null && messageChannel != null) {
const user = UserStore.getUser(data.userId);
if (user == null) {
return void 0;
}
if (isPrimaryEntryPointCommandMessage(message)) {
if (message.applicationId == null) {
return void 0;
}
const channel2 = ChannelStore.getChannel(data.messageChannelId);
if (channel2 == null) {
return void 0;
}
const section = getSection({
channel: channel2,
type: "channel"
}, message.applicationId);
if (section.descriptor?.application != null) {
if (chatInputRef == null) {
break L90;
}
const current4 = chatInputRef.current;
if (current4 == null) {
break L90;
}
const isGuildInstalled = section.isGuildInstalled;
current4.openCustomKeyboard({
type: KeyboardTypes.APP_LAUNCHER,
context: {
initialRouteName: AppLauncherRouteName.APPLICATION_VIEW,
initiallyExpanded: true,
application: section.descriptor.application,
installOnDemand: isGuildInstalled ? !isGuildInstalled : !section.isUserInstalled
}
});
break L90;
}
if (chatInputRef == null) {
break L90;
}
const current3 = chatInputRef.current;
if (current3 == null) {
break L90;
}
current3.openCustomKeyboard({
type: KeyboardTypes.APP_LAUNCHER,
context: {
initialRouteName: AppLauncherRouteName.APPLICATION_VIEW,
initiallyExpanded: true,
applicationId: message.applicationId,
installOnDemand: true
}
});
break L90;
}
if (message?.author == null) {
break L90;
}
const r189 = {
author: getUserAuthor(message.interaction.user, messageChannel),
channelId: data.messageChannelId,
chatInputRef,
messageId: data.messageId,
user,
applicationUser: new UserRecord(message?.author),
guildId: null,
messageType: null
};
let guildId = messageChannel.getGuildId();
if (guildId == null) {
guildId = void 0;
}
r189.guildId = guildId;
r189.messageType = data.messageType;
showExecutedApplicationCommandPopout(r189);
break L90;
}
return void 0;
case "bindTapActivityText":
const application = ApplicationStore.getApplication(data.applicationUserId);
if (chatInputRef == null) {
break L90;
}
const current2 = chatInputRef.current;
if (current2 == null) {
break L90;
}
current2.openCustomKeyboard(application == null ? {
type: KeyboardTypes.APP_LAUNCHER,
context: {
initialRouteName: AppLauncherRouteName.APPLICATION_VIEW,
applicationId: data.applicationUserId,
initiallyExpanded: true
}
} : {
type: KeyboardTypes.APP_LAUNCHER,
context: {
initialRouteName: AppLauncherRouteName.APPLICATION_VIEW,
application,
initiallyExpanded: true
}
});
break L90;
case "bindOpenThreadChannel":
const channel = ChannelStore.getChannel(data.threadId);
if (channel == null) {
break L90;
}
handleTransitionToThread(channel?.guild_id, channel.id, OpenThreadAnalyticsLocations.EMBED);
break L90;
case "bindJumpToMessage":
MessageActionCreators.jumpToMessage({
channelId: data.targetChannelId,
messageId: data.targetMessageId,
flash: true,
returnMessageId: data.messageId
});
break L90;
case "bindOpenRoleSubscriptionOverview":
transitionTo(Routes.CHANNEL(data.guildId, StaticChannelRoute.ROLE_SUBSCRIPTIONS));
trackRoleSubscriptionPurchaseMessageTierClick(data.guildId, data.channelId, data.messageId, data.roleSubscriptionListingId);
break L90;
case "bindUserSurvey":
const guild_id = ChannelStore.getChannel(data.message.channel_id)?.guild_id;
if (guild_id == null) {
break L90;
}
const notificationType = data.notificationType;
if (NotificationTypes.TRENDING_CONTENT_PUSH === notificationType) {
const { message: message2, notificationType: notificationType3 } = data;
const MESSAGE_EMBED = AnalyticsLocations.MESSAGE_EMBED;
let summary_id = SummaryStore.selectedSummary(data.message.channel_id)?.id;
if (summary_id == null) {
summary_id = "unknown";
}
openGuildHighlightNotificationForPush(guild_id, message2, notificationType3, MESSAGE_EMBED, {
summary_id
});
break L90;
}
if (NotificationTypes.TOP_MESSAGE_PUSH === notificationType) {
openGuildHighlightNotificationForPush(guild_id, data.message, data.notificationType, AnalyticsLocations.MESSAGE_EMBED);
break L90;
}
const r13 = import("../../../notifications/native/NotificationSurveyActionSheet");
let notificationType2 = data.notificationType;
if (notificationType2 == null) {
notificationType2 = NotificationTypes.TOP_MESSAGE_PUSH;
}
ActionSheetActionCreators.openLazy(r13, "NotificationSurvey", {
location: AnalyticsLocations.MESSAGE_EMBED,
messageId: data.message.id,
notificationType: notificationType2
});
break L90;
case "bindInsertText":
if (chatInputRef == null) {
break L90;
}
const current = chatInputRef.current;
if (current == null) {
break L90;
}
const text = data.text;
let addSpace = data.addSpace;
if (addSpace == null) {
addSpace = true;
}
current.insertText(text, null, addSpace);
break L90;
default:
}
}
}
}
@@ -0,0 +1,32 @@
// Metro module 10901 (f10902).
import { useState } from "react";
import ChannelLatestMessageLoadingStatsManager from "../ChannelLatestMessageLoadingStatsManager";
import { startOrCancelChannelLatestMessagesLoad } from "../MessagesUtils";
import useMountEffect from "../../../../_bundle/useMountEffect";
export default function useChannelLoading({ channelId, jumpTargetId, oldestUnreadMessageId, shouldJumpToOriginalPost }) {
const [state] = useState(() => new ChannelLatestMessageLoadingStatsManager("Messages"));
useMountEffect(() => {
startOrCancelChannelLatestMessagesLoad({
jumpTargetId,
oldestUnreadMessageId,
shouldJumpToOriginalPost: shouldJumpToOriginalPost(false),
channelId,
tracker: state
});
return () => {
state.cancel();
};
});
return {
channelLatestMessageLoadingStatsManager: state,
startOrCancelLatestMessagesLoad: function startOrCancelLatestMessagesLoad(a0) {
startOrCancelChannelLatestMessagesLoad({
jumpTargetId,
oldestUnreadMessageId,
shouldJumpToOriginalPost: shouldJumpToOriginalPost(a0),
channelId,
tracker: state
});
}
};
};
@@ -0,0 +1,321 @@
// Metro module 11144 (f11145).
import TTITracker from "../../../tti_analytics/TTITracker";
import { JumpType } from "../../../../flow/Client";
import NativeChatUtils, { ChatScrollPosition } from "../../../chat/native/NativeChatUtils";
import { isIOS } from "../../../../utils/PlatformUtils";
import computeScrollData from "../../../chat/native/computeScrollData";
function $mk107736($env) {
return () => {
const r4 = $env;
const r0 = $env.$parent;
const chatManager = r0[0];
const messages = r0[5];
chatManager.setup(messages);
r0[1].setOptions({
inlineAttachmentMedia: r0[11],
inlineEmbedMedia: r0[12],
renderEmbeds: r0[13],
renderReactions: r0[14],
animateEmoji: r0[15],
animatingStickerMessageId: r0[2].current,
constrainedWidth: r0[26],
gifAutoPlay: r0[16],
timestampHourCycle: r0[17],
renderCommunicationDisabled: r0[19],
ignoreEmbedDescriptionCache: r4[2],
enableSwipeActions: r0[21],
shouldObscureSpoiler: r0[23],
shouldDisableInteractiveComponents: r0[24]
});
const r36 = $env.$parent.$parent;
for (const item of (0, r36[1])(r36[2][1])({
channel: r0[4],
messages,
uploads: r0[7],
oldestUnreadMessageId: r0[9],
replyingMessageId: r0[10],
currentUserId: r0[18],
canAddNewReactions: (0, r0[3])(),
selectedSummary: r0[20],
chatManager,
roleStyle: r0[8],
forceRender: r4[0],
updateMessageIds: r4[1],
isResourceChannel: r0[22],
unloadableContentEntryMessageIds: r0[25]
})) {
r0[0].createRow(r0[1].generate(item));
}
return r0[0].createChangeset();
};
}
function $mk107737($env) {
return () => {
const r9 = $env;
const r4 = $env.$parent;
const r3 = r4[38];
const scrollToMessageId3 = r9[0];
const r7 = r3(scrollToMessageId3);
if (r7 != null) {
const r11 = r4[27];
if (r11.current != null) {
const r12 = r9[1];
let r13 = false;
if (r12) {
const r14 = r4[42];
const r16 = $env.$parent.$parent;
r14({
scrollToMessageId: scrollToMessageId3,
jumpTargetId: scrollToMessageId3,
jumpType: r9[2],
focusTargetId: scrollToMessageId3,
overrideScrollJumpType: (0, r16[0])(r16[2][2]).JumpType.INSTANT,
isRescrolling: true,
hasJumpedToOriginalPost: r9[3]
});
r13 = true;
}
if (!r13) {
const r24 = $env.$parent.$parent;
(0, r24[1])(r24[2][3]).scrollTo(r11.current, r7, {
animated: r9[2] === (0, r24[0])(r24[2][2]).JumpType.ANIMATED
});
}
}
}
};
}
let env7531 = {};
export default function useRowManager(a0) {
let env18559 = {
$parent: env7531
};
env18559[0] = a0.chatManager;
env18559[1] = a0.rowGenerator;
env18559[2] = a0.animatingStickerMessageIdRef;
env18559[3] = a0.canAddNewReactions;
env18559[4] = a0.channel;
env18559[5] = a0.messages;
env18559[6] = a0.isMessagesReady;
env18559[7] = a0.uploads;
env18559[8] = a0.roleStyle;
env18559[9] = a0.oldestUnreadMessageId;
env18559[10] = a0.replyingMessageId;
env18559[11] = a0.inlineAttachmentMedia;
env18559[12] = a0.inlineEmbedMedia;
env18559[13] = a0.renderEmbeds;
env18559[14] = a0.renderReactions;
env18559[15] = a0.animateEmoji;
env18559[16] = a0.gifAutoPlay;
env18559[17] = a0.timestampHourCycle;
env18559[18] = a0.currentUserId;
env18559[19] = a0.renderCommunicationDisabled;
env18559[20] = a0.selectedSummary;
env18559[21] = a0.enableSwipeActions;
env18559[22] = a0.isResourceChannel;
env18559[23] = a0.shouldObscureSpoiler;
env18559[24] = a0.shouldDisableInteractiveComponents;
env18559[25] = a0.unloadableContentEntryMessageIds;
env18559[26] = a0.containerWidth;
env18559[27] = a0.chatRef;
env18559[28] = a0.loadedRef;
env18559[29] = a0.animatedRef;
env18559[30] = a0.hasMoreMessagesAfterForLastUpdateRef;
env18559[31] = a0.updateNativeRows;
env18559[32] = a0.isLoadingAtTop;
env18559[33] = a0.channelLatestMessageLoadingStatsManager;
env18559[34] = a0.channelId;
env18559[35] = a0.isMessagesCached;
env18559[36] = a0.chatUpdatesQueue;
env18559[37] = a0.shouldJumpToOriginalPost;
env18559[38] = a0.findMessageIndex;
env18559[39] = a0.scrollToTopMessage;
env18559[40] = a0.useReducedMotion;
const scrollToMessageId = function scrollToMessageId(a0) {
let animated, c26950_3;
const { scrollToMessageId: scrollToMessageId2, jumpTargetId = null } = a0;
let c26950_1 = jumpTargetId;
const { jumpType = JumpType.ANIMATED, scrollPosition = ChatScrollPosition.TOP, minimizeScrolling = false, isRescrolling = false } = a0;
let hasJumpedToOriginalPost = a0.hasJumpedToOriginalPost;
if (hasJumpedToOriginalPost === void 0) {
hasJumpedToOriginalPost = false;
}
animated = void 0;
c26950_3 = void 0;
const r13 = env18559[40] || jumpType === JumpType.INSTANT;
L29: {
animated = !r13;
if (isIOS() && !isRescrolling) {
let r46 = r13 ? JumpType.INSTANT : JumpType.ANIMATED;
let env26951;
const r47 = env26951 = {
$parent: env18559
};
env26951[0] = scrollToMessageId2;
env26951[1] = true;
if (r46 === void 0) {
r46 = JumpType.INSTANT;
}
env26951[2] = r46;
if (hasJumpedToOriginalPost === void 0) {
hasJumpedToOriginalPost = false;
}
env26951[3] = hasJumpedToOriginalPost;
if (scrollToMessageId2 == null) {
break L29;
}
setTimeout($mk107737(r47), 50);
} else {
const r59 = (0, env18559[38])(scrollToMessageId2);
c26950_3 = r59;
if (r59 != null) {
if (minimizeScrolling) {
setTimeout(() => {
NativeChatUtils.scrollIntoView(env18559[27].current, c26950_3, {
animated,
highlight: c26950_1 === scrollToMessageId2
});
}, 5);
} else {
NativeChatUtils.scrollTo(env18559[27].current, r59, {
animated,
highlight: jumpTargetId === scrollToMessageId2,
position: scrollPosition
});
}
}
}
}
};
env18559[41] = scrollToMessageId;
const updateRows = function updateRows(r4 = {}) {
const { forceRender = false, forceReload, updateMessageIds = new Set(), scrollToMessageId: scrollToMessageId3 = null, jumpTargetId = null, jumpType = JumpType.ANIMATED, focusTargetId = null, ignoreEmbedDescriptionCache = false, messagesNewlyLoaded = false, shouldInitialScroll = false, minimizeScrolling = false, isRescrolling = false } = r4;
let overrideScrollJumpType = r4.overrideScrollJumpType;
const { isAnimated = true, hasJumpedToOriginalPost = false } = r4;
const r38 = env18559[27];
if (r38.current != null) {
let env26952;
const r40 = env26952 = {
$parent: env18559
};
env26952[0] = forceRender;
env26952[1] = updateMessageIds;
env26952[2] = ignoreEmbedDescriptionCache;
const rows = env18559[4] != null ? env18559[5] != null ? env18559[6] ? TTITracker.firstRowGenerator.measure($mk107736(r40)) : null : null : null;
const r53 = env18559[28];
const current = r53.current;
const r55 = env18559[20];
const scrollPosition = r55 != null ? r55.startId === scrollToMessageId3 ? ChatScrollPosition.MIDDLE : void 0 : void 0;
L57: {
if (rows != null && rows.length > 0) {
const r103 = {
rows: env18559[0].getPreviousRows(),
scrollToMessageId: scrollToMessageId3,
jumpTargetId,
jumpType: null,
shouldInitialScroll: null,
animated: null,
scrollPosition: null,
focusTargetId: null
};
if (overrideScrollJumpType == null) {
overrideScrollJumpType = env18559[5].jumpType;
}
r103.jumpType = overrideScrollJumpType;
const current2 = r53.current;
r103.shouldInitialScroll = current2 ? shouldInitialScroll : !current2;
r103.animated = env18559[29].current;
r103.scrollPosition = scrollPosition;
r103.focusTargetId = focusTargetId;
const scrollData = computeScrollData(r103);
r53.current = true;
(0, env18559[31])({
rows,
hasMoreMessagesAfter: env18559[5].hasMoreAfter,
isLoadingAtTop: (0, env18559[32])(rows, env18559[30].current),
scrollData,
HACK_iOSForceAnimations: messagesNewlyLoaded,
forceReload,
isAnimated
});
if (current) {
break L57;
}
env18559[33].finish({
channelId: env18559[34],
areMessagesCached: env18559[35]
});
} else {
if (r53.current) {
const r66 = env18559[36];
if (r66.hasUpdates()) {
r66.tryFlush();
break L57;
}
}
if (!r53.current && (rows != null && rows.length === 0)) {
NativeChatUtils.fadeIn(r38.current);
} else if (scrollToMessageId3 != null && !(0, env18559[37])(hasJumpedToOriginalPost)) {
(0, env18559[41])({
scrollToMessageId: scrollToMessageId3,
jumpTargetId,
jumpType,
scrollPosition,
minimizeScrolling,
isRescrolling,
hasJumpedToOriginalPost
});
} else if (focusTargetId != null) {
const r84 = (0, env18559[38])(focusTargetId);
if (r84 != null) {
NativeChatUtils.focus(r38.current, r84);
}
}
}
}
if (r53.current && r53.current !== current && env18559[22]) {
setTimeout(() => (0, env18559[39])(), 100);
}
}
};
env18559[42] = updateRows;
return {
createRows: function createRows(a0) {
let env26948;
const r3 = env26948 = {
$parent: env18559
};
env26948[0] = a0.forceRender;
env26948[1] = a0.updateMessageIds;
env26948[2] = a0.ignoreEmbedDescriptionCache;
return env18559[4] != null ? env18559[5] != null ? env18559[6] ? TTITracker.firstRowGenerator.measure($mk107736(r3)) : null : null : null;
},
updateRows,
scrollToMessageId,
maybeRescrollToMessageId: function maybeRescrollToMessageId(a0) {
let env26949;
const r3 = env26949 = {
$parent: env18559
};
env26949[0] = a0;
let r5 = arguments[1];
if (r5 === void 0) {
r5 = false;
}
env26949[1] = r5;
let r8 = arguments[2];
if (r8 === void 0) {
r8 = JumpType.INSTANT;
}
env26949[2] = r8;
let r13 = arguments[3];
if (r13 === void 0) {
r13 = false;
}
env26949[3] = r13;
if (a0 != null) {
setTimeout($mk107737(r3), 50);
}
}
};
};
@@ -0,0 +1,199 @@
// Metro module 10903 (f10904).
import { useRef } from "react";
import { updateIsAtBottom, updateShouldShowJumpToPresentButton } from "../../../chat_input/native/useChatBottomManagerUIStore";
import Logger from "../../../debug/Logger";
import { getIsScreenReaderEnabled } from "../../../a11y/native/useIsScreenReaderEnabled.native";
import DimensionActionCreators from "../../../../actions/DimensionActionCreators";
import { batchUpdates } from "../../../../_bundle/Module705";
import NativeChatUtils from "../../../chat/native/NativeChatUtils";
import { getChangesetIdForChat } from "../../../chat/native/ChatChangesetUpdateTracker";
import { QuestsVisibleMessagesChangedSource } from "../../../quests/QuestTypes";
let c7341_6 = new Logger("useScrollHandlers");
export default function useScrollHandlers({ chatRef, chatManager, chatUpdatesQueue, pendingUpdatesQueueRef, animatedRef, fetchMoreBefore, fetchMoreAfter, handleVisibleMessagesChange, applyNativeRowsUpdate, messages, channel, channelId, screenIndex, onScroll, useReducedMotion, isStaff, visibleMessagesWindowHandler }) {
let ref, ref2, ref3, ref4, ref5, ref6, ref7, handleScroll2;
ref = void 0;
ref2 = void 0;
ref3 = void 0;
ref4 = void 0;
ref5 = void 0;
ref6 = void 0;
ref7 = void 0;
const handleScrollCallbacks2 = function handleScrollCallbacks(a0) {
const { eventTimestamp, isAtBottom: isAtBottom2, isNearBottom = false, isNearTop = false } = a0;
let dragging = a0.dragging;
if (dragging === void 0) {
dragging = false;
}
const { decelerating = false, isFirstMessageVisible = false } = a0;
L38: {
if (channel != null) {
if (messages.length === 0 && messages.loadingMore) {
break L38;
}
const isScreenReaderEnabled = getIsScreenReaderEnabled();
const loadingMore = messages.loadingMore;
let r32 = !loadingMore;
if (!loadingMore) {
if (!dragging) {
dragging = decelerating;
}
if (!dragging) {
dragging = isScreenReaderEnabled;
}
r32 = dragging;
}
if (r32) {
r32 = pendingUpdatesQueueRef.current.length === 0;
}
if (!ref5.current && (isNearTop && (messages.hasMoreBefore && r32))) {
animatedRef.current = true;
fetchMoreBefore();
} else if (!ref4.current && (isNearBottom && (messages.hasMoreAfter && r32))) {
animatedRef.current = true;
fetchMoreAfter();
} else if (!(ref3.current === isAtBottom2 && ref2.current)) {
DimensionActionCreators.updateChannelDimensions(channel.id, eventTimestamp, isAtBottom2 ? 1 : 0, 1, 0);
ref2.current = true;
}
onScroll({
isFirstMessageVisible
});
chatUpdatesQueue.tryFlush();
return true;
}
}
return false;
};
handleScroll2 = function handleScroll(a0) {
const { eventTimestamp, isAtBottom, isNearBottom = false, isNearTop = false, dragging = false, decelerating = false, shouldShowJumpToPresent = false } = a0;
let c26846_1 = shouldShowJumpToPresent;
let isFirstMessageVisible = a0.isFirstMessageVisible;
if (isFirstMessageVisible === void 0) {
isFirstMessageVisible = false;
}
if (handleScrollCallbacks2({
eventTimestamp,
isAtBottom,
isNearBottom,
isNearTop,
dragging,
decelerating,
shouldShowJumpToPresent,
isFirstMessageVisible
})) {
ref3.current = isAtBottom;
ref4.current = isNearBottom;
ref5.current = isNearTop;
ref7.current = dragging;
ref6.current = decelerating;
batchUpdates(() => {
updateShouldShowJumpToPresentButton(channelId, screenIndex, c26846_1 || messages.hasMoreAfter);
updateIsAtBottom(screenIndex, isAtBottom);
});
}
};
ref = useRef(void 0);
ref2 = useRef(false);
ref3 = useRef(false);
ref4 = useRef(false);
ref5 = useRef(false);
ref6 = useRef(false);
ref7 = useRef(false);
return {
hasHandledScrollRef: ref2,
isAtBottomRef: ref3,
isNearBottomRef: ref4,
isNearTopRef: ref5,
deceleratingRef: ref6,
draggingRef: ref7,
firstIgnoredScrollEventTimestampRef: ref,
loadMoreBefore: function loadMoreBefore() {
animatedRef.current = true;
fetchMoreBefore();
},
loadMoreAfter: function loadMoreAfter() {
animatedRef.current = true;
fetchMoreAfter();
},
scrollToTop: function scrollToTop(r5 = true) {
const current = chatRef.current;
if (r5) {
r5 = !useReducedMotion;
}
NativeChatUtils.scrollToTop(current, r5);
},
scrollToRelativeOffset: function scrollToRelativeOffset(a0, r6 = true) {
const current = chatRef.current;
if (r6) {
r6 = !useReducedMotion;
}
NativeChatUtils.scrollToRelativeOffset(current, a0, r6);
},
scrollToTopMessage: function scrollToTopMessage() {
const previousRows = chatManager.getPreviousRows();
if (previousRows.length > 0) {
NativeChatUtils.scrollTo(chatRef.current, previousRows.length - 1);
}
},
updateNativeRows: function updateNativeRows(a0) {
L7: {
if (chatUpdatesQueue.isBlocking) {
chatUpdatesQueue.add(a0);
} else {
L4: {
if (a0.isLoadingAtTop) {
if (!ref6.current && !ref7.current) {
break L4;
}
chatUpdatesQueue.add(a0);
break L7;
}
}
applyNativeRowsUpdate(a0);
}
}
},
handleScrollCallbacks: handleScrollCallbacks2,
handleScroll: handleScroll2,
handleScrollPosition: function handleScrollPosition({ timeStamp, nativeEvent }) {
const { isAtBottom: isAtBottom2, isNearBottom, isNearTop, dragging, decelerating, shouldShowJumpToPresent, isFirstMessageVisible, firstVisibleMessageIndex, firstVisibleMessagePercentVisible, lastVisibleMessageIndex, changesetUpdateId, lastVisibleMessagePercentVisible } = nativeEvent;
const changesetIdForChat = getChangesetIdForChat(chatRef.current);
if (changesetUpdateId !== changesetIdForChat) {
if (ref.current == null) {
ref.current = timeStamp;
}
if (isStaff) {
c7341_6.log("STAFF-ACK-LOG: Ignoring outdated scroll event.", channelId, changesetUpdateId, changesetIdForChat, timeStamp);
}
return void 0;
}
handleVisibleMessagesChange({
firstVisibleMessageRowIndex: firstVisibleMessageIndex,
lastVisibleMessageRowIndex: lastVisibleMessageIndex,
firstVisibleMessagePercentVisible,
lastVisibleMessagePercentVisible,
source: QuestsVisibleMessagesChangedSource.SCROLL
});
let current = ref.current;
if (current == null) {
current = timeStamp;
}
ref.current = void 0;
handleScroll2({
eventTimestamp: current,
isAtBottom: isAtBottom2,
isNearBottom,
isNearTop,
dragging,
decelerating,
shouldShowJumpToPresent,
isFirstMessageVisible
});
visibleMessagesWindowHandler.handleScrollPosition({
rows: chatManager._rows,
firstVisibleMessageRowIndex: firstVisibleMessageIndex,
lastVisibleMessageRowIndex: lastVisibleMessageIndex
});
}
};
};
@@ -0,0 +1,13 @@
// Metro module 11123 (f11124).
import MessageActionCreators from "../../../actions/MessageActionCreators";
export default function jumpToReferencedMessage(a0) {
const messageReference = a0.messageReference;
if (messageReference?.channel_id != null && messageReference.message_id != null) {
MessageActionCreators.jumpToMessage({
channelId: messageReference.channel_id,
messageId: messageReference.message_id,
flash: true,
returnMessageId: a0.id
});
}
};
@@ -0,0 +1,512 @@
// Metro module 9551 (f9552).
import { useEffect, useCallback } from "react";
import GuildAutomodMessageStore from "../../../guild_automod/GuildAutomodMessageStore";
import ReportToModStore from "../../../report_to_mod/ReportToModStore";
import SavedMessagesStore from "../../../saved_messages/SavedMessagesStore";
import { isMessageComponentsV2 } from "../../../../records/MessageRecord";
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import GuildStore from "../../../../stores/GuildStore";
import PermissionStore from "../../../../stores/PermissionStore";
import { FileUploadErrorTypes } from "../../MessageConstants";
import { AnalyticEvents, AnalyticsPages, ChannelTypes, GuildFeatures, LOCAL_BOT_ID, MessageAttachmentFlags, MessageFlags, MessageStates, MessageTypes, MessageTypesSets, Permissions } from "../../../../Constants";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import AppAnalyticsUtils from "../../../app_analytics/AppAnalyticsUtils";
import { showLongPressMessageActionSheet } from "./showLongPressMessageActionSheet";
import { useCanReplyToMessage } from "../../../replies/canReplyToMessage";
import { useCanForwardMessage } from "../../../forwarding/canForwardMessage";
import ForLaterExperiment from "../../../saved_messages/ForLaterExperiment";
import { useStateFromStoresArray, useStateFromStores } from "../../../../_bundle/Module589";
import hasForLaterPremiumType from "../../../saved_messages/hasForLaterPremiumType";
import { useIsNonModInLockedThread, useIsActiveChannelOrUnarchivableThread, computeCanStartPublicThread } from "../../../threads/ThreadHooks";
import useShouldHideMediaOptions from "../../../media_channel/useShouldHideMediaOptions";
import usePollMessageContextItemTypes, { PollMessageContextItemTypes } from "../../../polls/chat/usePollMessageContextItemTypes";
import { DeveloperMode } from "../../../user_settings/UserSettings";
import { useCanToggleGuildOfficialMessages } from "../../GuildOfficialMessageUtils";
import isMessagePinnable from "../../isMessagePinnable";
import { getAllTextDisplayContent } from "../../../interaction_components/InteractionComponentUtils";
import * as _Module1384 from "../../../../_bundle/Module1384";
import countContentTypes from "../../countContentTypes";
import { canRetryInteractionData } from "../../../interactions/InteractionUtils";
import { useIsReportToModEnabled } from "../../../report_to_mod/hooks/useReportToModHooks";
import { ActionSheetRow } from "../../../../design/components/Sheet/native/ActionSheetRow.native";
import { longPressMessageOptionHandler } from "./LongPressMessageActionSheetUtils";
import { ActionSheet } from "../../../../design/components/Sheet/native/ActionSheet.native";
import { isMetaQuest } from "../../../device/MetaQuestUtils.android";
import { shouldShowEmojiRow } from "../../../action_sheet/native/components/EmojiRowUtils";
import EmojiRow from "../../../action_sheet/native/components/EmojiRow";
import { intl, t } from "../../../../intl/index.native";
import { RetryIcon } from "../../../../design/components/Icon/native/redesign/generated/RetryIcon";
import { CopyIcon } from "../../../../design/components/Icon/native/redesign/generated/CopyIcon";
import { TrashIcon } from "../../../../design/components/Icon/native/redesign/generated/TrashIcon";
import { LinkIcon } from "../../../../design/components/Icon/native/redesign/generated/LinkIcon";
import { PencilIcon } from "../../../../design/components/Icon/native/redesign/generated/PencilIcon";
import { ArrowAngleLeftUpIcon } from "../../../../design/components/Icon/native/redesign/generated/ArrowAngleLeftUpIcon";
import ForwardingIcon from "../../../forwarding/native/ForwardingIcon";
import { ThreadIcon } from "../../../../design/components/Icon/native/redesign/generated/ThreadIcon";
import { ChatArrowRightIcon } from "../../../../design/components/Icon/native/redesign/generated/ChatArrowRightIcon";
import { ChatMarkUnreadIcon } from "../../../../design/components/Icon/native/redesign/generated/ChatMarkUnreadIcon";
import { ClockXIcon } from "../../../../design/components/Icon/native/redesign/generated/ClockXIcon";
import { ReactionIcon } from "../../../../design/components/Icon/native/redesign/generated/ReactionIcon";
import { AnnouncementsIcon } from "../../../../design/components/Icon/native/redesign/generated/AnnouncementsIcon";
import { PinIcon } from "../../../../design/components/Icon/native/redesign/generated/PinIcon";
import { StampIcon } from "../../../../design/components/Icon/native/redesign/generated/StampIcon";
import { StampXIcon } from "../../../../design/components/Icon/native/redesign/generated/StampXIcon";
import { NitroWheelIcon } from "../../../../design/components/Icon/native/redesign/generated/NitroWheelIcon";
import { BookmarkOutlineIcon } from "../../../../design/components/Icon/native/redesign/generated/BookmarkOutlineIcon";
import { BookmarkIcon } from "../../../../design/components/Icon/native/redesign/generated/BookmarkIcon";
import { ClockIcon } from "../../../../design/components/Icon/native/redesign/generated/ClockIcon";
import { RobotIcon } from "../../../../design/components/Icon/native/redesign/generated/RobotIcon";
import { ChatIcon } from "../../../../design/components/Icon/native/redesign/generated/ChatIcon";
import { AtIcon } from "../../../../design/components/Icon/native/redesign/generated/AtIcon";
import { DownloadIcon } from "../../../../design/components/Icon/native/redesign/generated/DownloadIcon";
import { IdIcon } from "../../../../design/components/Icon/native/redesign/generated/IdIcon";
import { XSmallBoldIcon } from "../../../../design/components/Icon/native/redesign/generated/XSmallBoldIcon";
import { FlagIcon } from "../../../../design/components/Icon/native/redesign/generated/FlagIcon";
import { ClydeIcon } from "../../../../design/components/Icon/native/redesign/generated/ClydeIcon";
import ReportToMod_messages from "../../../report_to_mod/ReportToMod.messages";
import { ImageWarningIcon } from "../../../../design/components/Icon/native/redesign/generated/ImageWarningIcon";
import { canReportMessageToMods } from "../../../report_to_mod/ReportToModUtils";
import { canReportUser, canReportMessage } from "../../../../utils/ReportUtils";
import canEditMessage from "../../canEditMessage";
import { isWebPlayerVideoUrl } from "../../MediaFormatTesters";
import { messageHasObscurableMedia } from "../../../explicit_media_redaction/ObscuredMediaUtils";
import { hasNonVoteReactions } from "../../../polls/PollsUtils";
import { canViewInteractionInfo } from "../../../applications/ApplicationInteractionInfoUtils";
export default function LongPressMessageActionSheet(a0) {
let callback, isActiveChannelOrUnarchivableThread, props, props2, props3, props4, props5, props6, props7, props8, props9, props10, props11, props12, props13, props14, props15, props16, props17, props18, props19, props20, props21, props22, props23, props24, props25, props26, c17286_37, c17286_38;
let c17286_0 = a0;
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.MESSAGE_LONG_PRESS_MENU).analyticsLocations;
let analyticsLocation = a0.analyticsLocation;
if (analyticsLocation === void 0) {
analyticsLocation = {};
}
let c17286_2 = analyticsLocation;
const { user, message, channel, chatInputRef, selectedMedia, actionSheetSource = void 0, canAddNewReactions = false } = a0;
useEffect(() => {
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.MESSAGE_ACTION_SHEET_OPENED, {
channel_id: channel.id,
guild_id: channel.guild_id,
location: {
page: channel.isPrivate() ? AnalyticsPages.DM_CHANNEL : AnalyticsPages.GUILD_CHANNEL,
...c17286_2
}
});
}, [analyticsLocation, channel]);
callback = useCallback(() => {
showLongPressMessageActionSheet(c17286_0);
}, [a0]);
const canReplyToMessage2 = useCanReplyToMessage(channel, message);
const canForwardMessage2 = useCanForwardMessage(message);
const guild = GuildStore.getGuild(channel.guild_id);
let enabled = ForLaterExperiment.useConfig({
location: "LongPressMessageActionSheet"
}).enabled;
const [r73, r74] = useStateFromStoresArray([SavedMessagesStore], () => [SavedMessagesStore.isMessageReminder(channel.id, message.id), SavedMessagesStore.isMessageBookmarked(channel.id, message.id)]);
const hasForLaterPremiumType2 = hasForLaterPremiumType();
const isNonModInLockedThread = useIsNonModInLockedThread(channel);
const shouldHideMediaOptions = useShouldHideMediaOptions(channel?.id);
const r154 = GuildAutomodMessageStore.getMessage(message.id) != null;
const interactionError = message.interactionError;
const EXPLICIT_CONTENT = FileUploadErrorTypes.EXPLICIT_CONTENT;
const pollMessageContextItemTypes = usePollMessageContextItemTypes(message);
isActiveChannelOrUnarchivableThread = useIsActiveChannelOrUnarchivableThread(channel);
const r69 = user == null ? void 0 : user.isNonUserBot();
const id = AuthenticationStore.getId();
const setting = DeveloperMode.getSetting();
const r49 = PermissionStore.can(Permissions.MANAGE_MESSAGES, channel);
const r178 = PermissionStore.can(Permissions.SEND_MESSAGES, channel);
const canToggleGuildOfficialMessages = useCanToggleGuildOfficialMessages(message, channel, "LongPressMessageActionSheet");
const id2 = message.author.id;
const hasFlag = message.hasFlag(MessageFlags.CROSSPOSTED);
const isMessagePinnable2 = isMessagePinnable(message, channel);
const r64 = (hasFlag ? !hasFlag : channel.type === ChannelTypes.GUILD_ANNOUNCEMENT) && (guild == null ? void 0 : guild.features.has(GuildFeatures.NEWS)) && r178 && (id2 === id || r49) && message.type === MessageTypes.DEFAULT && !message.isPoll();
const r77 = computeCanStartPublicThread(channel, message);
const contentMessage = message.getContentMessage();
const length = contentMessage.embeds.length;
const r214 = isMessageComponentsV2(contentMessage) ? getAllTextDisplayContent(contentMessage.components) : contentMessage.content;
const r65 = (r49 || message.canDeleteOwnMessage(id)) && length > 0 && message.author.id !== LOCAL_BOT_ID && !_Module1384.hasFlag(message.flags, MessageFlags.EPHEMERAL) && countContentTypes(message) >= 1;
const r239 = (r154 ? !r154 : !(interactionError === EXPLICIT_CONTENT)) && (message.interactionData == null || canRetryInteractionData(message.interactionData));
const r252 = message.attachments.filter((attachment) => attachment.flags == null || !_Module1384.hasFlag(attachment.flags, MessageAttachmentFlags.IS_THUMBNAIL));
const r54 = message.author.id === id && (r252.length > 1 || message.content !== "");
const stateFromStores = useStateFromStores([ReportToModStore], () => ReportToModStore.hasReportedMessage(message.channel_id, message.id));
const id3 = guild?.id;
const getProps = function getProps({ arrow, IconComponent, label, onActionExecuted, variant, disabled }) {
return {
arrow,
icon: <ActionSheetRow.Icon IconComponent={IconComponent} />,
label,
onPress: () => {
(0, longPressMessageOptionHandler)({
actionSheetSource,
analyticsLocations,
channel,
chatInputRef,
label,
message,
onBack: callback,
onActionExecuted,
selectedMedia,
disabled
});
},
variant,
disabled
};
};
const render = function render(a0) {
return <AnalyticsLocationProvider value={analyticsLocations}>
<ActionSheet showGradient startExpanded={isMetaQuest()} header={shouldShowEmojiRow(canAddNewReactions, message, isActiveChannelOrUnarchivableThread) && <EmojiRow message={message} channel={channel} />}>
{a0 == null ? void 0 : a0.map((a0, a1) => <ActionSheetRow.Group key={a1} hasIcons>
{a0.map((item, index) => {
const { icon, arrow } = item;
return <ActionSheetRow key={index} icon={icon} arrow={arrow} label={item.label} onPress={item.onPress} variant={item.variant} disabled={item.disabled} />;
})}
</ActionSheetRow.Group>)}
</ActionSheet>
</AnalyticsLocationProvider>;
};
const isReportToModEnabled = useIsReportToModEnabled(id3);
if (message.state === MessageStates.SEND_FAILED) {
const r1103 = [];
if (r239) {
r1103.push(getProps({
label: intl.string(t["5911Lb"]),
IconComponent: RetryIcon
}));
}
if (r214 != null && r214.length > 0) {
r1103.push(getProps({
label: intl.string(t.JrGD7E),
IconComponent: CopyIcon
}));
}
r1103.push(getProps({
label: intl.string(t.xwMqD7),
IconComponent: TrashIcon,
variant: "danger"
}));
return render([r1103]);
}
if (message.state === MessageStates.SENDING) {
const r1059 = r214 != null && r214.length > 0;
const r1062 = [];
if (r1059) {
r1062.push(getProps({
label: intl.string(t.JrGD7E),
IconComponent: CopyIcon
}));
}
r1062.push(getProps({
label: intl.string(t.xwMqD7),
IconComponent: TrashIcon,
variant: "danger"
}));
return render([r1062]);
}
if (message.type === MessageTypes.THREAD_STARTER_MESSAGE) {
return render([[getProps({
label: intl.string(t.k5WiPf),
IconComponent: LinkIcon
})]]);
}
props = getProps({
label: intl.string(t.fsBWmS),
IconComponent: PencilIcon
});
props2 = getProps({
label: intl.string(t["5IEsGx"]),
IconComponent: ArrowAngleLeftUpIcon
});
props3 = getProps({
label: intl.string(t.I3ltXO),
IconComponent: ForwardingIcon
});
props4 = getProps({
label: intl.string(t.rBIGBL),
IconComponent: ThreadIcon
});
const r44 = getProps({
label: intl.string(t["39d0Wj"]),
IconComponent: ThreadIcon
});
const r45 = getProps({
label: intl.string(t["+TSRGD"]),
IconComponent: ChatArrowRightIcon
});
const r43 = getProps({
label: intl.string(t.JrGD7E),
IconComponent: CopyIcon
});
props5 = getProps({
label: intl.string(t.RpE9k7),
IconComponent: ChatMarkUnreadIcon
});
const r41 = getProps({
label: intl.string(t.grdwwt),
IconComponent: ClockXIcon
});
const r40 = getProps({
label: intl.string(t.gHp0C4),
IconComponent: ReactionIcon
});
props6 = getProps({
label: intl.string(t.MFGE51),
IconComponent: AnnouncementsIcon
});
props7 = getProps({
label: intl.string(t.CvQ18w),
IconComponent: PinIcon
});
props8 = getProps({
label: intl.string(t["Bse+F/"]),
IconComponent: PinIcon
});
props9 = getProps({
label: intl.string(t["lE/PG3"]),
IconComponent: StampIcon
});
props10 = getProps({
label: intl.string(t["2km5Gf"]),
IconComponent: StampXIcon
});
props11 = getProps({
label: intl.string(t.tpxJto),
IconComponent: NitroWheelIcon
});
props12 = getProps({
label: intl.string(t.tpxJto),
IconComponent: BookmarkOutlineIcon
});
props13 = getProps({
label: intl.string(t.SvXS1Z),
IconComponent: BookmarkIcon
});
props14 = getProps({
label: intl.string(t.mJ3P0N),
IconComponent: ClockIcon,
arrow: true
});
props15 = getProps({
label: intl.string(t.vrbqs1),
IconComponent: ClockIcon,
arrow: true
});
props16 = getProps({
label: intl.string(t.PHjkRE),
IconComponent: RobotIcon,
arrow: true
});
props17 = getProps({
label: intl.string(t["g33r/P"]),
IconComponent: ChatIcon
});
props18 = getProps({
label: intl.string(t.P8tvKG),
IconComponent: AtIcon
});
const r26 = getProps({
label: intl.string(t["S/xNKV"]),
IconComponent: DownloadIcon
});
const r25 = getProps({
label: intl.string(t.JVuuz3),
IconComponent: DownloadIcon
});
const r24 = getProps({
label: intl.string(t.vbAEaA),
IconComponent: DownloadIcon
});
let r621 = false;
try {
const r630 = selectedMedia?.mediaUrl != null ? new URL(selectedMedia.mediaUrl) : null;
r621 = selectedMedia?.mediaType === "image" && r630 != null && r630.hostname === "cdn.discordapp.com" && /\.(png|jpe?g|webp|avif|bmp|svg)(\?|$)/i.test(r630.pathname);
} catch ($e) {}
const r23 = getProps({
label: intl.string(r621 ? t["8xHmxo"] : t["92CPQ+"]),
IconComponent: LinkIcon
});
props19 = getProps({
label: intl.string(t.Xrt5Po),
IconComponent: LinkIcon
});
const r689 = getProps({
label: intl.string(t.Rjezbz),
IconComponent: ClockIcon,
arrow: true
});
const r703 = getProps({
label: intl.string(t.zBoHlf),
IconComponent: IdIcon
});
props20 = getProps({
label: length > 1 ? intl.string(t.wUIMqa) : intl.string(t["4sxKOb"]),
IconComponent: XSmallBoldIcon,
variant: "danger"
});
props21 = getProps({
label: intl.string(t.ZbtGBm),
IconComponent: TrashIcon,
variant: "danger"
});
props22 = getProps({
label: intl.string(t.kFwAsa),
IconComponent: TrashIcon,
variant: "danger"
});
props23 = getProps({
label: intl.string(t["+78Pfm"]),
IconComponent: FlagIcon,
variant: "danger"
});
props24 = getProps({
label: intl.string(t.n5EBAJ),
variant: "danger",
IconComponent: ClydeIcon
});
props25 = getProps({
label: intl.string(ReportToMod_messages["1D+vqy"]),
IconComponent: FlagIcon,
disabled: stateFromStores
});
const r811 = getProps({
label: intl.string(t.ZH7P2h),
IconComponent: ImageWarningIcon
});
props26 = getProps({
label: intl.string(t.xwMqD7),
IconComponent: TrashIcon,
variant: "danger"
});
c17286_37 = (() => {
const r33 = actionSheetSource === "Preview" || _Module1384.hasFlag(message.flags, MessageFlags.EPHEMERAL);
const r41 = [];
if (r33) {
r41.push(props4, props5, props12, props13, props11, props14, props15, props20, props26, props, props18, props17, props16, props21);
}
let r43 = isActiveChannelOrUnarchivableThread;
if (isActiveChannelOrUnarchivableThread) {
r43 = !_Module1384.hasFlag(message.flags, MessageFlags.EPHEMERAL);
}
if (!r43) {
r41.push(props, props2, props20, props22, props26, props6, props7, props8, props9, props10, props5, props18, props16, props21);
}
if (_Module1384.hasFlag(message.flags, MessageFlags.EPHEMERAL)) {
r41.push(props3, props2, props19, props23, props24, props25);
}
return new Set(r41);
})();
const r827 = [];
if (actionSheetSource === "Preview") {
r827.unshift(r45);
}
if (r77) {
r827.unshift(props4);
} else if (message.hasFlag(MessageFlags.HAS_THREAD)) {
r827.unshift(r44);
}
r827.unshift(props19);
if (setting) {
r827.unshift(r703);
}
if (isReportToModEnabled && canReportMessageToMods(message)) {
r827.unshift(props24);
r827.unshift(props25);
} else if (user != null && canReportUser(user) && canReportMessage(message)) {
r827.unshift(props23);
}
r827.unshift(props5);
if (enabled) {
enabled = r74 || r73 || channel.isPrivate() || PermissionStore.can(Permissions.READ_MESSAGE_HISTORY, channel);
}
L110: {
if (enabled) {
if (!hasForLaterPremiumType2 && !r74 && !r73) {
r827.unshift(props11);
break L110;
}
r827.unshift(r74 ? props13 : props12);
r827.unshift(r73 ? props15 : props14);
}
}
if (r65) {
r827.unshift(props20);
}
if (!((r49 ? !r49 : !message.canDeleteOwnMessage(id)) || MessageTypesSets.UNDELETABLE.has(message.type))) {
r827.unshift(props26);
}
if (canEditMessage(message, id) && !isNonModInLockedThread) {
r827.unshift(props);
}
if (r64) {
r827.unshift(props6);
}
const r901 = channel.type === ChannelTypes.GROUP_DM;
if (!(channel.isPrivate() && !r901 || r69 === true)) {
if (PermissionStore.can(Permissions.SEND_MESSAGES, channel) || r901) {
r827.unshift(props18);
}
if (id !== user?.id) {
r827.unshift(props17);
}
}
if (isMessagePinnable2) {
r827.unshift(message.pinned ? props8 : props7);
}
if (canToggleGuildOfficialMessages) {
r827.unshift(_Module1384.hasFlag(message.flags, MessageFlags.IS_GUILD_OFFICIAL) ? props10 : props9);
}
if (r214 != null && r214.length > 0) {
r827.unshift(r43);
}
if (canReplyToMessage2) {
r827.unshift(props2);
}
if (canForwardMessage2) {
r827.unshift(props3);
}
if (!(selectedMedia == null || shouldHideMediaOptions)) {
L165: {
r827.unshift(r23);
if (selectedMedia.mediaType === "image") {
r827.unshift(r26);
} else {
if (selectedMedia.mediaType === "video" && !isWebPlayerVideoUrl(selectedMedia.mediaUrl)) {
r827.unshift(r25);
break L165;
}
if (!(selectedMedia.mediaType !== "audio" && selectedMedia.mediaType !== "file")) {
r827.unshift(r24);
}
}
}
if (messageHasObscurableMedia(message)) {
r827.unshift(r811);
}
if (selectedMedia.sourceType === "attachment" && r54) {
r827.unshift(props22);
}
}
let r977 = message.reactions.length > 0;
if (r977) {
const isPoll = message.isPoll();
r977 = isPoll ? hasNonVoteReactions(message) : !isPoll;
}
if (r977) {
r827.unshift(r40);
if (r49) {
r827.unshift(props21);
}
}
for (const item of pollMessageContextItemTypes) {
if (item === PollMessageContextItemTypes.END_EARLY) {
r827.unshift(r41);
}
}
r827.unshift(props16);
if (canViewInteractionInfo(message)) {
r827.unshift(r689);
}
c17286_38 = new Set(r827.filter((item) => !c17286_37.has(item)));
return render([[props, props2, props3, props4], [r45, r44, r43, props5, r41, r40, props6, props7, props8, props9, props10, props11, props12, props13, props14, props15, props16, props17, props18, r26, r25, r24, r23, props19, r689, r703], [props20, props21, props22, props23, props24, props25, r811, props26]].map((a0) => a0.filter((item) => c17286_38.has(item))).filter((item) => item.length > 0));
};
@@ -0,0 +1,671 @@
// Metro module 9563 (f9564).
import PendingReplyStore from "../../../replies/PendingReplyStore";
import { isMessageComponentsV2 } from "../../../../records/MessageRecord";
import EditMessageStore from "../../../../stores/EditMessageStore";
import UploadStore from "../../../../stores/UploadStore";
import UserStore from "../../../../stores/UserStore";
import SendMessageOptionsStore from "../../SendMessageOptionsStore";
import { AnalyticEvents, AnalyticsObjects, AnalyticsPages, AnalyticsSections, ComponentActions, GIF_RE_IOS, MediaType, MessageStates, MessageTypes } from "../../../../Constants";
import { isStaticChannelRoute } from "../../../channel/ChannelConstants";
import { EXPLICIT_MEDIA_FALSE_POSITIVE_ACTION_SHEET_KEY } from "../../../explicit_media_redaction/ExplicitMediaRedactionConstants";
import UserUtils from "../../../../utils/UserUtils";
import SnowflakeUtils from "../../../../utils/SnowflakeUtils";
import { deletePendingReply } from "../../../replies/PendingReplyActionCreators";
import { openCreateForumPostModal } from "../../../forums/native/composer/ForumComposerModalActionCreators";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import MessageActionCreators from "../../../../actions/MessageActionCreators";
import AlertActionCreators from "../../../../actions/AlertActionCreators";
import { intl, t } from "../../../../intl/index.native";
import PublishModal from "../../../action_sheet/native/components/PublishModal";
import LongPressMessageChatItemPreview from "./LongPressMessageChatItemPreview";
import ChannelPinActionCreators from "../../../../actions/ChannelPinActionCreators";
import { AccessibilityAnnouncer } from "../../../../_bundle/Module3902";
import MessageQueue from "../../../../lib/MessageQueue";
import retrySendMessage_native from "../../retrySendMessage.native";
import ThreadActionCreators from "../../../threads/ThreadActionCreators";
import { navigateToCreateThread, navigateToContextMenuCommands } from "../../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import { transitionToGuild } from "../../../routing/router_utils";
import { getAllTextDisplayContent } from "../../../interaction_components/InteractionComponentUtils";
import { copy } from "../../../../utils/ClipboardUtils.native";
import { presentLinkCopied, presentMessageIdCopied, presentMessageCopied, presentGifSaved, presentImageSaved, presentVideoSaved } from "../../../toast/native/ToastUtils";
import { getChannelPermalink } from "../../../../utils/ChannelUtils";
import ChannelActionCreators from "../../../../actions/ChannelActionCreators";
import markUnread from "../../markUnread";
import { urlMatchesFileExtension } from "../../MediaFormatTesters";
import URLUtils from "../../../../utils/URLUtils";
import { isAttachmentUrl, maybeRefreshAttachmentUrl } from "../../SignedAttachmentLinkUtils";
import { downloadMediaAssetWithContentType } from "../../../media_viewer/native/MediaSourceUtil";
import { handleClick } from "../../../../utils/MaskedLinkUtils";
import { getHostname } from "../../../../stores/MaskedLinkStoreMethodsAdditional.native";
import { messageHasObscurableMedia } from "../../../explicit_media_redaction/ObscuredMediaUtils";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { canReportMessage } from "../../../../utils/ReportUtils";
import { showReportToModMessageModal, showReportModalForMessage } from "../../../in_app_reports/ReportModals";
import ReportToMod_messages from "../../../report_to_mod/ReportToMod.messages";
import { canReportMessageToMods } from "../../../report_to_mod/ReportToModUtils";
import { transitionToMessage } from "../../../routing/transitionToChannel";
import showUserProfileActionSheet from "../../../user_profile/native/showUserProfileActionSheet";
import AppAnalyticsUtils from "../../../app_analytics/AppAnalyticsUtils";
import { handleAddNewReactions, handleViewPreviewReactions, handleViewReactions, handleRemoveAllReactions } from "../../../reactions/native/ReactionUtils";
import replyToMessage from "../../../replies/native/replyToMessage";
import { ComponentDispatch } from "../../../../utils/ComponentDispatchUtils";
import { openForwardModal } from "../../../forwarding/native/ForwardModalUtils";
import { ApplicationCommandType } from "../../../../flow/Server";
import { addOrUpdateSavedMessage, removeSavedMessage } from "../../../saved_messages/SavedMessageHelpers.native";
import PollsActionCreators from "../../../polls/PollsActionCreators";
import { HermesBuiltin } from "../../../../_hermes/prelude";
const handleEdit = function handleEdit(a0, a1, a2, a3, r5 = false) {
L27: {
if (a1.isForumPost() && (a1.id === SnowflakeUtils.castMessageIdAsChannelId(a0.id) && a1.parent_id != null)) {
deletePendingReply(a1.id);
openCreateForumPostModal({
guildId: a1.guild_id,
parentChannelId: a1.parent_id,
threadId: a1.id,
messageId: a0.id,
isEdit: true,
analyticsLocations: [AnalyticsLocation.FORUM_CHANNEL, AnalyticsLocation.GUILD_CHANNEL],
analyticsLocationObject: {
page: AnalyticsPages.GUILD_CHANNEL,
section: AnalyticsSections.FORUM_POST_HEADER,
object: AnalyticsObjects.CONTEXT_MENU
}
});
} else if (r5 && (a3 === "message_swipe" && EditMessageStore.isEditing(a1.id, a0.id))) {
const currentUser2 = UserStore.getCurrentUser();
AnalyticsUtils.track(AnalyticEvents.CHAT_CONTEXT_BAR_ACTION_CANCELED, {
message_id: a0.id,
channel_id: a1.id,
guild_id: a1.guild_id,
context_action: "edit",
reason: "swipe_edit_undo",
is_own_message: currentUser2 != null && currentUser2.id === a0.author.id
});
MessageActionCreators.endEditMessage(a1.id);
if (a2 == null) {
break L27;
}
const current2 = a2.current;
if (current2 == null) {
break L27;
}
current2.dismissKeyboard();
} else {
const pendingReply = PendingReplyStore.getPendingReply(a1.id);
if (pendingReply != null) {
const currentUser = UserStore.getCurrentUser();
AnalyticsUtils.track(AnalyticEvents.CHAT_CONTEXT_BAR_ACTION_CANCELED, {
message_id: a0.id,
channel_id: a1.id,
guild_id: a1.guild_id,
context_action: "reply",
reason: a3 === "message_swipe" ? "swipe_edit" : a3 === "action_sheet" ? "action_sheet_edit" : a3 !== "cancel" ? void 0 : "pressed_cancel",
is_own_message: currentUser != null && currentUser.id === pendingReply.message.author.id
});
}
deletePendingReply(a1.id);
MessageActionCreators.startEditMessageRecord(a1.id, a0, a3);
if (a2 != null) {
const current = a2.current;
if (current != null) {
current.openSystemKeyboard();
}
}
}
}
};
export function getContextBarCancelReason(a0, a1) {
if (a1 === "message_swipe") {
return a0 === "reply" ? "swipe_edit" : "swipe_reply";
}
if (a1 === "action_sheet") {
return a0 === "reply" ? "action_sheet_edit" : "action_sheet_reply";
}
if (a1 === "cancel") {
return "pressed_cancel";
}
}
export { handleEdit };
export function handleCreateThread(a0, a1, r11 = "Message") {
ThreadActionCreators.openThreadCreationForMobile(a0, a1?.id, r11);
if (!(a1 == null || navigateToCreateThread(a0.guild_id, SnowflakeUtils.castMessageIdAsChannelId(a1.id)))) {
transitionToGuild(a0.guild_id, SnowflakeUtils.castMessageIdAsChannelId(a1.id));
}
}
export function handleCopyMessageLink(a0, a1) {
AnalyticsUtils.track(AnalyticEvents.MESSAGE_LINK_COPIED, {
message_id: a1,
channel: a0.id
});
const channelPermalink = getChannelPermalink(a0.guild_id, a0.id, a1);
if (channelPermalink != null) {
copy(channelPermalink);
presentLinkCopied();
}
}
export function handleCopyId(a0) {
copy(a0);
presentMessageIdCopied();
}
export function longPressMessageOptionHandler({ label, message: message5, channel, chatInputRef, selectedMedia: selectedMedia3, actionSheetSource, analyticsLocations, onActionExecuted, onBack, disabled = false }) {
const { guild_id, id } = channel;
const id2 = message5.id;
if (!disabled) {
if (label !== intl.string(t.PHjkRE)) {
ActionSheetActionCreators.hideActionSheet();
}
L179: {
if (intl.string(t["+78Pfm"]) !== label && intl.string(t.n5EBAJ) !== label) {
if (intl.string(ReportToMod_messages["1D+vqy"]) === label) {
if (!canReportMessageToMods(message5)) {
break L179;
}
showReportToModMessageModal(message5);
break L179;
}
if (intl.string(t.k5WiPf) === label) {
if (message5.type !== MessageTypes.THREAD_STARTER_MESSAGE) {
break L179;
}
if (message5.messageReference == null) {
break L179;
}
const messageReference = message5.messageReference;
const { message_id, guild_id: guild_id2, channel_id } = messageReference;
if (guild_id2 == null) {
break L179;
}
transitionToGuild(guild_id2, channel_id, message_id);
break L179;
}
if (intl.string(t["+TSRGD"]) === label) {
transitionToMessage(channel.id, message5.id);
break L179;
}
if (intl.string(t.zBoHlf) === label) {
copy(id2);
presentMessageIdCopied();
break L179;
}
if (intl.string(t.P8tvKG) === label) {
const user = UserStore.getUser(message5.author.id);
if (user == null) {
break L179;
}
if (chatInputRef != null) {
const current7 = chatInputRef.current;
if (current7 != null) {
current7.insertText(`@${UserUtils.getUserTag(user, {
decoration: "never"
})}`, null, true);
}
}
if (chatInputRef != null) {
const current8 = chatInputRef.current;
if (current8 != null) {
current8.focus();
}
}
if (chatInputRef == null) {
break L179;
}
const current9 = chatInputRef.current;
if (current9 == null) {
break L179;
}
current9.openSystemKeyboard();
break L179;
}
if (intl.string(t.cduTBL) === label) {
showUserProfileActionSheet({
userId: message5.author.id,
channelId: id,
messageId: message5.id,
sourceAnalyticsLocations: analyticsLocations
});
break L179;
}
if (intl.string(t.fsBWmS) === label) {
handleEdit(message5, channel, chatInputRef, "action_sheet");
break L179;
}
if (intl.string(t.MFGE51) === label) {
const id8 = id;
const id9 = id2;
if (chatInputRef != null) {
const current6 = chatInputRef.current;
if (current6 != null) {
current6.dismissKeyboard();
}
}
AlertActionCreators.show({
title: intl.string(t.aIz1oV),
children: <PublishModal channelId={id} />,
cancelText: intl.string(t["ETE/oC"]),
confirmText: intl.string(t["cY+Oob"]),
onConfirm: () => MessageActionCreators.crosspostMessage(id8, id9)
});
break L179;
}
if (intl.string(t.CvQ18w) === label) {
const channel3 = channel;
const message4 = message5;
if (chatInputRef != null) {
const current5 = chatInputRef.current;
if (current5 != null) {
current5.dismissKeyboard();
}
}
AlertActionCreators.show({
title: intl.string(t.CvQ18w),
body: intl.string(t.WG5dyo),
children: <LongPressMessageChatItemPreview message={message4} />,
cancelText: intl.string(t.gm1Vej),
confirmText: intl.string(t.p89ACt),
onConfirm: () => {
ChannelPinActionCreators.pinMessage(channel3, message4.id);
AccessibilityAnnouncer.announce(intl.string(t.sCfDDl));
}
});
break L179;
}
if (intl.string(t["Bse+F/"]) === label) {
const channel2 = channel;
const message3 = message5;
if (chatInputRef != null) {
const current4 = chatInputRef.current;
if (current4 != null) {
current4.dismissKeyboard();
}
}
AlertActionCreators.show({
title: intl.string(t["Bse+F/"]),
body: intl.string(t.NjEPp7),
children: <LongPressMessageChatItemPreview message={message3} />,
cancelText: intl.string(t.gm1Vej),
confirmText: intl.string(t.p89ACt),
onConfirm: () => ChannelPinActionCreators.unpinMessage(channel2, message3.id)
});
break L179;
}
if (intl.string(t["lE/PG3"]) === label) {
MessageActionCreators.patchMessageGuildOfficial(id, id2, true);
break L179;
}
if (intl.string(t["2km5Gf"]) === label) {
MessageActionCreators.patchMessageGuildOfficial(id, id2, false);
break L179;
}
if (intl.string(t.xwMqD7) === label) {
if (message5.state === MessageStates.SENDING) {
MessageQueue.cancelRequest(id2);
} else if (message5.state === MessageStates.SEND_FAILED) {
MessageActionCreators.deleteMessage(id, id2, true);
} else {
const id7 = id;
const message2 = message5;
if (chatInputRef != null) {
const current3 = chatInputRef.current;
if (current3 != null) {
current3.dismissKeyboard();
}
}
AlertActionCreators.show({
title: intl.string(t.MWMcg7),
body: intl.string(t.AMvpS4),
children: <LongPressMessageChatItemPreview message={message2} />,
cancelText: intl.string(t.gm1Vej),
confirmText: intl.string(t.p89ACt),
onConfirm: () => {
MessageActionCreators.deleteMessage(id7, message2.id, false);
}
});
}
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.MESSAGE_ACTION_SHEET_OPTION_PRESSED, {
channel_id: id,
guild_id,
action_sheet_option: "delete",
message_state: message5.state
});
break L179;
}
if (intl.string(t["5911Lb"]) === label) {
let r850 = UploadStore.getUploaderFileForMessageId(message5.id)?.items;
if (r850 == null) {
r850 = void 0;
}
retrySendMessage_native(channel, message5, r850, SendMessageOptionsStore.getOptions(message5.id));
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.MESSAGE_ACTION_SHEET_OPTION_PRESSED, {
channel_id: id,
guild_id,
action_sheet_option: "retry",
message_state: message5.state
});
break L179;
}
if (intl.string(t.JrGD7E) === label) {
const contentMessage = message5.getContentMessage();
if (isMessageComponentsV2(contentMessage)) {
const allTextDisplayContent = getAllTextDisplayContent(contentMessage.components);
if (allTextDisplayContent != null) {
copy(allTextDisplayContent);
}
} else {
copy(contentMessage.content);
}
presentMessageCopied();
break L179;
}
if (intl.string(t.lfIHs4) === label) {
handleAddNewReactions(channel, id2);
break L179;
}
if (intl.string(t.gHp0C4) === label) {
if (actionSheetSource === "Preview") {
handleViewPreviewReactions(id2, id);
break L179;
}
handleViewReactions({
messageId: id2,
channelId: id,
location: {
object: AnalyticsObjects.MESSAGE_ACTION_SHEET
}
});
break L179;
}
if (intl.string(t.ZbtGBm) === label) {
handleRemoveAllReactions(id, id2);
break L179;
}
if (intl.string(t["g33r/P"]) === label) {
ChannelActionCreators.openPrivateChannel({
recipientIds: message5.author.id
});
break L179;
}
if (intl.string(t.Xrt5Po) === label) {
AnalyticsUtils.track(AnalyticEvents.MESSAGE_LINK_COPIED, {
message_id: id2,
channel: channel.id
});
const channelPermalink = getChannelPermalink(channel.guild_id, channel.id, id2);
if (channelPermalink == null) {
break L179;
}
copy(channelPermalink);
presentLinkCopied();
break L179;
}
if (intl.string(t.RpE9k7) === label) {
markUnread(id, id2);
break L179;
}
if (intl.string(t["S/xNKV"]) === label) {
const selectedMedia2 = selectedMedia3;
const id6 = id;
if (selectedMedia2?.mediaUrl == null) {
break L179;
}
let c17296_2 = urlMatchesFileExtension(selectedMedia2.mediaUrl, GIF_RE_IOS);
const r746 = URLUtils.toURLSafe(selectedMedia2.mediaUrl);
(r746 != null && isAttachmentUrl(r746) ? maybeRefreshAttachmentUrl(selectedMedia2.mediaUrl) : Promise.resolve(selectedMedia2.mediaUrl)).then((result) => downloadMediaAssetWithContentType(result, c17296_2 ? MediaType.GIF : MediaType.IMAGE, selectedMedia2.contentType)).then(() => {
if (c17296_2) {
presentGifSaved();
} else {
presentImageSaved();
}
const CONTEXT_MENU_IMAGE_SAVED = AnalyticEvents.CONTEXT_MENU_IMAGE_SAVED;
const isStaticChannelRoute2 = isStaticChannelRoute(id6);
AnalyticsUtils.track(CONTEXT_MENU_IMAGE_SAVED, {
...{
channel_id: isStaticChannelRoute2 ? void 0 : id6,
channel_static_route: isStaticChannelRoute2 ? id6 : void 0
}
});
}, () => {
AlertActionCreators.show({
title: intl.string(t.cV3alD),
body: intl.string(t.r4Zjzv),
isDismissable: true
});
const CONTEXT_MENU_IMAGE_SAVE_FAILED = AnalyticEvents.CONTEXT_MENU_IMAGE_SAVE_FAILED;
const isStaticChannelRoute2 = isStaticChannelRoute(id6);
AnalyticsUtils.track(CONTEXT_MENU_IMAGE_SAVE_FAILED, {
...{
channel_id: isStaticChannelRoute2 ? void 0 : id6,
channel_static_route: isStaticChannelRoute2 ? id6 : void 0
}
});
});
break L179;
}
if (intl.string(t.JVuuz3) === label) {
if (selectedMedia3?.mediaUrl == null) {
break L179;
}
downloadMediaAssetWithContentType(selectedMedia3.mediaUrl, MediaType.VIDEO, selectedMedia3.contentType).then(() => {
presentVideoSaved();
}, () => {
AlertActionCreators.show({
title: intl.string(t.cV3alD),
body: intl.string(t.r4Zjzv),
isDismissable: true
});
});
break L179;
}
if (intl.string(t.vbAEaA) === label) {
const mediaUrl2 = selectedMedia3?.mediaUrl;
if (mediaUrl2 == null) {
break L179;
}
handleClick({
href: mediaUrl2
});
break L179;
}
if (intl.string(t["92CPQ+"]) !== label && intl.string(t["8xHmxo"]) !== label) {
if (intl.string(t["5IEsGx"]) === label) {
replyToMessage({
message: message5,
channel,
chatInputRef,
actionSource: "action_sheet"
});
if (actionSheetSource !== "Preview") {
break L179;
}
transitionToMessage(channel.id, message5.id);
setTimeout(() => ComponentDispatch.dispatch(ComponentActions.TEXTAREA_FOCUS, {
channelId: channel.id
}), 500);
break L179;
}
if (intl.string(t.I3ltXO) === label) {
openForwardModal({
message: message5,
source: "long-press-sheet"
});
break L179;
}
if (intl.string(t.rBIGBL) === label) {
ThreadActionCreators.openThreadCreationForMobile(channel, message5?.id, "Message");
if (message5 == null || navigateToCreateThread(channel.guild_id, SnowflakeUtils.castMessageIdAsChannelId(message5.id))) {
break L179;
}
transitionToGuild(channel.guild_id, SnowflakeUtils.castMessageIdAsChannelId(message5.id));
break L179;
}
if (intl.string(t["39d0Wj"]) === label) {
transitionToGuild(channel.guild_id, SnowflakeUtils.castMessageIdAsChannelId(message5.id));
break L179;
}
if (intl.string(t.PHjkRE) === label) {
ActionSheetActionCreators.hideActionSheet();
navigateToContextMenuCommands({
channel,
commandType: ApplicationCommandType.MESSAGE,
commandTargetId: message5.id
});
break L179;
}
if (intl.string(t.tpxJto) === label) {
addOrUpdateSavedMessage({
channelId: id,
messageId: id2,
displayToast: true
});
break L179;
}
if (intl.string(t.SvXS1Z) === label) {
removeSavedMessage({
channelId: id,
messageId: id2,
displayToast: true
});
break L179;
}
if (intl.string(t.mJ3P0N) === label) {
ActionSheetActionCreators.openLazy(import("../../../saved_messages/message_reminders/native/MessageReminderDurationActionSheet"), "MessageReminderDurationActionSheet", {
createReminder: (a0) => addOrUpdateSavedMessage({
channelId: id,
messageId: id2,
dueAt: a0,
displayToast: true
}),
channelId: message5.channel_id,
messageId: message5.id,
onBack
});
break L179;
}
if (intl.string(t.vrbqs1) === label) {
ActionSheetActionCreators.openLazy(import("../../../saved_messages/message_reminders/native/MessageReminderDurationActionSheet"), "MessageReminderDurationActionSheet", {
createReminder: (a0) => addOrUpdateSavedMessage({
channelId: id,
messageId: id2,
dueAt: a0,
displayToast: true
}),
removeReminder: () => removeSavedMessage({
channelId: id,
messageId: id2,
displayToast: true,
isReminder: true
}),
channelId: message5.channel_id,
messageId: message5.id,
onBack
});
break L179;
}
if (intl.string(t.ZH7P2h) === label) {
if (selectedMedia3 == null) {
break L179;
}
const embedId = selectedMedia3.sourceType === "embed" ? selectedMedia3.source.id : void 0;
const attachmentId = selectedMedia3.sourceType === "attachment" ? selectedMedia3.source.id : void 0;
if (!(embedId !== void 0 || attachmentId !== void 0 || messageHasObscurableMedia(message5))) {
break L179;
}
ActionSheetActionCreators.openLazy(import("../../../explicit_media_redaction/native/false_positive_reporting/ExplicitMediaObscuredFalsePositiveActionSheet"), EXPLICIT_MEDIA_FALSE_POSITIVE_ACTION_SHEET_KEY, {
channelId: message5.channel_id,
messageId: message5.id,
attachmentId,
embedId
});
break L179;
}
if (intl.string(t.grdwwt) === label) {
PollsActionCreators.endPollEarly({
channelId: message5.channel_id,
messageId: message5.id
});
break L179;
}
if (intl.string(t.Rjezbz) === label) {
ActionSheetActionCreators.openLazy(import("../../../applications/native/AppInteractionInfoActionSheet"), "AppInteractionInfoActionSheet", {
message: message5,
guildId: guild_id,
onBack
});
break L179;
}
if (intl.string(t["4sxKOb"]) !== label && intl.string(t.wUIMqa) !== label) {
if (intl.string(t.kFwAsa) !== label) {
break L179;
}
const id3 = id;
const message = message5;
const selectedMedia = selectedMedia3;
if (selectedMedia?.sourceType !== "attachment") {
break L179;
}
if (chatInputRef != null) {
const current = chatInputRef.current;
if (current != null) {
current.dismissKeyboard();
}
}
AlertActionCreators.show({
title: intl.string(t.CbTIEo),
body: intl.string(t.faHmO3),
cancelText: intl.string(t["ETE/oC"]),
confirmText: intl.string(t.kFwAsa),
onConfirm: () => {
const id10 = selectedMedia.source.id;
MessageActionCreators.patchMessageAttachments(id3, message.id, message.attachments.filter((attachment) => attachment.id !== id10));
}
});
break L179;
}
const id4 = id;
const id5 = id2;
if (chatInputRef != null) {
const current2 = chatInputRef.current;
if (current2 != null) {
current2.dismissKeyboard();
}
}
AlertActionCreators.show({
title: intl.string(t.VL1KOk),
body: intl.string(t["vXZ+Fo"]),
cancelText: intl.string(t["ETE/oC"]),
confirmText: intl.string(t.YEHppG),
onConfirm: () => {
MessageActionCreators.suppressEmbeds(id4, id5);
}
});
break L179;
}
const mediaUrl = selectedMedia3?.mediaUrl;
let r682 = mediaUrl != null;
if (r682) {
copy(mediaUrl);
presentLinkCopied();
r682 = true;
}
if (!r682) {
break L179;
}
const CONTEXT_MENU_MEDIA_LINK_COPIED = AnalyticEvents.CONTEXT_MENU_MEDIA_LINK_COPIED;
const r701 = {
hostname: mediaUrl != null ? getHostname(mediaUrl) : void 0
};
const isStaticChannelRoute2 = isStaticChannelRoute(id);
HermesBuiltin.copyDataProperties(r701, {
channel_id: isStaticChannelRoute2 ? void 0 : id,
channel_static_route: isStaticChannelRoute2 ? id : void 0
});
AnalyticsUtils.track(CONTEXT_MENU_MEDIA_LINK_COPIED, r701);
} else if (canReportMessage(message5)) {
showReportModalForMessage(message5, "mobile_message_action_sheet");
}
}
if (onActionExecuted != null) {
onActionExecuted(label);
}
}
}
@@ -0,0 +1,14 @@
// Metro module 9881 (f9882).
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import RowGenerator from "../renderer/RowGenerator";
import ChatItem from "../../../../components_native/chat/ChatItem";
const useStyles = createStyles({
chatItem: {
maxHeight: 2 * Module712.space.PX_80
}
});
const rowGenerator = new RowGenerator();
export default function LongPressMessageChatItemPreview(props) {
return <ChatItem rowGenerator={rowGenerator} message={props.message} maxHeight={useStyles().chatItem.maxHeight} backgroundColor={Module712.colors.MOBILE_ALERT_BACKGROUND_DEFAULT} />;
};
@@ -0,0 +1,5 @@
// Metro module 9550 (f9551).
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
export function showLongPressMessageActionSheet(a0) {
ActionSheetActionCreators.openLazy(import("./LongPressMessageActionSheet"), "MessageLongPressActionSheet", a0);
}
@@ -0,0 +1,13 @@
// Metro module 9513 (f9514).
import { ChannelDetailsNavigatorScreens } from "../../main_tabs_v2/native/sidebar/details/ChannelDetailsConstants";
import { getRootNavigationRef } from "../../main_tabs_v2/RootNavigationRef.native";
export default function openPinnedMessages(a0, a1) {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null && rootNavigationRef.isReady()) {
rootNavigationRef.navigate("sidebar", {
initialRouteName: ChannelDetailsNavigatorScreens.PINNED_MESSAGES,
channelId: a0,
source: a1
});
}
};
@@ -0,0 +1,287 @@
// Metro module 9307 (f9308).
import { Changeset, RowType } from "./RowGeneratorConstants";
import getEmbeddedActivityKey from "../getEmbeddedActivityKey";
import isUndefinedOrNull from "../../../../_bundle/isUndefinedOrNull";
const r17 = {
determineChangeType: () => Changeset.NOOP,
determineChangeTypeForUploadProgress: () => Changeset.NOOP,
determineChangeTypeForEmbeddedActivity: () => Changeset.NOOP,
getBlocked: () => false,
getIgnored: () => false
};
class ChatManager {
_messages = null;
_rows = [];
messages = null;
rows = [];
rowIndex = 0;
maybeRemove = false;
uploadProgressIds = {};
embeddedActivities = {};
getPreviousMessages() {
return this._messages;
}
getPreviousRows() {
return this._rows;
}
getBlocked(a0) {
if (this._messages != null && !Array.isArray(this._messages)) {
const r13 = this._messages._map[a0.id];
return r13 != null && !(r13.blocked || !a0.blocked);
}
return false;
}
getIgnored(a0) {
if (this._messages != null && !Array.isArray(this._messages)) {
const r13 = this._messages._map[a0.id];
return r13 != null && !(r13.ignored || !a0.ignored);
}
return false;
}
clear() {
this._messages = null;
this._rows = [];
this.embeddedActivities = {};
}
finishUpdate(a0, a1) {
this._messages = a0;
this._rows = a1;
}
getLastRow() {
return this.rows != null ? this.rows.length > 0 ? this.rows[this.rows.length - 1] : null : null;
}
setup(a0) {
this.messages = a0;
this.rows = [];
this.rowIndex = 0;
this.maybeRemove = this._messages?.length === this.messages.length;
}
determineChangeTypeForUploadProgress(a0) {
let r13, NOOP;
const r10 = this.uploadProgressIds[a0.id];
if (r10 != null) {
if (r10.items?.length === a0.items?.length && (r10.compressionProgress === a0.compressionProgress && (r10.progress === a0.progress && r10.currentSize === a0.currentSize))) {
NOOP = Changeset.NOOP;
} else {
this.uploadProgressIds[a0.id] = a0;
NOOP = Changeset.UPDATE;
}
r13 = NOOP;
} else {
this.uploadProgressIds[a0.id] = a0;
r13 = Changeset.INSERT;
}
return r13;
}
determineChangeTypeForEmbeddedActivity(a0) {
const embeddedActivityKey = getEmbeddedActivityKey(a0);
const r10 = this.embeddedActivities[embeddedActivityKey];
this.embeddedActivities[embeddedActivityKey] = a0;
return r10 != null ? Changeset.UPDATE : Changeset.INSERT;
}
determineChangeType(a0) {
let UPDATE;
const { message, updateMessageIds, forceRender } = a0;
let r6 = arguments[1];
if (r6 === void 0) {
r6 = false;
}
if (this._messages == null) {
return Changeset.NOOP;
}
if (Array.isArray(this._messages)) {
return Changeset.NOOP;
}
if (this._messages._map == null) {
return Changeset.NOOP;
}
L25: {
const r20 = this._messages._map[message.id];
let r21 = r20;
if (r20 == null) {
const nonce = message.nonce;
r21 = r20;
if (nonce != null) {
r21 = this._messages._map[message.nonce];
if (r21 != null) {
UPDATE = Changeset.UPDATE;
break L25;
}
}
}
L22: {
if (r21 != null) {
if (r6 && r21.blocked && !message.blocked) {
break L22;
}
if (!forceRender && !(updateMessageIds == null ? void 0 : updateMessageIds.has(message.id))) {
if (isUndefinedOrNull(r21, message)) {
UPDATE = Changeset.NOOP;
break L25;
}
UPDATE = Changeset.UPDATE;
break L25;
}
UPDATE = Changeset.UPDATE;
break L25;
}
}
UPDATE = Changeset.INSERT;
}
return UPDATE;
}
createRow(a0) {
if (a0.type === RowType.MESSAGE && a0.message == null) {
return void 0;
}
const index = +this.rowIndex;
this.rowIndex = index + 1;
a0.index = index;
this.rows.push(a0);
return a0;
}
createChangeset() {
let r2, r3, r17, r34, rows;
if (this._messages == null) {
rows = this.rows;
} else {
L49: {
r17 = [];
const r12 = 0 < this._rows.length;
let r6 = 0;
let r7 = 0;
let r8 = 0;
if (!r12) {
const r27 = 0 < this.rows.length;
r6 = 0;
r7 = 0;
r8 = 0;
if (!r27) {
break L49;
}
}
while (true) {
L47: {
const length = this.rows.length;
const r9 = r6;
const r5 = r7;
const r4 = r8;
if (r4 !== length) {
if (r9 !== this._rows.length) {
const r21 = this._rows[r9];
const r46 = this.rows[r4];
const changeType = r46.changeType;
if (Changeset.NOOP !== changeType && Changeset.UPDATE !== changeType) {
Changeset.INSERT;
r46.index = r4 + r5;
r17.push(r46);
r34 = r4 + 1;
r2 = r9;
r3 = r5;
break L47;
}
L39: {
if (r46.type === r21.type) {
if (r46.type === RowType.SEPARATOR && r46.id !== r21.id) {
break L39;
}
if (r46.type === RowType.LOADING && r46.id !== r21.id) {
break L39;
}
if (r46.type === RowType.MESSAGE && r46.message != null && r21.message != null && r46.message.id !== r21.message.id && r46.message.nonce !== r21.message.id) {
break L39;
}
L37: {
if (r46.changeType === Changeset.NOOP) {
L38: {
if (!(r46.type === RowType.SEPARATOR && r46.text !== r21.text) && !(r46.type === RowType.LOADING && r46.isLoading !== r21.isLoading)) {
if (!(r46.type !== RowType.BLOCKED_GROUP && r46.type !== RowType.IGNORED_GROUP)) {
if (r46.text !== r21.text) {
break L38;
}
if (r46.revealed !== r21.revealed) {
break L38;
}
}
if (!(r46.type === RowType.MESSAGE && (r46.separatorBefore !== r21.separatorBefore && !this.maybeRemove))) {
if (r46.message?.isFirst === r21.message?.isFirst) {
break L37;
}
}
}
}
r46.changeType = Changeset.UPDATE;
r46.index = r4 + r5;
r17.push(r46);
r2 = r9 + 1;
r34 = r4 + 1;
r3 = r5;
break L47;
}
}
r46.index = r4 + r5;
r17.push(r46);
r2 = r9 + 1;
r34 = r4 + 1;
r3 = r5;
break L47;
}
}
const REMOVE = Changeset.REMOVE;
const index = r4 + r5;
r17.push({
changeType: REMOVE,
index
});
if (0 < index) {
const r121 = r17[index - 1];
if (!(r121.changeType !== Changeset.NOOP || r121.type !== RowType.MESSAGE || this.maybeRemove)) {
r121.changeType = Changeset.UPDATE;
}
}
r2 = r9 + 1;
r3 = r5 + 1;
r34 = r4;
} else {
const r38 = this.rows[r4];
r38.changeType = Changeset.INSERT;
r38.index = r4 + r5;
r17.push(r38);
r34 = r4 + 1;
r2 = r9;
r3 = r5;
}
} else {
r17.push({
changeType: Changeset.REMOVE,
index: r4 + r5
});
r3 = r5 + 1;
r2 = r9 + 1;
r34 = r4;
}
}
const length2 = this._rows.length;
r6 = r2;
r7 = r3;
r8 = r34;
if (!(r2 < length2)) {
const length3 = this.rows.length;
r6 = r2;
r7 = r3;
r8 = r34;
if (!(r8 < length3)) {
break;
}
}
}
}
rows = r17.filter((item) => item.changeType !== Changeset.NOOP);
}
this._messages = this.messages;
this._rows = this.rows;
return rows;
}
}
export default ChatManager;
export { r17 as MockChatManager };
@@ -0,0 +1,10 @@
// Metro module 7729 (f7730).
import { Image as Image2 } from "react-native";
let c4862_1 = Object.freeze(new Set(["YouTube", "TikTok"]));
export function getAssetUriForEmbed(a0) {
return Image2.resolveAssetSource(a0).uri;
}
export { c4862_1 as SUPPORTED_VIDEO_PARTNERS };
export function shouldPlayVideoInline(a0) {
return c4862_1.has(a0 == null ? "" : a0);
}
@@ -0,0 +1,87 @@
// Metro module 7904 (f7905).
import { MessageAttachmentFlags } from "../../../../Constants";
import * as _Module1384 from "../../../../_bundle/Module1384";
import * as _ObscuredMediaUtils from "../../../explicit_media_redaction/ObscuredMediaUtils";
import { getMediaObscuredReasonFromBitmask } from "../../../explicit_media_redaction/ObscuredMediaUtils";
import { ObscuredMediaTypes } from "../../../explicit_media_redaction/ExplicitMediaRedactionModels";
import { isVerifiedTeen } from "../../../age_assurance/AgeVerificationUtils";
import { intl, t } from "../../../../intl/index.native";
export function getAttachmentObscurityProps({ attachment, shouldObscureSpoiler, enabledContentHarmTypeFlags, shouldAgeVerify }) {
let flags = attachment.flags;
if (flags == null) {
flags = 0;
}
const hasFlag = _Module1384.hasFlag(flags, MessageAttachmentFlags.IS_SPOILER);
let contentScanVersion = attachment.content_scan_version !== void 0 ? attachment.content_scan_version : attachment.contentScanVersion !== void 0 ? attachment.contentScanVersion : void 0;
if (contentScanVersion == null) {
contentScanVersion = 0;
}
let flags2 = attachment.flags;
if (flags2 == null) {
flags2 = 0;
}
const media = {
contentScanVersion,
flags: flags2
};
const mediaObscuredReasonFromBitmask = getMediaObscuredReasonFromBitmask({
type: ObscuredMediaTypes.Attachment,
media
}, enabledContentHarmTypeFlags);
const isMediaScanPending = _ObscuredMediaUtils.isMediaScanPending({
type: ObscuredMediaTypes.Attachment,
media
}, enabledContentHarmTypeFlags);
const obscure = mediaObscuredReasonFromBitmask.length > 0;
const obscureHideControls = obscure ? isVerifiedTeen() : obscure;
const isSpoiler = shouldObscureSpoiler && hasFlag;
let obscureDescription = "";
const spoiler = shouldObscureSpoiler ? hasFlag ? intl.string(t["F+x38C"]).toUpperCase() : "" : "";
if (obscure) {
obscureDescription = intl.string(t.SpxcUR);
}
return {
isSpoiler,
spoiler,
obscure,
obscureDescription,
obscureAwaitingScan: isMediaScanPending,
verifyAge: obscure && shouldAgeVerify,
obscureHideControls,
obscureIsOpaque: obscure
};
}
export function getUnfurledMediaItemObscurityProps(a0) {
const { type, mediaItem } = a0;
let isSpoilered = a0.isSpoilered;
const { isAuthorBot, shouldObscureSpoiler, enabledContentHarmTypeFlags, shouldAgeVerify } = a0;
const mediaObscuredReasonFromBitmask = getMediaObscuredReasonFromBitmask({
type: ObscuredMediaTypes.GenericMedia,
media: mediaItem
}, enabledContentHarmTypeFlags);
const obscureAwaitingScan = isAuthorBot ? !isAuthorBot : _ObscuredMediaUtils.isMediaScanPending({
type: ObscuredMediaTypes.GenericMedia,
media: mediaItem
}, enabledContentHarmTypeFlags);
if (isSpoilered) {
isSpoilered = shouldObscureSpoiler;
}
const isObscured = mediaObscuredReasonFromBitmask.length > 0;
const obscureHideControls = isObscured ? isVerifiedTeen() : isObscured;
return {
isSpoiler: isSpoilered,
spoilerDescription: isSpoilered ? type === "image" ? intl.string(t.sb2W2J) : type === "video" ? intl.string(t.ehBaMc) : type === "file" ? intl.string(t["3Gc2XP"]) : type === "generic" ? intl.string(t.G71b77) : void 0 : null,
isObscured,
obscureDescription: isObscured ? intl.string(t.SpxcUR) : null,
obscureAwaitingScan,
verifyAge: isObscured && shouldAgeVerify,
obscureHideControls,
obscureIsOpaque: isObscured
};
}
export function getAttachmentObscurityDefaults() {
return {
isSpoiler: false,
spoiler: ""
};
}
Loaded 100 of 33051 files, more files were not shown because too many files have changed in this diff. Show more