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

234 lines
7.8 KiB
TypeScript
Raw Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 9600
// Function ID: 9601
// Name: NativeChatUtils
2026-10-12 06:59:38 +00:00
// Dependencies: [17, 1382, 9601, 1255, 9602, 9603, 2]
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 9600 (NativeChatUtils)
2026-10-09 10:00:15 +00:00
import SentryUtilsDefault from "SentryUtils" /* 1255 */;
import PlatformUtils from "PlatformUtils" /* 1382 */;
2026-10-12 06:59:38 +00:00
import ChatNativeComponent from "ChatNativeComponent" /* 9601 */;
import ChatChangesetUpdateTracker from "ChatChangesetUpdateTracker" /* 9602 */;
import react_nativeDefault from "react-native" /* 9603 */;
2026-10-03 08:58:59 +00:00
import react_native from "react-native" /* 17 */;
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;
({ NativeModules: c3, findNodeHandle: closure_4 } = react_native);
const ChatScrollPosition = { TOP: 0, [0]: "TOP", MIDDLE: 1, [1]: "MIDDLE", BOTTOM: 2, [2]: "BOTTOM", NONE: 3, [3]: "NONE" };
2026-10-03 08:58:59 +00:00
let obj2 = {
2026-07-20 16:05:17 +00:00
scrollTo(arg0, arg1, arg2) {
if (null != arg0) {
let obj = arg2;
2026-07-29 08:29:29 +00:00
if (arg2 == null) {
2026-07-20 16:05:17 +00:00
obj = {};
}
const animated = obj.animated;
const highlight = obj.highlight;
let TOP = obj.position;
if (undefined === TOP) {
TOP = obj.TOP;
}
2026-10-03 08:58:59 +00:00
const obj2 = PlatformUtils;
const tmp5 = require;
2026-07-20 16:05:17 +00:00
if (obj2.isIOS()) {
2026-10-03 08:58:59 +00:00
const tmp15 = React3(arg0);
2026-07-29 08:29:29 +00:00
if (null != tmp15) {
2026-10-03 08:58:59 +00:00
const DCDChatManager = _false.DCDChatManager;
DCDChatManager.scrollTo(tmp15, arg1, undefined !== animated && animated, undefined !== highlight && highlight, TOP);
2026-07-20 16:05:17 +00:00
}
} else {
2026-10-12 06:59:38 +00:00
const Commands = tmp5(9601).Commands;
2026-10-03 08:58:59 +00:00
Commands.scrollTo(arg0, arg1, undefined !== animated && animated, undefined !== highlight && highlight, TOP);
2026-07-20 16:05:17 +00:00
}
}
},
scrollToBottom(arg0, arg1) {
if (null != arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
const tmp2 = require;
2026-07-20 16:05:17 +00:00
if (obj.isIOS()) {
2026-10-03 08:58:59 +00:00
const tmp6 = React3(arg0);
2026-07-29 08:29:29 +00:00
if (null != tmp6) {
2026-10-03 08:58:59 +00:00
const DCDChatManager = _false.DCDChatManager;
2026-07-29 08:29:29 +00:00
DCDChatManager.scrollToBottom(tmp6, arg1);
2026-07-20 16:05:17 +00:00
}
} else {
2026-10-12 06:59:38 +00:00
const Commands = tmp2(9601).Commands;
2026-07-20 16:05:17 +00:00
Commands.scrollToBottom(arg0, arg1);
}
}
},
scrollToTop(arg0, arg1) {
if (null != arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isIOS()) {
2026-10-03 08:58:59 +00:00
const tmp4 = React3(arg0);
2026-07-20 16:05:17 +00:00
if (null != tmp4) {
2026-10-03 08:58:59 +00:00
const DCDChatManager = _false.DCDChatManager;
2026-07-20 16:05:17 +00:00
DCDChatManager.scrollToTop(tmp4, arg1);
}
}
}
},
scrollToRelativeOffset(arg0, arg1, arg2) {
if (null != arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isIOS()) {
2026-10-03 08:58:59 +00:00
const tmp4 = React3(arg0);
2026-07-20 16:05:17 +00:00
if (null != tmp4) {
2026-10-03 08:58:59 +00:00
const DCDChatManager = _false.DCDChatManager;
2026-07-20 16:05:17 +00:00
const result = DCDChatManager.scrollToRelativeOffset(tmp4, arg1, arg2);
}
}
}
},
scrollIntoView(arg0, arg1, arg2) {
if (null != arg0) {
let obj = arg2;
2026-07-29 08:29:29 +00:00
if (arg2 == null) {
2026-07-20 16:05:17 +00:00
obj = {};
}
const animated = obj.animated;
const highlight = obj.highlight;
2026-10-03 08:58:59 +00:00
const obj2 = PlatformUtils;
const tmp4 = require;
2026-07-20 16:05:17 +00:00
if (obj2.isIOS()) {
2026-10-03 08:58:59 +00:00
const tmp13 = React3(arg0);
2026-07-29 08:29:29 +00:00
if (null != tmp13) {
2026-10-03 08:58:59 +00:00
const DCDChatManager = _false.DCDChatManager;
DCDChatManager.scrollIntoView(tmp13, arg1, undefined !== animated && animated, undefined !== highlight && highlight);
2026-07-20 16:05:17 +00:00
}
} else {
2026-10-12 06:59:38 +00:00
const Commands = tmp4(9601).Commands;
2026-10-03 08:58:59 +00:00
Commands.scrollIntoView(arg0, arg1, undefined !== animated && animated, undefined !== highlight && highlight);
2026-07-20 16:05:17 +00:00
}
}
},
updateRows(arg0, rows) {
2026-10-03 08:58:59 +00:00
let forceReload;
let obj2;
2026-07-20 16:05:17 +00:00
if (null != arg0) {
2026-10-03 08:58:59 +00:00
const obj5 = PlatformUtils;
if (obj5.isIOS()) {
const tmp32Result = ChatChangesetUpdateTracker;
const andIncrementChangesetIdForChat = tmp32Result.getAndIncrementChangesetIdForChat(arg0);
2026-08-13 07:00:46 +00:00
({ rows, forceReload } = rows);
if (forceReload == null) {
forceReload = false;
}
const _HermesInternal = HermesInternal;
2026-10-03 08:58:59 +00:00
const obj = { category: "chat.dispatch", message: "updateRows dispatch id=" + andIncrementChangesetIdForChat + " ops=" + rows.length, data: obj2 };
const addBreadcrumb = SentryUtilsDefault.addBreadcrumb;
SentryUtilsDefault;
obj2 = { changesetUpdateId: andIncrementChangesetIdForChat, opCount: rows.length, rows, forceReload };
addBreadcrumb(obj);
2026-10-12 06:59:38 +00:00
const Commands = tmp32(9601).Commands;
2026-08-13 07:00:46 +00:00
const _JSON2 = JSON;
2026-10-03 08:58:59 +00:00
const updateRows = Commands.updateRows;
2026-08-13 07:00:46 +00:00
const json = JSON.stringify(rows.rows);
const isLoadingAtTop = rows.isLoadingAtTop;
let str3 = "";
if (null != rows.scrollData) {
2026-07-20 16:05:17 +00:00
const _JSON3 = JSON;
2026-08-13 07:00:46 +00:00
str3 = JSON.stringify(rows.scrollData);
}
let flag4 = rows.HACK_iOSForceAnimations;
if (flag4 == null) {
flag4 = false;
}
let flag5 = rows.forceReload;
if (flag5 == null) {
flag5 = false;
}
let flag6 = rows.isAnimated;
if (flag6 == null) {
flag6 = true;
}
2026-10-03 08:58:59 +00:00
updateRows(arg0, json, isLoadingAtTop, str3, andIncrementChangesetIdForChat, flag4, flag5, flag6);
2026-08-13 07:00:46 +00:00
} else {
2026-10-03 08:58:59 +00:00
const tmp2 = React3(arg0);
2026-08-13 07:00:46 +00:00
if (null != tmp2) {
const _JSON4 = JSON;
2026-10-03 08:58:59 +00:00
const updateRows2 = react_nativeDefault.updateRows;
2026-08-13 07:00:46 +00:00
const json1 = JSON.stringify(rows.rows);
2026-07-20 16:05:17 +00:00
const isLoadingAtTop2 = rows.isLoadingAtTop;
2026-08-13 07:00:46 +00:00
let json2 = null;
2026-07-20 16:05:17 +00:00
if (null != rows.scrollData) {
2026-08-13 07:00:46 +00:00
const _JSON = JSON;
json2 = JSON.stringify(rows.scrollData);
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
const tmp32Result2 = ChatChangesetUpdateTracker;
const andIncrementChangesetIdForChat1 = tmp32Result2.getAndIncrementChangesetIdForChat(arg0);
2026-08-13 07:00:46 +00:00
let flag = rows.HACK_iOSForceAnimations;
if (flag == null) {
flag = false;
2026-07-29 08:29:29 +00:00
}
2026-08-13 07:00:46 +00:00
let flag2 = rows.forceReload;
if (flag2 == null) {
flag2 = false;
2026-07-20 16:05:17 +00:00
}
2026-08-13 07:00:46 +00:00
let flag3 = rows.isAnimated;
if (flag3 == null) {
flag3 = true;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
updateRows2(tmp2, json1, isLoadingAtTop2, json2, andIncrementChangesetIdForChat1, flag, flag2, flag3);
2026-07-20 16:05:17 +00:00
}
}
}
},
clearRows(arg0) {
2026-10-08 09:57:35 +00:00
if (null == arg0) {
return null;
} else {
const obj4 = PlatformUtils;
if (obj4.isIOS()) {
const tmp8Result = ChatChangesetUpdateTracker;
const andIncrementChangesetIdForChat = tmp8Result.getAndIncrementChangesetIdForChat(arg0);
2026-10-12 06:59:38 +00:00
const Commands = tmp8(9601).Commands;
2026-10-08 09:57:35 +00:00
Commands.clearRows(arg0, andIncrementChangesetIdForChat);
return andIncrementChangesetIdForChat;
2026-08-13 07:00:46 +00:00
} else {
2026-10-03 08:58:59 +00:00
const tmp2 = React3(arg0);
2026-10-08 09:57:35 +00:00
if (null == tmp2) {
return null;
} else {
const tmp8Result2 = ChatChangesetUpdateTracker;
const andIncrementChangesetIdForChat1 = tmp8Result2.getAndIncrementChangesetIdForChat(arg0);
const obj2 = react_nativeDefault;
obj2.clearRows(tmp2, andIncrementChangesetIdForChat1);
return andIncrementChangesetIdForChat1;
2026-07-20 16:05:17 +00:00
}
}
}
},
fadeIn(arg0) {
2026-08-13 07:00:46 +00:00
let isIOSResult = null != arg0;
if (isIOSResult) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
isIOSResult = obj.isIOS();
2026-08-13 07:00:46 +00:00
}
if (isIOSResult) {
const Commands = ChatNativeComponent.Commands;
2026-08-13 07:00:46 +00:00
Commands.fadeIn(arg0);
2026-07-20 16:05:17 +00:00
}
},
focus(arg0, arg1) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isIOS()) {
if (null != arg0) {
2026-10-03 08:58:59 +00:00
const tmp4 = React3(arg0);
2026-07-29 08:29:29 +00:00
if (null != tmp4) {
2026-10-03 08:58:59 +00:00
const DCDChatManager = _false.DCDChatManager;
2026-07-29 08:29:29 +00:00
DCDChatManager.focus(tmp4, arg1);
2026-07-20 16:05:17 +00:00
}
}
}
}
};
2026-10-03 08:58:59 +00:00
let result = size.fileFinishedImporting("modules/chat/native/NativeChatUtils.tsx");
export default obj2;
export { ChatScrollPosition };
2026-07-20 16:05:17 +00:00
export const ChatScrollType = { SCROLL: 0, [0]: "SCROLL", FOCUS_ONLY: 1, [1]: "FOCUS_ONLY" };