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

@@ -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: ""
};
}
@@ -0,0 +1,117 @@
// Metro module 7864 (f7865).
import { MessageTypes } from "../../../../Constants";
import Durations from "../../../../utils/Durations";
import LRUCache from "../../../../_bundle/LRUCache";
import MarkupUtils from "../../../markup/MarkupUtils";
import { changelogRules } from "../../../../components_native/ChangeLogStandardTemplate";
import { renderMessageMarkupToAST } from "../../renderMessageMarkup";
const r26 = {
max: Infinity,
maxAge: 15 * Durations.Millis.MINUTE,
updateAgeOnGet: true
};
let c4965_4 = new LRUCache(r26);
let c4965_5 = new LRUCache(r26);
let c4965_6 = new LRUCache({
...r26,
updateAgeOnGet: false
});
let c4965_7 = new LRUCache(r26);
export function parseEmbedTitleMarkup(a0, a1) {
const r5 = `${a0}-${a1}`;
let r13 = c4965_4.get(r5);
if (r13 == null) {
const r21 = MarkupUtils.parseEmbedTitleToAST(a0, true, {
channelId: a1
});
c4965_4.set(r5, r21);
r13 = r21;
}
return r13;
}
export function parseEmbedTitleMarkupWithoutLinks(a0, a1) {
const r15 = `${a0}-${a1}-nolinks`;
let r17 = c4965_5.get(r15);
if (r17 == null) {
const r24 = MarkupUtils.parseEmbedTitleWithoutLinksToAST(a0, true, {
channelId: a1
});
c4965_5.set(r15, r24);
r17 = r24;
}
return r17;
}
export function parseEmbedDescriptionMarkup({ description, channelId, isField, ignoreCache, replaceMap, showListsAndHeaders, showMaskedLinks }) {
let r18;
const r22 = `${description}-${channelId}`;
const r25 = c4965_6.get(r22);
if (r25 != null && !ignoreCache) {
return r25;
}
let r27 = description;
let r28 = r27;
for (const key in replaceMap) {
r18 = r27;
r28 = r18;
r27 = r18.replaceAll(key, replaceMap[key]);
}
r18 = r27;
r28 = r18;
const r39 = MarkupUtils.parseToAST(r28, true, {
channelId,
allowGameMentions: true,
allowLinks: true,
allowEmojiLinks: true,
allowHeading: isField ? !isField : showListsAndHeaders,
allowList: showListsAndHeaders,
previewLinkTarget: showMaskedLinks
});
c4965_6.set(r22, r39);
return r39;
}
export function parseMessageMarkup(a0, a1, a2, formatInline = false, allowList = false, r4 = false, allowLinks = false) {
let r29;
let r19 = c4965_7.get(a0);
if (!(r19 != null && r19.isInlineReplyPreview === formatInline)) {
if (a0.type === MessageTypes.CHANGELOG && a0.changelogId != null) {
const r45 = MarkupUtils.astParserFor(changelogRules(a0.changelogId, true));
const content = a0.content;
const allowHeading = allowList ? allowList : r4;
if (!allowList) {
allowList = r4;
}
const r51 = {
content: r45(content, false, {
hideSimpleEmbedContent: a2,
formatInline,
allowHeading,
allowList,
allowLinks,
previewLinkTarget: allowLinks
}),
isInlineReplyPreview: false,
hasSpoilerEmbeds: false,
hasBailedAst: false
};
c4965_7.set(a0, r51);
r29 = r51;
} else {
r29 = {
...renderMessageMarkupToAST(a0, {
contentMessage: a1,
hideSimpleEmbedContent: a2,
formatInline,
allowGameMentions: true,
allowHeading: allowList ? allowList : r4,
allowList: allowList ? allowList : r4,
allowLinks,
previewLinkTarget: allowLinks
}),
isInlineReplyPreview: formatInline
};
c4965_7.set(a0, r29);
}
r19 = r29;
}
return r19;
}
@@ -0,0 +1,60 @@
// Metro module 7718 (f7719).
import GuildAutomodMessageStore from "../../../guild_automod/GuildAutomodMessageStore";
import { RowType } from "./RowGeneratorConstants";
import createMessageContent from "./createMessageContent";
import { intl, t } from "../../../../intl/index.native";
import RowGeneratorUtils from "./RowGeneratorUtils";
export function generateMessageRowData(a0, a1, a2) {
const { changeType, message, roleStyle, isFirst, isEditing, separatorBefore, canAddNewReactions, reactionsTheme, isSystemDM: isSystemDM2 = false, canShowImages: canShowImages2 = true, truncation, renderContentOnly, pushFeedbackType, alwaysShowAddReaction: alwaysShowAddReaction2 = false } = a0;
let overrideBackgroundHighlight = a0.overrideBackgroundHighlight;
const r30 = {
type: RowType.MESSAGE,
message: createMessageContent({
options: a1,
message,
roleStyle,
isFirst,
isEditing,
canShowImages: canShowImages2,
isSystemDM: isSystemDM2,
isInlineReplyPreview: false,
pushFeedbackType,
renderContentOnly,
showContentInventoryEntryFallbackEmbed: a0.showContentInventoryEntryFallbackEmbed
}),
canAddNewReactions,
addNewReactionAccessibilityLabel: intl.string(t.lfIHs4),
reactionsTheme,
highlightLabel: intl.string(t["IOS/dU"]),
renderContentOnly,
separatorBefore,
changeType,
truncation,
alwaysShowAddReaction: alwaysShowAddReaction2,
backgroundHighlight: null,
swipeActions: null,
replyAccessibilityLabel: null,
forwardAccessibilityLabel: null,
threadAccessibilityLabel: null,
forcedTheme: null
};
if (overrideBackgroundHighlight == null) {
overrideBackgroundHighlight = RowGeneratorUtils.createBackgroundHighlight({
message,
theme: a2,
isEditing,
isAutomodBlockedMessage: GuildAutomodMessageStore.getMessage(message.id) != null
});
}
r30.backgroundHighlight = overrideBackgroundHighlight;
r30.swipeActions = RowGeneratorUtils.createSwipeActions(a1.enableSwipeActions && a0.canReply, a1.enableSwipeActions && a0.canEdit);
r30.replyAccessibilityLabel = intl.string(t["5IEsGx"]);
r30.forwardAccessibilityLabel = intl.string(t.I3ltXO);
r30.threadAccessibilityLabel = intl.string(t.rBIGBL);
let forcedTheme = a1.forcedTheme;
if (forcedTheme == null) {
forcedTheme = void 0;
}
r30.forcedTheme = forcedTheme;
return r30;
}
@@ -0,0 +1,38 @@
// Metro module 7715 (f7716).
const r9 = {
USER_SETTING: 0,
0: "USER_SETTING",
FORCE_ENABLE: 1,
1: "FORCE_ENABLE",
FORCE_DISABLE: 2,
2: "FORCE_DISABLE"
};
export { r9 as UserOption };
export const DEFAULT_OPTIONS = {
renderEmbeds: true,
renderReactions: true,
inlineEmbedMedia: true,
inlineAttachmentMedia: true,
animateEmoji: true,
gifAutoPlay: false,
timestampHourCycle: 0,
renderCodedLinks: true,
renderGiftCode: true,
renderActivityInstanceEmbed: true,
renderActivityInviteEmbed: true,
renderComponents: true,
renderThreadEmbeds: true,
renderReplies: true,
renderCommunicationDisabled: false,
renderAttachments: true,
renderExecutedCommands: true,
renderPolls: true,
renderSharedClientTheme: true,
renderForumPostActions: true,
ignoreMentioned: false,
ignoreEmbedDescriptionCache: false,
forceHideSimpleEmbedContent: false,
enableSwipeActions: false,
useAlternateEmbedColors: false,
restrictedPreview: false
};
@@ -0,0 +1,51 @@
// Metro module 7713 (f7714).
import ThemeStore from "../../../user_settings/ThemeStore";
import { LoadingType, RowType, SeparatorType } from "./RowGeneratorConstants";
import { DEFAULT_OPTIONS } from "./RenderMessageOptionsContext";
import Module12 from "../../../../_bundle/Module12";
import { generateBlockedGroupRowData } from "./rows/BlockedGroup";
import { generateMessageRowData } from "./MessageWithContent";
import { generateSeparatorRowData } from "./rows/Separator";
import { generateLoadingRowData } from "./rows/Loading";
import { assertNever } from "../../../../utils/GlobalUtils";
const options = {
constrainedWidth: 0,
animatingStickerMessageId: null,
forcedTheme: null,
shouldObscureSpoiler: true,
shouldDisableInteractiveComponents: true,
...DEFAULT_OPTIONS
};
class RowManager {
constructor() {
return {
__proto__: new.target.prototype,
options
};
}
setOptions(a0) {
this.options = Module12.merge({}, options, this.options, a0);
}
generate(a0) {
const rowType = a0.rowType;
let forcedTheme = this.options.forcedTheme;
if (forcedTheme == null) {
forcedTheme = ThemeStore.theme;
}
if (RowType.BLOCKED_GROUP !== rowType && RowType.IGNORED_GROUP !== rowType && RowType.SUSPENDED_USER_GROUP !== rowType) {
if (RowType.MESSAGE === rowType) {
return generateMessageRowData(a0, this.options, forcedTheme);
}
if (SeparatorType.DAY !== rowType && SeparatorType.UNREAD !== rowType && SeparatorType.SUMMARY !== rowType) {
if (LoadingType.LOAD_BEFORE !== rowType && LoadingType.LOAD_AFTER !== rowType) {
assertNever(rowType);
return void 0;
}
return generateLoadingRowData(a0, forcedTheme);
}
return generateSeparatorRowData(a0, forcedTheme);
}
return generateBlockedGroupRowData(a0, forcedTheme, this);
}
}
export default RowManager;
@@ -0,0 +1,79 @@
// Metro module 7714 (f7715).
const r14 = {
NOOP: 0,
0: "NOOP",
INSERT: 1,
1: "INSERT",
UPDATE: 2,
2: "UPDATE",
REMOVE: 3,
3: "REMOVE"
};
const r13 = {
SEPARATOR: 0,
0: "SEPARATOR",
MESSAGE: 1,
1: "MESSAGE",
BLOCKED_GROUP: 2,
2: "BLOCKED_GROUP",
LOADING: 4,
4: "LOADING",
EMBEDDED_ACTIVITY: 5,
5: "EMBEDDED_ACTIVITY",
IGNORED_GROUP: 6,
6: "IGNORED_GROUP",
SUSPENDED_USER_GROUP: 7,
7: "SUSPENDED_USER_GROUP"
};
const r12 = {
DAY: "day",
UNREAD: "unread",
SUMMARY: "summary"
};
const r11 = {
TOGGLE_BLOCKED_MESSAGES: "toggle",
LOAD_MORE_BEFORE: "load_more_before",
LOAD_MORE_AFTER: "load_more_after",
DISMISS_SUSPENDED_USER_MESSAGES: "dismiss"
};
const r10 = {
LOAD_BEFORE: "load_before",
LOAD_AFTER: "load_after"
};
const r44 = {
LOADED: 0,
0: "LOADED",
SYSTEM: 1,
1: "SYSTEM"
};
const r47 = {
UNSPECIFIED: 0,
0: "UNSPECIFIED",
UPLOAD_FAILED: 1,
1: "UPLOAD_FAILED",
AUTO_MODERATION_BLOCKED_MESSAGE: 2,
2: "AUTO_MODERATION_BLOCKED_MESSAGE"
};
const r51 = {
IMAGE: "image",
VIDEO: "video",
AUDIO: "audio",
OTHER: "other"
};
const r56 = {
NONE: 0,
0: "NONE",
REPLY: 1,
1: "REPLY",
REPLY_EDIT: 2,
2: "REPLY_EDIT"
};
export { r14 as Changeset };
export { r13 as RowType };
export { r12 as SeparatorType };
export { r11 as SeparatorAction };
export { r10 as LoadingType };
export { r44 as ReferencedMessageRowState };
export { r47 as MessageFailureState };
export { r51 as AttachmentType };
export { r56 as SwipeActionsType };
@@ -0,0 +1,9 @@
// Metro module 7717 (f7718).
import { processColor } from "react-native";
export function processColorOrThrow(a0) {
const r10 = processColor(a0);
if (r10 == null) {
throw new Error(`Unable to parse color: "${a0}"`);
}
return r10;
}
@@ -0,0 +1,19 @@
// Metro module 7905 (f7906).
const r12 = {
IMAGE: 1,
1: "IMAGE",
VIDEO: 2,
2: "VIDEO",
VISUAL_PLACEHOLDER: 3,
3: "VISUAL_PLACEHOLDER"
};
const r16 = {
DEFAULT: 0,
0: "DEFAULT",
SEARCH: 1,
1: "SEARCH",
MEDIA_VIEWER: 2,
2: "MEDIA_VIEWER"
};
export { r12 as MediaGalleryItemType };
export { r16 as MessageContextType };
@@ -0,0 +1,75 @@
// Metro module 7886 (f7887).
import { NativeModules } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildStore from "../../../../stores/GuildStore";
import { DEFAULT_GUILD_OFFICIAL_COLOR, GUILD_OFFICIAL_HIGHLIGHT_ALPHA_COLOR } from "../../MessageConstants";
import { SwipeActionsType } from "./RowGeneratorConstants";
import { MessageFlags, MessageTypes } from "../../../../Constants";
import { createNativeStyleProperties, experimental_createToken } from "../../../../design/components/Styles/native/createStyles";
import { hexWithOpacity } from "../../../../utils/ColorUtils";
import Module712 from "../../../../_bundle/Module712";
import { showGuildOfficialMessageGradient, isGuildOfficialMessagesEnabled } from "../../GuildOfficialMessageUtils";
import { hasEphemeralAppearance } from "../../MessageRecordUtils";
import ImageUtils from "../../../../utils/native/ImageUtils";
let c4983_12;
const nativeStyleProperties = createNativeStyleProperties({
ephemeralBackgroundColor: Module712.colors.INTERACTIVE_BACKGROUND_ACTIVE,
ephemeralGutterColor: Module712.colors.BACKGROUND_BRAND,
giftIntentEphemeralBackgroundColor: experimental_createToken(() => hexWithOpacity(Module712.unsafe_rawColors.BRAND_500, 0.1)),
mentionedBackgroundColor: Module712.colors.MESSAGE_MENTIONED_BACKGROUND_DEFAULT,
mentionedGutterColor: Module712.unsafe_rawColors.YELLOW_300,
automodBlockedBackgroundColor: Module712.colors.MESSAGE_AUTOMOD_BACKGROUND_DEFAULT,
automodBlockedGutterColor: Module712.unsafe_rawColors.RED_345,
editingColor: Module712.colors.MESSAGE_HIGHLIGHT_BACKGROUND_DEFAULT
});
c4983_12 = new Set(NativeModules.MediaManager.getConstants().supportedExtensions);
const r82 = {
getImageSrc: function getImageSrc(a0, a1, a2, a3) {
const r12 = a0.endsWith(".webp");
return ImageUtils.getMobileOptimizedSrc(a0, a1, a2, ((r12 ? !r12 : !a0.endsWith(".avif")) || c4983_12.has("webp") ? a3 : true) ? "png" : null);
},
createBackgroundHighlight: function createBackgroundHighlight({ message, theme, isEditing, isAutomodBlockedMessage }) {
const r13 = nativeStyleProperties(theme);
if (isEditing) {
return {
backgroundColor: r13.editingColor
};
}
if (isAutomodBlockedMessage) {
return {
backgroundColor: r13.automodBlockedBackgroundColor,
gutterColor: r13.automodBlockedGutterColor
};
}
if (message.hasFlag(MessageFlags.IS_GUILD_OFFICIAL) && showGuildOfficialMessageGradient(AccessibilityStore.officialMessageStyle)) {
const guild = GuildStore.getGuild(ChannelStore.getChannel(message.getChannelId())?.guild_id);
if (isGuildOfficialMessagesEnabled(guild, "RowGeneratorUtils")) {
let r55 = guild?.officialMessageColor;
if (r55 == null) {
r55 = DEFAULT_GUILD_OFFICIAL_COLOR;
}
return {
backgroundColor: r55 | GUILD_OFFICIAL_HIGHLIGHT_ALPHA_COLOR,
gutterColor: message.mentioned ? r13.mentionedGutterColor : hasEphemeralAppearance(message) ? r13.ephemeralGutterColor : void 0
};
}
}
return message.mentioned ? {
backgroundColor: r13.mentionedBackgroundColor,
gutterColor: r13.mentionedGutterColor
} : hasEphemeralAppearance(message) ? {
backgroundColor: message.type === MessageTypes.GIFTING_PROMPT ? r13.giftIntentEphemeralBackgroundColor : r13.ephemeralBackgroundColor,
gutterColor: r13.ephemeralGutterColor
} : void 0;
},
createSwipeActions: function createSwipeActions(a0, a1) {
return a0 ? a1 ? SwipeActionsType.REPLY_EDIT : SwipeActionsType.REPLY : SwipeActionsType.NONE;
}
};
export default r82;
export const InviteEmbedBackground = {
dark: "#313339",
light: "#fafafa"
};
export { nativeStyleProperties as resolveHighlightThemedColors };
@@ -0,0 +1,920 @@
// Metro module 7720 (f7721).
import { processColor } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import ApplicationStore from "../../../applications/ApplicationStore";
import ClientThemesBackgroundStore from "../../../client_themes/ClientThemesBackgroundStore";
import EmojiStore from "../../../emojis/EmojiStore";
import GuildAutomodMessageStore from "../../../guild_automod/GuildAutomodMessageStore";
import InteractionStore from "../../../interactions/InteractionStore";
import LurkingStore from "../../../lurker_mode/LurkingStore";
import MediaPostSharePromptStore from "../../../media_channel/MediaPostSharePromptStore";
import ReferencedMessageStore, { ReferencedMessageState } from "../../../replies/ReferencedMessageStore";
import JoinedThreadsStore from "../../../threads/JoinedThreadsStore";
import ThreadMessageStore from "../../../threads/ThreadMessageStore";
import ThemeStore from "../../../user_settings/ThemeStore";
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import GuildStore from "../../../../stores/GuildStore";
import RelationshipStore from "../../../../stores/RelationshipStore";
import UploadStore from "../../../../stores/UploadStore";
import UserStore from "../../../../stores/UserStore";
import { DEFAULT_GUILD_OFFICIAL_COLOR, GUILD_OFFICIAL_HIGHLIGHT_ALPHA, GUILD_OFFICIAL_HIGHLIGHT_ALPHA_COLOR } from "../../MessageConstants";
import { ReferencedMessageRowState } from "./RowGeneratorConstants";
import { ChannelTypes, MessageFlags, MessageStates, MessageTypes } from "../../../../Constants";
import { GuildTagBadgeSize } from "../../../guild_tag/GuildTagConstants";
import { computeChannelName } from "../../../channel/useChannelName";
import getEmbedThemeColors from "./row_data/embeds/getEmbedThemeColors";
import SnowflakeUtils from "../../../../utils/SnowflakeUtils";
import { formatMobileMessageCountLabel, formatMessageCountLabel } from "../../../threads/MessageCountUtils";
import { isChannelSpoilerGated } from "../../../spoiler_channels/SpoilerChannelUtils";
import { intl, t } from "../../../../intl/index.native";
import { getAssetUriForEmbed } from "./EmbedUtils";
import Module7730 from "../../../../_bundle/Module7730";
import { createDefaultReaction, createForumPostActions } from "./row_data/ForumPostActions";
import { getMessageStickers } from "../../../stickers/StickersUtils";
import * as _Module1384 from "../../../../_bundle/Module1384";
import { getPollResultsReplyPreviewMobile, getPollReplyPreview } from "../../../polls/PollsUtils";
import resolveMessageContentColors from "./resolveMessageContentColors";
import { getHasEnhancedRoleColors } from "../../../premium/powerups/hooks/useHasEnhancedRoleColors";
import { maybeCreateSingleForwardForMessage } from "../../../forwarding/formatMessageForwards";
import transformReactions from "./transformReactions";
import isSystemMessage from "../../isSystemMessage";
import { createSystemMessageContent } from "./system_messages/SystemMessage";
import * as _MarkupEligibilityUtils from "../../../markup/MarkupEligibilityUtils";
import { parseMessageMarkup } from "./MarkupParsers";
import redactRestrictedContent from "./redactRestrictedContent";
import { getEnabledHarmTypesForMessage } from "../../../explicit_media_redaction/ObscuredMediaUtils";
import * as _ExplicitMediaRedactionUtils from "../../../explicit_media_redaction/ExplicitMediaRedactionUtils";
import { ViewImageDescriptions, AnimateStickers } from "../../../user_settings/UserSettings";
import transformEmbeds from "./transformEmbeds";
import transformMessageComponents from "./transformMessageComponents";
import getTagProperties from "./getTagProperties";
import createMessageFailedEmbed, { createAutomodBlockedMessageEmbed } from "./createMessageFailedEmbed";
import { getUserAuthor, getMessageAuthor } from "../../useMessageAuthor";
import { ensureAvatarSource } from "../../../../utils/native/AvatarUtils";
import AvatarUtils2, { getAvatarDecorationURL } from "../../../../utils/AvatarUtils";
import { getDecorationSizeForAvatarSize } from "../../../collectibles/avatar_decorations/native/AvatarDecorationUtils";
import { AvatarSizes } from "../../../../design/void/native";
import { getRoleIcon } from "../../../guild_boosting/native/RoleIconUtils";
import didReplyMention from "../../../replies/didReplyMention";
import { assertNever } from "../../../../utils/GlobalUtils";
import { createInteractionStatus } from "./row_data/interaction/InteractionStatus";
import * as _CommunicationDisabledUtils from "../../../guild_communication_disabled/CommunicationDisabledUtils";
import { getVisibleConnectionsRole } from "../../../connections/ConnectionsUtils";
import transformUploaderAttachments from "./transformUploaderAttachments";
import transformMessageAttachments from "./transformMessageAttachments";
import { calendarFormat, accessibilityLabelCalendarFormat, dateFormat } from "../../../../utils/DateUtils";
import formatPollMessageChatData from "../../../polls/chat/formatPollMessageChatData";
import { formatSharedClientThemeData } from "../../../client_themes/native/chat/formatSharedClientThemeData";
import * as _GuildTagUtils from "../../../guild_tag/GuildTagUtils";
import { getUserPrimaryGuild, getGuildTagBadgeUrl } from "../../../guild_tag/GuildTagUtils";
import * as _GuildOfficialMessageUtils from "../../GuildOfficialMessageUtils";
import { showGuildOfficialMessageGradient, showGuildOfficialMessageTextColor, getAccessibleGuildOfficialTextColor } from "../../GuildOfficialMessageUtils";
import Module712 from "../../../../_bundle/Module712";
import { createVoiceChannelBadge } from "./row_data/VoiceChannelBadge";
import { processColorStrings } from "../../../premium/enhanced_role_colors/native/EnhancedRoleColorUtils";
import { createConnectionsRoleTag } from "./row_data/ConnectionsRoleTag";
import { createSurveyIndication } from "./row_data/SurveyIndication";
import { createEphemeralIndication } from "./row_data/EphemeralIndication";
import { createExecutedCommand } from "./row_data/interaction/ExecutedCommand";
import { createGiftCodeEmbed } from "./row_data/embeds/GiftCodeEmbed";
import { createCodedLinkEmbeds } from "./row_data/embeds/coded_links/CodedLinks";
import { createActivityInstanceEmbed } from "./row_data/embeds/EmbeddedActivityInstanceEmbed";
import { createActivityRichPresenceInviteEmbed } from "./row_data/embeds/ActivityRichPresenceInviteEmbed";
import transformStickers from "./transformStickers";
import Module7747 from "../../../../_bundle/Module7747";
import Module7748 from "../../../../_bundle/Module7748";
import { createPostPreviewEmbeds } from "./row_data/embeds/PostPreviewEmbeds";
import { createSafetyPolicyNoticeEmbed } from "./row_data/embeds/SafetyPolicyNoticeEmbed";
import { createSafetySystemNotificationEmbed } from "./row_data/embeds/SafetySystemNotificationEmbed";
import { createCtaButton } from "./row_data/CtaButton";
import { createMessageAccessibilityActions } from "../MessageAccessibilityActions";
import { createDisplayNameStylesMobile } from "../../../display_name_styles/native/createDisplayNameStylesMobile";
let createMessageContent;
const createThreadEmbed = function createThreadEmbed(a0, a1, a2, channel2, a4, theme) {
let r62, r83;
if (!a2 && a0.hasFlag(MessageFlags.HAS_THREAD) && channel2 != null) {
const title = computeChannelName(channel2, UserStore, RelationshipStore);
const backgroundColor = getEmbedThemeColors(theme).baseColors.backgroundColor;
const mostRecentMessage = ThreadMessageStore.getMostRecentMessage(SnowflakeUtils.castMessageIdAsChannelId(a0.id));
const count = ThreadMessageStore.getCount(SnowflakeUtils.castMessageIdAsChannelId(a0.id));
const messageCountLabel = formatMobileMessageCountLabel(count, channel2.id);
const messageCountAccessibilityLabel = formatMessageCountLabel(count, channel2.id);
if (count != null && count > 0) {
L26: {
if (isChannelSpoilerGated(channel2)) {
r83 = {
title,
messageCountLabel,
messageCountAccessibilityLabel,
messagePreviewString: intl.string(t["5uaI/7"]),
archived: false,
backgroundColor
};
} else if (channel2.threadMetadata?.archived) {
r83 = {
title,
messageCountLabel,
messageCountAccessibilityLabel,
messagePreviewString: intl.string(t.ZTo4HS),
archived: true,
archivedIconUrl: getAssetUriForEmbed(Module7730),
backgroundColor
};
} else {
if (mostRecentMessage != null && mostRecentMessage.type !== MessageTypes.CHANNEL_NAME_CHANGE && mostRecentMessage.type !== MessageTypes.THREAD_STARTER_MESSAGE) {
if (!mostRecentMessage.blocked && !mostRecentMessage.ignored) {
r83 = {
title,
messageCountLabel,
messageCountAccessibilityLabel,
referencedMessage: {
state: ReferencedMessageRowState.LOADED,
message: createMessageContent({
message: mostRecentMessage,
roleStyle: a1,
options: a4,
isFirst: true,
isEditing: false,
canShowImages: true,
isSystemDM: false,
isInlineReplyPreview: true
})
},
backgroundColor
};
break L26;
}
r83 = {
title,
messageCountLabel,
messageCountAccessibilityLabel,
messagePreviewString: mostRecentMessage.blocked ? intl.string(t.XAkOo2) : intl.string(t["G7p6v/"]),
archived: false,
backgroundColor
};
break L26;
}
r83 = {
title,
messageCountLabel,
messageCountAccessibilityLabel,
messagePreviewString: intl.string(t.ZTo4HS),
archived: false,
backgroundColor
};
}
}
r62 = r83;
} else {
r62 = {
title,
messageCountLabel,
messageCountAccessibilityLabel,
messagePreviewString: intl.string(t.HYtNyE),
archived: false,
backgroundColor
};
}
return r62;
}
};
createMessageContent = function createMessageContent(a0) {
let r178, r920, colorString3, content4, defaultUsernameColor, usernameColor;
const message = a0.message;
let messageForward = a0.messageForward;
const { roleStyle, isFirst, isEditing, canShowImages, isSystemDM, isInlineReplyPreview = false, options, pushFeedbackType, renderContentOnly, showContentInventoryEntryFallbackEmbed } = a0;
const { renderEmbeds, renderReactions, inlineEmbedMedia, inlineAttachmentMedia, constrainedWidth, ignoreMentioned, animateEmoji, animatingStickerMessageId, gifAutoPlay, timestampHourCycle, renderCodedLinks, renderGiftCode, renderActivityInstanceEmbed, renderActivityInviteEmbed, renderComponents, renderThreadEmbeds, renderReplies } = options;
let renderCommunicationDisabled = options.renderCommunicationDisabled;
let renderAttachments = options.renderAttachments;
const { renderExecutedCommands, renderPolls, renderSharedClientTheme, renderForumPostActions } = options;
let forcedTheme = options.forcedTheme;
const ignoreEmbedDescriptionCache = options.ignoreEmbedDescriptionCache;
let forceHideSimpleEmbedContent = options.forceHideSimpleEmbedContent;
const { shouldObscureSpoiler, shouldDisableInteractiveComponents, useAlternateEmbedColors, restrictedPreview } = options;
if (forcedTheme == null) {
forcedTheme = ThemeStore.theme;
}
const colors = resolveMessageContentColors(forcedTheme, useAlternateEmbedColors);
const shouldShowMedia = canShowImages === true;
const theme = forcedTheme;
let r40 = (shouldShowMedia ? renderEmbeds : shouldShowMedia) && message.type !== MessageTypes.CUSTOM_GIFT;
const shouldInlineEmbedMedia = shouldShowMedia ? inlineEmbedMedia : shouldShowMedia;
let shouldInlineAttachmentMedia = shouldShowMedia ? inlineAttachmentMedia : shouldShowMedia;
const channel = ChannelStore.getChannel(message.getChannelId());
const channel2 = ChannelStore.getChannel(SnowflakeUtils.castMessageIdAsChannelId(message.id));
const guildId = channel == null ? void 0 : channel.getGuildId();
const hasEnhancedRoleColors = getHasEnhancedRoleColors(guildId, message.author.id);
if (messageForward == null) {
messageForward = maybeCreateSingleForwardForMessage(message);
}
const message4 = messageForward != null ? messageForward.messageSnapshot.message : message;
const reactions = renderReactions ? transformReactions({
reactions: message.reactions,
animateEmoji
}) : [];
const type = message.type;
const THREAD_STARTER_MESSAGE = MessageTypes.THREAD_STARTER_MESSAGE;
let message5 = null;
if (type === THREAD_STARTER_MESSAGE) {
const messageByReference = ReferencedMessageStore.getMessageByReference(message.messageReference);
message5 = messageByReference.state === ReferencedMessageState.LOADED ? messageByReference.message : null;
}
if (message5 != null) {
return {
...createMessageContent({
message: message5,
roleStyle,
isFirst,
isEditing,
canShowImages,
isSystemDM,
isInlineReplyPreview,
options: {
...options,
renderThreadEmbeds: false,
renderReactions: false,
shouldDisableInteractiveComponents: true
}
}),
id: message.id
};
}
if (isSystemMessage(message)) {
return message.type === MessageTypes.THREAD_CREATED ? {
threadEmbed: createThreadEmbed(message, roleStyle, isInlineReplyPreview, channel2, options, theme),
...createSystemMessageContent({
message,
theme,
reactions,
roleStyle
})
} : createSystemMessageContent({
message,
theme,
reactions,
roleStyle,
isForumPost: channel == null ? void 0 : channel.isForumPost()
});
}
const r78 = isFirst ? renderContentOnly : !isFirst;
const author = message.author;
let editedTimestamp = message.editedTimestamp;
if (editedTimestamp == null) {
editedTimestamp = message.timestamp;
}
const isMessageNewerThanImprovedMarkdownEpoch = _MarkupEligibilityUtils.isMessageNewerThanImprovedMarkdownEpoch(editedTimestamp.valueOf());
if (message4.content != null && message4.content !== "") {
if (!forceHideSimpleEmbedContent) {
forceHideSimpleEmbedContent = r40 ? shouldInlineEmbedMedia : r40;
}
r178 = parseMessageMarkup(message, message4, forceHideSimpleEmbedContent, isInlineReplyPreview, channel2 != null && message.isFirstMessageInForumPost(channel2), isMessageNewerThanImprovedMarkdownEpoch, isMessageNewerThanImprovedMarkdownEpoch);
} else {
r178 = {
content: void 0,
hasSpoilerEmbeds: false,
hasBailedAst: false
};
}
const { content, hasSpoilerEmbeds, hasBailedAst } = r178;
let r188 = restrictedPreview && content != null ? redactRestrictedContent(content) : content;
const enabledHarmTypesForMessage = getEnabledHarmTypesForMessage(message);
const shouldAgeVerifyForExplicitMedia = _ExplicitMediaRedactionUtils.shouldAgeVerifyForExplicitMedia();
const setting = ViewImageDescriptions.getSetting();
if (r40) {
r40 = !hasBailedAst;
}
if (r40) {
r40 = !restrictedPreview;
}
const interaction = InteractionStore.getInteraction(message);
const r203 = r40 ? transformEmbeds({
embeds: message4.embeds,
channelId: message.channel_id,
gifAutoPlay,
hasSpoilerEmbeds,
ignoreEmbedDescriptionCache,
shouldInlineEmbedMedia,
colors,
showListsAndHeaders: isMessageNewerThanImprovedMarkdownEpoch,
showMaskedLinks: isMessageNewerThanImprovedMarkdownEpoch,
themedBackgroundColor: colors.embedBackgroundColor,
enabledContentHarmTypeFlags: enabledHarmTypesForMessage,
shouldAgeVerify: shouldAgeVerifyForExplicitMedia,
authorIsBot: message.author.bot,
showContentInventoryEntryFallbackEmbed,
transformComponents: (a0) => transformMessageComponents({
message,
guildId,
interaction,
shouldDisableInteractiveComponents,
shouldShowMedia,
shouldObscureSpoiler,
enabledContentHarmTypeFlags: enabledHarmTypesForMessage,
shouldAgeVerify: shouldAgeVerifyForExplicitMedia,
shouldShowMosaicMediaDescriptions: setting,
shouldAutoPlayGifs: gifAutoPlay,
colors
}, a0)
}) : void 0;
const tagProperties = getTagProperties({
message,
isSystemDM,
channel,
colors
});
const { tagText, tagAccessibilityLabel, tagVerified, tagTextColor, tagBackgroundColor, tagType, tagIconUrl, opTagText, opTagTextColor, opTagBackgroundColor } = tagProperties;
const uploaderFileForMessageId = UploadStore.getUploaderFileForMessageId(message.id);
const useAttachmentUploadPreview = uploaderFileForMessageId != null;
const r225 = message.state !== MessageStates.SEND_FAILED || message.isCommandType();
let r227 = r203;
if (!r225) {
const r228 = r203 == null ? [] : r203;
r228.push(createMessageFailedEmbed({
uploaderFile: uploaderFileForMessageId,
useAttachmentUploadPreview,
colors
}));
r227 = r228;
}
const message2 = GuildAutomodMessageStore.getMessage(message.id);
let embeds = r227;
if (message2 != null) {
const r239 = r227 == null ? [] : r227;
r239.push(createAutomodBlockedMessageEmbed({
errorMessage: message2.errorMessage,
colors
}));
embeds = r239;
}
const userAuthor = getUserAuthor(message.author, channel);
const guildMemberAvatar = userAuthor.guildMemberAvatar;
let guildMemberAvatarDecoration = userAuthor.guildMemberAvatarDecoration;
const iconRoleId = userAuthor.iconRoleId;
const r88 = ensureAvatarSource(message.isInteractionPlaceholder() && message.author.avatar == null && guildMemberAvatar == null ? message.application?.icon != null ? AvatarUtils2.getApplicationIconSource({
id: message.application.id,
icon: message.application.icon,
bot: message.application.bot
}) : guildMemberAvatar != null && guildId != null ? AvatarUtils2.getGuildMemberAvatarSource({
userId: author.id,
avatar: guildMemberAvatar,
guildId
}, author) : author.getAvatarSource(void 0) : guildMemberAvatar != null && guildId != null ? AvatarUtils2.getGuildMemberAvatarSource({
userId: author.id,
avatar: guildMemberAvatar,
guildId
}, author) : author.getAvatarSource(void 0));
if (guildMemberAvatarDecoration == null) {
guildMemberAvatarDecoration = author.avatarDecoration;
}
const avatarDecorationURL = getAvatarDecorationURL({
avatarDecoration: guildMemberAvatarDecoration,
size: getDecorationSizeForAvatarSize(AvatarSizes.NORMAL)
});
const r80 = iconRoleId != null ? guildId != null ? getRoleIcon({
guildId,
roleId: iconRoleId,
size: 18
}) : void 0 : void 0;
if (message.hasFlag(MessageFlags.SOURCE_MESSAGE_DELETED)) {
r188 = intl.string(t.JOtgSw);
}
const messageAuthor = getMessageAuthor(message);
let nick = messageAuthor.nick;
let colorString = messageAuthor.colorString;
const colorStrings = messageAuthor.colorStrings;
if (message.type === MessageTypes.INTERACTION_PREMIUM_UPSELL) {
r188 = intl.formatToPlainString(t["u4A+xK"], {
appName: nick
});
}
const type2 = message.type;
const REPLY = MessageTypes.REPLY;
let r108 = void 0;
if (type2 === REPLY) {
r108 = void 0;
if (renderReplies) {
const messageByReference2 = ReferencedMessageStore.getMessageByReference(message.messageReference);
const state = messageByReference2.state;
if (ReferencedMessageState.LOADED === state) {
const message3 = messageByReference2.message;
const messageForward2 = maybeCreateSingleForwardForMessage(message3);
if (RelationshipStore.isBlockedForMessage(message3)) {
r108 = {
state: ReferencedMessageRowState.SYSTEM,
content: intl.string(t.XAkOo2)
};
} else if (RelationshipStore.isIgnoredForMessage(message3)) {
r108 = {
state: ReferencedMessageRowState.SYSTEM,
content: intl.string(t["G7p6v/"])
};
} else {
const messageContent = createMessageContent({
message: message3,
messageForward: messageForward2,
roleStyle,
isFirst: true,
isEditing: false,
canShowImages: true,
isSystemDM: false,
isInlineReplyPreview: true,
options: {
...options,
renderReplies: false
}
});
if (messageContent == null) {
r108 = {
state: ReferencedMessageRowState.SYSTEM,
content: intl.string(t["1i+hMi"])
};
} else {
if ("username" in messageContent) {
const messageAuthor2 = getMessageAuthor(message3);
let nick2 = messageAuthor2.nick;
let colorString2 = messageAuthor2.colorString;
if (nick2 == null) {
nick2 = message3.author.username;
}
if (nick2 == null) {
nick2 = void 0;
}
messageContent.username = nick2;
if (r78) {
colorString3 = messageContent.colorString;
} else {
if (colorString2 == null) {
colorString2 = void 0;
}
colorString3 = processColor(colorString2);
if (colorString3 == null) {
colorString3 = messageContent.colorString;
}
}
messageContent.colorString = colorString3;
if (didReplyMention(message, message3)) {
messageContent.username = "@" + messageContent.username;
}
}
if (Array.isArray(messageContent.content) && messageContent.content.length === 0) {
messageContent.content = void 0;
}
let r406 = messageForward2 == null ? void 0 : messageForward2.messageSnapshot.message;
if (r406 == null) {
r406 = message3;
}
const content2 = messageContent.content;
const r411 = "stickers" in r406 ? getMessageStickers(r406) : [];
L137: {
if (r411.length > 0) {
content4 = intl.string(t["7K5Lma"]);
} else {
if ("interaction" in r406 && r406.interaction != null && r406.content === "") {
content4 = intl.string(t["2v7kfl"]);
break L137;
}
if (_Module1384.hasFlag(r406.flags, MessageFlags.IS_VOICE_MESSAGE)) {
content4 = intl.string(t["6bhHrc"]);
} else if (r406.type === MessageTypes.POLL_RESULT) {
content4 = getPollResultsReplyPreviewMobile(r406);
} else if (_Module1384.hasFlag(r406.flags, MessageFlags.IS_COMPONENTS_V2)) {
content4 = intl.string(t.Xxm5i3);
} else {
if (r406.content !== "") {
const r438 = content2 == null;
content4 = null;
if (!r438) {
break L137;
}
}
content4 = intl.string(t.JAKsM8);
}
}
}
if (message3.type === MessageTypes.POLL_RESULT) {
messageContent.content = content4;
}
const r487 = {
state: ReferencedMessageRowState.LOADED,
message: messageContent
};
r108 = r487;
if (content4 != null) {
r487.systemContent = content4;
r108 = r487;
}
}
}
} else if (ReferencedMessageState.NOT_LOADED === state) {
r108 = {
state: ReferencedMessageRowState.SYSTEM,
content: intl.string(t["1i+hMi"])
};
} else if (ReferencedMessageState.DELETED === state) {
r108 = {
state: ReferencedMessageRowState.SYSTEM,
content: intl.string(t.mE3KJN)
};
} else {
assertNever(messageByReference2);
r108 = void 0;
}
}
}
const threadEmbed = renderThreadEmbeds ? createThreadEmbed(message, roleStyle, isInlineReplyPreview, channel2, options, theme) : void 0;
const interactionStatus = createInteractionStatus(message, interaction);
const r536 = guildId != null ? GuildMemberStore.getMember(guildId, author.id) : null;
const isMemberCommunicationDisabled = _CommunicationDisabledUtils.isMemberCommunicationDisabled(r536);
const r545 = channel == null;
const guildMember = r536;
const visibleConnectionsRole = getVisibleConnectionsRole({
guildMember,
channel: (r545 ? void 0 : channel.parent_id) != null ? (channel == null ? void 0 : channel.isThread()) ? ChannelStore.getChannel(channel.parent_id) : channel : channel,
onlyChannelConnectionRoles: true
});
const length = message4.attachments.length;
const length2 = message4.embeds.length;
const r562 = (useAttachmentUploadPreview ? message.attachments.length === 0 : useAttachmentUploadPreview) && uploaderFileForMessageId != null;
const attachments = r562 ? transformUploaderAttachments({
uploaderFile: uploaderFileForMessageId,
isFailedMessage: message.state === MessageStates.SEND_FAILED,
shouldInlineAttachmentMedia
}) : renderAttachments ? transformMessageAttachments({
attachments: message4.attachments,
uploadAttachments: UploadStore.getUploadAttachments(message.nonce),
shouldInlineAttachmentMedia,
gifAutoPlay,
viewImageDescriptions: setting,
useReducedMotion: AccessibilityStore.useReducedMotion,
shouldObscureSpoiler,
themedBackgroundColor: colors.embedBackgroundColor,
enabledContentHarmTypeFlags: enabledHarmTypesForMessage,
shouldAgeVerify: shouldAgeVerifyForExplicitMedia,
colors
}) : [];
const r79 = r562 && message.state !== MessageStates.SEND_FAILED ? intl.string(t["yXY+5J"]) : calendarFormat(message.timestamp, true, timestampHourCycle);
const r76 = r562 && message.state !== MessageStates.SEND_FAILED ? intl.string(t["yXY+5J"]) : accessibilityLabelCalendarFormat(message.timestamp);
const id = AuthenticationStore.getId();
let content3 = message.isUnsupported ? intl.string(t.sWi5EU) : r188;
const isPoll = message.isPoll();
if (!((isPoll ? isInlineReplyPreview ? !isInlineReplyPreview : renderPolls : !isPoll) || r188 != null && r188 !== "")) {
content3 = getPollReplyPreview(message);
}
const pollData = renderPolls ? formatPollMessageChatData(message, void 0, {
theme,
animateEmoji
}) : void 0;
const sharedClientTheme = renderSharedClientTheme ? formatSharedClientThemeData(message, r88, nick) : void 0;
const shouldDisplayGuildTag = _GuildTagUtils.shouldDisplayGuildTag(author.id, guildId == null ? void 0 : guildId);
let clanBadgeUrl = void 0;
let clanTag = void 0;
let clanTagGuildId = void 0;
if (shouldDisplayGuildTag) {
const userPrimaryGuild = getUserPrimaryGuild(author.primaryGuild);
const { guildId: guildId2, tag } = userPrimaryGuild;
clanBadgeUrl = userPrimaryGuild.guildId != null ? getGuildTagBadgeUrl(userPrimaryGuild.guildId, userPrimaryGuild.badge, GuildTagBadgeSize.SIZE_12) : void 0;
clanTag = tag;
clanTagGuildId = guildId2;
}
const linkedLobby = channel?.linkedLobby;
const r662 = linkedLobby != null;
let lobbyTagIconUrl = void 0;
let lobbyAdditionalName = void 0;
if (r662) {
const r666 = message.additionalName != null;
lobbyTagIconUrl = void 0;
lobbyAdditionalName = void 0;
if (r666) {
const additionalName = message.additionalName;
lobbyTagIconUrl = void 0;
lobbyAdditionalName = void 0;
if (additionalName !== "") {
const additionalName2 = message.additionalName;
const application = ApplicationStore.getApplication(linkedLobby.application_id);
lobbyTagIconUrl = application?.icon != null ? AvatarUtils2.getApplicationIconURL({
id: application.id,
icon: application.icon,
size: 16
}) : void 0;
lobbyAdditionalName = additionalName2;
}
}
}
const hasFlag = _Module1384.hasFlag((message4 == null ? message : message4).flags, MessageFlags.IS_VOICE_MESSAGE);
let applicationId = message.applicationId;
if (applicationId == null) {
applicationId = "";
}
const application2 = ApplicationStore.getApplication(applicationId);
const gameApplicationId = application2 != null && _Module1384.hasFlag(message.flags, MessageFlags.SENT_BY_SOCIAL_LAYER_INTEGRATION) ? application2.id : void 0;
const r702 = message4 == null ? void 0 : message4.hasFlag(MessageFlags.IS_GUILD_OFFICIAL);
let stateAccessibilityLabel = void 0;
let r706 = void 0;
let officialMessageColor2 = void 0;
if (r702) {
const guild = GuildStore.getGuild(guildId);
const r711 = guild != null;
stateAccessibilityLabel = void 0;
r706 = void 0;
officialMessageColor2 = void 0;
if (r711) {
const isGuildOfficialMessagesEnabled = _GuildOfficialMessageUtils.isGuildOfficialMessagesEnabled(guild, "createMessageContent");
stateAccessibilityLabel = void 0;
r706 = void 0;
officialMessageColor2 = void 0;
if (isGuildOfficialMessagesEnabled) {
let officialMessageColor = guild.officialMessageColor;
if (officialMessageColor == null) {
officialMessageColor = DEFAULT_GUILD_OFFICIAL_COLOR;
}
const r114 = showGuildOfficialMessageGradient(AccessibilityStore.officialMessageStyle);
const r720 = r114 ? officialMessageColor | GUILD_OFFICIAL_HIGHLIGHT_ALPHA_COLOR : void 0;
const r726 = showGuildOfficialMessageTextColor(AccessibilityStore.officialMessageStyle) ? getAccessibleGuildOfficialTextColor(officialMessageColor, Module712.internal.resolveSemanticColor(theme, Module712.colors.BACKGROUND_BASE_LOWER), AccessibilityStore.desaturateUserColors ? AccessibilityStore.saturation : 1, r114 ? GUILD_OFFICIAL_HIGHLIGHT_ALPHA : 0).num() : void 0;
stateAccessibilityLabel = intl.string(t.GzDTxY);
r706 = r726;
officialMessageColor2 = r720;
}
}
}
const voiceChannelBadge = createVoiceChannelBadge(message.author.id, guildId);
const guildId4 = guildId == null ? void 0 : guildId;
let r765 = message4;
if (r765 == null) {
r765 = message;
}
const nonce = message.nonce != null && typeof message.nonce !== "string" ? String(message.nonce) : message.nonce;
const referencedMessage = renderContentOnly ? void 0 : r108;
const forwardInfo = messageForward != null ? messageForward.getForwardInfo() : void 0;
const mentioned = ignoreMentioned ? !ignoreMentioned : message.mentioned;
const edited = message.isEdited() ? renderContentOnly ? "" : intl.string(t.C8sXIM) : "";
const editedTimestamp2 = message.isEdited() ? renderContentOnly ? void 0 : message.editedTimestamp != null ? dateFormat(message.editedTimestamp, "LLLL") : void 0 : void 0;
const textColor = message.isUnsupported ? colors.unsupportedColor : r706 != null ? 4278190080 | r706 : colors.textColor;
if (r78) {
nick = author.username;
}
if (nick == null) {
nick = void 0;
}
const r762 = {
id: message.id,
channelId: message.channel_id,
guildId: guildId4,
flags: r765.flags,
type: message.type,
nonce,
state: message.state,
reactions,
referencedMessage,
threadEmbed,
forwardInfo,
mentioned,
edited,
editedTimestamp: editedTimestamp2,
editedColor: colors.editedColor,
textColor,
officialMessageColor: officialMessageColor2,
linkColor: colors.linkColor,
tagText,
tagAccessibilityLabel,
tagVerified,
tagTextColor,
tagBackgroundColor,
tagType,
tagIconUrl,
opTagText,
opTagTextColor,
opTagBackgroundColor,
stateAccessibilityLabel,
constrainedWidth,
gifAutoPlay,
animateEmoji,
username: nick,
avatarURL: r78 ? void 0 : r88.uri,
avatarDecorationURL: null,
authorId: null,
usernameColor: null,
roleColor: null,
roleColors: null,
shouldShowRoleDot: null,
shouldShowRoleOnName: null,
showLinkDecorations: null,
colorString: null,
roleIcon: null,
connectionsRoleTag: null,
timestamp: null,
timestampTooltip: null,
timestampColor: null,
timestampAccessibilityLabel: null,
content: null,
isEditing: null,
renderContentOnly: null,
surveyIndication: null,
ephemeralIndication: null,
interactionStatus: null,
executedCommand: null,
components: null,
feedbackColor: null,
highlightColor: null,
embeds: null,
giftCodes: null,
codedLinks: null,
activityInstanceEmbed: null,
activityRichPresenceInviteEmbed: null,
useAttachmentGridLayout: null,
useAttachmentUploadPreview: null,
attachments: null,
attachmentsOpacity: null,
stickers: null,
communicationDisabled: null,
isFirstForumPostMessage: null,
postActions: null,
isCurrentUserMessageAuthor: null,
usingGradientTheme: null,
swipeToReplyIconUrl: null,
swipeToEditIconUrl: null,
postPreviewEmbeds: null,
obscureLearnMoreLabel: null,
safetyPolicyNoticeEmbed: null,
pollData: null,
sharedClientTheme: null,
safetySystemNotificationEmbed: null,
ctaButton: null,
audioAttachmentBackgroundColor: null,
accessibilityActions: null,
clanTagGuildId: null,
clanTag: null,
clanBadgeUrl: null,
lobbyAdditionalName: null,
lobbyTagIconUrl: null,
isFirst: null,
gameApplicationId: null,
isAnnouncementChannel: null,
displayNameStyles: null,
voiceChannelBadge: null
};
const avatarDecorationURL2 = r78 ? null : avatarDecorationURL;
L270: {
r762.avatarDecorationURL = avatarDecorationURL2;
r762.authorId = author.id;
if (!r78 && roleStyle === "username") {
usernameColor = processColor(colorString == null ? void 0 : colorString);
if (usernameColor != null) {
break L270;
}
usernameColor = colors.defaultUsernameColor;
} else {
usernameColor = colors.defaultUsernameColor;
}
}
r762.usernameColor = usernameColor;
let roleColor = null;
if (!r78) {
let r817 = processColor(colorString == null ? void 0 : colorString);
if (r817 == null) {
r817 = null;
}
roleColor = r817;
}
r762.roleColor = roleColor;
r762.roleColors = hasEnhancedRoleColors ? r78 ? null : processColorStrings(colorStrings) : null;
r762.shouldShowRoleDot = roleStyle === "dot";
r762.shouldShowRoleOnName = roleStyle === "username";
r762.showLinkDecorations = AccessibilityStore.alwaysShowLinkDecorations;
if (r78) {
defaultUsernameColor = colors.defaultUsernameColor;
} else {
if (colorString == null) {
colorString = void 0;
}
defaultUsernameColor = processColor(colorString);
if (defaultUsernameColor == null) {
defaultUsernameColor = colors.defaultUsernameColor;
}
}
r762.colorString = defaultUsernameColor;
r762.roleIcon = r78 ? void 0 : r80;
r762.connectionsRoleTag = visibleConnectionsRole != null ? createConnectionsRoleTag(visibleConnectionsRole) : void 0;
r762.timestamp = r78 ? void 0 : r79;
r762.timestampTooltip = r78 ? void 0 : dateFormat(message.timestamp, "LLLL");
r762.timestampColor = r78 ? void 0 : colors.timestampColor;
r762.timestampAccessibilityLabel = r78 ? void 0 : r76;
r762.content = content3;
r762.isEditing = isEditing;
r762.renderContentOnly = renderContentOnly;
r762.surveyIndication = pushFeedbackType !== void 0 ? createSurveyIndication(message, theme, pushFeedbackType) : void 0;
r762.ephemeralIndication = createEphemeralIndication(message);
r762.interactionStatus = interactionStatus;
r762.executedCommand = renderExecutedCommands ? createExecutedCommand(message, channel, roleStyle, theme, colors.defaultUsernameColor) : void 0;
r762.components = message4.components.length > 0 ? renderComponents ? transformMessageComponents({
message,
guildId,
interaction,
shouldDisableInteractiveComponents,
shouldShowMedia,
shouldObscureSpoiler,
enabledContentHarmTypeFlags: enabledHarmTypesForMessage,
shouldAgeVerify: shouldAgeVerifyForExplicitMedia,
shouldShowMosaicMediaDescriptions: setting,
shouldAutoPlayGifs: gifAutoPlay,
colors
}, message4.components) : void 0 : void 0;
r762.feedbackColor = renderContentOnly ? 0 : colors.feedbackColor;
r762.highlightColor = renderContentOnly ? 0 : colors.highlightColor;
if (embeds == null) {
embeds = void 0;
}
r762.embeds = embeds;
r762.giftCodes = renderGiftCode ? createGiftCodeEmbed(message, theme) : [];
r762.codedLinks = renderCodedLinks ? createCodedLinkEmbeds(message, message4, channel, theme) : [];
r762.activityInstanceEmbed = renderActivityInstanceEmbed ? createActivityInstanceEmbed(message) : void 0;
r762.activityRichPresenceInviteEmbed = renderActivityInviteEmbed ? createActivityRichPresenceInviteEmbed(message, channel) : void 0;
if (shouldInlineAttachmentMedia) {
if (renderAttachments) {
renderAttachments = length !== 0 || length2 !== 0;
}
if (!renderAttachments) {
renderAttachments = useAttachmentUploadPreview;
}
shouldInlineAttachmentMedia = renderAttachments;
}
r762.useAttachmentGridLayout = shouldInlineAttachmentMedia;
r762.useAttachmentUploadPreview = useAttachmentUploadPreview;
r762.attachments = attachments;
r762.attachmentsOpacity = useAttachmentUploadPreview ? message.state === MessageStates.SEND_FAILED ? 0.2 : 1 : 1;
r762.stickers = restrictedPreview ? [] : transformStickers({
message: message4,
animateStickersSetting: AnimateStickers.getSetting(),
isUserInteracting: message.id === animatingStickerMessageId
});
if (renderCommunicationDisabled) {
renderCommunicationDisabled = isMemberCommunicationDisabled;
}
r762.communicationDisabled = renderCommunicationDisabled;
r762.isFirstForumPostMessage = !!(channel == null ? void 0 : channel.isForumPost()) && message.id === message.channel_id;
const r915 = channel == null ? void 0 : channel.isForumPost();
let postActions = void 0;
if (r915) {
postActions = void 0;
if (renderForumPostActions) {
L357: {
const { id: id2, channel_id } = message;
r920 = void 0;
if (id2 === channel_id) {
const guildId3 = channel.getGuildId();
if (guildId3 != null) {
const isLurking = LurkingStore.isLurking(guildId3);
r920 = void 0;
if (isLurking) {
break L357;
}
}
const hasJoined = JoinedThreadsStore.hasJoined(message.channel_id);
const hasReactions = message.reactions.length !== 0;
let defaultReaction = void 0;
if (!hasReactions) {
const defaultReactionEmoji = ChannelStore.getChannel(channel.parent_id)?.defaultReactionEmoji;
defaultReaction = createDefaultReaction({
defaultReactionEmoji,
customGuildEmoji: defaultReactionEmoji?.emojiId != null ? EmojiStore.getUsableCustomEmojiById(defaultReactionEmoji.emojiId) : null
});
}
r920 = createForumPostActions({
isFollowing: hasJoined,
hasReactions,
defaultReaction,
showMediaPostSharePrompt: MediaPostSharePromptStore.shouldDisplayPrompt(channel.id)
});
}
}
postActions = r920;
}
}
r762.postActions = postActions;
r762.isCurrentUserMessageAuthor = message.author.id === id;
r762.usingGradientTheme = ClientThemesBackgroundStore.gradientPreset != null;
r762.swipeToReplyIconUrl = getAssetUriForEmbed(Module7747);
r762.swipeToEditIconUrl = getAssetUriForEmbed(Module7748);
r762.postPreviewEmbeds = r40 ? createPostPreviewEmbeds(message, roleStyle, AccessibilityStore.useReducedMotion) : [];
r762.obscureLearnMoreLabel = intl.string(t["2aXnfa"]);
r762.safetyPolicyNoticeEmbed = createSafetyPolicyNoticeEmbed(message);
r762.pollData = pollData;
r762.sharedClientTheme = sharedClientTheme;
r762.safetySystemNotificationEmbed = createSafetySystemNotificationEmbed(message);
r762.ctaButton = createCtaButton(message.id, message.channel_id, colors);
r762.audioAttachmentBackgroundColor = hasFlag ? colors.embedBackgroundColor : void 0;
r762.accessibilityActions = createMessageAccessibilityActions(message, channel);
r762.clanTagGuildId = clanTagGuildId;
r762.clanTag = clanTag;
r762.clanBadgeUrl = clanBadgeUrl;
r762.lobbyAdditionalName = lobbyAdditionalName;
r762.lobbyTagIconUrl = lobbyTagIconUrl;
r762.isFirst = isFirst;
r762.gameApplicationId = gameApplicationId;
r762.isAnnouncementChannel = channel?.type === ChannelTypes.GUILD_ANNOUNCEMENT;
r762.displayNameStyles = createDisplayNameStylesMobile(message.author, guildMember);
r762.voiceChannelBadge = voiceChannelBadge;
return r762;
};
export default createMessageContent;
@@ -0,0 +1,42 @@
// Metro module 7932 (f7933).
import { MessageFailureState } from "./RowGeneratorConstants";
import { MessageEmbedTypes } from "../../../../Constants";
import { getAssetUriForEmbed } from "./EmbedUtils";
import Module7933 from "../../../../_bundle/Module7933";
import { intl, t } from "../../../../intl/index.native";
import Module7934 from "../../../../_bundle/Module7934";
import { sizeString } from "../../../../utils/FileUtils";
export default function createMessageFailedEmbed({ uploaderFile, useAttachmentUploadPreview, colors }) {
return uploaderFile != null ? useAttachmentUploadPreview ? {
type: MessageEmbedTypes.TEXT,
messageSendError: intl.string(t.lBLP4u),
failureState: MessageFailureState.UNSPECIFIED,
disableBackgroundColor: true,
bodyTextColor: colors.failedMessageBodyTextColor,
iconURL: getAssetUriForEmbed(Module7934)
} : {
type: MessageEmbedTypes.TEXT,
numAttachments: intl.formatToPlainString(t.D0noUt, {
count: uploaderFile.attachmentsCount
}),
failureState: MessageFailureState.UPLOAD_FAILED,
attachmentsSize: "" + (uploaderFile.currentSize !== 0 ? ` (${sizeString(uploaderFile.currentSize)})` : ""),
bodyTextColor: colors.embedBodyTextColor
} : {
type: MessageEmbedTypes.TEXT,
messageSendError: intl.string(t.lBLP4u),
failureState: MessageFailureState.UNSPECIFIED,
disableBackgroundColor: true,
bodyTextColor: colors.failedMessageBodyTextColor
};
};
export function createAutomodBlockedMessageEmbed(a0) {
return {
type: MessageEmbedTypes.TEXT,
messageSendError: a0.errorMessage,
failureState: MessageFailureState.AUTO_MODERATION_BLOCKED_MESSAGE,
disableBackgroundColor: true,
bodyTextColor: a0.colors.automodBlockedBodyTextColor,
iconURL: getAssetUriForEmbed(Module7933)
};
}
@@ -0,0 +1,75 @@
// Metro module 7815 (f7816).
import { Image as Image2 } from "react-native";
import { MessageTagTypes } from "../../MessageConstants";
import { isPublicSystemMessage } from "../../../public_guilds/PublicGuildsUtils";
import { intl, t } from "../../../../intl/index.native";
import isCrosspost from "../../isCrosspost";
import Module7820 from "../../../../_bundle/Module7820";
export default function getTagProperties(a0) {
let r78, BOT_TAG_SERVER_TYPE, channel, colors, tagIconUrl, tagText, tagVerified;
const { message, isSystemDM = false } = a0;
L11: {
channel = a0.channel;
colors = a0.colors;
const isVerifiedBot = message.author.isVerifiedBot();
if (!isPublicSystemMessage(message) && !isSystemDM) {
if (isCrosspost(message)) {
tagText = intl.string(t.PuJGuM);
BOT_TAG_SERVER_TYPE = MessageTagTypes.BOT_TAG_SERVER_TYPE;
tagVerified = isVerifiedBot;
tagIconUrl = void 0;
break L11;
}
const bot = message.author.bot;
tagVerified = isVerifiedBot;
tagIconUrl = void 0;
BOT_TAG_SERVER_TYPE = void 0;
tagText = null;
if (!bot) {
break L11;
}
const r37 = intl.string(t["9RNkeF"]);
tagIconUrl = isVerifiedBot ? Image2.resolveAssetSource(Module7820).uri : void 0;
tagVerified = isVerifiedBot;
BOT_TAG_SERVER_TYPE = void 0;
tagText = r37;
} else {
tagText = intl.string(t.lKQ7Wt);
BOT_TAG_SERVER_TYPE = MessageTagTypes.SYSTEM_DM_TAG_SYSTEM_TYPE;
tagVerified = true;
tagIconUrl = void 0;
}
}
const r1 = tagText != null;
let tagAccessibilityLabel = null;
if (r1) {
L22: {
if (!isPublicSystemMessage(message) && !isSystemDM) {
if (isCrosspost(message)) {
r78 = intl.string(t["39trQT"]);
break L22;
}
if (tagVerified) {
r78 = intl.string(t.g76OcH);
break L22;
}
r78 = intl.string(t.qwJHjo);
} else {
r78 = intl.string(t["7s687k"]);
}
}
tagAccessibilityLabel = r78;
}
return {
tagText,
tagAccessibilityLabel,
tagVerified,
tagTextColor: void 0,
tagBackgroundColor: void 0,
tagType: BOT_TAG_SERVER_TYPE,
tagIconUrl,
opTagText: channel?.ownerId === message.author.id && (channel == null ? void 0 : channel.isForumPost()) ? intl.string(t.fyE8sH) : null,
opTagTextColor: colors.opTagTextColor,
opTagBackgroundColor: colors.opTagBackgroundColor
};
};
@@ -0,0 +1,66 @@
// Metro module 7883 (f7884).
let redactRestrictedContent;
const nodeToText = function nodeToText(content) {
return content == null ? "" : typeof content !== "string" ? Array.isArray(content) ? content.map(nodeToText).join("") : typeof content.content === "string" ? content.content : content.content != null ? nodeToText(content.content) : "" : content;
};
redactRestrictedContent = function redactRestrictedContent(a0) {
let r54;
if (a0 != null && typeof a0 !== "string") {
if (Array.isArray(a0)) {
return a0.map(redactRestrictedContent);
}
if (a0.type !== "link" && a0.type !== "attachmentLink") {
if (a0.type === "customEmoji") {
return {
type: "text",
content: `:${a0.alt}:`
};
}
const r6 = a0.content != null ? {
...a0,
content: redactRestrictedContent(a0.content)
} : a0;
return a0.items != null ? {
...r6,
items: redactRestrictedContent(a0.items)
} : r6;
}
const content = a0.content;
const r45 = content == null;
let content3 = "";
if (!r45) {
let r47 = content;
if (typeof r47 !== "string") {
if (Array.isArray(content)) {
r54 = content.map(nodeToText).join("");
} else if (typeof content.content === "string") {
r54 = content.content;
} else {
const r53 = content.content != null;
r54 = "";
if (r53) {
const content2 = content.content;
const r55 = content2 == null;
let r56 = "";
if (!r55) {
let r8 = content2;
if (typeof r8 !== "string") {
r8 = Array.isArray(content2) ? content2.map(nodeToText).join("") : typeof content2.content === "string" ? content2.content : content2.content != null ? nodeToText(content2.content) : "";
}
r56 = r8;
}
r54 = r56;
}
}
r47 = r54;
}
content3 = r47;
}
return {
type: "inlineCode",
content: content3
};
}
return a0;
};
export default redactRestrictedContent;
@@ -0,0 +1,37 @@
// Metro module 7736 (f7737).
import { experimental_createToken, createNativeStyleProperties } from "../../../../design/components/Styles/native/createStyles";
import { isThemeDark } from "../../../../design/shared";
import Module712 from "../../../../_bundle/Module712";
let nativeStyleProperties;
let c4865_3 = {
textColor: Module712.colors.TEXT_STRONG,
linkColor: Module712.colors.TEXT_LINK,
timestampColor: Module712.colors.TEXT_MUTED,
highlightColor: Module712.colors.MESSAGE_HIGHLIGHT_BACKGROUND_DEFAULT,
unsupportedColor: Module712.colors.TEXT_MUTED,
embedProviderColor: experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_300 : Module712.unsafe_rawColors.PRIMARY_630),
embedBorderLeftColor: Module712.colors.BORDER_NORMAL,
embedBodyTextColor: Module712.colors.TEXT_DEFAULT,
embedHeaderTextColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
opTagTextColor: Module712.unsafe_rawColors.BRAND_560,
opTagBackgroundColor: experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.BRAND_260 : Module712.unsafe_rawColors.BRAND_200),
failedMessageBodyTextColor: Module712.unsafe_rawColors.RED_400,
automodBlockedBodyTextColor: Module712.colors.TEXT_MUTED,
aiBotTagColor: Module712.colors.TEXT_FEEDBACK_POSITIVE,
editedColor: Module712.colors.TEXT_MUTED,
defaultUsernameColor: Module712.colors.INTERACTIVE_TEXT_ACTIVE,
feedbackColor: Module712.colors.BACKGROUND_MOD_MUTED,
reportFpTextColor: Module712.colors.CONTROL_SECONDARY_TEXT_DEFAULT,
reportFpBackgroundColor: Module712.colors.CONTROL_SECONDARY_BACKGROUND_DEFAULT,
retryTextColor: Module712.colors.WHITE,
retryBackgroundColor: Module712.colors.BACKGROUND_BRAND,
clipTagBackgroundColor: Module712.colors.BACKGROUND_BRAND,
clipTagTextColor: Module712.unsafe_rawColors.WHITE
};
nativeStyleProperties = createNativeStyleProperties((a0) => ({
embedBackgroundColor: a0 ? Module712.colors.EMBED_BACKGROUND_ALTERNATE : Module712.colors.EMBED_BACKGROUND,
...c4865_3
}));
export default function resolveMessageContentColors(a0, r4 = false) {
return nativeStyleProperties(a0, r4);
};
@@ -0,0 +1,21 @@
// Metro module 8008 (f8009).
import { processColor } from "react-native";
import { DEFAULT_ROLE_COLOR_HEX } from "../../../../../Constants";
import Module712 from "../../../../../_bundle/Module712";
import { getDarkness, hex2int } from "../../../../../_bundle/int2hslRaw";
export function createConnectionsRoleTag(a0) {
let colorString = a0.colorString;
if (colorString == null) {
colorString = DEFAULT_ROLE_COLOR_HEX;
}
let WHITE = Module712.unsafe_rawColors.WHITE;
if (getDarkness(hex2int(colorString)) < 0.3) {
WHITE = Module712.unsafe_rawColors.PRIMARY_630;
}
return {
id: a0.id,
name: a0.name,
backgroundColor: processColor(colorString),
iconColor: processColor(WHITE)
};
}
@@ -0,0 +1,34 @@
// Metro module 12391 (f12392).
import ExplicitMediaStore from "../../../../explicit_media_redaction/ExplicitMediaStore";
import { getCtaButtonType, CtaButtonType } from "../../../CtaButtonUtils";
import * as _AgeVerificationUtils from "../../../../age_assurance/AgeVerificationUtils";
import { intl, t } from "../../../../../intl/index.native";
export function createCtaButton(a0, a1, a2) {
const ctaButtonType = getCtaButtonType(a0, a1);
const isAgeVerified = _AgeVerificationUtils.isAgeVerified();
const shouldShowTiggerPawtect = _AgeVerificationUtils.shouldShowTiggerPawtect();
if (CtaButtonType.MARK_AS_FALSE_POSITIVE === ctaButtonType) {
return {
text: intl.string(t["4q1Elf"]),
textColor: a2.reportFpTextColor,
backgroundColor: a2.reportFpBackgroundColor,
callback: ExplicitMediaStore.canSubmitFpReport(a0) ? CtaButtonType.MARK_AS_FALSE_POSITIVE : void 0
};
}
if (CtaButtonType.AGE_VERIFICATION_RETRY === ctaButtonType) {
return {
text: isAgeVerified ? intl.string(t["9KiIz6"]) : intl.string(t["/nicWo"]),
textColor: a2.retryTextColor,
backgroundColor: a2.retryBackgroundColor,
callback: shouldShowTiggerPawtect ? CtaButtonType.AGE_VERIFICATION_RETRY : void 0
};
}
if (CtaButtonType.CONNECT_TO_TEEN === ctaButtonType) {
return {
text: intl.string(t.n8a49k),
textColor: a2.retryTextColor,
backgroundColor: a2.retryBackgroundColor,
callback: CtaButtonType.CONNECT_TO_TEEN
};
}
}
@@ -0,0 +1,40 @@
// Metro module 7860 (f7861).
import GuildAutomodMessageStore from "../../../../guild_automod/GuildAutomodMessageStore";
import { HelpdeskArticles, MessageFlags } from "../../../../../Constants";
import { getEphemeralReasonMessage } from "../../../../application_commands/ApplicationCommandUserAppUtils";
import { intl, t } from "../../../../../intl/index.native";
import HelpdeskUtils from "../../../../../utils/HelpdeskUtils";
export function createEphemeralIndication(a0) {
if (a0.hasFlag(MessageFlags.EPHEMERAL)) {
if (a0.interactionMetadata?.ephemerality_reason != null) {
return {
content: intl.formatToParts(t.xgCMRQ, {
handleDelete: {
action: "bindDismissMessage",
message: a0
},
reason: getEphemeralReasonMessage(a0.interactionMetadata?.ephemerality_reason)
}),
helpArticleLink: HelpdeskUtils.getArticleURL(HelpdeskArticles.USING_APPS_FAQ),
helpButtonAccessibilityLabel: intl.string(t.OIWSJe)
};
}
const r25 = {
content: intl.formatToParts(t.uX3ecL, {
count: 1,
countMessages: 1,
handleDelete: {
action: "bindDismissMessage",
message: a0
}
}),
helpArticleLink: HelpdeskUtils.getAppsSupportURL(HelpdeskArticles.EPHEMERAL_MESSAGES),
helpButtonAccessibilityLabel: intl.string(t.htHOrp)
};
if (GuildAutomodMessageStore.getMessage(a0.id) != null) {
r25.helpArticleLink = HelpdeskUtils.getArticleURL(HelpdeskArticles.GUILD_AUTOMOD_BLOCKED_MESSAGE);
r25.helpButtonAccessibilityLabel = intl.string(t.OiCBhP);
}
return r25;
}
}
@@ -0,0 +1,103 @@
// Metro module 7731 (f7732).
import { HelpdeskArticles } from "../../../../../Constants";
import { getAssetUriForEmbed } from "../EmbedUtils";
import Module4142 from "../../../../../_bundle/Module4142";
import Module7732 from "../../../../../_bundle/Module7732";
import SentryUtils_native from "../../../../../utils/SentryUtils.native";
import Module4134 from "../../../../../_bundle/Module4134";
import { intl, t } from "../../../../../intl/index.native";
import HelpdeskUtils from "../../../../../utils/HelpdeskUtils";
import Module7733 from "../../../../../_bundle/Module7733";
import Module7734 from "../../../../../_bundle/Module7734";
import * as _AccessibilityLabelOptimizationExperiment from "../../../../a11y/native/AccessibilityLabelOptimizationExperiment";
import AvatarUtils from "../../../../../utils/AvatarUtils";
import { getAccessibleEmojiDisplayName } from "../../../../reactions/ReactionUtils";
import EmojiUtils from "../../../../../utils/EmojiUtils";
export function createDefaultReaction(a0) {
let emoji;
L14: {
const { defaultReactionEmoji, customGuildEmoji } = a0;
const shouldSkipAccessibilityLabels = _AccessibilityLabelOptimizationExperiment.shouldSkipAccessibilityLabels();
const r2 = defaultReactionEmoji != null;
emoji = void 0;
if (r2) {
const { emojiId, emojiName } = defaultReactionEmoji;
if (emojiId != null && customGuildEmoji != null) {
let name = customGuildEmoji.name;
if (name == null) {
name = "";
}
emoji = {
id: emojiId,
name: void 0,
animated: customGuildEmoji.animated,
src: AvatarUtils.getEmojiURL({
id: emojiId,
animated: customGuildEmoji.animated,
size: 48
}),
displayName: shouldSkipAccessibilityLabels ? name : getAccessibleEmojiDisplayName(false, 0, {
id: emojiId,
name,
animated: customGuildEmoji.animated
})
};
break L14;
}
const r21 = emojiName != null;
emoji = void 0;
if (r21) {
let name2 = emojiName;
if (name2 == null) {
name2 = "";
}
emoji = {
id: void 0,
name: emojiName,
animated: false,
src: EmojiUtils.getURL(emojiName),
displayName: shouldSkipAccessibilityLabels ? name2 : getAccessibleEmojiDisplayName(false, 0, {
id: void 0,
name: name2,
animated: false
})
};
}
}
}
return emoji != null ? {
emoji,
me: false,
count: 0
} : void 0;
}
export function createForumPostActions({ isFollowing, hasReactions, defaultReaction, showMediaPostSharePrompt }) {
const followIcon = isFollowing ? getAssetUriForEmbed(Module4142) : getAssetUriForEmbed(Module7732);
if (followIcon == null) {
SentryUtils_native.captureMessage(`Forum follow is null. isFollowing: ${isFollowing} icon: ${isFollowing ? Module4142 : Module7732}`);
}
const assetUriForEmbed = getAssetUriForEmbed(Module4134);
const addReactLabel = hasReactions ? void 0 : defaultReaction?.emoji != null ? void 0 : intl.string(t.xpOyTO);
const sharePrompt = showMediaPostSharePrompt ? {
title: intl.string(t["5uAO7d"]),
subtitle: intl.formatToParts(t.YtCu5p, {
helpArticleUrl: {
url: HelpdeskUtils.getCreatorSupportArticleURL(HelpdeskArticles.MEDIA_CHANNEL)
}
}),
cta: intl.string(t.C5UQC9),
icon: getAssetUriForEmbed(Module7733),
closeIcon: getAssetUriForEmbed(Module7734)
} : void 0;
return {
numDisplayedReactions: 3,
isFollowing,
followIcon,
followLabel: isFollowing ? intl.string(t["OtF+lC"]) : intl.string(t["0rQinA"]),
shareIcon: assetUriForEmbed,
shareLabel: intl.string(t.Ej3B3Y),
defaultReaction,
addReactLabel,
sharePrompt
};
}
@@ -0,0 +1,24 @@
// Metro module 8009 (f8010).
import { NotificationTypes } from "../../../../push_notifications/PushNotificationConstants";
import { t, intl } from "../../../../../intl/index.native";
import { getAssetUriForEmbed } from "../EmbedUtils";
import { isThemeDark } from "../../../../../design/shared";
import Module8010 from "../../../../../_bundle/Module8010";
import Module8011 from "../../../../../_bundle/Module8011";
export function createSurveyIndication(a0, a1, a2) {
let notificationType = a2;
const r10 = a2 === NotificationTypes.TOP_MESSAGE_PUSH ? t.GwWhce : t["46+Iqc"];
if (a2 == null) {
notificationType = NotificationTypes.TOP_MESSAGE_PUSH;
}
return {
content: intl.formatToParts(r10, {
handleMessage: {
action: "bindUserSurvey",
message: a0,
notificationType
}
}),
feedbackIconUrl: getAssetUriForEmbed(isThemeDark(a1) ? Module8010 : Module8011)
};
}
@@ -0,0 +1,33 @@
// Metro module 8006 (f8007).
import { Image as Image2 } from "react-native";
import ChannelStore from "../../../../../stores/ChannelStore";
import PermissionStore from "../../../../../stores/PermissionStore";
import VoiceStateStore from "../../../../../stores/VoiceStateStore";
import { Permissions } from "../../../../../Constants";
import { getVoiceChannelBadgeExperiment } from "../../../../channel/VoiceChannelBadgeExperiment";
import { getChannelIcon } from "../../../../../utils/native/ChannelUtils";
import { shouldAgeVerifyForAgeGate, shouldShowAgeGateForChannelId } from "../../../../age_gate/AgeGateUtils";
export function createVoiceChannelBadge(a0, a1) {
if (getVoiceChannelBadgeExperiment({
guildId: a1 == null ? void 0 : a1,
location: "VoiceChannelBadgeNative"
}).enabled && a1 != null) {
const discoverableVoiceState = VoiceStateStore.getDiscoverableVoiceState(a1, a0);
if (discoverableVoiceState != null) {
const channel = ChannelStore.getChannel(discoverableVoiceState?.channelId);
if (channel != null) {
const uri = Image2.resolveAssetSource(getChannelIcon(channel))?.uri;
if (uri != null) {
const r34 = shouldAgeVerifyForAgeGate() && shouldShowAgeGateForChannelId(channel.id);
const r40 = channel.isPrivate() || PermissionStore.can(Permissions.VIEW_CHANNEL, channel) && PermissionStore.can(Permissions.CONNECT, channel);
if (!r34 && r40) {
return {
channelId: channel.id,
channelIconUrl: uri
};
}
}
}
}
}
}
@@ -0,0 +1,410 @@
// Metro module 12371 (f12372).
import ApplicationStore from "../../../../../applications/ApplicationStore";
import SpotifyStore from "../../../../../spotify/SpotifyStore";
import { SpotifyApplication } from "../../../../../../records/SpotifyApplicationRecord";
import UserRecord from "../../../../../../records/UserRecord";
import AuthenticationStore from "../../../../../../stores/AuthenticationStore";
import GamePartyStore from "../../../../../../stores/GamePartyStore";
import LocalActivityStore from "../../../../../../stores/LocalActivityStore";
import MessageStore from "../../../../../../stores/MessageStore";
import PresenceStore from "../../../../../../stores/PresenceStore";
import SelfPresenceStore from "../../../../../../stores/SelfPresenceStore";
import UserStore from "../../../../../../stores/UserStore";
import ActivityLauncherStore from "../../../../../../stores/views/ActivityLauncherStore";
import { ActivityActionStates, ActivityActionTypes, ActivityTypes } from "../../../../../../Constants";
import { SPOTIFY_PLATFORM_NAME, isSpotifyParty } from "../../../../../spotify/SpotifyConstants";
import { fetchApplication } from "../../../../../applications/ApplicationActionCreators";
import { getRemoteJoinFooterLabel } from "../../../../../activities/utils/getRemoteJoinFooterLabel";
import { intl, t } from "../../../../../../intl/index.native";
import { getContentClassificationVisibility, ContentClassificationVisibility } from "../../../../../content_classification/ContentClassificationVisibility";
import { getApplicationFromMessage } from "../../../../../activities/utils/getApplicationFromMessage";
import isInviteActive from "../../../../../activities/utils/isInviteActive";
import { getIsAskToJoin } from "../../../../../activities/utils/getIsAskToJoin";
import { getAssetImage } from "../../../../../../utils/ApplicationAssetUtils";
import { getRequestToStreamText, getHeaderText, getPartyText, getDeadGameInviteText } from "../../../../../activities/utils/InviteEmbedTextUtils";
import { getPartySize } from "../../../../../activities/utils/getPartySize";
import { getCurrentActivityGamePlatform } from "../../../../../activities/utils/isActivityJoinableOnCurrentPlatform";
import getCurrentUserPresenceActivity from "../../../../../activities/utils/getCurrentUserPresenceActivity";
import { getIsInParty } from "../../../../../activities/utils/getIsInParty";
import { getCanSendInvite } from "../../../../../activities/utils/getCanSendInvite";
import { canLaunchFrame } from "../../../../../frames/utils/canLaunchFrame";
import { isEmbeddedApp } from "../../../../../app_launcher/utils/AppLauncherUtils";
import { getCanJoin } from "../../../../../activities/utils/getCanJoin";
import { formatActiveTimestamp } from "../../../../../content_inventory/utils";
import { getAppIconSrc, getAppGradientColors } from "../../../../../applications/message_embed/native/utils/nativeAppMessageEmbedUtil";
import getCoverImageFromActivity from "../../../../../activities/utils/getCoverImageFromActivity";
import { isMostRecentDeadEndInvite } from "../../../../../activities/utils/isMostRecentDeadEndInvite";
import { getSupportsRemoteJoin } from "../../../../../activities/utils/getSupportsRemoteJoin";
import { getShouldShowAppAuthPrompt } from "../../../../../application_account_linking/native/getShouldShowAppAuthPrompt";
import { ACTIVITY_GAME_PLATFORM_TO_ICON_KEY, getJoinFromSupportedPlatformsIconKeys } from "../../../../../activities/utils/useJoinFromSupportedPlatformsIconKeys";
import { getPresenceActivityInviteCoverImageURL } from "../../../../../activities/utils/usePresenceActivityInviteCoverImageURL";
import getRequestToStreamCTAAndIsDisabled from "../../../../../request_to_stream/native/getRequestToStreamCTAAndIsDisabled";
import RequestToStream_messages from "../../../../../request_to_stream/RequestToStream.messages";
let $mk89734 = function() {
return (a0) => a0.type === ActivityTypes.LISTENING;
};
let c8542_20 = {
ACTIVE: "active",
DEAD: "dead",
DEAD_COMPACT: "dead_compact",
BLOCKED: "blocked"
};
export { c8542_20 as EmbedDisplayType };
export function createActivityRichPresenceInviteEmbed(a0, a1) {
let r7, r28, r359, r576, ctaButtonEnabled, ctaButtonIsLoading, ctaButtonText, detailsText, footerLabel2, headerText2, iconSrc, partyMemberAvatarURIs, partySizeText, platformIconKeys, presenceActivity, subtitle, title;
if (a0.author != null && a0.activity != null && a1 != null) {
const contentClassificationVisibility = getContentClassificationVisibility(a0.application?.content_classification, a1, UserStore.getCurrentUser()?.nsfwAllowed);
if (ContentClassificationVisibility.DISPLAY === contentClassificationVisibility) {
let c19810_0 = a1;
const applicationFromMessage = getApplicationFromMessage(a0);
const id = a0.application?.id;
let application = id != null ? ApplicationStore.getApplication(id) : null;
if (application == null && id != null && ApplicationStore.isFetchingApplication(id) === false) {
fetchApplication(id, false);
}
if (application == null) {
application = applicationFromMessage;
}
const id2 = AuthenticationStore.getId();
if (a0.application != null) {
const id3 = a0.author.id;
presenceActivity = PresenceStore.getApplicationActivity(a0.activity?.type === ActivityActionTypes.JOIN_REQUEST ? id3 === id2 ? a1.isPrivate() ? a1.getRecipientId() : id2 : id2 : a0.activity?.type === ActivityActionTypes.STREAM_REQUEST ? id2 : id3, a0.application.id);
} else {
presenceActivity = PresenceStore.findActivity(a0.author.id, $mk89734());
}
const r163 = application != null;
let r164 = void 0;
if (r163) {
if (a0.activity?.type === ActivityActionTypes.STREAM_REQUEST) {
const iconSrc2 = application.icon != null ? getAppIconSrc(application.id, application.icon, application.bot) : null;
let r564 = iconSrc2;
if (r564 == null) {
r564 = void 0;
}
const appGradientColors2 = getAppGradientColors(r564);
const id6 = AuthenticationStore.getId();
if (a0.application != null) {
const id7 = a0.author.id;
r576 = PresenceStore.getApplicationActivity(a0.activity?.type === ActivityActionTypes.JOIN_REQUEST ? id7 === id6 ? a1.isPrivate() ? a1.getRecipientId() : id6 : id6 : a0.activity?.type === ActivityActionTypes.STREAM_REQUEST ? id6 : id7, a0.application.id);
} else {
r576 = PresenceStore.findActivity(a0.author.id, $mk89734());
}
const isInviteActive3 = isInviteActive(r576, a0, application.id);
const requestToStreamText = getRequestToStreamText(a0, a1, AuthenticationStore.getId());
const requestToStreamCTAAndIsDisabled = getRequestToStreamCTAAndIsDisabled(a0);
r164 = {
displayType: isInviteActive3 ? c8542_20.ACTIVE : c8542_20.DEAD,
ctaButtonEnabled: !requestToStreamCTAAndIsDisabled.isDisabled,
ctaButtonText: requestToStreamCTAAndIsDisabled.text,
ctaButtonIsLoading: false,
footerLabel: null,
gradientColors: appGradientColors2,
headerText: intl.string(RequestToStream_messages.nAyuPp),
iconSrc: iconSrc2,
isSpotifyParty: false,
isPlatformSupported: true,
maxPartySize: 0,
partyMemberAvatarURIs: null,
partySizeText: null,
platformIconKeys: [],
coverImageUrl: null,
detailsText: null,
subtitle: requestToStreamText,
title: application.name
};
} else {
const isInviteActive2 = isInviteActive(presenceActivity, a0, application.id);
const r173 = !isInviteActive2;
const isAskToJoin = getIsAskToJoin(a0);
let appName = a0.activity?.name_override;
if (appName == null) {
appName = application.name;
}
let r43 = a0.activity?.icon_override != null ? getAssetImage(application.id, a0.activity.icon_override) : null;
const headerText = getHeaderText(appName, a0.activity?.type, r173);
if (presenceActivity != null && presenceActivity.party != null) {
const r195 = Array;
let r200 = GamePartyStore.getParty(presenceActivity.party.id);
if (r200 == null) {
r200 = [];
}
r28 = r195.from(r200);
} else {
r28 = [];
}
let maxPartySize = getPartySize(presenceActivity).maxPartySize;
const currentActivityGamePlatform = getCurrentActivityGamePlatform();
const currentUserPresenceActivity = getCurrentUserPresenceActivity(LocalActivityStore, SelfPresenceStore, application.id);
const isInParty = getIsInParty(currentUserPresenceActivity, presenceActivity);
const canSendInvite = getCanSendInvite(presenceActivity, a0, application, id2);
const r220 = Set;
let r222 = presenceActivity?.supported_platforms;
if (r222 == null) {
r222 = [];
}
const isGameLaunchable = new r220(r222).has(currentActivityGamePlatform);
const canLaunchFrame2 = canLaunchFrame(application);
const canJoin2 = getCanJoin({
presenceActivity,
currentUserPresenceActivity,
currentUserId: id2,
message: a0,
application,
isEmbeddedApplication: isEmbeddedApp(application),
isFrameApplication: canLaunchFrame2,
isGameLaunchable
});
const { canJoin, remoteJoinPlatform } = canJoin2;
const isSpotifyParty2 = isSpotifyParty(presenceActivity == null ? void 0 : presenceActivity.party?.id) || application.id === SpotifyApplication.id;
let start = presenceActivity == null ? void 0 : presenceActivity.timestamps?.start;
if (start == null) {
start = presenceActivity?.created_at;
}
const end = presenceActivity == null ? void 0 : presenceActivity.timestamps?.end;
const r40 = start != null ? formatActiveTimestamp({
start,
end
}, Date.now()) : "";
if (r43 == null) {
r43 = application.icon != null ? getAppIconSrc(application.id, application.icon, application.bot) : null;
}
L160: {
if (isSpotifyParty2) {
const r435 = presenceActivity != null && (presenceActivity.details != null && presenceActivity.state != null) ? intl.formatToPlainString(t.JCvHtx, {
track: presenceActivity.details,
artist: presenceActivity.state
}).replace("\n", " ") : application.name;
const r459 = intl.string(t.sTo7s3);
if (isInviteActive2) {
let r471 = getCoverImageFromActivity(presenceActivity, application.id);
if (r471 == null) {
r471 = void 0;
}
const author = a0.author;
const hasConnectedAccount = SpotifyStore.hasConnectedAccount();
const syncingWith = SpotifyStore.getSyncingWith();
const activity = SpotifyStore.getActivity();
const id4 = author.id;
const id5 = AuthenticationStore.getId();
const r485 = activity?.party != null && (presenceActivity == null ? void 0 : presenceActivity.party?.id) === activity.party.id;
const r8 = syncingWith?.userId != null && syncingWith?.userId === author.id;
const r505 = intl.string(t.VJlc0S);
const r516 = hasConnectedAccount ? (r8 ? r8 : r485) ? intl.string(t.KC26NR) : r505 : intl.formatToPlainString(t.XWSHTb, {
platform: SPOTIFY_PLATFORM_NAME
});
ctaButtonEnabled = !(id4 === id5 || r8 || r485);
r7 = false;
title = r435;
iconSrc = r471;
subtitle = r40;
detailsText = null;
partySizeText = "";
partyMemberAvatarURIs = null;
ctaButtonIsLoading = false;
headerText2 = headerText;
footerLabel2 = r459;
ctaButtonText = r516;
} else {
subtitle = intl.string(t["84qx9r"]);
title = application.name;
r7 = false;
iconSrc = r43;
detailsText = null;
partySizeText = "";
partyMemberAvatarURIs = null;
ctaButtonIsLoading = false;
ctaButtonEnabled = false;
headerText2 = headerText;
footerLabel2 = r459;
ctaButtonText = void 0;
}
} else if (isInviteActive2) {
const r330 = r28.map((item) => {
let r7 = UserStore.getUser(item);
if (r7 == null) {
r7 = new UserRecord({
discriminator: "0005"
});
}
return String(r7 == null ? void 0 : r7.getAvatarURL(c19810_0.guild_id, 64));
});
const partyText = getPartyText({
maxPartySize,
partySize: r28.length,
activityActionType: a0.activity?.type
});
const details = presenceActivity?.details;
const r341 = details != null && details !== "" ? details : null;
L122: {
const supportsRemoteJoin = getSupportsRemoteJoin(presenceActivity);
const shouldShowAppAuthPrompt = getShouldShowAppAuthPrompt(application);
if (canJoin) {
const footerLabel3 = remoteJoinPlatform != null ? getRemoteJoinFooterLabel(remoteJoinPlatform) : void 0;
r359 = {
label: intl.string(t.VJlc0S),
disabled: false,
footerLabel: footerLabel3
};
} else if (canSendInvite) {
r359 = {
label: intl.string(t["hC/Zey"]),
disabled: a0.author.id === id2,
footerLabel: void 0
};
} else if (isInParty) {
r359 = {
label: intl.string(t.KC26NR),
disabled: true,
footerLabel: void 0
};
} else if (isAskToJoin) {
r359 = {
label: void 0,
disabled: false,
footerLabel: intl.formatToPlainString(t.gYVkSW, {
username: a0.author.globalName,
appName
})
};
} else {
if (supportsRemoteJoin && shouldShowAppAuthPrompt) {
r359 = {
label: intl.string(t.lw71Nf),
disabled: false,
footerLabel: void 0
};
break L122;
}
r359 = {
label: void 0,
disabled: false,
footerLabel: intl.string(t.OAB5TK)
};
}
}
const label = r359.label;
const r423 = !r359.disabled;
const footerLabel = r359.footerLabel;
const r5 = presenceActivity != null && presenceActivity.application_id != null && ActivityLauncherStore.getState(presenceActivity.application_id, ActivityActionTypes.JOIN) === ActivityActionStates.LOADING;
r7 = false;
ctaButtonIsLoading = r5;
title = appName;
iconSrc = r43;
subtitle = r40;
detailsText = r341;
partySizeText = partyText;
partyMemberAvatarURIs = r330;
ctaButtonEnabled = r423;
headerText2 = headerText;
footerLabel2 = footerLabel;
ctaButtonText = label;
} else {
const r278 = application.deepLinkUri != null;
const r279 = r278 ? MessageStore.getMessages(a1.id) : void 0;
if (r278 && r279 != null && isMostRecentDeadEndInvite(a0.id, r279, application.id, presenceActivity)) {
subtitle = getDeadGameInviteText(a0, appName, a1, id2, true);
ctaButtonText = intl.string(t["s+J8Dl"]);
r7 = false;
title = appName;
iconSrc = r43;
detailsText = null;
partySizeText = "";
partyMemberAvatarURIs = null;
ctaButtonIsLoading = false;
ctaButtonEnabled = true;
headerText2 = headerText;
footerLabel2 = void 0;
break L160;
}
headerText2 = intl.string(t.pkq6Vq);
subtitle = intl.string(t["Sq/E1I"]);
ctaButtonIsLoading = false;
title = appName;
iconSrc = r43;
r7 = true;
detailsText = null;
partySizeText = "";
partyMemberAvatarURIs = null;
ctaButtonEnabled = false;
footerLabel2 = void 0;
ctaButtonText = void 0;
}
}
if (remoteJoinPlatform != null) {
const r534 = [];
const r538 = ACTIVITY_GAME_PLATFORM_TO_ICON_KEY[remoteJoinPlatform];
platformIconKeys = r534;
if (r538 != null) {
r534.push(r538);
platformIconKeys = r534;
}
} else {
platformIconKeys = getJoinFromSupportedPlatformsIconKeys({
platforms: presenceActivity?.supported_platforms,
currentPlatform: currentActivityGamePlatform,
isGameLaunchable
});
}
let r541 = iconSrc;
if (r541 == null) {
r541 = void 0;
}
const appGradientColors = getAppGradientColors(r541);
const presenceActivityInviteCoverImageURL = getPresenceActivityInviteCoverImageURL({
messageId: a0.id,
presenceActivity,
application
});
const displayType = r7 ? c8542_20.DEAD_COMPACT : isInviteActive2 ? c8542_20.ACTIVE : c8542_20.DEAD;
if (!(maxPartySize > 0)) {
maxPartySize = r28.length;
}
r164 = {
displayType,
ctaButtonEnabled,
ctaButtonText,
ctaButtonIsLoading,
footerLabel: footerLabel2,
gradientColors: appGradientColors,
headerText: headerText2,
iconSrc,
isPlatformSupported: isGameLaunchable,
isSpotifyParty: isSpotifyParty2,
maxPartySize,
partyMemberAvatarURIs,
partySizeText,
platformIconKeys,
coverImageUrl: presenceActivityInviteCoverImageURL,
detailsText,
subtitle,
title
};
}
}
return r164;
}
if (ContentClassificationVisibility.BLOCK_UNDERAGE !== contentClassificationVisibility && ContentClassificationVisibility.BLOCK_CHANNEL_RESTRICTION !== contentClassificationVisibility) {
return null;
}
return {
displayType: c8542_20.BLOCKED,
headerText: intl.string(t.pkq6Vq),
subtitle: contentClassificationVisibility === ContentClassificationVisibility.BLOCK_UNDERAGE ? intl.string(t.GhU4yl) : intl.string(t.B99UMJ),
ctaButtonEnabled: false,
ctaButtonText: void 0,
ctaButtonIsLoading: false,
footerLabel: void 0,
gradientColors: [],
iconSrc: void 0,
isPlatformSupported: false,
isSpotifyParty: false,
maxPartySize: 0,
partyMemberAvatarURIs: null,
partySizeText: void 0,
platformIconKeys: [],
coverImageUrl: void 0,
detailsText: void 0,
title: void 0
};
}
}
@@ -0,0 +1,157 @@
// Metro module 12369 (f12370).
import EmbeddedActivitiesStore from "../../../../../activities/EmbeddedActivitiesStore";
import ApplicationStore from "../../../../../applications/ApplicationStore";
import AuthenticationStore from "../../../../../../stores/AuthenticationStore";
import ChannelStore from "../../../../../../stores/ChannelStore";
import PresenceStore from "../../../../../../stores/PresenceStore";
import UserStore from "../../../../../../stores/UserStore";
import { CodedLinkExtendedType } from "./coded_links/CodedLinksConstants";
import { getContentClassificationVisibility, ContentClassificationVisibility } from "../../../../../content_classification/ContentClassificationVisibility";
import { intl, t } from "../../../../../../intl/index.native";
import { AppMessageEmbedDisplayType } from "./coded_links/CodedLinksTypes";
import { getEmbeddedActivityParticipantAvatarUris } from "./coded_links/useEmbeddedActivityParticipantAvatarUris";
import { getJoinOrStartButtonState } from "../../../../EmbeddedApplicationInstanceUtils";
import { getPlayInContext } from "../../../../../applications/message_embed/utils/getPlayInContext";
import { getAppIconSrc, getAppGradientColors } from "../../../../../applications/message_embed/native/utils/nativeAppMessageEmbedUtil";
import { fetchApplication } from "../../../../../applications/ApplicationActionCreators";
import { getActivityLaunchURL } from "../../../../../applications/getApplicationInstallURL";
export function createActivityInstanceEmbed(a0) {
let header, participantsDescription;
const { application: application2, activityInstance } = a0;
const channel = ChannelStore.getChannel(a0.channel_id);
if (application2 != null && activityInstance?.id != null && channel != null) {
const contentClassificationVisibility = getContentClassificationVisibility(application2.content_classification, channel, UserStore.getCurrentUser()?.nsfwAllowed);
if (ContentClassificationVisibility.DISPLAY === contentClassificationVisibility) {
const id5 = activityInstance.id;
const application = application2;
const channel_id = a0.channel_id;
const guild_id = channel.guild_id;
let r92 = channel.isThread() ? channel.parent_id : channel_id;
if (r92 == null) {
r92 = "";
}
let id;
const activity = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannelIncludingHidden(r92).find((item) => item.applicationId === application.id);
const currentEmbeddedActivity = EmbeddedActivitiesStore.getCurrentEmbeddedActivity();
const embeddedActivityParticipantAvatarUris = getEmbeddedActivityParticipantAvatarUris({
activity,
applicationId: application.id,
guildId: guild_id,
channelId: channel_id
});
id = application.id;
const r109 = activity == null ? void 0 : activity.userIds.values().next().value;
let r116 = r109 == null ? null : PresenceStore.findActivity(r109, (a0) => a0.application_id === id)?.details;
const joinOrStartButtonState = getJoinOrStartButtonState({
embeddedActivity: activity,
currentEmbeddedActivity,
channel
});
if (activity != null) {
if (r116 == null) {
r116 = intl.string(t.oQn0h4);
}
participantsDescription = `${embeddedActivityParticipantAvatarUris.length} ${intl.string(t.BMTj28)}`;
header = r116;
} else {
const r136 = joinOrStartButtonState.disabled ? intl.string(t.JBnc7N) : intl.string(t.cX9uLZ);
header = r116 == null ? r136 : r116;
participantsDescription = null;
}
const playInContext = getPlayInContext(application.id, channel_id);
const instanceId = playInContext.instanceId;
let isCurrentlyInInstance = playInContext.isCurrentlyInInstance;
const canLaunchInChannel = playInContext.canLaunchInChannel;
let iconSrc = application.icon != null ? getAppIconSrc(application.id, application.icon, application.bot) : null;
const label = instanceId == null ? intl.string(t.RscU7I) : intl.string(t.VJlc0S);
if (!isCurrentlyInInstance) {
isCurrentlyInInstance = canLaunchInChannel === false;
}
const actions = [{
id: "play_in_channel",
label,
disabled: isCurrentlyInInstance
}];
if (ApplicationStore.getApplication(application.id) == null && ApplicationStore.isFetchingApplication(application.id) === false) {
fetchApplication(application.id);
}
const appMessageEmbedModel = {
displayType: AppMessageEmbedDisplayType.DISPLAY,
appId: application.id,
messageId: a0.id,
title: intl.string(t.pkq6Vq),
header: null,
info: null,
tagline: null,
staticBannerSrc: null,
iconSrc: null,
embedUrl: null,
bannerRatio: "bot",
actions: null,
extendedType: null,
gradientColors: null,
backgroundColor: 0,
borderColor: 0,
headerColor: 0,
headerText: null,
type: null
};
if (header == null) {
header = "";
}
appMessageEmbedModel.header = header;
appMessageEmbedModel.iconSrc = iconSrc;
appMessageEmbedModel.embedUrl = getActivityLaunchURL({
applicationId: application.id,
referrerId: AuthenticationStore.getId()
});
appMessageEmbedModel.actions = actions;
appMessageEmbedModel.extendedType = CodedLinkExtendedType.APP_MESSAGE_EMBED;
if (iconSrc == null) {
iconSrc = void 0;
}
appMessageEmbedModel.gradientColors = getAppGradientColors(iconSrc);
return {
applicationId: application.id,
instanceId: id5,
appMessageEmbedModel,
participantAvatarUris: embeddedActivityParticipantAvatarUris,
participantsDescription
};
}
if (ContentClassificationVisibility.BLOCK_UNDERAGE !== contentClassificationVisibility && ContentClassificationVisibility.BLOCK_CHANNEL_RESTRICTION !== contentClassificationVisibility) {
return void 0;
}
const id2 = application2.id;
const id3 = activityInstance.id;
const id4 = a0.id;
const info = contentClassificationVisibility === ContentClassificationVisibility.BLOCK_UNDERAGE ? intl.string(t.LPOzxB) : intl.string(t.NIZyKq);
return {
applicationId: id2,
instanceId: id3,
participantAvatarUris: [],
participantsDescription: null,
appMessageEmbedModel: {
displayType: AppMessageEmbedDisplayType.BLOCKED,
appId: id2,
messageId: id4,
title: null,
header: intl.string(t.bZBN64),
info,
tagline: null,
iconSrc: null,
staticBannerSrc: null,
bannerRatio: "bot",
actions: [],
embedUrl: null,
extendedType: CodedLinkExtendedType.APP_MESSAGE_EMBED,
gradientColors: [],
backgroundColor: 0,
borderColor: 0,
headerColor: 0,
headerText: null,
type: null
}
};
}
}
@@ -0,0 +1,282 @@
// Metro module 8031 (f8032).
import { Image as Image2, processColor } from "react-native";
import AuthenticationStore from "../../../../../../stores/AuthenticationStore";
import GiftCodeStore from "../../../../../../stores/GiftCodeStore";
import UserStore from "../../../../../../stores/UserStore";
import SKUStore from "../../../../../../stores/game_store/SKUStore";
import { AbortCodes, MessageTypes } from "../../../../../../Constants";
import { PremiumGiftStyles, PremiumSubscriptionSKUs } from "../../../../../premium/PremiumConstants";
import Module12334 from "../../../../../../_bundle/Module12334";
import Module12335 from "../../../../../../_bundle/Module12335";
import Module12336 from "../../../../../../_bundle/Module12336";
import Module12337 from "../../../../../../_bundle/Module12337";
import Module12338 from "../../../../../../_bundle/Module12338";
import Module12339 from "../../../../../../_bundle/Module12339";
import Module12340 from "../../../../../../_bundle/Module12340";
import Module12341 from "../../../../../../_bundle/Module12341";
import Module12342 from "../../../../../../_bundle/Module12342";
import Module12343 from "../../../../../../_bundle/Module12343";
import Module12344 from "../../../../../../_bundle/Module12344";
import Module11896 from "../../../../../../_bundle/Module11896";
import UserUtils from "../../../../../../utils/UserUtils";
import getEmbedThemeColors from "./getEmbedThemeColors";
import * as _shared from "../../../../../../design/shared";
import { getEmbedBackground } from "../../../../../client_themes/native/ClientThemesUtils";
import { intl, t } from "../../../../../../intl/index.native";
import Module10994 from "../../../../../../_bundle/Module10994";
import Module10995 from "../../../../../../_bundle/Module10995";
import Module712 from "../../../../../../_bundle/Module712";
import Module3771 from "../../../../../../_bundle/Module3771";
import { processColorOrThrow } from "../../RowGeneratorStyleSheet";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import Module12345 from "../../../../../../_bundle/Module12345";
import Module12346 from "../../../../../../_bundle/Module12346";
import Module12347 from "../../../../../../_bundle/Module12347";
import Module12348 from "../../../../../../_bundle/Module12348";
import Module12349 from "../../../../../../_bundle/Module12349";
import * as _SlayerStorefrontUtils from "../../../../../slayer_storefront/SlayerStorefrontUtils";
import { getGameItemThumbnailUrl } from "../../../../../slayer_storefront/SlayerStorefrontUtils";
import PremiumUtils from "../../../../../../utils/PremiumUtils";
import { HermesBuiltin } from "../../../../../../_hermes/prelude";
const getGiftStyleUrl = function getGiftStyleUrl(giftStyle) {
if (PremiumGiftStyles.BOX === giftStyle) {
return Module12334;
}
if (PremiumGiftStyles.CUP === giftStyle) {
return Module12335;
}
if (PremiumGiftStyles.SNOWGLOBE === giftStyle) {
return Module12336;
}
if (PremiumGiftStyles.STANDARD_BOX === giftStyle) {
return Module12337;
}
if (PremiumGiftStyles.COFFEE === giftStyle) {
return Module12338;
}
if (PremiumGiftStyles.CAKE === giftStyle) {
return Module12339;
}
if (PremiumGiftStyles.CHEST === giftStyle) {
return Module12340;
}
if (PremiumGiftStyles.SEASONAL_STANDARD_BOX === giftStyle) {
return Module12341;
}
if (PremiumGiftStyles.SEASONAL_CAKE === giftStyle) {
return Module12342;
}
if (PremiumGiftStyles.SEASONAL_CHEST === giftStyle) {
return Module12343;
}
if (PremiumGiftStyles.SEASONAL_COFFEE === giftStyle) {
return Module12344;
}
if (PremiumGiftStyles.NITROWEEN_STANDARD === giftStyle) {
return {
uri: Module11896
};
}
return Module12337;
};
export function createGiftCodeEmbed(a0, a1) {
let headerColor, titleColor, subtitleColor, bodyTextColor, resolvingGradientStart, resolvingGradientEnd, acceptLabelDisabledBackgroundColor, acceptLabelDisabledColor, thumbnailBackgroundColor, acceptLabelGreenColor, acceptBlurpleLabelBackgroundColor, c16195_13;
let c16195_0 = a0;
if (a0.author != null && a0.giftCodes.length !== 0) {
const colors = getEmbedThemeColors(a1).colors;
headerColor = colors.headerColor;
titleColor = colors.titleColor;
subtitleColor = colors.subtitleColor;
bodyTextColor = colors.bodyTextColor;
const { borderColor, backgroundColor } = colors;
resolvingGradientStart = colors.resolvingGradientStart;
resolvingGradientEnd = colors.resolvingGradientEnd;
acceptLabelDisabledBackgroundColor = colors.acceptLabelDisabledBackgroundColor;
acceptLabelDisabledColor = colors.acceptLabelDisabledColor;
thumbnailBackgroundColor = colors.thumbnailBackgroundColor;
acceptLabelGreenColor = colors.acceptLabelGreenColor;
acceptBlurpleLabelBackgroundColor = colors.acceptBlurpleLabelBackgroundColor;
const isThemeDark = _shared.isThemeDark(a1);
let backgroundColor2 = backgroundColor;
if (isThemeDark) {
let r41 = getEmbedBackground();
if (r41 == null) {
r41 = void 0;
}
let r42 = processColor(r41);
if (r42 == null) {
r42 = backgroundColor;
}
backgroundColor2 = r42;
}
c16195_13 = {
borderColor,
backgroundColor: backgroundColor2,
thumbnailCornerRadius: 3
};
return a0.giftCodes.map((a0) => {
let r220, r221, acceptLabelBackgroundColor, acceptLabelColor, acceptLabelText, headerText;
const r12 = GiftCodeStore.get(a0);
if (a0 != null) {
if (GiftCodeStore.getIsResolved(a0)) {
const id = AuthenticationStore.getId();
const r6 = r12 != null ? id === r12.userId : id === c16195_0.author.id;
if (r12 == null) {
const code = GiftCodeStore.getError(a0)?.code;
const INVALID_GIFT_REDEMPTION_CLIENT_UPDATE_REQUIRED = AbortCodes.INVALID_GIFT_REDEMPTION_CLIENT_UPDATE_REQUIRED;
const r420 = {
thumbnailUrl: Image2.resolveAssetSource(_shared.isThemeDark(a1) ? Module10994 : Module10995).uri,
headerText: (r6 ? intl.string(t.kzFKb6) : intl.string(t.jwCLTM)).toUpperCase(),
titleText: intl.string(t.SdKbX2),
titleColor: null,
headerColor: null,
thumbnailBackgroundColor: null,
subtitle: null,
subtitleColor: null
};
let titleColor2 = processColor(Module712.unsafe_rawColors.RED_400);
if (titleColor2 == null) {
titleColor2 = titleColor;
}
r420.titleColor = titleColor2;
r420.headerColor = headerColor;
r420.thumbnailBackgroundColor = thumbnailBackgroundColor;
r420.subtitle = code === INVALID_GIFT_REDEMPTION_CLIENT_UPDATE_REQUIRED ? intl.string(t.QXgO5w) : r6 ? intl.string(t.pBDXpb) : intl.string(t.TPamyd);
r420.subtitleColor = subtitleColor;
HermesBuiltin.copyDataProperties(r420, c16195_13);
return r420;
}
const r27 = SKUStore.get(r12.skuId);
const isAccepting = GiftCodeStore.getIsAccepting(a0);
const currentUser = UserStore.getCurrentUser();
const canBeAccepted = !!currentUser?.verified && !(r12.redeemed || r12.isClaimed);
const subtitle = canBeAccepted && r12.expiresAt != null ? intl.formatToPlainString(t.nZBvUR, {
hours: r12.expiresAt.diff(Module3771(), "h")
}) : void 0;
const bodyText = r12.redeemed ? intl.string(t["/cg57l"]) : r12.isClaimed ? intl.string(t.ARWFQX) : currentUser?.verified ? void 0 : intl.string(t["j+KPkX"]);
const r123 = r12.giftStyle != null || c16195_0.type === MessageTypes.CUSTOM_GIFT;
L42: {
if (canBeAccepted) {
const r188 = r123 ? intl.string(t.TiZFqX) : intl.string(t.bUvv1f);
acceptLabelBackgroundColor = acceptBlurpleLabelBackgroundColor;
acceptLabelColor = acceptLabelGreenColor;
acceptLabelText = r188;
} else if (isAccepting) {
acceptLabelText = intl.string(t.rTeOBK);
acceptLabelBackgroundColor = acceptLabelDisabledBackgroundColor;
acceptLabelColor = acceptLabelDisabledColor;
} else {
if (!r12.redeemed && !r12.isClaimed) {
const verified = currentUser?.verified;
acceptLabelColor = void 0;
acceptLabelBackgroundColor = void 0;
acceptLabelText = void 0;
if (verified) {
break L42;
}
acceptLabelText = intl.string(t.v740sh);
acceptLabelBackgroundColor = processColorOrThrow(Module712.unsafe_rawColors.BRAND_500);
acceptLabelColor = processColorOrThrow(Module712.unsafe_rawColors.WHITE);
break L42;
}
acceptLabelText = intl.string(t.BTihou);
acceptLabelBackgroundColor = acceptLabelDisabledBackgroundColor;
acceptLabelColor = acceptLabelDisabledColor;
}
}
L71: {
const skuId = r12.skuId;
if (PremiumSubscriptionSKUs.TIER_0 === skuId) {
const assetUriForEmbed5 = getAssetUriForEmbed(r123 ? getGiftStyleUrl(r12.giftStyle) : Module12345);
r220 = getAssetUriForEmbed(_shared.isThemeDark(a1) ? Module12346 : Module12347);
r221 = assetUriForEmbed5;
} else if (PremiumSubscriptionSKUs.TIER_1 === skuId) {
const assetUriForEmbed4 = getAssetUriForEmbed(r123 ? getGiftStyleUrl(r12.giftStyle) : Module12348);
r220 = getAssetUriForEmbed(_shared.isThemeDark(a1) ? Module12346 : Module12347);
r221 = assetUriForEmbed4;
} else {
if (PremiumSubscriptionSKUs.TIER_2 !== skuId && PremiumSubscriptionSKUs.LEGACY !== skuId) {
const assetUriForEmbed = getAssetUriForEmbed(_shared.isThemeDark(a1) ? Module12346 : Module12347);
const assetUriForEmbed2 = getAssetUriForEmbed(getGiftStyleUrl(r12.giftStyle));
r220 = assetUriForEmbed;
r221 = assetUriForEmbed2;
break L71;
}
const assetUriForEmbed3 = getAssetUriForEmbed(r123 ? getGiftStyleUrl(r12.giftStyle) : Module12349);
r220 = getAssetUriForEmbed(_shared.isThemeDark(a1) ? Module12346 : Module12347);
r221 = assetUriForEmbed3;
}
}
const isGameItemSKU = _SlayerStorefrontUtils.isGameItemSKU(r27);
let r308 = r221;
if (isGameItemSKU) {
const gameItemThumbnailUrl = getGameItemThumbnailUrl(r27);
let r314 = gameItemThumbnailUrl == null ? void 0 : gameItemThumbnailUrl.toString();
if (r314 == null) {
r314 = r221;
}
r308 = r314;
}
if (c16195_0.type === MessageTypes.CUSTOM_GIFT && !r6) {
const t1SOId = t.t1SOId;
let recipientDisplayName = UserUtils.getName(currentUser);
if (recipientDisplayName == null) {
recipientDisplayName = "";
}
headerText = intl.formatToPlainString(t1SOId, {
recipientDisplayName
}).toUpperCase();
} else {
headerText = (r6 ? intl.string(t.QLEMld) : intl.string(t.W4DBcy)).toUpperCase();
}
const r351 = r12 != null;
let titleText = void 0;
if (r351) {
if (c16195_0.type !== MessageTypes.CUSTOM_GIFT) {
titleText = r27 != null ? r27.name : void 0;
} else {
const user = UserStore.getUser(r12.userId);
const DDO4Wz = t.DDO4Wz;
let sender = UserUtils.getName(user);
if (sender == null) {
sender = "";
}
titleText = intl.formatToPlainString(DDO4Wz, {
sender
});
}
}
return {
...c16195_13,
headerText,
titleText,
subtitle,
bodyText,
headerColor,
titleColor,
subtitleColor,
bodyTextColor,
acceptLabelBackgroundColor,
acceptLabelColor,
acceptLabelText,
acceptLabelBorderColor: void 0,
canBeAccepted,
embedCanBeTapped: true,
giftCode: a0,
thumbnailUrl: r308 ?? void 0,
splashUrl: c16195_0.type !== MessageTypes.CUSTOM_GIFT ? r220 ?? void 0 : void 0,
splashHasRadialGradient: !PremiumUtils.isPremiumSku(r12.skuId),
splashOpacity: PremiumUtils.isPremiumSku(r12.skuId) ? 0.8 : 0.97
};
}
return {
headerText: intl.string(t["E+va0m"]).toUpperCase(),
headerColor,
resolvingGradientStart,
resolvingGradientEnd,
...c16195_13
};
}
});
}
}
@@ -0,0 +1,74 @@
// Metro module 7852 (f7853).
import PremiumGiftingIntentStore from "../../../../../premium/gifting/PremiumGiftingIntentStore";
import UserStore from "../../../../../../stores/UserStore";
import { GiftIntentType } from "../../../../../premium/PremiumConstants";
import { createNativeStyleProperties } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import { intl, t } from "../../../../../../intl/index.native";
import { unhandledGiftIntent } from "../../../../../premium/PremiumGiftingUtils";
import UserUtils from "../../../../../../utils/UserUtils";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import Module4126 from "../../../../../../_bundle/Module4126";
import Module7858 from "../../../../../../_bundle/Module7858";
import Module7859 from "../../../../../../_bundle/Module7859";
const nativeStyleProperties = createNativeStyleProperties({
headerTextColor: Module712.colors.TEXT_STRONG,
subHeaderTextColor: Module712.colors.TEXT_SUBTLE,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
borderColor: Module712.colors.BORDER_MUTED
});
export function createGiftIntentEmbed({ giftingPrompt }, a1) {
let r29;
if (giftingPrompt == null) {
return null;
}
const { giftIntentType, recipientUserId } = giftingPrompt;
const user = UserStore.getUser(recipientUserId);
if (user == null) {
return null;
}
const name = UserUtils.getName(user);
const friendAnniversaryYears = PremiumGiftingIntentStore.getFriendAnniversaryYears(recipientUserId);
if (GiftIntentType.FRIEND_ANNIVERSARY === giftIntentType) {
r29 = {
headerText: intl.string(t.CeQIwZ),
subHeaderParts: [{
text: intl.formatToPlainString(t.PpG27s, {
numberOfYears: friendAnniversaryYears
})
}]
};
} else {
const UNSPECIFIED = GiftIntentType.UNSPECIFIED;
r29 = null;
if (UNSPECIFIED !== giftIntentType) {
unhandledGiftIntent(giftIntentType);
r29 = null;
}
}
if (r29 == null) {
return null;
}
const currentUser = UserStore.getCurrentUser();
const recipientAvatarUrl = `${user.getAvatarURL(void 0, 40)}`;
const currentUserAvatarUrl = currentUser != null ? `${currentUser.getAvatarURL(void 0, 40)}` : void 0;
const r69 = nativeStyleProperties(a1);
return {
recipientAvatarUrl,
currentUserAvatarUrl,
recipientName: name,
headerText: r29.headerText,
subHeaderParts: r29.subHeaderParts,
recipientUserId,
giftIntentType,
headerTextColor: r69.headerTextColor,
subHeaderTextColor: r69.subHeaderTextColor,
backgroundColor: r69.backgroundColor,
borderColor: r69.borderColor,
subHeaderIconUrl: getAssetUriForEmbed(Module4126),
primaryCtaLabel: intl.string(t.ilhtIa),
primaryCtaIconUrl: getAssetUriForEmbed(Module7858),
secondaryCtaIconUrl: getAssetUriForEmbed(Module7859),
secondaryCtaAccessibilityLabel: intl.string(t.I5gL2H)
};
}
@@ -0,0 +1,25 @@
// Metro module 12386 (f12387).
import { MessageEmbedTypes } from "../../../../../../Constants";
import createMediaPostPreviewEmbedContent from "../../../../../media_channel/native/createMediaPostPreviewEmbedContent";
export function createPostPreviewEmbeds(a0, c19818_1) {
let r5 = arguments[2];
if (r5 === void 0) {
r5 = false;
}
let c19818_2 = r5;
const r6 = [];
let c19818_3 = r6;
const embeds = a0.embeds;
if (embeds != null) {
embeds.forEach((embed) => {
if (embed.type === MessageEmbedTypes.POST_PREVIEW) {
const mediaPostPreviewEmbedContent = createMediaPostPreviewEmbedContent(a0, c19818_1, embed.url, c19818_2);
if (mediaPostPreviewEmbedContent == null) {
return void 0;
}
c19818_3.push(mediaPostPreviewEmbedContent);
}
});
}
return r6;
}
@@ -0,0 +1,53 @@
// Metro module 7829 (f7830).
import { HELP_CENTER_LINK, PremiumGroupInviteState } from "../../../../../premium/premium_group/PremiumGroupConstants";
import { createNativeStyleProperties } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import Module7830 from "../../../../../../_bundle/Module7830";
import { getPremiumGroupInviteEmbedText } from "../../../../../premium/premium_group/PremiumGroupUtils.native";
import { intl, t } from "../../../../../../intl/index.native";
import PremiumGroup_messages from "../../../../../premium/premium_group/PremiumGroup.messages";
export function createPremiumGroupInviteEmbed(a0, a1, a2, a3) {
if (a0.author != null) {
const r47 = createNativeStyleProperties({
headerTextColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
bodyTextColor: Module712.colors.TEXT_DEFAULT,
linkTextColor: Module712.colors.TEXT_LINK,
backgroundColor: Module712.colors.BACKGROUND_MOD_NORMAL,
betaPillTextColor: Module712.colors.BLACK,
betaPillBackgroundColor: Module712.colors.WHITE
})(a1);
const { headerTextColor, bodyTextColor, linkTextColor, backgroundColor, betaPillTextColor, betaPillBackgroundColor } = r47;
const assetUriForEmbed = getAssetUriForEmbed(Module7830);
const author = a0.author;
const premiumGroupInviteEmbedText = getPremiumGroupInviteEmbedText({
sender: author,
channel: a3,
isSender: a2 === author.id,
inviteState: PremiumGroupInviteState.UNKNOWN
});
if (premiumGroupInviteEmbedText != null) {
const { header, body } = premiumGroupInviteEmbedText;
const learnMoreLink = intl.formatToParts(PremiumGroup_messages["9VTnfI"], {
learnMoreLinkOnClick: {
action: "bindOpenUrl",
url: HELP_CENTER_LINK,
linkColor: linkTextColor
}
});
return {
headerText: header,
headerColor: headerTextColor,
backgroundColor,
borderColor: backgroundColor,
headerImageUrl: assetUriForEmbed,
betaPillText: intl.string(t.oW0eUd).toUpperCase(),
betaPillTextColor,
betaPillBackgroundColor,
bodyText: body,
bodyTextColor,
learnMoreLink
};
}
}
}
@@ -0,0 +1,154 @@
// Metro module 7843 (f7844).
import ChannelStore from "../../../../../../stores/ChannelStore";
import UserStore from "../../../../../../stores/UserStore";
import SubscriptionStore from "../../../../../../stores/billing/SubscriptionStore";
import UserOfferStore from "../../../../../../stores/billing/UserOfferStore";
import IAPStore_android from "../../../../../../stores/native/IAPStore.android";
import { HelpdeskArticles } from "../../../../../../Constants";
import { PREMIUM_TIER_2_REFERRAL_TRIAL_ID } from "../../../../../premium/PremiumConstants";
import { createNativeStyleProperties } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import { TrialIdToProductOfferId } from "../../../../../premium/native/ProductIds.android";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import Module6313 from "../../../../../../_bundle/Module6313";
import { intl, t } from "../../../../../../intl/index.native";
import Module7844 from "../../../../../../_bundle/Module7844";
import UserUtils from "../../../../../../utils/UserUtils";
import PremiumUtils, { formatIntervalDuration } from "../../../../../../utils/PremiumUtils";
import * as _useTrialOffer from "../../../../../premium/useTrialOffer";
import { getReferralTrialOfferExpirationCopy } from "../../../../../premium/referral_program/ReferralProgramUtils";
import HelpdeskUtils from "../../../../../../utils/HelpdeskUtils";
import { isMetaQuest } from "../../../../../device/MetaQuestUtils.android";
import Module6628 from "../../../../../../_bundle/Module6628";
export function createReferralTrialEmbedRedeemable(a0, a1, a2, a3) {
let r188, bodyText, structuredBodyText;
if (a0.author != null) {
const r65 = createNativeStyleProperties({
headerTextColor: Module712.colors.WHITE,
titleColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
bodyTextColor: Module712.colors.TEXT_DEFAULT,
footerTextColor: Module712.colors.TEXT_MUTED,
subTextColor: Module712.colors.INTERACTIVE_TEXT_DEFAULT,
backgroundColor: Module712.colors.BACKGROUND_MOD_NORMAL,
acceptLabelColor: Module712.colors.WHITE
})(a1);
const { headerTextColor, titleColor, bodyTextColor, footerTextColor, subTextColor, acceptLabelColor, backgroundColor } = r65;
const channel = ChannelStore.getChannel(a0.getChannelId());
if (channel != null && channel.isDM()) {
const r75 = {
backgroundColor,
borderColor: backgroundColor,
thumbnailCornerRadius: 3,
headerLogoUrl: getAssetUriForEmbed(Module6313),
headerText: intl.string(t.gtNqJQ).toLocaleLowerCase(),
headerColor: headerTextColor,
thumbnailUrl: getAssetUriForEmbed(Module7844)
};
const user = UserStore.getUser(a3?.user_id);
const user2 = UserStore.getUser(a3?.referrer_id);
if (user != null && user2 != null) {
const name2 = UserUtils.getName(user2);
const id = user2.id;
const name = UserUtils.getName(user);
const titleText = intl.formatToPlainString(t.IiWKwg, {
senderUserName: name2,
recipientUserName: name
});
if (a3 == null) {
return {
...r75,
titleText,
titleColor,
bodyText: intl.string(t.eEz1N5),
bodyTextColor,
canBeAccepted: false
};
}
const userTrialOffer = UserOfferStore.getUserTrialOffer(PREMIUM_TIER_2_REFERRAL_TRIAL_ID);
const offerIds = IAPStore_android.getOfferIds();
const r138 = Object.values(TrialIdToProductOfferId[PREMIUM_TIER_2_REFERRAL_TRIAL_ID]).every((item) => offerIds.has(item));
const r142 = a3.id === userTrialOffer?.id && r138;
const isPremium = PremiumUtils.isPremium(user);
const r148 = isPremium ? isPremium : user.id === a2 ? SubscriptionStore.getPremiumTypeSubscription() != null : isPremium;
const hasUserTrialOfferExpired = _useTrialOffer.hasUserTrialOfferExpired(a3);
const r158 = a3.redeemed_at != null;
const r160 = a3.expires_at == null || hasUserTrialOfferExpired || r148 || r158;
let footerText = void 0;
let subText = void 0;
if (!r160) {
const referralTrialOfferExpirationCopy = getReferralTrialOfferExpirationCopy(Date.parse(a3.expires_at));
footerText = intl.formatToPlainString(t.uj94C5, {
duration: formatIntervalDuration({
intervalType: a3.subscription_trial?.interval,
intervalCount: a3.subscription_trial?.interval_count
})
}).replace(/\*/g, "");
subText = referralTrialOfferExpirationCopy;
}
L48: {
r188 = id === a2;
if (r148 && (!r188 && !r158)) {
structuredBodyText = intl.formatToParts(t.LwCwT9, {
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
}
});
bodyText = void 0;
} else if (r148) {
bodyText = intl.formatToPlainString(t["Mptau/"], {
username: name
});
structuredBodyText = void 0;
} else {
if (hasUserTrialOfferExpired && !r158) {
bodyText = intl.string(t["9SNdf4"]);
structuredBodyText = void 0;
break L48;
}
structuredBodyText = !r142 && (!r158 && !r188) ? intl.formatToParts(isMetaQuest() ? t.yqX4Dr : t["7O7Zg3"], {
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
}
}) : intl.formatToParts(t.mVzEG8, {
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
},
username: name2
});
bodyText = void 0;
}
}
const canBeAccepted = (hasUserTrialOfferExpired ? !hasUserTrialOfferExpired : !r148) && r142 && !r188;
const r262 = {
...r75,
titleText,
titleColor,
bodyText,
structuredBodyText,
bodyTextColor,
subText,
subTextColor,
canBeAccepted
};
return canBeAccepted ? {
...r262,
footerText,
footerTextColor,
canBeAccepted,
acceptLabelText: intl.string(t.bXTClc),
acceptLabelColor,
acceptLabelIconUrl: getAssetUriForEmbed(Module6628)
} : r262;
}
return {
...r75,
bodyText: intl.string(t.eEz1N5),
bodyTextColor,
canBeAccepted: false
};
}
}
}
@@ -0,0 +1,165 @@
// Metro module 7834 (f7835).
import ChannelStore from "../../../../../../stores/ChannelStore";
import UserStore from "../../../../../../stores/UserStore";
import SubscriptionStore from "../../../../../../stores/billing/SubscriptionStore";
import UserOfferStore from "../../../../../../stores/billing/UserOfferStore";
import IAPStore_android from "../../../../../../stores/native/IAPStore.android";
import { HelpdeskArticles } from "../../../../../../Constants";
import { PREMIUM_TIER_2_REFERRAL_TRIAL_ID } from "../../../../../premium/PremiumConstants";
import { createNativeStyleProperties } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import { TrialIdToProductOfferId } from "../../../../../premium/native/ProductIds.android";
import Module7835 from "../../../../../../_bundle/Module7835";
import { intl, t } from "../../../../../../intl/index.native";
import UserUtils from "../../../../../../utils/UserUtils";
import HelpdeskUtils from "../../../../../../utils/HelpdeskUtils";
import PremiumUtils, { formatIntervalDuration } from "../../../../../../utils/PremiumUtils";
import * as _useTrialOffer from "../../../../../premium/useTrialOffer";
import { getReferralTrialOfferExpirationCopy } from "../../../../../premium/referral_program/ReferralProgramUtils";
import { isMetaQuest } from "../../../../../device/MetaQuestUtils.android";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import Module6628 from "../../../../../../_bundle/Module6628";
export function createReferralTrialEmbedRedesign(a0, a1, a2, a3) {
let r203, bodyText, structuredBodyText;
if (a0.author != null) {
const r12 = createNativeStyleProperties({
titleColor: Module712.colors.TEXT_DEFAULT,
headerTextColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
bodyTextColor: Module712.colors.TEXT_SUBTLE,
footerTextColor: Module712.colors.TEXT_MUTED,
subTextColor: Module712.colors.TEXT_SUBTLE,
backgroundColor: Module712.colors.BACKGROUND_MOD_NORMAL,
acceptLabelColor: Module712.colors.WHITE,
linkTextColor: Module712.colors.TEXT_LINK
})(a1);
const { titleColor, headerTextColor, bodyTextColor, footerTextColor, subTextColor, acceptLabelColor, backgroundColor, linkTextColor } = r12;
const channel = ChannelStore.getChannel(a0.getChannelId());
if (channel != null && channel.isDM()) {
const user = UserStore.getUser(a3?.user_id);
const user2 = UserStore.getUser(a3?.referrer_id);
if (user != null && user2 != null) {
const name = UserUtils.getName(user2);
const id = user2.id;
const titleText = intl.formatToPlainString(t.yisueA, {
sender: name,
helpdeskArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
});
const learnMoreLink = intl.formatToParts(t.yisueA, {
sender: name,
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM),
linkColor: linkTextColor
}
});
const r117 = {
titleText,
titleColor,
headerImageUrl: Module7835,
headerText: intl.string(t.HtTvXA),
headerColor: headerTextColor,
backgroundColor,
borderColor: backgroundColor,
learnMoreLink
};
if (a3 == null) {
return {
...r117,
bodyText: intl.string(t.eEz1N5),
bodyTextColor,
canBeAccepted: false
};
}
const userTrialOffer = UserOfferStore.getUserTrialOffer(PREMIUM_TIER_2_REFERRAL_TRIAL_ID);
const offerIds = IAPStore_android.getOfferIds();
const r147 = Object.values(TrialIdToProductOfferId[PREMIUM_TIER_2_REFERRAL_TRIAL_ID]).every((item) => offerIds.has(item));
const r151 = a3.id === userTrialOffer?.id && r147;
const isPremium = PremiumUtils.isPremium(user);
const r157 = isPremium ? isPremium : user.id === a2 ? SubscriptionStore.getPremiumTypeSubscription() != null : isPremium;
const hasUserTrialOfferExpired = _useTrialOffer.hasUserTrialOfferExpired(a3);
const name2 = UserUtils.getName(user);
const r171 = a3.redeemed_at != null;
const r173 = a3.expires_at == null || hasUserTrialOfferExpired || r157 || r171;
let footerText = void 0;
let subText = void 0;
if (!r173) {
const referralTrialOfferExpirationCopy = getReferralTrialOfferExpirationCopy(Date.parse(a3.expires_at));
footerText = intl.formatToPlainString(t.uj94C5, {
duration: formatIntervalDuration({
intervalType: a3.subscription_trial?.interval,
intervalCount: a3.subscription_trial?.interval_count
})
}).replace(/\*/g, "");
subText = referralTrialOfferExpirationCopy;
}
L48: {
r203 = id === a2;
if (r157 && (!r203 && !r171)) {
structuredBodyText = intl.formatToParts(t.LwCwT9, {
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
}
});
bodyText = void 0;
} else if (r157) {
bodyText = intl.formatToPlainString(t["Mptau/"], {
username: name2
});
structuredBodyText = void 0;
} else {
if (hasUserTrialOfferExpired && !r171) {
bodyText = intl.string(t["9SNdf4"]);
structuredBodyText = void 0;
break L48;
}
structuredBodyText = !r151 && (!r171 && !r203) ? intl.formatToParts(isMetaQuest() ? t.yqX4Dr : t["7O7Zg3"], {
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
}
}) : intl.formatToParts(t.mVzEG8, {
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
},
username: name
});
bodyText = void 0;
}
}
const canBeAccepted = (hasUserTrialOfferExpired ? !hasUserTrialOfferExpired : !r157) && r151 && !r203;
const r274 = {
...r117,
bodyText,
structuredBodyText,
bodyTextColor,
subText,
subTextColor,
canBeAccepted
};
return canBeAccepted ? {
...r274,
footerText,
footerTextColor,
canBeAccepted,
acceptLabelText: intl.string(t.bXTClc),
acceptLabelColor,
acceptLabelIconUrl: getAssetUriForEmbed(Module6628)
} : r274;
}
return {
titleText: "",
titleColor,
headerImageUrl: Module7835,
headerText: "",
headerColor: headerTextColor,
backgroundColor,
borderColor: backgroundColor,
bodyText: intl.string(t.eEz1N5),
bodyTextColor,
canBeAccepted: false
};
}
}
}
@@ -0,0 +1,44 @@
// Metro module 12389 (f12390).
import { Image as Image2 } from "react-native";
import { MessageEmbedTypes } from "../../../../../../Constants";
import { SafetyHubPolicyNoticeKeys } from "../../../../../safety_hub/SafetyHubConstants";
import Module3771 from "../../../../../../_bundle/Module3771";
import { intl, t } from "../../../../../../intl/index.native";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import Module7630 from "../../../../../../_bundle/Module7630";
export function createSafetyPolicyNoticeEmbed(a0) {
if (a0.embeds != null) {
if (a0.embeds[0]?.fields != null) {
if (a0.embeds[0]?.type === MessageEmbedTypes.SAFETY_POLICY_NOTICE) {
const r25 = a0.embeds[0];
const fields = r25.fields;
let r27 = fields == null ? void 0 : fields.find((field) => field.rawName === SafetyHubPolicyNoticeKeys.CLASSIFICATION_ID);
if (r27 == null) {
r27 = void 0;
}
let classificationId = r27?.rawValue;
if (classificationId == null) {
classificationId = void 0;
}
const fields2 = r25.fields;
let r33 = fields2 == null ? void 0 : fields2.find((item) => item.rawName === SafetyHubPolicyNoticeKeys.INCIDENT_TIMESTAMP);
if (r33 == null) {
r33 = void 0;
}
const r15 = r33 == null ? void 0 : r33.rawValue == null ? void 0 : parseFloat(r33.rawValue);
if (classificationId != null && r15 != null) {
return {
titleText: intl.string(t["4CxGXi"]),
titleIcon: getAssetUriForEmbed(Image2.resolveAssetSource(Module7630)),
subtitleText: intl.formatToPlainString(t.eevFb6, {
daysAgo: Module3771().diff(Module3771.unix(r15), "days")
}),
descriptionText: intl.string(t["5CLb0A"]),
ctaText: intl.string(t.zKnzwm),
classificationId
};
}
}
}
}
}
@@ -0,0 +1,66 @@
// Metro module 12390 (f12391).
import { Image as Image2 } from "react-native";
import { MessageEmbedTypes } from "../../../../../../Constants";
import Module3771 from "../../../../../../_bundle/Module3771";
import Module7630 from "../../../../../../_bundle/Module7630";
import Module4657 from "../../../../../../_bundle/Module4657";
import { parseMessageForProps, mapCtaToNativeData } from "../../../../../safety_hub/SafetyHubUtils";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import { t, intl } from "../../../../../../intl/index.native";
export function createSafetySystemNotificationEmbed(a0) {
if (a0 != null && a0.embeds != null) {
if (a0.embeds[0]?.fields != null) {
if (a0.embeds[0]?.type === MessageEmbedTypes.SAFETY_SYSTEM_NOTIFICATION) {
const r28 = parseMessageForProps(a0);
if (r28 != null) {
const r31 = r28.ctas != null;
let r32 = void 0;
let r8 = void 0;
if (r31) {
const r36 = r28.ctas[0] != null ? mapCtaToNativeData(r28.ctas[0], r28.learn_more_link, r28.classification_id) : void 0;
r32 = r28.ctas[1] != null ? mapCtaToNativeData(r28.ctas[1], r28.learn_more_link, r28.classification_id) : void 0;
r8 = r36;
}
let header = r28.header;
if (header == null) {
header = "";
}
const r50 = {
titleText: header,
titleIcon: getAssetUriForEmbed(Image2.resolveAssetSource(r28.icon === "danger" ? Module7630 : Module4657)),
subtitleText: null,
descriptionText: null,
primaryCtaText: null,
primaryCtaType: null,
primaryCtaKey: null,
secondaryCtaText: null,
secondaryCtaType: null,
secondaryCtaKey: null,
footerTheme: null
};
const eevFb6 = t.eevFb6;
let timestamp = r28.timestamp;
if (timestamp == null) {
timestamp = 0;
}
r50.subtitleText = intl.formatToPlainString(eevFb6, {
daysAgo: Module3771().diff(Module3771.unix(timestamp), "days")
});
let body = r28.body;
if (body == null) {
body = "";
}
r50.descriptionText = body;
r50.primaryCtaText = r8?.text;
r50.primaryCtaType = r8?.type;
r50.primaryCtaKey = r8?.key;
r50.secondaryCtaText = r32?.text;
r50.secondaryCtaType = r32?.type;
r50.secondaryCtaKey = r32?.key;
r50.footerTheme = r28.theme;
return r50;
}
}
}
}
}
@@ -0,0 +1,82 @@
// Metro module 12364 (f12365).
import { Image as Image2 } from "react-native";
import BuildOverrideStore, { State } from "../../../../../../build_overrides/BuildOverrideStore";
import { InviteTypes } from "../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../getEmbedThemeColors";
import { DEVICE_FIELD } from "../../../../../../build_overrides/native/BuildOverrideUtils";
import validateBuildOverride from "../../../../../../build_overrides/validateBuildOverride";
import { getConstants } from "../../../../../../../utils/native/ClientInfoUtils";
import { intl, t } from "../../../../../../../intl/index.native";
import { processColorOrThrow } from "../../../RowGeneratorStyleSheet";
import Module712 from "../../../../../../../_bundle/Module712";
import { isThemeDark } from "../../../../../../../design/shared";
import Module10994 from "../../../../../../../_bundle/Module10994";
import Module10995 from "../../../../../../../_bundle/Module10995";
import Module12363 from "../../../../../../../_bundle/Module12363";
export function createBuildOverrideEmbed(a0, a1) {
let r61;
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
const currentBuildOverride = BuildOverrideStore.getCurrentBuildOverride();
const buildOverride = BuildOverrideStore.getBuildOverride(a0);
if (buildOverride.state === State.Resolving) {
return {
headerText: "RESOLVING",
resolvingGradientEnd: colors.resolvingGradientEnd,
resolvingGradientStart: colors.resolvingGradientStart,
type: InviteTypes.GUILD,
...baseColors
};
}
const override = buildOverride.override;
const r1 = override == null;
let subtitle = void 0;
if (!r1) {
const targetBuildOverride = override.targetBuildOverride;
subtitle = targetBuildOverride == null ? void 0 : targetBuildOverride[DEVICE_FIELD]?.id;
}
let r36 = subtitle != null;
if (r36) {
const overrides = currentBuildOverride.overrides;
r36 = subtitle === (overrides == null ? void 0 : overrides[DEVICE_FIELD]?.id);
}
const r54 = validateBuildOverride(buildOverride.override, ["discord_ios", "discord_android"], getConstants().Version);
if (currentBuildOverride.state !== State.Invalid && (buildOverride.state !== State.Invalid && (buildOverride.override != null && (subtitle != null && r54.valid)))) {
const r109 = {
...baseColors,
headerText: intl.string(t.Wj3LW4).toLocaleUpperCase(),
headerColor: colors.headerColor
};
const override2 = buildOverride.override;
const r131 = override2 == null;
let r132 = void 0;
if (!r131) {
const targetBuildOverride2 = override2.targetBuildOverride;
r132 = targetBuildOverride2 == null ? void 0 : targetBuildOverride2[DEVICE_FIELD]?.type;
}
r109.titleText = intl.string(r132 === "branch" ? t.p9TwTG : t.RCYGot);
r109.titleColor = colors.titleColor;
r109.subtitle = subtitle;
r109.subtitleColor = colors.subtitleColor;
r109.thumbnailUrl = Image2.resolveAssetSource(Module12363).uri;
r109.acceptButtonVariant = r36 ? "destructive" : "primary";
r109.acceptLabelText = r36 ? intl.string(t.tX4xrt) : intl.string(t.nOunHC);
r109.embedCanBeTapped = true;
r109.canBeAccepted = true;
r109.type = InviteTypes.GUILD;
r61 = r109;
} else {
r61 = {
...baseColors,
headerText: intl.string(t.d34xi4).toLocaleUpperCase(),
titleColor: processColorOrThrow(Module712.unsafe_rawColors.RED_400),
titleText: r54.valid ? intl.string(t.ODXApH) : r54.reason,
subtitle,
subtitleColor: subtitle != null ? colors.subtitleColor : void 0,
thumbnailUrl: Image2.resolveAssetSource(isThemeDark(a1) ? Module10994 : Module10995).uri,
thumbnailBackgroundColor: colors.thumbnailBackgroundColor,
type: InviteTypes.GUILD
};
}
return r61;
}
@@ -0,0 +1,152 @@
// Metro module 12350 (f12351).
import _slicedToArray from "../../../../../../../_bundle/_slicedToArray";
import LurkingStore from "../../../../../../lurker_mode/LurkingStore";
import GuildStore from "../../../../../../../stores/GuildStore";
import UserStore from "../../../../../../../stores/UserStore";
import { isApplicationCodedLink, isApplicationCodedLinkMobileSupported, getApplicationCodedLinkData } from "../../../../../../coded_links/ApplicationCodedLink";
import { getAppLinkGateResult, createAppMessageEmbed } from "../../../../../../applications/message_embed/native/createAppMessageEmbed";
import { CodedLinkType } from "../../../../../../coded_links/CodedLink";
import { createActivityMessageEmbed } from "../../../../../../applications/message_embed/native/createActivityMessageEmbed";
import { createInviteEmbed } from "./InviteEmbed";
import { createGuildTemplateEmbed } from "./GuildTemplateEmbed";
import { createBuildOverrideEmbed } from "./BuildOverrideEmbed";
import { createGuildScheduledEventLinkEmbed } from "./GuildScheduledEventEmbed";
import { createVoiceChannelLinkEmbed } from "./VoiceChannelLinkEmbed";
import { createEmbeddedActivityInviteEmbed } from "./EmbeddedActivityInviteEmbed";
import { canSeeExperimentEmbeds } from "../../../../../../experiments/client_override_hooks/useCodedLinksExperimentEmbeds";
import { createExperimentEmbed } from "./ExperimentEmbed";
import { getIsEligibleForSocialLayerStorefrontMobilePurchasing } from "../../../../../../slayer_storefront/experiments/SocialLayerStorefrontMobilePurchasingExperiment";
import { createSocialLayerStorefrontProductDetailsEmbed } from "../../../../../../slayer_storefront/native/createSocialLayerStorefrontProductDetailsEmbed";
import { createQuestsEmbed } from "../../../../../../quests/native/QuestEmbed.native";
import { assertNever } from "../../../../../../../utils/GlobalUtils";
export function createCodedLinkEmbeds(a0, a1, channel, theme) {
let currentUser;
const message = a0;
if (a0.author != null && a1.codedLinks.length !== 0) {
currentUser = UserStore.getCurrentUser();
return a1.codedLinks.map(({ type, code, url }) => {
if (isApplicationCodedLink(type)) {
if (channel == null) {
return null;
}
if (isApplicationCodedLinkMobileSupported(type)) {
const applicationCodedLinkData = getApplicationCodedLinkData(type, code, url);
if (applicationCodedLinkData == null) {
return null;
}
const appLinkGateResult = getAppLinkGateResult({
appId: applicationCodedLinkData.applicationId,
channel,
message,
theme
});
if (appLinkGateResult.state === "unavailable") {
return null;
}
if (appLinkGateResult.state === "blocked") {
return appLinkGateResult.model;
}
const app = appLinkGateResult.app;
const type2 = applicationCodedLinkData.type;
if (CodedLinkType.ACTIVITY_BOOKMARK === type2) {
return createActivityMessageEmbed({
theme,
embedUrl: url,
message,
app,
params: applicationCodedLinkData.params
});
}
if (CodedLinkType.APP_DIRECTORY_PROFILE !== type2 && CodedLinkType.APP_OAUTH2_LINK !== type2) {
return null;
}
return createAppMessageEmbed({
theme,
embedUrl: url,
message,
app
});
}
return null;
}
if (CodedLinkType.INVITE === type) {
return createInviteEmbed(message, code, theme);
}
if (CodedLinkType.TEMPLATE === type) {
return createGuildTemplateEmbed(code, theme);
}
if (CodedLinkType.BUILD_OVERRIDE === type) {
return createBuildOverrideEmbed(code, theme);
}
if (CodedLinkType.MANUAL_BUILD_OVERRIDE === type) {
const currentUser2 = UserStore.getCurrentUser();
let r161 = currentUser2 == null ? void 0 : currentUser2.isStaff();
if (!r161) {
const currentUser3 = UserStore.getCurrentUser();
r161 = currentUser3 == null ? void 0 : currentUser3.isStaffPersonal();
}
if (!r161) {
r161 = GuildStore.getGuild("943265993613008967") != null && !LurkingStore.isLurking("943265993613008967");
}
return r161 ? createBuildOverrideEmbed(code, theme) : null;
}
if (CodedLinkType.EVENT === type) {
return createGuildScheduledEventLinkEmbed(code, theme);
}
if (CodedLinkType.CHANNEL_LINK === type) {
return createVoiceChannelLinkEmbed(code, theme);
}
if (CodedLinkType.EMBEDDED_ACTIVITY_INVITE === type) {
return createEmbeddedActivityInviteEmbed({
theme,
inviteCode: code
});
}
if (CodedLinkType.EXPERIMENT === type) {
return canSeeExperimentEmbeds() ? createExperimentEmbed(url, theme) : null;
}
if (CodedLinkType.GUILD_PRODUCT !== type && CodedLinkType.SERVER_SHOP !== type) {
if (CodedLinkType.SOCIAL_LAYER_STOREFRONT !== type && CodedLinkType.SOCIAL_LAYER_STOREFRONT_APP !== type) {
if (CodedLinkType.QUESTS_EMBED === type) {
return createQuestsEmbed({
theme,
questId: code,
currentUser
});
}
if (CodedLinkType.COLLECTIBLES_SHOP !== type && CodedLinkType.GAME_PROFILE !== type && CodedLinkType.GAME_SERVER_SHARE !== type) {
return assertNever(type);
}
return null;
}
if (getIsEligibleForSocialLayerStorefrontMobilePurchasing({
location: "create_coded_link_embeds"
})) {
if (type === CodedLinkType.SOCIAL_LAYER_STOREFRONT_APP) {
const r120 = _slicedToArray(code.split("-"), 2);
return createSocialLayerStorefrontProductDetailsEmbed({
skuId: r120[0],
guildOrApplication: {
type: "application",
applicationId: r120[1]
},
theme
});
}
const r106 = _slicedToArray(code.split("-"), 2);
return createSocialLayerStorefrontProductDetailsEmbed({
skuId: r106[0],
guildOrApplication: {
type: "guild",
guildId: r106[1]
},
theme
});
}
return null;
}
return null;
});
}
return [];
}
@@ -0,0 +1,18 @@
// Metro module 9500 (f9501).
const r9 = {
STAGE_INSTANCE: 0,
0: "STAGE_INSTANCE",
GUILD_SCHEDULED_EVENT: 1,
1: "GUILD_SCHEDULED_EVENT",
GUILD_INVITE_DISABLED: 2,
2: "GUILD_INVITE_DISABLED",
EMBEDDED_ACTIVITY_INVITE: 3,
3: "EMBEDDED_ACTIVITY_INVITE",
APP_MESSAGE_EMBED: 4,
4: "APP_MESSAGE_EMBED",
GUILD_PROFILE_INVITE: 5,
5: "GUILD_PROFILE_INVITE",
VOICE_CHANNEL_LIST_INVITE: 6,
6: "VOICE_CHANNEL_LIST_INVITE"
};
export { r9 as CodedLinkExtendedType };
@@ -0,0 +1,6 @@
// Metro module 11135 (f11136).
const r8 = {
DISPLAY: "display",
BLOCKED: "blocked"
};
export { r8 as AppMessageEmbedDisplayType };
@@ -0,0 +1,100 @@
// Metro module 12359 (f12360).
import { Image as Image2 } from "react-native";
import EmbeddedActivitiesStore from "../../../../../../activities/EmbeddedActivitiesStore";
import ApplicationAssetsStore, { FetchState } from "../../../../../../applications/ApplicationAssetsStore";
import ApplicationStore from "../../../../../../applications/ApplicationStore";
import AuthenticationStore from "../../../../../../../stores/AuthenticationStore";
import ChannelStore from "../../../../../../../stores/ChannelStore";
import InviteStore from "../../../../../../../stores/InviteStore";
import RelationshipStore from "../../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../../stores/UserStore";
import { CodedLinkExtendedType } from "./CodedLinksConstants";
import { InviteTargetTypes } from "../../../../../../instant_invite/Constants";
import Dispatcher from "../../../../../../../Dispatcher";
import { fetchAssetIds, getAssetIds, getAssetImage } from "../../../../../../../utils/ApplicationAssetUtils";
import getEmbedThemeColors from "../getEmbedThemeColors";
import { getSimpleChannelIcon } from "../../../../../../../utils/native/ChannelUtils";
import { intl, t } from "../../../../../../../intl/index.native";
import { computeChannelName } from "../../../../../../channel/useChannelName";
import { getEmbeddedActivityParticipantAvatarUris } from "./useEmbeddedActivityParticipantAvatarUris";
const _excluded = ["embedded_cover"];
export function createEmbeddedActivityInviteEmbed({ inviteCode, theme }) {
let id;
id = void 0;
const invite = InviteStore.getInvite(inviteCode);
if (invite == null) {
return null;
}
const { target_type, target_application } = invite;
if (target_type === InviteTargetTypes.EMBEDDED_APPLICATION && target_application != null) {
if (ApplicationStore.getApplication(target_application.id) == null) {
Dispatcher.dispatch({
type: "APPLICATION_UPDATE",
application: target_application
});
}
id = target_application.id;
if (ApplicationAssetsStore.getApplicationAssetFetchState(id) === FetchState.NOT_FETCHED) {
fetchAssetIds(id, _excluded);
}
const embedThemeColors = getEmbedThemeColors(theme);
const baseColors = embedThemeColors.baseColors;
const acceptLabelGreenBackgroundColor = embedThemeColors.colors.acceptLabelGreenBackgroundColor;
const name = invite.guild?.name;
const id3 = invite.channel?.id;
const id2 = invite.guild?.id;
const r26 = id3 != null ? ChannelStore.getChannel(id3) : null;
const r72 = r26 != null ? getSimpleChannelIcon(r26) : null;
const channelIcon = r72 != null ? Image2.resolveAssetSource(r72)?.uri : void 0;
let headerText = target_application?.name;
if (headerText == null) {
headerText = null;
}
const titleText = intl.string(t["1qHIZ4"]);
const structurableSubtitleText = r26 != null && name != null ? intl.formatToParts(t.omZR7L, {
channelName: computeChannelName(r26, UserStore, RelationshipStore),
guildName: name
}) : name != null ? intl.formatToParts(t.u0vaDE, {
guildName: name
}) : null;
let r114 = id3 != null;
if (r114) {
const r120 = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(id3).find((item) => item.applicationId === id);
const r121 = r120 == null;
let r122 = void 0;
if (!r121) {
const userIds = r120.userIds;
r122 = userIds == null ? void 0 : userIds.has(AuthenticationStore.getId());
}
r114 = r122;
}
const participantAvatarUris = id3 != null && id2 != null ? getEmbeddedActivityParticipantAvatarUris({
channelId: id3,
guildId: id2,
applicationId: id
}) : [];
const r142 = intl.string(t.VJlc0S);
const acceptLabelText = participantAvatarUris.length === 0 ? intl.string(t.I0v0Qv) : r114 ? intl.string(t.KC26NR) : r142;
let r165 = getAssetIds(id, _excluded);
if (r165 == null) {
r165 = [];
}
const [r169] = r165;
return {
...baseColors,
channelIcon,
headerText,
acceptLabelBackgroundColor: acceptLabelGreenBackgroundColor,
titleText,
structurableSubtitleText,
type: null,
extendedType: CodedLinkExtendedType.EMBEDDED_ACTIVITY_INVITE,
participantAvatarUris,
acceptLabelText,
splashUrl: r169 != null ? getAssetImage(id, r169, 1024) : void 0,
noParticipantsText: intl.string(t.PZLnuD),
ctaEnabled: !r114
};
}
return null;
}
@@ -0,0 +1,171 @@
// Metro module 10993 (f10994).
import { useMemo, useCallback } from "react";
import { Image as Image2 } from "react-native";
import AuthenticationStore from "../../../../../../../stores/AuthenticationStore";
import { ExperimentEmbedType } from "../../../../../../experiments/ExperimentConstants";
import { InviteTypes } from "../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../getEmbedThemeColors";
import { getExperimentFromEmbedURL, getExperimentTreatmentFromEmbedURL, getExperimentBuckets, getExperimentServerAssignmentLabel } from "../../../../../../experiments/ExperimentEmbedUtils";
import { useLegacyExperiments, getLegacyExperiments } from "../../../../../../experiments/client_override_hooks/useLegacyExperiments";
import { useApexExperiments, getApexExperiments } from "../../../../../../experiments/client_override_hooks/useApexExperiments";
import { isThemeDark } from "../../../../../../../design/utils/shared/themes";
import Module10994 from "../../../../../../../_bundle/Module10994";
import Module10995 from "../../../../../../../_bundle/Module10995";
import { getExperimentServerAssignment } from "../../../../../../experiments/client_override_hooks/useExperimentAssignments";
import { getAssetUriForEmbed } from "../../../EmbedUtils";
import Module10997 from "../../../../../../../_bundle/Module10997";
import { getExperimentVariantsForDevTools } from "../../../../../../experiments/devtools/ExperimentDevToolsUtils";
import ActionSheetActionCreators from "../../../../../../action_sheet/native/ActionSheetActionCreators";
import { overrideBucket } from "../../../../../../experiments/ExperimentManager";
import { BottomSheet } from "../../../../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { ExperimentDetails } from "../../../../../../devtools/native/components/screens/DevToolsExperimentsScreen";
import { useCanSeeExperimentEmbeds } from "../../../../../../experiments/client_override_hooks/useCodedLinksExperimentEmbeds";
const ExperimentOverrideActionSheet = function ExperimentOverrideActionSheet(props) {
const { id, experiment, override } = props;
const memo = useMemo(() => experiment != null ? getExperimentVariantsForDevTools(experiment) : [], [experiment]);
return <BottomSheet header={<BottomSheetTitleHeader title={experiment.title} subtitle={id} />}>
<ExperimentDetails experiment={experiment} override={override} id={id} options={useMemo(() => {
if (experiment == null) {
return [];
}
let c26901_1;
const map = new Map();
let c26901_0 = map;
memo.forEach((item) => {
c26901_0.set(item.id, item);
});
const r15 = [];
c26901_1 = r15;
map.forEach((item) => {
c26901_1.push({
label: item.label,
onPress: () => {
ActionSheetActionCreators.hideActionSheet("ExperimentOverrideSheet");
overrideBucket(experiment.system, id, item.id);
}
});
});
r15.push({
label: "Clear Override",
isDestructive: true,
onPress: () => {
ActionSheetActionCreators.hideActionSheet("ExperimentOverrideSheet");
overrideBucket(experiment.system, id, null);
}
});
return r15;
}, [id, experiment, memo])} onCopyLink={useCallback(() => {
ActionSheetActionCreators.hideActionSheet("ExperimentOverrideSheet");
}, [])} />
</BottomSheet>;
};
export default function ConnectedExperimentOverrideActionSheet(props) {
const id2 = props.id;
const legacyExperiments = useLegacyExperiments();
const { experiments, overridesInfo } = legacyExperiments;
const apexExperiments = useApexExperiments();
const { experiments: experiments2, overridesInfo: overridesInfo2 } = apexExperiments;
const memo2 = useMemo(() => {
let r4 = experiments[id2];
if (r4 == null) {
r4 = experiments2[id2];
}
if (r4 == null) {
r4 = null;
}
return r4;
}, [experiments, experiments2, id2]);
const memo3 = useMemo(() => {
let r4 = overridesInfo[id2];
if (r4 == null) {
r4 = overridesInfo2[id2];
}
if (r4 == null) {
r4 = null;
}
return r4;
}, [overridesInfo, overridesInfo2, id2]);
const canSeeExperimentEmbeds = useCanSeeExperimentEmbeds();
return memo2 != null ? canSeeExperimentEmbeds ? <ExperimentOverrideActionSheet id={id2} experiment={memo2} override={memo3} /> : null : null;
};
export function createExperimentEmbed(a0, a1) {
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
const experimentFromEmbedURL = getExperimentFromEmbedURL(a0);
const experimentTreatmentFromEmbedURL = getExperimentTreatmentFromEmbedURL(a0);
const legacyExperiments = getLegacyExperiments();
const { experiments: experiments3, overridesInfo: overridesInfo3 } = legacyExperiments;
const apexExperiments = getApexExperiments();
const { experiments: experiments4, overridesInfo: overridesInfo4 } = apexExperiments;
const r0 = experimentFromEmbedURL != null;
let r20 = null;
if (r0) {
let r41 = experiments3[experimentFromEmbedURL];
if (r41 == null) {
r41 = experiments4[experimentFromEmbedURL];
}
r20 = r41;
}
if (experimentFromEmbedURL != null && r20 != null) {
let r42 = overridesInfo3[experimentFromEmbedURL];
if (r42 == null) {
r42 = overridesInfo4[experimentFromEmbedURL];
}
if (r42 == null) {
r42 = null;
}
const r49 = getExperimentBuckets(r20).find((item) => item.value === experimentTreatmentFromEmbedURL);
const r51 = r49 != null ? ExperimentEmbedType.EXPERIMENT_TREATMENT : ExperimentEmbedType.EXPERIMENT;
const experimentServerAssignmentLabel = getExperimentServerAssignmentLabel(r20, getExperimentServerAssignment(r20, AuthenticationStore.getId()));
if (r51 === ExperimentEmbedType.EXPERIMENT_TREATMENT) {
const subtitle = r49 != null ? r49.label : `Server Config: ${experimentServerAssignmentLabel}`;
const r97 = r42 != null && r49 != null && r42.variantId === r49.value;
const r100 = {
...baseColors,
headerText: "EXPERIMENT TREATMENT",
titleText: experimentFromEmbedURL,
titleColor: colors.titleColor,
subtitle,
subtitleColor: colors.subtitleColor,
thumbnailUrl: getAssetUriForEmbed(Module10997),
thumbnailBackgroundColor: colors.backgroundColor,
acceptLabelColor: r97 ? colors.clearLabelRedColor : colors.acceptLabelGreenColor,
acceptLabelBackgroundColor: r97 ? colors.clearLabelRedBackgroundColor : colors.acceptLabelGreenBackgroundColor
};
const concat = HermesInternal.concat;
r100.acceptLabelText = r97 ? concat.call("Clear Treatment ", experimentTreatmentFromEmbedURL) : concat.call("Apply Treatment ", experimentTreatmentFromEmbedURL);
r100.embedCanBeTapped = true;
r100.type = InviteTypes.GUILD;
return r100;
}
return {
...baseColors,
headerText: "EXPERIMENT",
titleText: experimentFromEmbedURL,
titleColor: colors.titleColor,
subtitle: r42 != null ? `Client Override Applied: Treatment ${r42.variantId}` : `Server Assignment: ${experimentServerAssignmentLabel}`,
subtitleColor: colors.subtitleColor,
thumbnailUrl: getAssetUriForEmbed(Module10997),
thumbnailBackgroundColor: colors.backgroundColor,
acceptLabelColor: colors.acceptLabelGreenColor,
acceptLabelBackgroundColor: colors.acceptLabelGreenBackgroundColor,
acceptLabelText: "View Experiment Details",
embedCanBeTapped: true,
type: InviteTypes.GUILD
};
}
return {
...baseColors,
headerText: "EXPERIMENT",
titleText: experimentFromEmbedURL == null ? "Unknown Experiment" : experimentFromEmbedURL,
titleColor: colors.titleColor,
subtitle: "Unknown Experiment",
subtitleColor: colors.subtitleColor,
bodyText: "This client is missing this experiment. You may need to open the surface where the experiment is used first.",
bodyTextColor: colors.bodyTextColor,
thumbnailUrl: Image2.resolveAssetSource(isThemeDark(a1) ? Module10994 : Module10995).uri,
thumbnailBackgroundColor: colors.thumbnailBackgroundColor,
type: InviteTypes.GUILD
};
}
@@ -0,0 +1,222 @@
// Metro module 12357 (f12358).
import { processColor } from "react-native";
import GuildScheduledEventStore, { isGuildEventEnded, isGuildScheduledEventActive } from "../../../../../../guild_scheduled_events/GuildScheduledEventStore";
import { getGuildIconSource } from "../../../../../../../records/GuildRecord";
import ChannelStore from "../../../../../../../stores/ChannelStore";
import GuildStore from "../../../../../../../stores/GuildStore";
import RelationshipStore from "../../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../../stores/UserStore";
import { CodedLinkExtendedType } from "./CodedLinksConstants";
import { GuildScheduledEventEntityTypes } from "../../../../../../guild_scheduled_events/GuildScheduledEventsConstants";
import { InviteTypes } from "../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../getEmbedThemeColors";
import { getAssetUriForEmbed } from "../../../EmbedUtils";
import * as _useCanInviteForGuildEvent from "../../../../../../guild_scheduled_events/useCanInviteForGuildEvent";
import { getEventSchedule } from "../../../../../../guild_scheduled_events/useEventSchedule";
import { getEventTimeData, getNextRecurrenceIdInEvent } from "../../../../../../guild_scheduled_events/utils/ScheduleUtils";
import { getGuildScheduledEventHeaderProps } from "../../../../../../guild_scheduled_events/native/GuildScheduledEventHeaderUtils";
import { intl, t } from "../../../../../../../intl/index.native";
import Module7732 from "../../../../../../../_bundle/Module7732";
import Share from "../../../../../../icons/native/Share";
import { processColorOrThrow } from "../../../RowGeneratorStyleSheet";
import Module712 from "../../../../../../../_bundle/Module712";
import Module10356 from "../../../../../../../_bundle/Module10356";
import MarkupUtils from "../../../../../../markup/MarkupUtils";
import { getLocationFromEvent } from "../../../../../../guild_scheduled_events/utils/EntityUtils";
import { computeChannelName } from "../../../../../../channel/useChannelName";
import { getEventLocationIconSource } from "../../../../../../guild_scheduled_events/native/components/GuildEventUtils";
import GuildScheduledEventManager from "../../../../../../guild_scheduled_events/GuildScheduledEventManager";
import Module12358 from "../../../../../../../_bundle/Module12358";
import GuildScheduledEventsActionCreators from "../../../../../../guild_scheduled_events/GuildScheduledEventsActionCreators";
import { fromInviteGuild } from "../../../../../../../utils/GuildRecordUtils";
let c8531_17;
const createGuildScheduledEventEmbed = function createGuildScheduledEventEmbed({ channel, guildEvent, userCount, guild, theme, type, recurrenceId }) {
let acceptLabelBackgroundColor, acceptLabelGreenColor, acceptLabelIcon, acceptLabelText, headerTextColor, isRsvped, secondaryActionIcon;
const colors = getEmbedThemeColors(theme).colors;
const id = channel?.id;
const r9 = guild != null ? getGuildIconSource(guild, 128, false) : void 0;
const guildIcon = r9 != null ? getAssetUriForEmbed(r9) : void 0;
const isGuildEventInvitable = _useCanInviteForGuildEvent.isGuildEventInvitable(guildEvent);
const isGuildScheduledEventActive2 = isGuildScheduledEventActive(guildEvent);
const entity_type2 = guildEvent.entity_type;
const EXTERNAL = GuildScheduledEventEntityTypes.EXTERNAL;
const isInterestedInEventRecurrence = GuildScheduledEventStore.isInterestedInEventRecurrence(guildEvent.id, recurrenceId);
const { name, description, entity_type } = guildEvent;
const STAGE_INSTANCE = GuildScheduledEventEntityTypes.STAGE_INSTANCE;
const eventSchedule = getEventSchedule(guildEvent, recurrenceId);
const guildScheduledEventHeaderProps = getGuildScheduledEventHeaderProps({
eventTimeData: getEventTimeData(eventSchedule == null ? void 0 : eventSchedule.startTime.toISOString()),
isStage: entity_type === STAGE_INSTANCE,
theme,
event: guildEvent
});
const { color, icon, shouldChangeTextColor, text } = guildScheduledEventHeaderProps;
const embedCanBeTapped = guild != null;
const r31 = {
titleColor: colors.titleColor,
borderColor: colors.borderColor,
backgroundColor: colors.backgroundColor,
thumbnailCornerRadius: 15,
embedCanBeTapped
};
const r38 = intl.string(t.DlcqlU);
const assetUriForEmbed2 = getAssetUriForEmbed(Module7732);
const assetUriForEmbed = getAssetUriForEmbed(Share);
if (embedCanBeTapped) {
if (isGuildScheduledEventActive2) {
const acceptLabelActiveBackgroundColor = colors.acceptLabelActiveBackgroundColor;
const r135 = entity_type2 === EXTERNAL ? intl.string(t.GoCQxU) : intl.string(t.IaYdtW);
acceptLabelGreenColor = colors.acceptLabelGreenColor;
isRsvped = false;
acceptLabelText = r135;
secondaryActionIcon = assetUriForEmbed;
acceptLabelIcon = void 0;
acceptLabelBackgroundColor = acceptLabelActiveBackgroundColor;
} else if (isInterestedInEventRecurrence) {
acceptLabelBackgroundColor = colors.backgroundColor;
acceptLabelIcon = getAssetUriForEmbed(Module10356);
acceptLabelGreenColor = colors.acceptLabelDisabledTextColor;
secondaryActionIcon = assetUriForEmbed;
acceptLabelText = r38;
isRsvped = isInterestedInEventRecurrence;
} else {
acceptLabelBackgroundColor = colors.acceptLabelActiveBackgroundColor;
acceptLabelGreenColor = colors.acceptLabelGreenColor;
secondaryActionIcon = assetUriForEmbed;
acceptLabelIcon = assetUriForEmbed2;
acceptLabelText = r38;
isRsvped = isInterestedInEventRecurrence;
}
} else {
acceptLabelBackgroundColor = processColorOrThrow(Module712.unsafe_rawColors.GREEN_360);
acceptLabelText = intl.string(t.XpeFYr);
acceptLabelGreenColor = colors.acceptLabelGreenColor;
secondaryActionIcon = void 0;
acceptLabelIcon = void 0;
isRsvped = false;
}
if (!isGuildEventInvitable) {
secondaryActionIcon = void 0;
}
const content = description != null ? MarkupUtils.parseToAST(description, true, {
channelId: id,
allowLinks: true,
allowEmojiLinks: true,
allowHeading: true,
allowList: true
}) : void 0;
let channelName = getLocationFromEvent(guildEvent);
if (channelName == null) {
channelName = channel != null ? computeChannelName(channel, UserStore, RelationshipStore) : void 0;
}
const eventLocationIconSource = getEventLocationIconSource(guildEvent, channel, embedCanBeTapped);
const user = UserStore.getUser(guildEvent.creator_id);
GuildScheduledEventManager.getGuildEventUserCounts(guildEvent.guild_id, guildEvent.id, recurrenceId != null ? [recurrenceId] : []);
GuildScheduledEventManager.getGuildEventsForCurrentUser(guildEvent.guild_id);
const r182 = {
...r31,
acceptLabelBackgroundColor,
acceptLabelBorderColor: isRsvped ? colors.acceptLabelDisabledBorderColor : void 0,
acceptLabelColor: acceptLabelGreenColor,
acceptLabelIcon,
acceptLabelText,
badgeCount: userCount == null ? void 0 : userCount.toLocaleString(),
badgeIcon: getAssetUriForEmbed(Module12358),
channelIcon: eventLocationIconSource != null ? getAssetUriForEmbed(eventLocationIconSource) : void 0
};
if (channelName == null) {
channelName = void 0;
}
r182.channelName = channelName;
r182.content = content;
r182.creatorAvatar = user != null ? getAssetUriForEmbed(user.getAvatarSource(guildEvent.guild_id)) : void 0;
r182.extendedType = CodedLinkExtendedType.GUILD_SCHEDULED_EVENT;
r182.guildIcon = guildIcon;
r182.guildName = guild?.name;
let headerColor = processColor(color);
if (headerColor == null) {
headerColor = colors.headerColor;
}
r182.headerColor = headerColor;
r182.headerIcon = getAssetUriForEmbed(icon);
r182.headerText = text;
if (shouldChangeTextColor) {
let r218 = processColor(color);
if (r218 == null) {
r218 = colors.headerColor;
}
headerTextColor = r218;
} else {
headerTextColor = colors.headerColor;
}
r182.headerTextColor = headerTextColor;
r182.isRsvped = isRsvped;
r182.secondaryActionIcon = secondaryActionIcon;
r182.titleText = name;
r182.type = type;
r182.guildEventId = guildEvent.id;
return r182;
};
c8531_17 = {};
export function createGuildScheduledEventInviteEmbed(a0, a1) {
let r49;
const channel = ChannelStore.getChannel(a0.channel?.id);
const guild_id = channel?.guild_id;
const guildScheduledEvent = GuildScheduledEventStore.getGuildScheduledEvent(a0.guild_scheduled_event?.id);
const userCount = GuildScheduledEventStore.getUserCount(a0.guild_scheduled_event?.id, null);
if (guildScheduledEvent == null) {
const r50 = guild_id != null;
r49 = null;
if (r50) {
GuildScheduledEventsActionCreators.fetchGuildEventsForGuild(guild_id);
r49 = null;
}
} else {
if (guild_id != null) {
GuildScheduledEventManager.getGuildEventUserCounts(guild_id, guildScheduledEvent.id, []);
}
const guild = a0.guild != null ? fromInviteGuild(a0.guild) : GuildStore.getGuild(channel?.guild_id);
let type = a0.type;
if (type == null) {
type = InviteTypes.GUILD;
}
r49 = createGuildScheduledEventEmbed({
channel,
guildEvent: guildScheduledEvent,
userCount,
guild,
theme: a1,
type
});
}
return r49;
}
export function createGuildScheduledEventLinkEmbed(a0, a1) {
let [r19, r20, recurrenceId] = a0.split("-");
let c19802_0 = r19;
const guildScheduledEvent = GuildScheduledEventStore.getGuildScheduledEvent(r20);
if (recurrenceId == null) {
recurrenceId = getNextRecurrenceIdInEvent(guildScheduledEvent);
}
if (recurrenceId == null) {
recurrenceId = void 0;
}
if (guildScheduledEvent != null && !isGuildEventEnded(guildScheduledEvent)) {
GuildScheduledEventManager.getGuildEventUserCounts(r19, guildScheduledEvent.id, recurrenceId != null ? [recurrenceId] : []);
const userCount = GuildScheduledEventStore.getUserCount(guildScheduledEvent.id, recurrenceId);
return createGuildScheduledEventEmbed({
channel: ChannelStore.getChannel(guildScheduledEvent?.channel_id),
guildEvent: guildScheduledEvent,
userCount,
guild: GuildStore.getGuild(r19),
theme: a1,
type: InviteTypes.GUILD,
recurrenceId
});
}
if (!c8531_17[r19]) {
GuildScheduledEventsActionCreators.fetchGuildEventsForGuild(r19).then(() => delete c8531_17[c19802_0]).catch(() => delete c8531_17[c19802_0]);
c8531_17[r19] = true;
}
return null;
}
@@ -0,0 +1,59 @@
// Metro module 12362 (f12363).
import { Image as Image2 } from "react-native";
import GuildTemplateStore from "../../../../../../guild_templates/GuildTemplateStore";
import { GuildTemplateStates } from "../../../../../../guild_templates/GuildTemplatesConstants";
import { InviteTypes } from "../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../getEmbedThemeColors";
import { intl, t } from "../../../../../../../intl/index.native";
import { processColorOrThrow } from "../../../RowGeneratorStyleSheet";
import Module712 from "../../../../../../../_bundle/Module712";
import { isThemeDark } from "../../../../../../../design/shared";
import Module10994 from "../../../../../../../_bundle/Module10994";
import Module10995 from "../../../../../../../_bundle/Module10995";
import Module12363 from "../../../../../../../_bundle/Module12363";
export function createGuildTemplateEmbed(a0, a1) {
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
const guildTemplate = GuildTemplateStore.getGuildTemplate(a0);
if (guildTemplate == null) {
return null;
}
if (guildTemplate.state === GuildTemplateStates.RESOLVING) {
return {
headerText: intl.string(t.Xj87Yf).toUpperCase(),
resolvingGradientEnd: colors.resolvingGradientEnd,
resolvingGradientStart: colors.resolvingGradientStart,
type: InviteTypes.GUILD,
...baseColors
};
}
if (guildTemplate.state === GuildTemplateStates.EXPIRED) {
return {
...baseColors,
headerText: intl.string(t.C7ZRNw).toUpperCase(),
titleColor: processColorOrThrow(Module712.unsafe_rawColors.RED_400),
titleText: intl.string(t.A6MwXE),
thumbnailUrl: Image2.resolveAssetSource(isThemeDark(a1) ? Module10994 : Module10995).uri,
thumbnailBackgroundColor: colors.thumbnailBackgroundColor,
type: InviteTypes.GUILD
};
}
const subtitle = intl.formatToPlainString(t.L8Awgh, {
usageCount: guildTemplate.usageCount.toString()
});
return {
...baseColors,
headerText: intl.string(t.kAvFkO).toUpperCase(),
headerColor: colors.headerColor,
titleText: guildTemplate.name,
titleColor: colors.titleColor,
subtitle,
subtitleColor: colors.subtitleColor,
thumbnailUrl: Image2.resolveAssetSource(Module12363).uri,
acceptLabelColor: colors.acceptLabelGreenColor,
acceptLabelBackgroundColor: colors.acceptLabelGreenBackgroundColor,
acceptLabelText: intl.string(t["a3Gl+e"]),
embedCanBeTapped: true,
type: InviteTypes.GUILD
};
}
@@ -0,0 +1,67 @@
// Metro module 12352 (f12353).
import InviteStore from "../../../../../../../stores/InviteStore";
import UserStore from "../../../../../../../stores/UserStore";
import { AbortCodes, InviteStates } from "../../../../../../../Constants";
import { InviteTypes } from "../../../../../../instant_invite/Constants";
import { createResolvingGuildInvite, createErroredGuildInvite, createDisabledGuildInvite, createGuildInvite, createExpiredGuildInvite } from "./invite/GuildInvite";
import { getInviteType, getGuildInviteExtendedType, GuildInviteExtendedType } from "../../../../../../instant_invite/InviteTypeUtils";
import { createGroupDMInvite } from "./invite/GroupDMInvite";
import { createFriendInvite } from "./invite/FriendInvite";
import { createGuildScheduledEventInviteEmbed } from "./GuildScheduledEventEmbed";
import { createEmbeddedActivityInviteEmbed } from "./EmbeddedActivityInviteEmbed";
import { createGuildProfileInvite } from "./invite/GuildProfileInvite";
import { getVoiceChannelListInviteExperiment } from "../../../../../VoiceChannelListInviteExperiment";
import { createVoiceChannelListInviteEmbed } from "./invite/VoiceChannelListInviteEmbed";
export function createInviteEmbed(a0, a1, a2) {
const invite = InviteStore.getInvite(a1);
if (invite == null) {
return null;
}
const id2 = UserStore.getCurrentUser()?.id;
const id = a0.author.id;
if (invite.state === InviteStates.RESOLVING) {
return createResolvingGuildInvite(a2);
}
const r27 = id2 === id;
if (invite.state !== InviteStates.EXPIRED && invite.state !== InviteStates.BANNED) {
if (invite.state === InviteStates.ERROR) {
const inviteError = InviteStore.getInviteError(a1);
return inviteError == null ? createErroredGuildInvite(a1, r27, a2) : inviteError.code === AbortCodes.INVITES_DISABLED ? createDisabledGuildInvite(invite, a2) : createErroredGuildInvite(a1, r27, a2);
}
const inviteType = getInviteType(invite);
if (InviteTypes.GROUP_DM === inviteType) {
return createGroupDMInvite(invite, r27, a2);
}
if (InviteTypes.FRIEND === inviteType) {
return createFriendInvite(invite, r27, id2, a2);
}
const guildInviteExtendedType = getGuildInviteExtendedType(invite);
if (GuildInviteExtendedType.EVENT === guildInviteExtendedType) {
return createGuildScheduledEventInviteEmbed(invite, a2);
}
if (GuildInviteExtendedType.APPLICATION === guildInviteExtendedType) {
return createEmbeddedActivityInviteEmbed({
inviteCode: invite.code,
theme: a2
});
}
if (GuildInviteExtendedType.PROFILE === guildInviteExtendedType) {
return createGuildProfileInvite(invite, a2);
}
if (GuildInviteExtendedType.VOICE_CHANNEL === guildInviteExtendedType) {
const id3 = invite.guild?.id;
if (id3 != null && getVoiceChannelListInviteExperiment({
guildId: id3,
location: "mobile_invite_embed"
}).enabled) {
const voiceChannelListInviteEmbed = createVoiceChannelListInviteEmbed(invite, a2);
if (voiceChannelListInviteEmbed != null) {
return voiceChannelListInviteEmbed;
}
}
return createGuildInvite(invite, r27, a2);
}
return createGuildInvite(invite, r27, a2);
}
return createExpiredGuildInvite(a0, r27, a2);
}
@@ -0,0 +1,66 @@
// Metro module 12366 (f12367).
import _slicedToArray from "../../../../../../../_bundle/_slicedToArray";
import { Image as Image2 } from "react-native";
import { getGuildAcronym } from "../../../../../../../records/GuildRecord";
import ChannelStore from "../../../../../../../stores/ChannelStore";
import GuildStore from "../../../../../../../stores/GuildStore";
import PermissionStore from "../../../../../../../stores/PermissionStore";
import RelationshipStore from "../../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../../stores/UserStore";
import { Permissions } from "../../../../../../../Constants";
import { InviteTypes } from "../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../getEmbedThemeColors";
import AvatarUtils from "../../../../../../../utils/AvatarUtils";
import { isAndroid } from "../../../../../../../utils/PlatformUtils";
import { intl, t } from "../../../../../../../intl/index.native";
import { getChannelIcon } from "../../../../../../../utils/native/ChannelUtils";
import { computeChannelName } from "../../../../../../channel/useChannelName";
export function createVoiceChannelLinkEmbed(a0, a1) {
let r12, thumbnailText;
const r22 = _slicedToArray(a0.split("/"), 2);
const r23 = r22[0];
const channel = ChannelStore.getChannel(r22[1]);
const guild = GuildStore.getGuild(r23);
if (channel != null && channel.isGuildVocal() && guild != null && PermissionStore.can(Permissions.VIEW_CHANNEL, channel) && PermissionStore.can(Permissions.CONNECT, channel)) {
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
if (guild?.icon != null) {
r12 = AvatarUtils.getGuildIconURL({
id: guild?.id,
icon: guild?.icon,
canAnimate: true,
size: 128
});
thumbnailText = void 0;
} else {
thumbnailText = guild != null ? getGuildAcronym(guild) : void 0;
r12 = void 0;
}
return {
...baseColors,
headerText: isAndroid() ? "" : void 0,
headerColor: colors.headerColor,
acceptLabelText: channel.isGuildStageVoice() ? intl.string(t["7vb2cc"]) : intl.string(t.gpqgah),
onlineText: void 0,
memberText: void 0,
channelIcon: Image2.resolveAssetSource(getChannelIcon(channel))?.uri,
titleText: computeChannelName(channel, UserStore, RelationshipStore),
titleColor: colors.titleColor,
thumbnailUrl: r12 ?? void 0,
thumbnailText,
subtitleColor: void 0,
acceptLabelBackgroundColor: colors.acceptLabelGreenBackgroundColor,
acceptLabelBorderColor: void 0,
acceptLabelColor: colors.acceptLabelGreenColor,
embedCanBeTapped: true,
canBeAccepted: true,
channelName: intl.formatToPlainString(t["2wimj5"], {
guildName: guild.name
}),
subtitle: "",
type: InviteTypes.GUILD,
inviteSplash: void 0
};
}
return null;
}
@@ -0,0 +1,68 @@
// Metro module 12356 (f12357).
import { Image as Image2 } from "react-native";
import RelationshipStore from "../../../../../../../../stores/RelationshipStore";
import { InviteTypes } from "../../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../../getEmbedThemeColors";
import { intl, t } from "../../../../../../../../intl/index.native";
import UserUtils from "../../../../../../../../utils/UserUtils";
import AvatarUtils from "../../../../../../../../utils/AvatarUtils";
export function createFriendInvite(a0, a1, a2, a3) {
let acceptLabelDisabledBackgroundColor, acceptLabelDisabledColor, acceptLabelText, canBeAccepted;
const embedThemeColors = getEmbedThemeColors(a3);
const { colors, baseColors } = embedThemeColors;
const r18 = a1 ? intl.string(t.eQyu1F) : intl.string(t.PYJHW6);
const titleText = a0.inviter != null ? a0.inviter.username : "";
const subtitle = a0.inviter != null ? UserUtils.getUserTag(a0.inviter) : "";
const r48 = a0.inviter != null && RelationshipStore.isFriend(a0.inviter?.id);
const r54 = a0.inviter != null ? Image2.resolveAssetSource(AvatarUtils.getUserAvatarSource(a0.inviter)).uri : "";
if (a0.inviter?.id === a2) {
acceptLabelDisabledColor = colors.acceptLabelDisabledColor;
acceptLabelDisabledBackgroundColor = colors.acceptLabelDisabledBackgroundColor;
acceptLabelText = intl.string(t.ib7Ng1);
canBeAccepted = false;
} else {
const { acceptLabelGreenColor, acceptLabelGreenBackgroundColor } = colors;
if (r48) {
acceptLabelText = intl.string(t.xhxnPn);
canBeAccepted = true;
acceptLabelDisabledBackgroundColor = acceptLabelGreenBackgroundColor;
acceptLabelDisabledColor = acceptLabelGreenColor;
} else {
acceptLabelText = intl.string(t.ib7Ng1);
canBeAccepted = true;
acceptLabelDisabledBackgroundColor = acceptLabelGreenBackgroundColor;
acceptLabelDisabledColor = acceptLabelGreenColor;
}
}
const headerText = r18 != null ? r18.toUpperCase() : void 0;
const thumbnailUrl = r54 ?? void 0;
const subtitleColor = subtitle !== "" ? colors.subtitleColor : void 0;
let channelName = a0.channel?.name;
if (channelName == null) {
channelName = void 0;
}
let type = a0.type;
if (type == null) {
type = InviteTypes.FRIEND;
}
return {
...baseColors,
thumbnailCornerRadius: 25,
headerText,
headerColor: colors.headerColor,
acceptLabelText,
channelIcon: void 0,
titleText,
titleColor: colors.titleColor,
thumbnailUrl,
subtitle,
subtitleColor,
acceptLabelBackgroundColor: acceptLabelDisabledBackgroundColor,
acceptLabelBorderColor: void 0,
acceptLabelColor: acceptLabelDisabledColor,
embedCanBeTapped: false,
canBeAccepted,
channelName,
type
};
}
@@ -0,0 +1,76 @@
// Metro module 12355 (f12356).
import ChannelStore from "../../../../../../../../stores/ChannelStore";
import RelationshipStore from "../../../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../../../stores/UserStore";
import { InviteTypes } from "../../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../../getEmbedThemeColors";
import getChannelAndRecipientsFromInvite from "./getChannelAndRecipientsFromInvite";
import { intl, t } from "../../../../../../../../intl/index.native";
import { getChannelIconSource } from "../../../../../../../channel/getChannelIcon";
import { ensureAvatarSource } from "../../../../../../../../utils/native/AvatarUtils";
import { computeChannelName } from "../../../../../../../channel/useChannelName";
export function createGroupDMInvite(a0, a1, a2) {
let acceptLabelDisabledBackgroundColor, acceptLabelDisabledColor, acceptLabelText;
const embedThemeColors = getEmbedThemeColors(a2);
const { colors, baseColors } = embedThemeColors;
const channelAndRecipientsFromInvite = getChannelAndRecipientsFromInvite(a0);
let channel = channelAndRecipientsFromInvite.channel;
const recipients_ = channelAndRecipientsFromInvite.recipients_;
const channel2 = ChannelStore.getChannel(channel?.id);
const r4 = channel2 != null;
let r36 = false;
if (r4) {
r36 = true;
channel = channel2;
}
const r20 = a1 ? intl.string(t.qmtuXE) : intl.string(t["3p3/BK"]);
if (r36) {
intl.string(t.cEnaWx);
} else {
intl.string(t.XpeFYr);
}
const memberText = recipients_.length > 0 ? intl.formatToPlainString(t.zRl6XR, {
count: recipients_.length
}) : void 0;
const r71 = channel != null ? getChannelIconSource(channel) : null;
const r76 = r71 != null ? ensureAvatarSource(r71).uri : null;
const titleText = (r36 ? channel != null ? computeChannelName(channel, UserStore, RelationshipStore) : null : null) || a0.channel?.name || recipients_.map((item) => item.username).join(", ") || intl.string(t.LJpTRF);
if (r36) {
acceptLabelDisabledColor = colors.acceptLabelDisabledColor;
acceptLabelDisabledBackgroundColor = colors.acceptLabelDisabledBackgroundColor;
acceptLabelText = intl.string(t.cEnaWx);
} else {
acceptLabelDisabledColor = colors.acceptLabelGreenColor;
acceptLabelDisabledBackgroundColor = colors.acceptLabelGreenBackgroundColor;
acceptLabelText = intl.string(t.XpeFYr);
}
const headerText = r20 != null ? r20.toUpperCase() : void 0;
const thumbnailUrl = r76 ?? void 0;
const channelName = r36 ? channel != null ? computeChannelName(channel, UserStore, RelationshipStore) : titleText : titleText;
let type = a0.type;
if (type == null) {
type = InviteTypes.GROUP_DM;
}
return {
...baseColors,
headerText,
headerColor: colors.headerColor,
acceptLabelText,
onlineText: void 0,
memberText,
channelIcon: void 0,
titleText,
titleColor: colors.titleColor,
thumbnailUrl,
thumbnailText: void 0,
subtitle: "",
subtitleColor: void 0,
acceptLabelBackgroundColor: acceptLabelDisabledBackgroundColor,
acceptLabelBorderColor: void 0,
acceptLabelColor: acceptLabelDisabledColor,
embedCanBeTapped: true,
canBeAccepted: !r36,
channelName,
type
};
}
@@ -0,0 +1,317 @@
// Metro module 12353 (f12354).
import { Image as Image2 } from "react-native";
import { getGuildAcronym, getGuildIconURL } from "../../../../../../../../records/GuildRecord";
import ApplicationStreamingStore from "../../../../../../../../stores/ApplicationStreamingStore";
import ChannelStore from "../../../../../../../../stores/ChannelStore";
import GuildMemberStore from "../../../../../../../../stores/GuildMemberStore";
import GuildStore from "../../../../../../../../stores/GuildStore";
import InviteStore from "../../../../../../../../stores/InviteStore";
import RelationshipStore from "../../../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../../../stores/UserStore";
import { CodedLinkExtendedType } from "../CodedLinksConstants";
import { ChannelTypes, GuildFeatures, HelpdeskArticles } from "../../../../../../../../Constants";
import { InviteTargetTypes, InviteTypes } from "../../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../../getEmbedThemeColors";
import { intl, t } from "../../../../../../../../intl/index.native";
import { processColorOrThrow } from "../../../../RowGeneratorStyleSheet";
import Module712 from "../../../../../../../../_bundle/Module712";
import UserUtils from "../../../../../../../../utils/UserUtils";
import { isThemeDark } from "../../../../../../../../design/shared";
import Module10994 from "../../../../../../../../_bundle/Module10994";
import Module10995 from "../../../../../../../../_bundle/Module10995";
import { fromInviteGuild } from "../../../../../../../../utils/GuildRecordUtils";
import HelpdeskUtils from "../../../../../../../../utils/HelpdeskUtils";
import { getAssetUriForEmbed } from "../../../../EmbedUtils";
import Module11827 from "../../../../../../../../_bundle/Module11827";
import { getDescriptiveInviteError } from "../../../../../../../../utils/InviteErrorUtils";
import GuestUtils from "../../../../../../../guests/GuestUtils";
import getChannelAndRecipientsFromInvite from "./getChannelAndRecipientsFromInvite";
import { getHeaderTextForInvite } from "../../../../../../getHeaderTextForInvite";
import { hasFlag } from "../../../../../../../../_bundle/Module1384";
import { GuildInviteFlags } from "../../../../../../../../_bundle/Module6709";
import AvatarUtils from "../../../../../../../../utils/AvatarUtils";
import getDevicePixelRatio_native from "../../../../../../../../utils/getDevicePixelRatio.native";
import { getChannelIcon } from "../../../../../../../../utils/native/ChannelUtils";
import { getGuildBadgeImageSource } from "../../../../../../../guild_badge/native/GuildBadgeImageSource";
import { computeChannelName } from "../../../../../../../channel/useChannelName";
export function createResolvingGuildInvite(a0) {
const embedThemeColors = getEmbedThemeColors(a0);
const { colors, baseColors } = embedThemeColors;
return {
headerText: intl.string(t["N/g9Z4"]).toUpperCase(),
resolvingGradientEnd: colors.resolvingGradientEnd,
resolvingGradientStart: colors.resolvingGradientStart,
type: InviteTypes.GUILD,
...baseColors
};
}
export function createExpiredGuildInvite(a0, a1, a2) {
const embedThemeColors = getEmbedThemeColors(a2);
const colors = embedThemeColors.colors;
return {
...embedThemeColors.baseColors,
headerText: (a1 ? intl.string(t.C89OLE) : intl.string(t.YVub5y)).toUpperCase(),
titleColor: processColorOrThrow(Module712.unsafe_rawColors.RED_400),
subtitle: a1 ? intl.string(t["F/OLvL"]) : a0.author?.username != null ? intl.formatToPlainString(t["9Akp1s"], {
username: UserUtils.getFormattedName(a0.author)
}) : intl.string(t["SMJr+a"]),
titleText: intl.string(t["Jhx/ud"]),
thumbnailUrl: Image2.resolveAssetSource(isThemeDark(a2) ? Module10994 : Module10995).uri,
thumbnailBackgroundColor: colors.thumbnailBackgroundColor,
subtitleColor: colors.subtitleColor,
type: InviteTypes.GUILD
};
}
export function createDisabledGuildInvite(a0, a1) {
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
const r27 = a0.guild != null ? fromInviteGuild(a0.guild) : GuildStore.getGuild(ChannelStore.getChannel(a0.channel?.id)?.guild_id);
const r34 = r27 != null ? getGuildIconURL(r27, 48, false) : void 0;
const r37 = {
...baseColors,
extendedType: CodedLinkExtendedType.GUILD_INVITE_DISABLED,
headerText: intl.string(t["Hyx2F/"]).toUpperCase(),
titleText: intl.string(t.tQ4AnN),
titleColor: processColorOrThrow(Module712.unsafe_rawColors.RED_345)
};
let guildName = r27?.name;
if (guildName == null) {
guildName = intl.string(t.wBceYP);
}
r37.guildName = guildName;
r37.subtitle = intl.string(t["x+XpjL"]);
r37.helpCenterArticleLabel = intl.string(t["4FlZqw"]);
r37.helpCenterArticleURL = HelpdeskUtils.getArticleURL(HelpdeskArticles.INVITE_DISABLED);
let guildIcon = r34;
if (guildIcon == null) {
guildIcon = void 0;
}
r37.guildIcon = guildIcon;
r37.thumbnailUrl = getAssetUriForEmbed(Module11827);
r37.thumbnailText = r34 != null ? void 0 : r27 != null ? getGuildAcronym(r27) : void 0;
r37.subtitleColor = colors.subtitleColor;
r37.type = InviteTypes.GUILD;
return r37;
}
export function createErroredGuildInvite(a0, a1, a2) {
const embedThemeColors = getEmbedThemeColors(a2);
const { colors, baseColors } = embedThemeColors;
const inviteError = InviteStore.getInviteError(a0);
const descriptiveInviteError = getDescriptiveInviteError(inviteError?.code);
const r26 = {
...baseColors,
headerText: (a1 ? intl.string(t.C89OLE) : intl.string(t.YVub5y)).toUpperCase(),
titleColor: processColorOrThrow(Module712.unsafe_rawColors.RED_400)
};
let subtitle = descriptiveInviteError?.description;
if (subtitle == null) {
subtitle = inviteError?.message;
}
r26.subtitle = subtitle;
let titleText = descriptiveInviteError?.title;
if (titleText == null) {
titleText = intl.string(t["Jhx/ud"]);
}
r26.titleText = titleText;
r26.thumbnailUrl = Image2.resolveAssetSource(isThemeDark(a2) ? Module10994 : Module10995).uri;
r26.thumbnailBackgroundColor = colors.thumbnailBackgroundColor;
r26.subtitleColor = colors.subtitleColor;
r26.type = InviteTypes.GUILD;
return r26;
}
export function createGuildInvite(a0, a1, a2) {
let r27, r33, r119, r121, acceptLabelBackgroundColor, acceptLabelColor, acceptLabelText, channelIcon, memberText, onlineText, subtitle, thumbnailText, titleText;
const embedThemeColors = getEmbedThemeColors(a2);
const { colors, baseColors } = embedThemeColors;
let r31 = a0.guild != null ? GuildStore.getGuild(a0.guild.id) : null;
const canAcceptInvite = GuestUtils.canAcceptInvite([GuildMemberStore], a0);
const channel = getChannelAndRecipientsFromInvite(a0).channel;
const isVoiceChannel = channel != null && channel.isGuildVocal();
let isStage = channel == null ? void 0 : channel.isGuildStageVoice();
if (isStage == null) {
isStage = false;
}
const { target_user, target_type } = a0;
let approximate_member_count = a0.approximate_member_count;
const approximate_presence_count = a0.approximate_presence_count;
const STREAM = InviteTargetTypes.STREAM;
const r2 = a0.guild != null && r31 == null;
let r4 = true;
if (r2) {
r31 = fromInviteGuild(a0.guild);
r4 = false;
}
let isHubGuild = r31 == null ? void 0 : r31.features.has(GuildFeatures.HUB);
if (isHubGuild == null) {
isHubGuild = false;
}
const isStream = target_type === STREAM;
let flags = a0.flags;
if (flags == null) {
flags = 0;
}
const headerTextForInvite = getHeaderTextForInvite({
isVoiceChannel,
isOwnInvite: a1,
isHubGuild,
isStream,
isStage,
isGuest: hasFlag(flags, GuildInviteFlags.IS_GUEST_INVITE)
});
const name = r31?.name;
if (r31?.icon != null) {
r27 = AvatarUtils.getGuildIconURL({
id: r31?.id,
icon: r31?.icon,
canAnimate: true,
size: 128
});
r33 = void 0;
} else {
r33 = r31 != null ? getGuildAcronym(r31) : void 0;
r27 = void 0;
}
const r100 = r31?.splash != null;
let inviteSplash = void 0;
if (r100) {
let r112 = AvatarUtils.getGuildSplashURL({
id: r31.id,
splash: r31.splash,
size: 400 * getDevicePixelRatio_native()
});
if (r112 == null) {
r112 = void 0;
}
inviteSplash = r112;
}
L63: {
if (isVoiceChannel) {
if (r4 && target_user != null && isStream) {
const uri3 = Image2.resolveAssetSource(AvatarUtils.getUserAvatarSource(target_user)).uri;
const r189 = intl.formatToPlainString(t.QmlLEq, {
name: UserUtils.getFormattedName(target_user)
});
subtitle = intl.formatToPlainString(t.u0vaDE, {
guildName: r31?.name
});
r119 = ApplicationStreamingStore.getActiveStreamForUser(target_user.id, channel.getGuildId()) != null;
thumbnailText = void 0;
r121 = uri3;
titleText = r189;
channelIcon = void 0;
memberText = void 0;
onlineText = void 0;
break L63;
}
const uri2 = Image2.resolveAssetSource(getChannelIcon(channel))?.uri;
subtitle = "";
channelIcon = uri2;
r119 = r4;
thumbnailText = r33;
r121 = r27;
titleText = name;
memberText = void 0;
onlineText = void 0;
} else {
if (channel != null && channel.type === ChannelTypes.GUILD_STAGE_VOICE) {
const uri = Image2.resolveAssetSource(getChannelIcon(channel))?.uri;
subtitle = "";
channelIcon = uri;
r119 = r4;
thumbnailText = r33;
r121 = r27;
titleText = name;
memberText = void 0;
onlineText = void 0;
break L63;
}
if (!(approximate_member_count != null && approximate_member_count >= 5) && !(approximate_presence_count != null && approximate_presence_count > 0)) {
const r6 = channel != null;
subtitle = "";
r119 = r4;
thumbnailText = r33;
r121 = r27;
titleText = name;
channelIcon = void 0;
memberText = void 0;
onlineText = void 0;
if (!r6) {
break L63;
}
channelIcon = Image2.resolveAssetSource(getChannelIcon(channel))?.uri;
subtitle = "";
r119 = r4;
thumbnailText = r33;
r121 = r27;
titleText = name;
memberText = void 0;
onlineText = void 0;
break L63;
}
const r140 = intl.formatToPlainString(t["LC+S+m"], {
membersOnline: approximate_presence_count
});
const zRl6XR = t.zRl6XR;
if (approximate_member_count == null) {
approximate_member_count = 0;
}
memberText = intl.formatToPlainString(zRl6XR, {
count: approximate_member_count
});
subtitle = "";
r119 = r4;
thumbnailText = r33;
r121 = r27;
titleText = name;
channelIcon = void 0;
onlineText = r140;
}
}
if (isVoiceChannel) {
const { acceptLabelGreenColor, acceptLabelGreenBackgroundColor } = colors;
acceptLabelText = isStage ? intl.string(t["7vb2cc"]) : intl.string(t.gpqgah);
acceptLabelBackgroundColor = acceptLabelGreenBackgroundColor;
acceptLabelColor = acceptLabelGreenColor;
} else if (r119) {
acceptLabelColor = colors.acceptLabelDisabledColor;
acceptLabelBackgroundColor = colors.acceptLabelDisabledBackgroundColor;
acceptLabelText = intl.string(t.cEnaWx);
} else {
acceptLabelColor = colors.acceptLabelGreenColor;
acceptLabelBackgroundColor = colors.acceptLabelGreenBackgroundColor;
acceptLabelText = intl.string(t.XpeFYr);
}
const r239 = r31 != null ? getGuildBadgeImageSource(r31, a2) : void 0;
const headerText = headerTextForInvite != null ? headerTextForInvite.toUpperCase() : void 0;
const thumbnailUrl = r121 ?? void 0;
const subtitleColor = subtitle !== "" ? colors.subtitleColor : void 0;
const channelName = channel != null ? computeChannelName(channel, UserStore, RelationshipStore) : void 0;
let type = a0.type;
if (type == null) {
type = InviteTypes.GUILD;
}
return {
...baseColors,
headerText,
headerColor: colors.headerColor,
acceptLabelText,
onlineText,
memberText,
channelIcon,
titleText,
titleColor: colors.titleColor,
thumbnailUrl,
thumbnailText,
subtitle,
subtitleColor,
acceptLabelBackgroundColor,
acceptLabelBorderColor: void 0,
acceptLabelColor,
embedCanBeTapped: true,
canBeAccepted: canAcceptInvite,
channelName,
type,
inviteSplash,
badgeIconUrl: r239 != null ? getAssetUriForEmbed(r239) : void 0
};
}
@@ -0,0 +1,210 @@
// Metro module 12361 (f12362).
import LocaleStore from "../../../../../../../user_settings/LocaleStore";
import { CodedLinkExtendedType } from "../CodedLinksConstants";
import { GuildFeatures } from "../../../../../../../../Constants";
import { InviteTypes } from "../../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../../getEmbedThemeColors";
import { buildGuildProfileFromInvite } from "../../../../../../../guild_profile/GuildProfileBuilders";
import { isThemeDark } from "../../../../../../../../design/shared";
import Module712 from "../../../../../../../../_bundle/Module712";
import { fromGuildProfile } from "../../../../../../../../utils/GuildRecordUtils";
import { getProfilePrimaryColor } from "../../../../../../../guild_profile/native/GuildProfileUtils";
import { getBackgroundForProfile } from "../../../../../../../guild_profile/native/components/GuildProfileView";
import AvatarUtils from "../../../../../../../../utils/AvatarUtils";
import { getAcronym } from "../../../../../../../../_bundle/Module1857";
import getDevicePixelRatio_native from "../../../../../../../../utils/getDevicePixelRatio.native";
import { intl, t } from "../../../../../../../../intl/index.native";
import { getGuildProfileCTAType, CTATypes } from "../../../../../../../guild_profile/hooks/useGuildProfileCTA";
import { getGuildBadgeImageSource } from "../../../../../../../guild_badge/native/GuildBadgeImageSource";
import { getEstablishedDate } from "../../../../../../../guild_profile/GuildProfileUtils";
import SnowflakeUtils from "../../../../../../../../utils/SnowflakeUtils";
import { sortInviteRoles, inviteRoleToDisplayData } from "../../../../../../../../utils/GuildRoleUtils";
import { getRoleIconData } from "../../../../../../../guild_boosting/RoleIconUtils";
import { int2hex } from "../../../../../../../../_bundle/int2hslRaw";
import { processColorOrThrow } from "../../../../RowGeneratorStyleSheet";
import { getAssetUriForEmbed } from "../../../../EmbedUtils";
export function createGuildProfileInvite(a0, a1) {
let r22, acceptLabelText, thumbnailText;
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
const r13 = buildGuildProfileFromInvite(a0);
const r15 = isThemeDark(a1) ? Module712.unsafe_rawColors.PRIMARY_660 : Module712.unsafe_rawColors.PRIMARY_160;
const r12 = r13 != null ? fromGuildProfile(r13) : null;
let r50 = getProfilePrimaryColor(r13);
if (r50 == null) {
r50 = r15;
}
const [r18, r17] = getBackgroundForProfile(a1, r50);
let count = r13?.memberCount;
if (count == null) {
count = a0.approximate_member_count;
}
let membersOnline = r13?.onlineCount;
if (membersOnline == null) {
membersOnline = a0.approximate_presence_count;
}
if (r13?.icon != null) {
r22 = AvatarUtils.getGuildIconURL({
id: r13.id,
icon: r13.icon,
canAnimate: true,
size: 128
});
thumbnailText = void 0;
} else {
let r64 = r13?.name;
if (r64 == null) {
r64 = "";
}
thumbnailText = getAcronym(r64);
r22 = void 0;
}
const r72 = r12 == null ? void 0 : r12.features.has(GuildFeatures.DISCOVERABLE);
let inviteSplash = void 0;
if (r72) {
const r80 = r13?.customBanner != null;
inviteSplash = void 0;
if (r80) {
let r91 = AvatarUtils.getGuildDiscoverySplashURL({
id: r13.id,
splash: r13.customBanner,
size: 400 * getDevicePixelRatio_native()
});
if (r91 == null) {
r91 = void 0;
}
inviteSplash = r91;
}
}
const r92 = count != null && count >= 5 || membersOnline != null && membersOnline > 0;
let memberText = void 0;
let onlineText = void 0;
if (r92) {
const r97 = membersOnline != null ? intl.formatToPlainString(t["LC+S+m"], {
membersOnline
}) : void 0;
memberText = count != null ? intl.formatToPlainString(t.zRl6XR, {
count
}) : void 0;
onlineText = r97;
}
const r117 = r13 != null ? getGuildProfileCTAType(r13, a0.code) : null;
if (CTATypes.IS_MEMBER === r117) {
acceptLabelText = intl.string(t.IRoQXr);
} else if (CTATypes.HAS_APPLICATION === r117) {
acceptLabelText = intl.string(t["4yfIDk"]);
} else if (CTATypes.APPLY_TO_JOIN === r117) {
acceptLabelText = intl.string(t["7XdMW2"]);
} else if (CTATypes.ACCEPT_ROLES === r117) {
acceptLabelText = intl.string(t.MMlhsr);
} else {
if (CTATypes.LURK_DISCOVERABLE !== r117) {
CTATypes.JOIN_VIA_INVITE;
}
acceptLabelText = intl.string(t.XpeFYr);
}
const r188 = r12 != null ? getGuildBadgeImageSource(r12, a1) : void 0;
const r192 = r13 == null;
let r193 = void 0;
if (!r192) {
const traits = r13.traits;
r193 = traits == null ? void 0 : traits.filter((trait) => trait != null && trait.label.trim().length > 0);
}
const establishedText = r13 != null ? intl.formatToPlainString(t.zb2Q56, {
createdAtDate: getEstablishedDate(SnowflakeUtils.extractTimestamp(r13.id), LocaleStore.locale)
}) : void 0;
const r221 = a0.roles != null;
let roles = void 0;
if (r221) {
const r226 = a0.roles.length > 0;
roles = void 0;
if (r226) {
const r228 = a0.guild != null;
roles = void 0;
if (r228) {
const id = a0.guild.id;
roles = [...a0.roles].sort(sortInviteRoles).map((item) => {
let r22 = getRoleIconData(inviteRoleToDisplayData(id, item), 16);
if (r22 == null) {
r22 = {};
}
const { customIconSrc, unicodeEmoji } = r22;
let color = item.color;
if (color == null) {
color = 0;
}
const r27 = int2hex(color);
const roleIcon = customIconSrc == null ? unicodeEmoji != null ? {
source: customIconSrc,
unicodeEmoji: unicodeEmoji?.surrogates,
name: item.name,
size: 16,
alt: intl.formatToPlainString(t["9+YWrE"], {
name: item.name
})
} : void 0 : {
source: customIconSrc,
unicodeEmoji: unicodeEmoji?.surrogates,
name: item.name,
size: 16,
alt: intl.formatToPlainString(t["9+YWrE"], {
name: item.name
})
};
return {
id: item.id,
name: item.name,
color: processColorOrThrow(r27),
roleIcon
};
});
}
}
}
const name = r13?.name;
const thumbnailUrl = r22 ?? void 0;
let bodyText = r13?.description;
if (bodyText == null) {
bodyText = "";
}
let type = a0.type;
if (type == null) {
type = InviteTypes.GUILD;
}
const r241 = {
...baseColors,
extendedType: CodedLinkExtendedType.GUILD_PROFILE_INVITE,
acceptLabelText,
onlineText,
memberText,
titleText: name,
thumbnailUrl,
thumbnailText,
bodyText,
embedCanBeTapped: true,
canBeAccepted: true,
type,
inviteSplash,
bannerColor: processColorOrThrow(r18),
bannerColorSecondary: processColorOrThrow(r17)
};
if (r193 == null) {
r193 = [];
}
let hasProfileOverflow = r193.length > 0;
if (!hasProfileOverflow) {
let r268 = r13?.gameApplicationIds;
if (r268 == null) {
r268 = [];
}
hasProfileOverflow = r268.length > 0;
}
r241.hasProfileOverflow = hasProfileOverflow;
r241.badgeIconUrl = r188 != null ? getAssetUriForEmbed(r188) : void 0;
r241.acceptLabelBackgroundColor = colors.acceptLabelGreenBackgroundColor;
r241.establishedText = establishedText;
r241.headerText = null;
r241.roles = roles;
r241.rolesHeadingText = roles != null ? roles.length > 0 ? intl.string(t.stcSfI) : void 0 : void 0;
return r241;
}
@@ -0,0 +1,174 @@
// Metro module 9498 (f9499).
import { processColor } from "react-native";
import AccessibilityStore from "../../../../../../../a11y/AccessibilityStore";
import VoiceChannelStartTimeStore from "../../../../../../../channel/VoiceChannelStartTimeStore";
import { getGuildIconSource } from "../../../../../../../../records/GuildRecord";
import ChannelStore from "../../../../../../../../stores/ChannelStore";
import GuildMemberStore from "../../../../../../../../stores/GuildMemberStore";
import GuildStore from "../../../../../../../../stores/GuildStore";
import PermissionStore from "../../../../../../../../stores/PermissionStore";
import RelationshipStore from "../../../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../../../stores/UserStore";
import VoiceStateStore from "../../../../../../../../stores/VoiceStateStore";
import SortedVoiceStateStore from "../../../../../../../../stores/views/SortedVoiceStateStore";
import { CodedLinkExtendedType } from "../CodedLinksConstants";
import { BasicPermissions } from "../../../../../../../../Constants";
import { InviteTypes } from "../../../../../../../instant_invite/Constants";
import getChannelAndRecipientsFromInvite from "./getChannelAndRecipientsFromInvite";
import getEmbedThemeColors from "../../getEmbedThemeColors";
import { getAssetUriForEmbed } from "../../../../EmbedUtils";
import AvatarUtils from "../../../../../../../../utils/AvatarUtils";
import UserUtils from "../../../../../../../../utils/UserUtils";
import { getEmbedScrollGradientBackground } from "../../../../../../../client_themes/native/ClientThemesUtils";
import { computeChannelName } from "../../../../../../../channel/useChannelName";
import { intl, t } from "../../../../../../../../intl/index.native";
import GuestUtils from "../../../../../../../guests/GuestUtils";
export function canShowVoiceChannelListInviteEmbed(a0) {
const r1 = a0.guild == null;
let r9 = null;
if (!r1) {
const guild2 = GuildStore.getGuild(a0.guild.id);
const r12 = guild2 == null;
r9 = null;
if (!r12) {
const channel = getChannelAndRecipientsFromInvite(a0).channel;
const r20 = channel == null;
r9 = null;
if (!r20) {
const isGuildVocal = channel.isGuildVocal();
r9 = null;
if (isGuildVocal) {
let channel2 = ChannelStore.getChannel(channel.id);
if (channel2 == null) {
channel2 = channel;
}
r9 = PermissionStore.canBasicChannel(BasicPermissions.VIEW_CHANNEL, channel2) ? {
guild: guild2,
channel: channel2
} : null;
}
}
}
}
return r9 != null;
}
export function createVoiceChannelListInviteEmbed(a0, a1) {
const r2 = a0.guild == null;
let r7 = null;
if (!r2) {
const guild2 = GuildStore.getGuild(a0.guild.id);
const r31 = guild2 == null;
r7 = null;
if (!r31) {
const channel2 = getChannelAndRecipientsFromInvite(a0).channel;
const r39 = channel2 == null;
r7 = null;
if (!r39) {
const isGuildVocal = channel2.isGuildVocal();
r7 = null;
if (isGuildVocal) {
let channel3 = ChannelStore.getChannel(channel2.id);
if (channel3 == null) {
channel3 = channel2;
}
r7 = PermissionStore.canBasicChannel(BasicPermissions.VIEW_CHANNEL, channel3) ? {
guild: guild2,
channel: channel3
} : null;
}
}
}
}
if (r7 == null) {
return null;
}
let displayNameStylesEnabled;
const { guild, channel } = r7;
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
const guildIcon = guild.icon != null ? getAssetUriForEmbed(getGuildIconSource(guild, 128, false)) : void 0;
const voiceStatesForChannelAlt = SortedVoiceStateStore.getVoiceStatesForChannelAlt(channel.id, guild.id);
const r83 = [...voiceStatesForChannelAlt.filter((item) => item.voiceState.selfStream), ...voiceStatesForChannelAlt.filter((item) => !item.voiceState.selfStream)].slice(0, 10);
displayNameStylesEnabled = AccessibilityStore.displayNameStylesEnabled;
const voiceUsers = r83.map((item) => {
let member = item.member;
if (member == null) {
member = GuildMemberStore.getMember(guild.id, item.user.id);
}
const r24 = member?.avatar != null ? AvatarUtils.getGuildMemberAvatarURLSimple({
guildId: guild.id,
userId: item.user.id,
avatar: member.avatar,
size: 24
}) : AvatarUtils.getUserAvatarURL(item.user, false, 24);
let avatarUrl = r24;
if (typeof avatarUrl === "number") {
avatarUrl = getAssetUriForEmbed(r24);
}
let fontId = void 0;
if (displayNameStylesEnabled) {
let r46 = member == null ? void 0 : member.displayNameStyles?.fontId;
if (r46 == null) {
r46 = item.user.displayNameStyles?.fontId;
}
fontId = r46;
}
let nick = item.nick;
if (nick == null) {
nick = UserUtils.getName(item.user);
}
let selfStream = item.voiceState.selfStream;
if (selfStream == null) {
selfStream = false;
}
return {
userId: item.user.id,
displayName: nick,
avatarUrl,
isStreaming: selfStream,
fontId
};
});
let voiceStartTimestamp = VoiceChannelStartTimeStore.getStartTime(channel);
if (voiceStartTimestamp == null) {
voiceStartTimestamp = void 0;
}
const currentClientVoiceChannelId = VoiceStateStore.getCurrentClientVoiceChannelId(guild.id);
const id = channel.id;
let r101 = getEmbedScrollGradientBackground();
if (r101 == null) {
r101 = void 0;
}
let backgroundColor = processColor(r101);
if (backgroundColor == null) {
backgroundColor = baseColors.backgroundColor;
}
const r95 = {
...baseColors,
backgroundColor,
extendedType: CodedLinkExtendedType.VOICE_CHANNEL_LIST_INVITE,
headerColor: colors.headerColor,
guildName: guild.name,
guildIcon,
headerText: "",
titleText: computeChannelName(channel, UserStore, RelationshipStore)
};
const titleColor = voiceStatesForChannelAlt.length > 0 ? colors.voiceActiveColor : colors.voiceMutedColor;
const isConnected = currentClientVoiceChannelId === id;
r95.titleColor = titleColor;
r95.acceptLabelText = intl.string(t.gpqgah);
r95.acceptLabelColor = colors.acceptLabelGreenColor;
r95.acceptLabelBackgroundColor = colors.acceptLabelGreenBackgroundColor;
r95.canBeAccepted = GuestUtils.canAcceptInvite([GuildMemberStore], a0);
r95.embedCanBeTapped = true;
r95.type = InviteTypes.GUILD;
r95.voiceUsers = voiceUsers;
r95.voiceStartTimestamp = voiceStartTimestamp;
r95.emptyStateText = intl.string(t.zSqdrS);
r95.streamingLabel = intl.string(t.dI3q4h).toUpperCase();
r95.voiceHeaderBackgroundColor = colors.voiceHeaderBackgroundColor;
r95.reducedMotion = AccessibilityStore.useReducedMotion;
r95.isConnected = isConnected;
r95.privacyHintText = intl.string(t.fkg9mQ);
return r95;
}
@@ -0,0 +1,12 @@
// Metro module 9501 (f9502).
import { createChannelRecordFromInvite } from "../../../../../../../../records/ChannelRecord";
export default function getChannelAndRecipientsFromInvite(a0) {
const recipients_ = a0.channel != null && a0.channel.recipients != null ? a0.channel.recipients.slice() : [];
return {
recipients_,
channel: a0.channel != null ? createChannelRecordFromInvite({
...a0.channel,
recipients: recipients_
}) : null
};
};
@@ -0,0 +1,36 @@
// Metro module 12360 (f12361).
import { useMemo } from "react";
import EmbeddedActivitiesStore from "../../../../../../activities/EmbeddedActivitiesStore";
import UserStore from "../../../../../../../stores/UserStore";
import { isNotNullish } from "../../../../../../../utils/GlobalUtils";
import { useStateFromStoresArray } from "../../../../../../../_bundle/defaultAreStatesEqual";
export default function useEmbeddedActivityParticipantAvatarUris({ activity, guildId }) {
let stateFromStoresArray;
stateFromStoresArray = void 0;
const memo = useMemo(() => {
const r4 = Array;
let r7 = activity?.userIds;
if (r7 == null) {
r7 = [];
}
return r4.from(r7);
}, [activity]);
stateFromStoresArray = useStateFromStoresArray([UserStore], () => memo.map((item) => UserStore.getUser(item)), [memo]);
return useMemo(() => stateFromStoresArray.filter(isNotNullish).map((item) => `${item.getAvatarURL(guildId, 64)}`), [guildId, stateFromStoresArray]);
};
export function getEmbeddedActivityParticipantAvatarUris(a0) {
const { channelId, guildId: guildId2, applicationId } = a0;
let activity2 = a0.activity;
if (activity2 == null) {
activity2 = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(channelId).find((item) => item.applicationId === applicationId);
}
const r16 = Array;
let r18 = activity2?.userIds;
if (r18 == null) {
r18 = [];
}
return r16.from(r18).map((item) => {
const user = UserStore.getUser(item);
return `${user == null ? void 0 : user.getAvatarURL(guildId2, 64)}`;
}).filter(isNotNullish);
}
@@ -0,0 +1,62 @@
// Metro module 7725 (f7726).
import { useMemo } from "react";
import { experimental_createToken, createNativeStyleProperties } from "../../../../../../design/components/Styles/native/createStyles";
import { isThemeDark } from "../../../../../../design/shared";
import Module712 from "../../../../../../_bundle/Module712";
import { hexWithOpacity } from "../../../../../../utils/ColorUtils";
let nativeStyleProperties;
const acceptLabelActiveBackgroundColor = experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_500 : Module712.unsafe_rawColors.PRIMARY_400);
const acceptLabelDisabledBackgroundColor = experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_600 : hexWithOpacity(Module712.unsafe_rawColors.PRIMARY_500, 0.3));
const acceptLabelDisabledBorderColor = experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_500 : Module712.unsafe_rawColors.PRIMARY_400);
const acceptLabelDisabledTextColor = experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_500 : Module712.unsafe_rawColors.PRIMARY_400);
const acceptLabelDisabledColor = experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_500 : Module712.unsafe_rawColors.PRIMARY_100);
nativeStyleProperties = createNativeStyleProperties({
acceptBlurpleLabelBackgroundColor: Module712.colors.BACKGROUND_BRAND,
acceptLabelGreenBackgroundColor: Module712.colors.CONTROL_CONNECTED_BACKGROUND_DEFAULT,
acceptLabelGreenColor: Module712.unsafe_rawColors.WHITE,
backgroundColor: Module712.colors.MOBILE_EMBED_BACKGROUND_DEFAULT,
bodyTextColor: Module712.colors.TEXT_DEFAULT,
clearLabelRedBackgroundColor: Module712.unsafe_rawColors.RED_400,
clearLabelRedColor: Module712.unsafe_rawColors.WHITE,
headerColor: Module712.colors.TEXT_SUBTLE,
subtitleColor: Module712.colors.TEXT_SUBTLE,
titleColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
acceptLabelActiveBackgroundColor,
acceptLabelDisabledBackgroundColor,
acceptLabelDisabledBorderColor,
acceptLabelDisabledTextColor,
acceptLabelDisabledColor,
borderColor: experimental_createToken((a0) => isThemeDark(a0.theme) ? hexWithOpacity(Module712.unsafe_rawColors.WHITE, 0.06) : hexWithOpacity(Module712.unsafe_rawColors.PRIMARY_860, 0.08)),
resolvingGradientEnd: experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_600 : Module712.unsafe_rawColors.PRIMARY_100),
resolvingGradientStart: experimental_createToken((a0) => isThemeDark(a0.theme) ? "#666b73" : Module712.unsafe_rawColors.PRIMARY_300),
thumbnailBackgroundColor: experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_600 : hexWithOpacity(Module712.unsafe_rawColors.PRIMARY_200, 0.3)),
voiceActiveColor: Module712.colors.TEXT_FEEDBACK_POSITIVE,
voiceHeaderBackgroundColor: Module712.colors.BACKGROUND_MOD_MUTED,
voiceMutedColor: Module712.colors.TEXT_MUTED
});
export default function getEmbedThemeColors(a0) {
const colors = nativeStyleProperties(a0);
return {
colors,
baseColors: {
borderColor: colors.borderColor,
backgroundColor: colors.backgroundColor,
thumbnailCornerRadius: 15,
headerColor: colors.headerColor
}
};
};
export function useEmbedThemeColors(a0) {
return useMemo(() => {
const colors = nativeStyleProperties(a0);
return {
colors,
baseColors: {
borderColor: colors.borderColor,
backgroundColor: colors.backgroundColor,
thumbnailCornerRadius: 15,
headerColor: colors.headerColor
}
};
}, [a0]);
}
@@ -0,0 +1,193 @@
// Metro module 8012 (f8013).
import { processColor } from "react-native";
import UserRecord from "../../../../../../records/UserRecord";
import ChannelStore from "../../../../../../stores/ChannelStore";
import UserStore from "../../../../../../stores/UserStore";
import { MessageTypes } from "../../../../../../Constants";
import { ensureAvatarSource } from "../../../../../../utils/native/AvatarUtils";
import AvatarUtils2 from "../../../../../../utils/AvatarUtils";
import { getUserAuthor } from "../../../../useMessageAuthor";
import * as _ApplicationInteractionInfoUtils from "../../../../../applications/ApplicationInteractionInfoUtils";
import Module712 from "../../../../../../_bundle/Module712";
import { getInitialInteractionMetadata } from "../../../../../application_commands/ApplicationCommandUtils";
import { InteractionTypes } from "../../../../../../flow/Server";
import * as _EnhancedRoleColorUtils from "../../../../../premium/enhanced_role_colors/native/EnhancedRoleColorUtils";
import { processColorStrings } from "../../../../../premium/enhanced_role_colors/native/EnhancedRoleColorUtils";
import { isActivitiesInTextEnabled } from "../../../../../activities/ActivitiesInTextUtils";
import { intl, t } from "../../../../../../intl/index.native";
import { formatPrimaryEntryPointCommandName } from "../../../../../app_launcher/utils/AppLauncherUtils";
export function createExecutedCommand(a0, a1, a2, a3, a4) {
let r202, SSrolr, commandNameOnClick, content;
const r4 = a0.activityInstance != null && a0.activityInstance !== void 0;
L5: {
if (a0.interaction != null) {
if (a0.interaction.displayName === "" && !r4) {
break L5;
}
const user = UserStore.getUser(a0.interaction?.user?.id);
const r44 = user != null;
let avatarURL = void 0;
if (r44) {
const guildMemberAvatar = getUserAuthor(user, a1 == null ? ChannelStore.getChannel(a0.getChannelId()) : a1).guildMemberAvatar;
const guildId = a1 == null ? void 0 : a1.getGuildId();
avatarURL = ensureAvatarSource(guildMemberAvatar != null && guildId != null ? AvatarUtils2.getGuildMemberAvatarSource({
userId: user.id,
avatar: guildMemberAvatar,
guildId
}, user) : user.getAvatarSource(void 0)).uri;
}
const r3 = a0.type === MessageTypes.CHAT_INPUT_COMMAND || a0.type === MessageTypes.INTERACTION_PREMIUM_UPSELL;
const isPrimaryEntryPointCommandMessage = _ApplicationInteractionInfoUtils.isPrimaryEntryPointCommandMessage(a0);
const userAuthor = getUserAuthor(a0.interaction.user, a1);
const { colorString: colorString2, colorStrings: colorStrings2 } = userAuthor;
const displayName = a0.interaction.displayName;
const r94 = Module712.internal.resolveSemanticColor(a3, Module712.colors.MENTION_BACKGROUND);
const initialInteractionMetadata = getInitialInteractionMetadata(a0);
const r105 = initialInteractionMetadata?.type === InteractionTypes.APPLICATION_COMMAND ? initialInteractionMetadata.target_user != null ? new UserRecord(initialInteractionMetadata.target_user) : null : null;
const userAuthor2 = getUserAuthor(r105, a1);
const { colorString, colorStrings } = userAuthor2;
const r118 = a2 === "username";
let linkColor = a4;
if (r118) {
let r123 = processColor(colorString == null ? void 0 : colorString);
if (r123 == null) {
r123 = a4;
}
linkColor = r123;
}
let linkColor2 = a4;
if (r118) {
let r127 = processColor(colorString2 == null ? void 0 : colorString2);
if (r127 == null) {
r127 = a4;
}
linkColor2 = r127;
}
const r129 = a1 == null ? void 0 : a1.getGuildId();
const id = a0.interaction.user.id;
const isNativeMessageEligibleForEnhancedRoleColors = _EnhancedRoleColorUtils.isNativeMessageEligibleForEnhancedRoleColors(r129, id);
const isNativeMessageEligibleForEnhancedRoleColors2 = _EnhancedRoleColorUtils.isNativeMessageEligibleForEnhancedRoleColors(r129, r105?.id);
const roleColors = isNativeMessageEligibleForEnhancedRoleColors ? processColorStrings(colorStrings2) : null;
const roleColors2 = isNativeMessageEligibleForEnhancedRoleColors2 ? processColorStrings(colorStrings) : null;
const r157 = {
username: getUserAuthor(a0.interaction.user, a1).nick,
usernameOnClick: null
};
let r161 = colorString2;
if (r161 == null) {
r161 = void 0;
}
let roleColor = processColor(r161);
if (roleColor == null) {
roleColor = null;
}
const usernameOnClick = {
name: "usernameOnClick",
action: "bindUserMenu",
userId: id,
messageChannelId: a0.channel_id,
linkColor: linkColor2,
roleColor,
roleColors,
shouldShowRoleDot: null
};
let shouldShowRoleDot2 = a2 === "dot";
const shouldShowRoleDot = shouldShowRoleDot2 ? colorString2 != null : shouldShowRoleDot2;
L76: {
usernameOnClick.shouldShowRoleDot = shouldShowRoleDot;
r157.usernameOnClick = usernameOnClick;
if (r4 && !isPrimaryEntryPointCommandMessage) {
if (isActivitiesInTextEnabled(a1)) {
content = intl.formatToParts(t["R/mrBi"], {
...r157,
activityTextOnClick: {
action: "bindTapActivityText",
applicationUserId: a0.author.id,
messageChannelId: a0.channel_id
}
});
break L76;
}
content = intl.formatToParts(t.k964Wm, {
...r157
});
} else {
const commandName = isPrimaryEntryPointCommandMessage ? formatPrimaryEntryPointCommandName(displayName) : displayName;
L66: {
L64: {
SSrolr = t.SSrolr;
r202 = {
...r157,
commandName
};
if (a1 != null) {
if (!r3 && !isPrimaryEntryPointCommandMessage) {
break L64;
}
commandNameOnClick = {
name: "commandNameOnClick",
action: "bindTapCommandName",
userId: a0.interaction.user.id,
messageId: a0.id,
applicationUserId: a0.author.id,
messageType: a0.type,
messageChannelId: a0.channel_id
};
break L66;
}
}
commandNameOnClick = {};
}
r202.commandNameOnClick = commandNameOnClick;
content = intl.formatToParts(SSrolr, r202);
if (r105 != null) {
const mqKdCM = t.mqKdCM;
const r224 = {
...r157,
commandName,
commandNameOnClick: {},
targetUsername: getUserAuthor(r105, a1).nick
};
const id2 = r105?.id;
let r238 = colorString;
if (r238 == null) {
r238 = void 0;
}
let roleColor2 = processColor(r238);
if (roleColor2 == null) {
roleColor2 = null;
}
if (shouldShowRoleDot2) {
shouldShowRoleDot2 = colorString != null;
}
r224.targetUsernameOnClick = {
name: "targetUsernameOnClick",
action: "bindUserMenu",
userId: id2,
messageChannelId: a0.channel_id,
linkColor,
roleColor: roleColor2,
roleColors: roleColors2,
shouldShowRoleDot: shouldShowRoleDot2
};
content = intl.formatToParts(mqKdCM, r224);
}
}
}
return {
userId: a0.interaction.user.id,
username: r157.username,
usernameColor: linkColor2,
avatarURL,
targetUsernameColor: linkColor,
content,
commandNameBackgroundStyles: {
color: processColor(r94),
borderRadius: 4,
spaceAround: true
},
showAppsIcon: true
};
}
}
}
@@ -0,0 +1,50 @@
// Metro module 7992 (f7993).
import { getInteractionStatusViewState, InteractionStatusViewState } from "../../../../../interactions/InteractionUtils";
import { intl, t } from "../../../../../../intl/index.native";
let c5057_2 = {
LOADING: 0,
0: "LOADING",
FAILED: 1,
1: "FAILED",
EPHEMERAL_SUCCESS: 999,
999: "EPHEMERAL_SUCCESS"
};
export function createInteractionStatus(a0, a1) {
const interactionStatusViewState = getInteractionStatusViewState(a0, a1);
if (InteractionStatusViewState.SENDING === interactionStatusViewState) {
return {
text: intl.string(t.RiLfBY),
state: c5057_2.LOADING
};
}
if (InteractionStatusViewState.CREATED === interactionStatusViewState) {
return {
text: intl.formatToPlainString(t["7ePV4t"], {
applicationName: a0.author.username
}),
state: c5057_2.LOADING
};
}
if (InteractionStatusViewState.TIMED_OUT === interactionStatusViewState) {
return {
text: intl.string(t.h8hzPd),
state: c5057_2.FAILED
};
}
if (InteractionStatusViewState.FAILED === interactionStatusViewState) {
let interactionError = a0.interactionError;
if (interactionError == null) {
interactionError = intl.string(t.VCsUJu);
}
return {
text: interactionError,
state: c5057_2.FAILED
};
}
if (InteractionStatusViewState.EPHEMERAL_SUCCESS === interactionStatusViewState) {
return {
text: "",
state: c5057_2.EPHEMERAL_SUCCESS
};
}
}
@@ -0,0 +1,43 @@
// Metro module 7716 (f7717).
import { SeparatorAction } from "../RowGeneratorConstants";
import { UNSAFE_Colors } from "../../../../../_bundle/Module505";
import { memoize } from "../../../../../_bundle/Module12";
import { isThemeDark } from "../../../../../design/shared";
import Module712 from "../../../../../_bundle/Module712";
import { hexWithOpacity } from "../../../../../utils/ColorUtils";
import { processColorOrThrow } from "../RowGeneratorStyleSheet";
let c4849_5 = memoize((a0) => {
const r9 = isThemeDark(a0) ? Module712.unsafe_rawColors.PRIMARY_700 : "#DBE0E4";
const r8 = isThemeDark(a0) ? Module712.unsafe_rawColors.PRIMARY_630 : "#FAFAFA";
const r30 = isThemeDark(a0) ? hexWithOpacity(Module712.unsafe_rawColors.PRIMARY_300, 0.6) : UNSAFE_Colors.GREY1;
return {
borderColor: processColorOrThrow(r9),
backgroundColor: processColorOrThrow(r8),
color: processColorOrThrow(r30)
};
});
export function generateBlockedGroupRowData(a0, a1, c15997_0) {
const { changeType, message, content, text, revealed } = a0;
let context = a0.context;
const rowType = a0.rowType;
const canUncollapse = !("canUncollapse" in a0) || a0.canUncollapse;
const r18 = {
...c4849_5(a1),
type: rowType,
content: content.map((item) => c15997_0.generate(item))
};
if (context == null) {
context = message.id;
}
r18.button = {
action: {
type: SeparatorAction.TOGGLE_BLOCKED_MESSAGES,
context
}
};
r18.changeType = changeType;
r18.text = text;
r18.revealed = revealed;
r18.canUncollapse = canUncollapse;
return r18;
}
@@ -0,0 +1,27 @@
// Metro module 12394 (f12395).
import { LoadingType, RowType, SeparatorAction } from "../RowGeneratorConstants";
import { createNativeStyleProperties } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
const nativeStyleProperties = createNativeStyleProperties({
loadButtonBackgroundColor: Module712.colors.CONTROL_SECONDARY_BACKGROUND_DEFAULT,
loadButtonColor: Module712.colors.CONTROL_SECONDARY_TEXT_DEFAULT,
loadingColor: Module712.colors.ICON_SUBTLE
});
export function generateLoadingRowData({ rowType, changeType, text, isLoading }, a1) {
const r10 = nativeStyleProperties(a1);
return {
type: RowType.LOADING,
id: rowType,
button: {
action: {
type: rowType === LoadingType.LOAD_BEFORE ? SeparatorAction.LOAD_MORE_BEFORE : SeparatorAction.LOAD_MORE_AFTER
},
backgroundColor: r10.loadButtonBackgroundColor,
cornerRadius: 4,
text
},
color: isLoading ? r10.loadingColor : r10.loadButtonColor,
changeType,
isLoading
};
}
@@ -0,0 +1,49 @@
// Metro module 12393 (f12394).
import { RowType, SeparatorType } from "../RowGeneratorConstants";
import { createNativeStyleProperties } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { isMobileVisualRefreshEnabled } from "../../../../themes/experiments/MobileVisualRefreshExperiment";
import { assertNever } from "../../../../../utils/GlobalUtils";
const nativeStyleProperties = createNativeStyleProperties({
dayColor: Module712.colors.TEXT_MUTED,
unreadTextColor: Module712.colors.MOBILE_CHAT_NEW_MESSAGE_TEXT,
unreadBorderColor: Module712.colors.MOBILE_CHAT_NEW_MESSAGE_BORDER,
summaryColor: Module712.colors.TEXT_BRAND
});
export function generateSeparatorRowData(a0, a1) {
const { rowType, changeType } = a0;
const r11 = nativeStyleProperties(a1);
if (SeparatorType.DAY === rowType) {
return {
type: RowType.SEPARATOR,
id: rowType,
color: r11.dayColor,
text: a0.text,
changeType
};
}
if (SeparatorType.UNREAD === rowType) {
const text = a0.text;
return {
type: RowType.SEPARATOR,
id: rowType,
color: r11.unreadTextColor,
borderColor: isMobileVisualRefreshEnabled("Separator") ? r11.unreadBorderColor : void 0,
changeType,
text
};
}
if (SeparatorType.SUMMARY === rowType) {
const summary = a0.summary;
return {
type: RowType.SEPARATOR,
id: rowType,
color: r11.summaryColor,
text: summary.topic,
summary,
isBeforeContent: a0.isBeforeContent,
changeType
};
}
assertNever(rowType);
}
@@ -0,0 +1,17 @@
// Metro module 7885 (f7886).
export function sanitizeMediaDimension(a0) {
let r7;
L4: {
if (typeof a0 === "number") {
const isFinite2 = Number.isFinite(a0);
r7 = 0;
if (!isFinite2) {
break L4;
}
r7 = a0 < 0 ? 0 : a0;
} else {
r7 = a0;
}
}
return r7;
}
Loaded 100 of 33051 files, more files were not shown because too many files have changed in this diff. Show more