Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
106 lines
3.4 KiB
TypeScript
106 lines
3.4 KiB
TypeScript
// Module ID: 11565
|
|
// Function ID: 11566
|
|
// Name: computeScrollData
|
|
// Dependencies: [4780, 8223, 11566, 4718, 2]
|
|
// Exports: default, findMessageRowIndex
|
|
|
|
// Module 11565 (computeScrollData)
|
|
import NativeChatUtils from "NativeChatUtils" /* 11566 */;
|
|
import AccessibilityStore from "AccessibilityStore" /* 4780 */;
|
|
|
|
require = fn;
|
|
const RowGeneratorConstants = fn(8223);
|
|
({ RowType: c3, SeparatorType: closure_4 } = RowGeneratorConstants);
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/chat/native/computeScrollData.tsx");
|
|
|
|
export default function computeScrollData(shouldInitialScroll) {
|
|
({ rows, scrollToMessageId, jumpTargetId, animated, scrollPosition, focusTargetId, jumpType } = shouldInitialScroll);
|
|
if (shouldInitialScroll.shouldInitialScroll) {
|
|
if (null == jumpTargetId) {
|
|
const findIndexResult = rows.findIndex((type) => {
|
|
let tmp = type.type === constants.SEPARATOR;
|
|
if (tmp) {
|
|
tmp = type.id === constants2.UNREAD;
|
|
}
|
|
return tmp;
|
|
});
|
|
let tmp3;
|
|
if (-1 !== findIndexResult) {
|
|
tmp3 = findIndexResult;
|
|
}
|
|
if (null != tmp3) {
|
|
const obj2 = { type: NativeChatUtils.ChatScrollType.SCROLL, index: tmp3, animate: null, highlight: false, position: null };
|
|
if (animated) {
|
|
animated = !AccessibilityStore.useReducedMotion;
|
|
}
|
|
obj2.animate = animated;
|
|
obj2.position = NativeChatUtils.ChatScrollPosition.TOP;
|
|
return obj2;
|
|
}
|
|
}
|
|
}
|
|
let tmp4;
|
|
if (null != scrollToMessageId) {
|
|
focusTargetId = scrollToMessageId;
|
|
const findIndexResult1 = rows.findIndex((message) => {
|
|
let tmp = null != message.message;
|
|
if (tmp) {
|
|
tmp = message.message.id === focusTargetId;
|
|
}
|
|
return tmp;
|
|
});
|
|
let tmp6;
|
|
if (-1 !== findIndexResult1) {
|
|
tmp6 = findIndexResult1;
|
|
}
|
|
if (null != tmp6) {
|
|
const obj = { type: NativeChatUtils.ChatScrollType.SCROLL, index: tmp6, animate: null, highlight: null, position: null };
|
|
const useReducedMotion = AccessibilityStore.useReducedMotion;
|
|
let tmp10 = !useReducedMotion;
|
|
if (!useReducedMotion) {
|
|
tmp10 = jumpType !== tmp7(4718).JumpType.INSTANT;
|
|
}
|
|
obj.animate = tmp10;
|
|
obj.highlight = scrollToMessageId === jumpTargetId;
|
|
if (scrollPosition == null) {
|
|
scrollPosition = tmp7(11566).ChatScrollPosition.TOP;
|
|
}
|
|
obj.position = scrollPosition;
|
|
tmp4 = obj;
|
|
}
|
|
}
|
|
if (null == tmp4) {
|
|
let tmp11;
|
|
if (null != focusTargetId) {
|
|
const findIndexResult2 = rows.findIndex((message) => {
|
|
let tmp = null != message.message;
|
|
if (tmp) {
|
|
tmp = message.message.id === focusTargetId;
|
|
}
|
|
return tmp;
|
|
});
|
|
let tmp13;
|
|
if (-1 !== findIndexResult2) {
|
|
tmp13 = findIndexResult2;
|
|
}
|
|
if (null != tmp13) {
|
|
const obj3 = { type: NativeChatUtils.ChatScrollType.FOCUS_ONLY, index: tmp13 };
|
|
tmp11 = obj3;
|
|
}
|
|
}
|
|
tmp4 = tmp11;
|
|
}
|
|
return tmp4;
|
|
};
|
|
export const findMessageRowIndex = function findMessageRowIndex(previousRows, ChatTTITracker) {
|
|
closure_0 = ChatTTITracker;
|
|
const findIndexResult = previousRows.findIndex((message) => {
|
|
let tmp = null != message.message;
|
|
if (tmp) {
|
|
tmp = message.message.id === focusTargetId;
|
|
}
|
|
return tmp;
|
|
});
|
|
return -1 !== findIndexResult ? findIndexResult : undefined;
|
|
};
|