Files
discord-decomp/sources/modules/chat/native/computeScrollData.tsx
T
2026-07-27 16:20:00 +03:00

113 lines
5.5 KiB
TypeScript

/* Metro module 9849; source: modules/chat/native/computeScrollData.tsx; dependencies: [4502, 8178, 9850, 4044, 2] */
function _fun77195(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#77195, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10035:6, offset: 0x01df46cd, size: 163 bytes, params: 8, frame: 19
let env0_0 = require;
const closure = function(a0, a1) {
var env0_0 = a1;
var index = a0.findIndex(_fun77197);
if (index !== -1) {
return index;
}
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const accessibilityStore = importDefault(4502) /* metro dependency 4502: AccessibilityStore */;
const rowGeneratorConstantsModule = require(8178) /* metro dependency 8178: RowGeneratorConstants */;
const env0_3 = rowGeneratorConstantsModule.RowType;
const env0_4 = rowGeneratorConstantsModule.SeparatorType;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/chat/native/computeScrollData.tsx');
exports.default = computeScrollData;
exports.findMessageRowIndex = closure;
}
function findMessageRowIndex(a0, a1) { // fn#77196, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10035:146, offset: 0x01df4770, size: 46 bytes, params: 3, frame: 11
const env0_0 = a1;
const index = a0.findIndex(_fun77197);
if (index !== -1) {
return index;
}
}
function computeScrollData({rows, scrollToMessageId, jumpTargetId, jumpType, shouldInitialScroll, animated, scrollPosition, focusTargetId}) { // fn#77198, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10035:342, offset: 0x01df47c6, size: 465 bytes, params: 2, frame: 28
var r0;
var r1;
var value;
var messageRowIndex;
const ChatScrollType = (require(9850) /* metro dependency 9850: NativeChatUtils */).ChatScrollType;
const JumpTypes = (require(4044) /* metro dependency 4044: Client */).JumpTypes;
const ChatScrollPosition = (require(9850) /* metro dependency 9850: NativeChatUtils */).ChatScrollPosition;
var messageRowIndex2;
if (shouldInitialScroll) {
if (jumpTargetId != null) {
value = undefined;
if (scrollToMessageId != null) {
messageRowIndex = findMessageRowIndex(rows, scrollToMessageId);
r0 = messageRowIndex != null ? {type: ChatScrollType.SCROLL, index: messageRowIndex,
animate: !AccessibilityStore.useReducedMotion && jumpType !== JumpTypes.INSTANT,
highlight: scrollToMessageId === jumpTargetId,
position: scrollPosition ?? ChatScrollPosition.TOP} : value;
} else {
r0 = value;
}
if (r0 == null) {
if (focusTargetId != null) {
messageRowIndex2 = findMessageRowIndex(rows, focusTargetId);
r1 = messageRowIndex2 != null ? {type: ChatScrollType.FOCUS_ONLY, index: messageRowIndex2} : value;
} else {
r1 = value;
}
r0 = r1;
}
return r0;
}
value = ((a0) => {
var index = a0.findIndex(_fun77200);
if (index !== -1) {
return index;
}
})(rows);
if (value != null) {
return {type: ChatScrollType.SCROLL, index: value,
animate: animated && !AccessibilityStore.useReducedMotion,
highlight: false, position: ChatScrollPosition.TOP};
}
}
value = undefined;
if (scrollToMessageId != null) {
messageRowIndex = findMessageRowIndex(rows, scrollToMessageId);
r0 = messageRowIndex != null ? {type: ChatScrollType.SCROLL, index: messageRowIndex,
animate: !AccessibilityStore.useReducedMotion && jumpType !== JumpTypes.INSTANT,
highlight: scrollToMessageId === jumpTargetId, position: scrollPosition ?? ChatScrollPosition.TOP} : value;
} else {
r0 = value;
}
if (r0 == null) {
if (focusTargetId != null) {
messageRowIndex2 = findMessageRowIndex(rows, focusTargetId);
r1 = messageRowIndex2 != null ? {type: ChatScrollType.FOCUS_ONLY, index: messageRowIndex2} : value;
} else {
r1 = value;
}
r0 = r1;
}
return r0;
}
function _fun77197(a0) { // fn#77197, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10035:199, offset: 0x01df479e, size: 40 bytes, params: 2, frame: 3
return a0.message != null && a0.message.id === require;
}
function findUnreadSeperatorRowIndex(a0) { // fn#77199, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10035:512, owner: computeScrollData.findUnreadSeperatorRowIndex, offset: 0x01df4997, size: 39 bytes, params: 2, frame: 11
const index = a0.findIndex(_fun77200);
if (index !== -1) {
return index;
}
}
function _fun77200(a0) { // fn#77200, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10035:571, offset: 0x01df49be, size: 49 bytes, params: 2, frame: 4
const type = a0.type;
const value = environment.__proto__.__proto__;
const SEPARATOR = RowType.SEPARATOR;
return type === SEPARATOR && a0.id === SeparatorType.UNREAD;
}