decord/source/components_native/common/ChatPreview.tsx

557 lines
24 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 8754
// Function ID: 8755
2026-07-29 08:29:29 +00:00
// Name: componentDidMount
2026-08-25 06:04:03 +00:00
// Dependencies: [19, 17, 4372, 4090, 1391, 1922, 8193, 21, 4380, 712, 4108, 8755, 8192, 8757, 11520, 4067, 1236, 11101, 11095, 12, 4391, 11165, 11144, 11107, 4633, 1892, 11205, 8231, 8760, 7367, 11106, 11108, 11143, 11045, 12223, 11454, 500, 5434, 4949, 4376, 4070, 589, 1494, 6053, 4619, 2]
2026-07-29 08:29:29 +00:00
// Exports: ChatPreview
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 8754 (componentDidMount)
2026-08-24 06:08:38 +00:00
import set from "set" /* 500 */;
import ThemesDefault from "Themes" /* 712 */;
import useWindowDimensionsDefault from "useWindowDimensions" /* 1494 */;
2026-08-25 06:04:03 +00:00
import Text from "Text" /* 4376 */;
import PressableBase from "PressableBase" /* 4949 */;
import setOptionsDefault from "setOptions" /* 8192 */;
import getPreviousMessagesDefault from "getPreviousMessages" /* 8755 */;
import GuildNSFWDefault from "GuildNSFW" /* 11045 */;
import DCDChatListDefault from "DCDChatList" /* 11454 */;
import ChannelSpoilerDefault from "ChannelSpoiler" /* 12223 */;
2026-08-24 06:08:38 +00:00
import importAllResult from "noop" /* 19 */;
import get_ActivityIndicator from "get ActivityIndicator" /* 17 */;
2026-08-25 06:04:03 +00:00
import closure_6 from "maybeApplyNoTextColorForLightCustomTheme" /* 4372 */;
import closure_7 from "setContent" /* 4090 */;
2026-08-24 06:08:38 +00:00
import closure_8 from "ensureGuildLoaded" /* 1391 */;
import closure_9 from "mergeGuildAvatar" /* 1922 */;
2026-08-25 06:04:03 +00:00
import Changeset from "Changeset" /* 8193 */;
2026-08-24 06:08:38 +00:00
import jsxProd from "jsxProd" /* 21 */;
2026-08-25 06:04:03 +00:00
import createCacheKey from "createCacheKey" /* 4380 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
let c4 = importAllResult;
({ View: c5, StyleSheet } = get_ActivityIndicator);
({ Changeset: c10, RowType: unpackModuleId, SeparatorType: closure_12 } = Changeset);
({ jsx: map1, jsxs: closure_14 } = jsxProd);
createCacheKey = { chat: { flex: 1, overflow: "hidden" }, containerInner: null, jumpToChatButtonContainer: null, jumpToChatButton: null, jumpToChatText: null };
2026-08-24 06:08:38 +00:00
createCacheKey = { flex: 1, backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOW };
2026-07-29 08:29:29 +00:00
createCacheKey[1] = createCacheKey;
2026-08-24 06:08:38 +00:00
createCacheKey[2] = { flexShrink: 0, backgroundColor: ThemesDefault.colors.BACKGROUND_SURFACE_HIGH };
let obj1 = { flexShrink: 0, backgroundColor: ThemesDefault.colors.BACKGROUND_SURFACE_HIGH };
createCacheKey[3] = { height: 44, borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: ThemesDefault.colors.BORDER_SUBTLE };
2026-07-29 08:29:29 +00:00
createCacheKey[4] = { textAlign: "center", flex: 1, lineHeight: 44 };
2026-08-24 06:08:38 +00:00
let closure_15 = createCacheKey.createLegacyClassComponentStyles(createCacheKey);
2026-07-29 08:29:29 +00:00
const PureComponent = importAllResult.PureComponent;
class ChatPreviewBase extends PureComponent {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
closure_0 = applyArgumentsResult;
tmp3 = new require("getPreviousMessages")();
applyArgumentsResult.chatManager = tmp3;
tmp4 = new require("setOptions")();
applyArgumentsResult.rowGenerator = tmp4;
applyArgumentsResult.chatRef = closure_4.createRef();
applyArgumentsResult.didPositionInitialScroll = false;
applyArgumentsResult.handleCompleteFirstLayout = function handleCompleteFirstLayout() {
if (tmp2) {
tmp.didPositionInitialScroll = true;
2026-08-24 06:08:38 +00:00
applyArgumentsResult(closure_1_3[13]).scrollToTopMessage(tmp.chatRef, tmp.chatManager);
const obj = applyArgumentsResult(closure_1_3[13]);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
applyArgumentsResult.setup = function setup() {
let flag = arg0;
if (arg0 === undefined) {
flag = false;
}
messages = undefined;
let roleStyle;
2026-08-24 06:08:38 +00:00
closure_3 = undefined;
2026-07-29 08:29:29 +00:00
let map;
let items;
let items1;
const props = applyArgumentsResult.props;
({ channel: c0, messages } = props);
roleStyle = props.roleStyle;
if (null != messages) {
const rowGenerator2 = tmp2.rowGenerator;
let obj = { renderEmbeds: null, inlineEmbedMedia: null, inlineAttachmentMedia: null, constrainedWidth: null };
obj[0] = tmp6;
obj[1] = tmp5;
obj[2] = tmp4;
obj[3] = tmp2.props.width;
rowGenerator2.setOptions(obj);
const chatManager5 = tmp2.chatManager;
chatManager5.setup(messages);
closure_3 = flag ? tmp31.UPDATE : tmp31.NOOP;
const chatManager = tmp2.chatManager;
const previousMessages = chatManager.getPreviousMessages();
const _Array = Array;
map = null;
if (Array.isArray(previousMessages)) {
const _Map = Map;
map = new Map(previousMessages.map((id) => {
2026-08-24 06:08:38 +00:00
items = [id.id, id];
2026-07-29 08:29:29 +00:00
return items;
}));
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
items = [];
let item = messages.forEach((props) => {
let arr = items;
const first = items[0];
if (null != first) {
2026-08-25 06:04:03 +00:00
if (messages(11520)(c0, first[first.length - 1], props)) {
2026-07-29 08:29:29 +00:00
items = [props];
arr = arr.unshift(items);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
arr = first.unshift(props);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
items1 = [props];
2026-07-29 08:29:29 +00:00
arr.unshift(items1);
}
});
items1 = [];
let item1 = items.forEach((arr) => {
2026-08-24 06:08:38 +00:00
let obj2 = tmp;
2026-07-29 08:29:29 +00:00
let isSameDayResult = items[items.length - 1] === arr;
2026-08-24 06:08:38 +00:00
messages = false;
2026-07-29 08:29:29 +00:00
let timestamp = null;
if (!isSameDayResult) {
timestamp = tmp2[arg1 + 1][0].timestamp;
}
if (!isSameDayResult) {
isSameDayResult = null == timestamp;
}
if (!isSameDayResult) {
2026-08-25 06:04:03 +00:00
let obj = _undefined(4067);
2026-07-29 08:29:29 +00:00
isSameDayResult = obj.isSameDay(tmp.timestamp, timestamp);
}
let flag = false;
if (!isSameDayResult) {
messages = true;
flag = true;
}
arr = items1;
let tmp8 = items1[items1.length - 1];
2026-08-24 06:08:38 +00:00
obj = { roleStyle, rowType: closure_1_11.BLOCKED_GROUP, changeType: dependencyMap, message: tmp, isFirst: true, content: [], text: "", revealed: false };
2026-07-29 08:29:29 +00:00
if (arr[arr.length - 1].blocked) {
if (!tmp25) {
obj = {};
const merged = Object.assign(obj);
obj.rowType = tmp10.BLOCKED_GROUP;
arr = arr.push(obj);
tmp8 = obj;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
obj2 = tmp8;
2026-07-29 08:29:29 +00:00
const item = arr.forEach((message) => {
2026-08-24 06:08:38 +00:00
const content = obj2.content;
content.unshift({ rowType: closure_3_11.MESSAGE, changeType: closure_3_10.NOOP, roleStyle, message, isFirst: message === obj2 });
2026-07-29 08:29:29 +00:00
});
tmp8.revealed = tmp.id === messages.revealedMessageId;
tmp8.context = tmp.id;
const intl2 = _undefined(1236).intl;
2026-08-24 06:08:38 +00:00
obj1 = { count: null };
2026-07-29 08:29:29 +00:00
obj1[0] = tmp8.content.length;
tmp8.text = intl2.formatToPlainString(_undefined(1236).t["+FcYM/"], obj1);
tmp25 = null != tmp8 && tmp8.rowType === tmp10.BLOCKED_GROUP;
} else if (tmp.ignored) {
let tmp14 = tmp8;
if (!tmp13) {
2026-08-24 06:08:38 +00:00
obj2 = {};
2026-07-29 08:29:29 +00:00
const merged1 = Object.assign(obj);
obj2.rowType = tmp10.IGNORED_GROUP;
arr = arr.push(obj2);
tmp14 = obj2;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
obj2 = tmp14;
2026-07-29 08:29:29 +00:00
const item1 = arr.forEach((message) => {
2026-08-24 06:08:38 +00:00
const content = obj2.content;
content.unshift({ rowType: closure_3_11.MESSAGE, changeType: closure_3_10.NOOP, roleStyle, message, isFirst: message === obj2 });
2026-07-29 08:29:29 +00:00
});
tmp14.revealed = tmp.id === messages.revealedMessageId;
tmp14.context = tmp.id;
const intl = _undefined(1236).intl;
const obj3 = { count: null };
obj3[0] = tmp14.content.length;
tmp14.text = intl.formatToPlainString(_undefined(1236).t["VFWjc+"], obj3);
tmp13 = null != tmp8 && tmp8.rowType === tmp10.IGNORED_GROUP;
} else {
const item2 = arr.forEach((id) => {
2026-08-24 06:08:38 +00:00
let obj = closure_1_4;
if (null != closure_1_4) {
2026-07-29 08:29:29 +00:00
if (obj.get(id.id) !== id) {
2026-08-24 06:08:38 +00:00
let UPDATE = closure_2_10.UPDATE;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { roleStyle: null, rowType: null, changeType: null, message: null, isFirst: null, isEditing: false, separatorBefore: null };
2026-08-24 06:08:38 +00:00
obj[0] = closure_1_2;
obj[1] = closure_2_11.MESSAGE;
2026-07-29 08:29:29 +00:00
obj[2] = UPDATE;
obj[3] = id;
2026-08-24 06:08:38 +00:00
obj[4] = id === obj2;
let tmp6 = id === obj2;
2026-07-29 08:29:29 +00:00
if (tmp6) {
tmp6 = c1;
}
obj[6] = tmp6;
2026-08-24 06:08:38 +00:00
closure_1_6.push(obj);
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
UPDATE = closure_1_3;
2026-07-29 08:29:29 +00:00
});
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (flag) {
const obj4 = { roleStyle: null, rowType: null, changeType: null, text: null };
obj4[0] = roleStyle;
2026-08-24 06:08:38 +00:00
obj4[1] = closure_1_12.DAY;
2026-07-29 08:29:29 +00:00
obj4[2] = dependencyMap;
2026-08-25 06:04:03 +00:00
obj4[3] = _undefined(4067).dateFormat(tmp.timestamp, "LL");
2026-07-29 08:29:29 +00:00
arr.push(obj4);
2026-08-25 06:04:03 +00:00
const obj8 = _undefined(4067);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
});
for (const item10042 of items1) {
let tmp17 = applyArgumentsResult;
let tmp18 = applyArgumentsResult;
({ chatManager: chatManager2, rowGenerator } = applyArgumentsResult);
let row = chatManager2.createRow(rowGenerator.generate(item10042));
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = applyArgumentsResult;
const chatManager3 = applyArgumentsResult.chatManager;
const chatManager4 = applyArgumentsResult.chatManager;
const changeset = chatManager3.createChangeset();
const jumpTargetId = tmp3.jumpTargetId;
let tmp23;
if (!tmp7) {
2026-08-25 06:04:03 +00:00
obj = { rows: null, scrollToMessageId: null, jumpTargetId: null, jumpType: "PX_16", shouldInitialScroll: "Array", animated: "4.8.0", scrollPosition: null, focusTargetId: 60 };
2026-07-29 08:29:29 +00:00
obj[0] = tmp22;
obj[1] = jumpTargetId;
obj[2] = jumpTargetId;
2026-08-24 06:08:38 +00:00
tmp23 = closure_1_1(closure_1_3[17])(obj);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.updateContent(changeset, tmp23);
const tmp20 = applyArgumentsResult;
}
};
applyArgumentsResult.updateContent = function updateContent(changeset, arg1) {
const current = applyArgumentsResult.chatRef.current;
if (null != current) {
2026-08-24 06:08:38 +00:00
let obj = closure_1_1(closure_1_3[18]);
2026-07-29 08:29:29 +00:00
obj = { rows: null, isLoadingAtTop: false, scrollData: null };
obj[0] = changeset;
obj[2] = arg1;
obj.updateRows(current, obj);
}
};
applyArgumentsResult.getMessage = function getMessage(arg0) {
2026-08-24 06:08:38 +00:00
return closure_1_1(closure_1_3[19]).find(arg0.props.messages, (id) => id.id === closure_0 || id.nonce === closure_0);
2026-07-29 08:29:29 +00:00
};
applyArgumentsResult.handleJumpToChat = function handleJumpToChat() {
({ channelId: closure_0, jumpToChatProps } = applyArgumentsResult.props);
const jumpTargetId = jumpToChatProps.jumpTargetId;
const onBeforeJumpToMessage = jumpToChatProps.onBeforeJumpToMessage;
if (onBeforeJumpToMessage != null) {
const result = onBeforeJumpToMessage("footer_cta");
}
if (null != jumpTargetId) {
const resolved = Promise.resolve();
resolved.then(() => {
2026-08-24 06:08:38 +00:00
closure_1_0(closure_1_3[20]).transitionToMessage(closure_0, jumpTargetId, { navigationReplace: true });
2026-07-29 08:29:29 +00:00
});
}
};
applyArgumentsResult.handleTapLink = function handleTapLink(nativeEvent) {
nativeEvent = nativeEvent.nativeEvent;
const data = nativeEvent.data;
if ("bindJumpToMessage" === data.action) {
if (null != data.targetChannelId) {
if (null != data.targetMessageId) {
let jumpToChatProps = applyArgumentsResult.props.jumpToChatProps;
let onBeforeJumpToMessage = jumpToChatProps.onBeforeJumpToMessage;
if (onBeforeJumpToMessage != null) {
let result = onBeforeJumpToMessage("message_link");
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
applyArgumentsResult(closure_1_3[20]).transitionToMessage(data.targetChannelId, data.targetMessageId, { navigationReplace: true });
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
let obj = applyArgumentsResult(closure_1_3[21]);
2026-08-25 06:04:03 +00:00
obj = { allowWithinModal: true, chatInputRef: "a", handleTransitionToThread: "Array", message: 0, messageChannel: "asc", selectedChannelId: "asc", tapLinkData: "isInRestrictedHours" };
2026-07-29 08:29:29 +00:00
obj[2] = function handleTransitionToThread(arg0, arg1, arg2) {
const jumpToChatProps = props.props.jumpToChatProps;
const onBeforeJumpToMessage = jumpToChatProps.onBeforeJumpToMessage;
if (onBeforeJumpToMessage != null) {
const result = onBeforeJumpToMessage("thread_link");
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const channel = closure_1_8.getChannel(arg1);
2026-07-29 08:29:29 +00:00
if (null != channel) {
2026-08-24 06:08:38 +00:00
let obj = closure_1_0(closure_1_3[20]);
2026-07-29 08:29:29 +00:00
obj = { source: null, navigationReplace: true };
obj[0] = arg2;
obj.transitionToThread(channel, obj);
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
obj[3] = applyArgumentsResult.getMessage(data.messageId);
let channel = applyArgumentsResult.props.channel;
obj[4] = channel;
obj[6] = nativeEvent;
const result1 = obj.handleMessagesTapLink(obj);
};
applyArgumentsResult.handleLongPressLink = function handleLongPressLink(nativeEvent) {
const url = nativeEvent.nativeEvent.url;
let hasActionSheetOpen = applyArgumentsResult.props.hasActionSheetOpen;
if (!hasActionSheetOpen) {
hasActionSheetOpen = null == url;
}
if (!hasActionSheetOpen) {
hasActionSheetOpen = "" === url;
}
if (!hasActionSheetOpen) {
const obj = { urlString: null };
obj[0] = url;
2026-08-24 06:08:38 +00:00
closure_1_1(closure_1_3[22])(obj);
2026-07-29 08:29:29 +00:00
}
};
applyArgumentsResult.handleLongPressMessage = function handleLongPressMessage(closure_0) {
2026-08-24 06:08:38 +00:00
let obj = applyArgumentsResult(closure_1_3[23]);
2026-07-29 08:29:29 +00:00
const nativeSyntheticEventData = obj.getNativeSyntheticEventData(closure_0);
({ mediaIndex, mediaType, componentMediaIndex } = nativeSyntheticEventData);
const props = applyArgumentsResult.props;
const channel = props.channel;
if (!props.hasActionSheetOpen) {
const message = obj2.getMessage(tmp4);
if (null != message) {
2026-08-24 06:08:38 +00:00
const user = closure_1_9.getUser(message.author.id);
2026-07-29 08:29:29 +00:00
if (null != user) {
let tmpResult = tmp(tmp2[13]);
tmpResult = tmp(tmp2[24]);
const longPressSelectedMedia = tmpResult.getLongPressSelectedMedia(message, mediaIndex, mediaType, tmpResult.asComponentId(tmp5), componentMediaIndex);
2026-08-24 06:08:38 +00:00
const result = closure_1_2(tmp2[25]).dismissGlobalKeyboard();
const obj5 = closure_1_2(tmp2[25]);
2026-07-29 08:29:29 +00:00
obj = { actionSheetSource: "Preview", analyticsLocation: null, canAddNewReactions: null, channel: null, message: null, selectedMedia: null, user: null };
obj[1] = obj2.props.analyticsLocation;
let tmp9 = true === tmp6;
if (tmp9) {
tmp9 = null != channel;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp9) {
2026-08-24 06:08:38 +00:00
tmp9 = closure_1_1(tmp2[27])(channel);
2026-07-29 08:29:29 +00:00
}
obj[2] = tmp9;
obj[3] = channel;
obj[4] = message;
obj[5] = longPressSelectedMedia;
obj[6] = user;
const result1 = tmp(tmp2[26]).showLongPressMessageActionSheet(obj);
const tmpResult1 = tmp(tmp2[26]);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
}
};
applyArgumentsResult.handleLongPressReaction = function handleLongPressReaction(closure_0) {
2026-08-24 06:08:38 +00:00
const nativeSyntheticEventData = applyArgumentsResult(closure_1_3[23]).getNativeSyntheticEventData(closure_0);
2026-07-29 08:29:29 +00:00
const reaction = nativeSyntheticEventData.reaction;
if (!applyArgumentsResult.props.hasActionSheetOpen) {
let emoji;
if (null != reaction) {
emoji = reaction.emoji;
2026-07-21 06:55:02 +00:00
}
2026-08-24 06:08:38 +00:00
const result = applyArgumentsResult(closure_1_3[28]).handleViewPreviewReactions(tmp4, tmp5, emoji);
const tmpResult = applyArgumentsResult(closure_1_3[28]);
2026-07-29 08:29:29 +00:00
}
};
applyArgumentsResult.handleTapReaction = function handleTapReaction(nativeEvent) {
const props = applyArgumentsResult.props;
const channel = props.channel;
if (!props.hasActionSheetOpen) {
if (true === tmp) {
if (null != channel) {
2026-08-24 06:08:38 +00:00
const nativeSyntheticEventData = applyArgumentsResult(closure_1_3[23]).getNativeSyntheticEventData(nativeEvent);
2026-07-29 08:29:29 +00:00
({ reaction, messageId, isBurst } = nativeSyntheticEventData);
2026-08-24 06:08:38 +00:00
const obj3 = applyArgumentsResult(closure_1_3[13]);
2026-07-29 08:29:29 +00:00
let tmp5 = null;
if (null != reaction) {
const obj = {};
const merged = Object.assign(reaction);
obj.emoji = reaction.emoji;
tmp5 = obj;
2026-07-21 06:55:02 +00:00
}
2026-07-29 08:29:29 +00:00
let MESSAGE = nativeEvent.nativeEvent.location;
if (MESSAGE == null) {
MESSAGE = tmp15(tmp16[29]).ReactionLocations.MESSAGE;
}
const result = obj3.handleAddOrRemoveReaction(messageId, channel, tmp5, isBurst, MESSAGE);
2026-08-24 06:08:38 +00:00
const obj2 = applyArgumentsResult(closure_1_3[23]);
2026-07-29 08:29:29 +00:00
tmp15 = applyArgumentsResult;
2026-08-24 06:08:38 +00:00
tmp16 = closure_1_3;
2026-07-21 06:55:02 +00:00
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
};
applyArgumentsResult.handleTapImage = function handleTapImage(nativeEvent) {
nativeEvent = nativeEvent.nativeEvent;
const message = applyArgumentsResult.getMessage(nativeEvent.id);
if (null != message) {
2026-08-24 06:08:38 +00:00
const channel = closure_1_8.getChannel(message.getChannelId());
2026-07-29 08:29:29 +00:00
if (null != channel) {
2026-08-08 06:10:11 +00:00
const obj = { tapImageData: null, allowWithinModal: true, message: null, messageChannel: null, selectedChannelId: "HermesInternal", showContextName: null };
2026-07-29 08:29:29 +00:00
obj[0] = nativeEvent;
obj[2] = message;
obj[3] = channel;
2026-08-24 06:08:38 +00:00
const result = applyArgumentsResult(closure_1_3[30]).handleMessagesTapImage(obj);
const obj2 = applyArgumentsResult(closure_1_3[30]);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
};
applyArgumentsResult.handleTapChannel = function handleTapChannel(closure_0) {
2026-08-24 06:08:38 +00:00
let obj = applyArgumentsResult(closure_1_3[23]);
2026-07-29 08:29:29 +00:00
obj = {
data: obj.getNativeSyntheticEventData(closure_0).data,
navigationReplace: true,
onBeforeNavigate() {
const jumpToChatProps = props.props.jumpToChatProps;
const onBeforeJumpToMessage = jumpToChatProps.onBeforeJumpToMessage;
let result;
if (onBeforeJumpToMessage != null) {
result = onBeforeJumpToMessage("channel_link");
}
return result;
2026-07-20 16:05:17 +00:00
}
};
2026-08-24 06:08:38 +00:00
let result = applyArgumentsResult(closure_1_3[31]).handleMessagesTapChannel(obj);
2026-07-29 08:29:29 +00:00
};
applyArgumentsResult.handleLongPressChannel = function handleLongPressChannel(arg0) {
2026-08-24 06:08:38 +00:00
applyArgumentsResult(closure_1_3[23]);
2026-07-29 08:29:29 +00:00
if (!applyArgumentsResult.props.hasActionSheetOpen) {
const obj = { data: null };
obj[0] = tmp4;
2026-08-24 06:08:38 +00:00
const result = applyArgumentsResult(closure_1_3[32]).handleMessagesLongPressChannel(obj);
const tmpResult = applyArgumentsResult(closure_1_3[32]);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
return applyArgumentsResult;
}
}
const prototype = ChatPreviewBase.prototype;
prototype["componentDidMount"] = function componentDidMount() {
const self = this;
let tmp = null != this.props.messages;
if (tmp) {
tmp = false !== self.props.canAccessChannel;
}
if (tmp) {
self.setup();
}
};
prototype["componentWillUnmount"] = function componentWillUnmount() {
if (null != this.chatRef.current) {
const chatManager = this.chatManager;
chatManager.clear();
}
};
prototype["componentDidUpdate"] = function componentDidUpdate(messages) {
const self = this;
if (!tmp) {
self.setup(messages.width !== self.props.width);
}
let tmp3 = messages.canAccessChannel !== self.props.canAccessChannel;
if (tmp3) {
tmp3 = null != self.props.messages;
}
if (tmp3) {
self.setup(self.props.canAccessChannel);
}
};
prototype["render"] = function render() {
const self = this;
2026-08-24 06:08:38 +00:00
const tmp = callback3(this.context);
2026-07-29 08:29:29 +00:00
const props = this.props;
({ channel, isSpoilerHidden } = props);
if (props.isNSFWHidden) {
let guild_id;
if (channel != null) {
guild_id = channel.guild_id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (null != guild_id) {
let obj = { guildId: null, channelId: null };
({ guild_id: obj8[0], id: obj8[1] } = channel);
2026-08-24 06:08:38 +00:00
let tmp14 = callback(GuildNSFWDefault, obj);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { style: null, children: null };
obj[0] = tmp.containerInner;
const items = [tmp14, tmp6Result];
obj[1] = items;
return callback2(closure_5, obj);
}
if (isSpoilerHidden) {
let guild_id1;
if (channel != null) {
guild_id1 = channel.guild_id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (null != guild_id1) {
2026-08-24 06:08:38 +00:00
obj1 = { guildId: null, channelId: null };
2026-07-29 08:29:29 +00:00
({ guild_id: obj7[0], id: obj7[1] } = channel);
2026-08-24 06:08:38 +00:00
tmp14 = callback(ChannelSpoilerDefault, obj1);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
obj = { ref: self.chatRef, style: tmp.chat, inverted: true, onTapLink: self.handleTapLink, onTapChannel: self.handleTapChannel, onLongPressChannel: self.handleLongPressChannel, onLongPressLink: self.handleLongPressLink, onLongPressMessage: self.handleLongPressMessage, onLongPressReaction: self.handleLongPressReaction, onTapReaction: self.handleTapReaction, onTapImage: self.handleTapImage, onCompleteFirstLayout: null, onFirstLayout: null };
2026-08-24 06:08:38 +00:00
obj1 = set;
2026-07-29 08:29:29 +00:00
let prop;
if (obj1.isIOS()) {
prop = self.handleCompleteFirstLayout;
}
obj[11] = prop;
2026-08-24 06:08:38 +00:00
const tmp8 = DCDChatListDefault;
2026-07-29 08:29:29 +00:00
let prop1;
if (!tmp9Result.isIOS()) {
prop1 = self.handleCompleteFirstLayout;
}
obj[12] = prop1;
tmp6Result = tmp6(tmp8, obj);
const obj2 = { bottom: true, style: tmp.jumpToChatButtonContainer, children: null };
2026-08-24 06:08:38 +00:00
tmp9Result = set;
obj2[2] = callback(PressableBase.PressableOpacity, { accessibilityRole: "button", style: tmp.jumpToChatButton, onPress: self.handleJumpToChat, children: callback(Text.Text, obj4) });
2026-08-25 06:04:03 +00:00
tmp6Result = tmp6(tmp9(5434).SafeAreaPaddingView, obj2);
2026-07-29 08:29:29 +00:00
tmp14 = tmp6Result;
};
ChatPreviewBase.contextType = require("ManaContext").ThemeContext;
ChatPreviewBase.defaultProps = { withSafeArea: true };
2026-08-24 06:08:38 +00:00
let obj2 = { height: 44, borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: ThemesDefault.colors.BORDER_SUBTLE };
let result = require("set").fileFinishedImporting("components_native/common/ChatPreview.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const ChatPreview = function ChatPreview(channelId) {
channelId = channelId.channelId;
2026-08-25 06:04:03 +00:00
const InlineAttachmentMedia = channelId(4070).InlineAttachmentMedia;
2026-07-29 08:29:29 +00:00
const setting = InlineAttachmentMedia.useSetting();
2026-08-25 06:04:03 +00:00
const InlineEmbedMedia = channelId(4070).InlineEmbedMedia;
2026-07-29 08:29:29 +00:00
const setting1 = InlineEmbedMedia.useSetting();
2026-08-25 06:04:03 +00:00
const RenderEmbeds = channelId(4070).RenderEmbeds;
2026-07-29 08:29:29 +00:00
const setting2 = RenderEmbeds.useSetting();
let obj = channelId(589);
2026-08-24 06:08:38 +00:00
const items = [closure_6];
2026-07-29 08:29:29 +00:00
const stateFromStores = obj.useStateFromStores(items, () => roleStyle.roleStyle);
2026-08-24 06:08:38 +00:00
const items1 = [closure_8];
const stateFromStores1 = channelId(589).useStateFromStores(items1, () => closure_1_8.getChannel(channelId));
2026-07-29 08:29:29 +00:00
const obj2 = channelId(589);
2026-08-25 06:04:03 +00:00
const isChannelSpoilerGated = channelId(6053).useIsChannelSpoilerGated(stateFromStores1);
const obj3 = channelId(6053);
const isChannelContentGated = channelId(4619).useIsChannelContentGated(stateFromStores1);
const obj4 = channelId(4619);
2026-08-24 06:08:38 +00:00
const items2 = [closure_7];
2026-07-20 16:05:17 +00:00
obj = {};
2026-07-29 08:29:29 +00:00
const stateFromStores2 = channelId(589).useStateFromStores(items2, () => null != content.getContent());
const merged = Object.assign(channelId);
obj.inlineAttachmentMedia = setting;
obj.inlineEmbedMedia = setting1;
obj.renderEmbeds = setting2;
obj.roleStyle = stateFromStores;
obj.channel = stateFromStores1;
2026-08-24 06:08:38 +00:00
obj.width = useWindowDimensionsDefault().width;
2026-07-29 08:29:29 +00:00
obj.isSpoilerHidden = isChannelSpoilerGated;
obj.isNSFWHidden = isChannelContentGated;
let tmp12 = !isChannelSpoilerGated;
if (!isChannelSpoilerGated) {
tmp12 = !isChannelContentGated;
}
obj.canAccessChannel = tmp12;
obj.hasActionSheetOpen = stateFromStores2;
return closure_13(ChatPreviewBase, obj);
2026-07-20 16:05:17 +00:00
};