decord/alpha/source/modules/chat/native/computeScrollData.tsx

89 lines
3.4 KiB
TypeScript
Raw Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 9599
// Function ID: 9600
2026-07-29 08:29:29 +00:00
// Name: computeScrollData
2026-10-12 06:59:38 +00:00
// Dependencies: [5081, 7748, 9600, 5027, 2]
2026-07-29 08:29:29 +00:00
// Exports: default, findMessageRowIndex
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 9599 (computeScrollData)
2026-10-10 08:08:14 +00:00
import flow_Client from "flow/Client" /* 5027 */;
2026-10-12 06:59:38 +00:00
import NativeChatUtils from "NativeChatUtils" /* 9600 */;
2026-10-10 08:08:14 +00:00
import AccessibilityStore from "AccessibilityStore" /* 5081 */;
2026-10-12 06:59:38 +00:00
import RowGeneratorConstants from "RowGeneratorConstants" /* 7748 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let c3;
let closure_4;
({ RowType: c3, SeparatorType: closure_4 } = RowGeneratorConstants);
const result = size.fileFinishedImporting("modules/chat/native/computeScrollData.tsx");
2026-07-20 16:05:17 +00:00
export default function computeScrollData(shouldInitialScroll) {
2026-10-03 08:58:59 +00:00
let animated;
let constants2;
let focusTargetId;
let jumpTargetId;
let jumpType;
let rows;
let scrollPosition;
let scrollToMessageId;
let scrollToRowIndexOverride;
let tmp16;
({ rows, scrollToMessageId, jumpTargetId, animated, scrollPosition, focusTargetId, scrollToRowIndexOverride, jumpType } = shouldInitialScroll);
2026-07-20 16:05:17 +00:00
if (shouldInitialScroll.shouldInitialScroll) {
if (null == jumpTargetId) {
2026-10-03 08:58:59 +00:00
const findIndexResult = rows.findIndex((type) => type.type === constants.SEPARATOR && type.id === constants2.UNREAD);
2026-07-29 08:29:29 +00:00
let tmp3;
if (-1 !== findIndexResult) {
tmp3 = findIndexResult;
}
if (null != tmp3) {
2026-10-12 06:59:38 +00:00
const obj2 = { type: NativeChatUtils.ChatScrollType.SCROLL, index: tmp3, animate: animated, highlight: false, position: tmp16(9600).ChatScrollPosition.TOP };
2026-10-03 08:58:59 +00:00
tmp16 = require;
2026-07-20 16:05:17 +00:00
if (animated) {
animated = !AccessibilityStore.useReducedMotion;
2026-07-20 16:05:17 +00:00
}
return obj2;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
let tmp4;
2026-07-20 16:05:17 +00:00
if (null != scrollToMessageId) {
if (scrollToRowIndexOverride == null) {
2026-10-03 08:58:59 +00:00
const findIndexResult1 = rows.findIndex((message) => null != message.message && message.message.id === focusTargetId);
let tmp6;
if (-1 !== findIndexResult1) {
tmp6 = findIndexResult1;
2026-07-29 08:29:29 +00:00
}
scrollToRowIndexOverride = tmp6;
2026-07-29 08:29:29 +00:00
}
if (null != scrollToRowIndexOverride) {
2026-10-03 08:58:59 +00:00
const obj = { type: NativeChatUtils.ChatScrollType.SCROLL, index: scrollToRowIndexOverride, animate: !AccessibilityStore.useReducedMotion && jumpType !== flow_Client.JumpType.INSTANT, highlight: scrollToMessageId === jumpTargetId, position: scrollPosition };
!AccessibilityStore.useReducedMotion && jumpType !== flow_Client.JumpType.INSTANT;
2026-07-29 08:29:29 +00:00
if (scrollPosition == null) {
2026-10-12 06:59:38 +00:00
scrollPosition = tmp7(9600).ChatScrollPosition.TOP;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4 = obj;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (null == tmp4) {
let tmp11;
2026-07-20 16:05:17 +00:00
if (null != focusTargetId) {
2026-10-03 08:58:59 +00:00
const findIndexResult2 = rows.findIndex((message) => null != message.message && message.message.id === focusTargetId);
2026-07-29 08:29:29 +00:00
let tmp13;
if (-1 !== findIndexResult2) {
tmp13 = findIndexResult2;
}
if (null != tmp13) {
2026-10-03 08:58:59 +00:00
tmp11 = { type: NativeChatUtils.ChatScrollType.FOCUS_ONLY, index: tmp13 };
const obj3 = { type: NativeChatUtils.ChatScrollType.FOCUS_ONLY, index: tmp13 };
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
tmp4 = tmp11;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp4;
};
export const findMessageRowIndex = function findMessageRowIndex(previousRows, startMessageId) {
2026-10-03 08:58:59 +00:00
let closure_0 = startMessageId;
const findIndexResult = previousRows.findIndex((message) => null != message.message && message.message.id === focusTargetId);
2026-07-29 08:29:29 +00:00
return -1 !== findIndexResult ? findIndexResult : undefined;
2026-07-20 16:05:17 +00:00
};