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

334 lines
15 KiB
TypeScript

/* Metro module 9850; source: modules/chat/native/NativeChatUtils.tsx; dependencies: [27, 477, 9851, 1216, 4020, 9852, 9853, 2] */
function _fun77201(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#77201, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10036:6, offset: 0x01df49ef, size: 350 bytes, params: 8, frame: 20
var object4;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const value = require(27) /* metro dependency 27 */;
const env0_3 = value.NativeModules;
const env0_4 = value.findNodeHandle;
object4 = {TOP: 0};
object4[0] = 'TOP';
object4.MIDDLE = 1;
object4[1] = 'MIDDLE';
object4.BOTTOM = 2;
object4[2] = 'BOTTOM';
object4.NONE = 3;
object4[3] = 'NONE';
const object5 = {SCROLL: 0};
object5[0] = 'SCROLL';
object5.FOCUS_ONLY = 1;
object5[1] = 'FOCUS_ONLY';
const object6 = {scrollTo: scrollTo, scrollToBottom: scrollToBottom_77203, scrollToTop: scrollToTop_77204,
scrollToRelativeOffset: scrollToRelativeOffset_77205, scrollIntoView: scrollIntoView, updateRows: updateRows,
clearRows: clearRows_77208, fadeIn: fadeIn, focus: function(a0, a1) {
var nodeHandle;
if (require(dependencyMap[1]).isIOS()) {
if (a0 != null) {
nodeHandle = findNodeHandle(a0);
if (nodeHandle != null) {
NativeModules.DCDChatManager.focus(nodeHandle, a1);
}
}
}
}};
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/chat/native/NativeChatUtils.tsx');
exports.default = object6;
exports.ChatScrollPosition = object4;
exports.ChatScrollType = object5;
}
function scrollTo(a0, a1, a2) { // fn#77202, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10036:351, offset: 0x01df4b4d, size: 227 bytes, params: 4, frame: 23
var r0;
var r5;
var r4;
var r3;
var animated;
var highlight;
var position;
var moduleValue;
var nodeHandle;
let value = a2;
if (a0 != null) {
r0 = value ?? ({});
animated = r0.animated;
value = animated !== undefined;
r5 = value && animated;
highlight = r0.highlight;
value = highlight !== undefined;
r4 = value && highlight;
position = r0.position;
r3 = position !== undefined ? position : env0_5.TOP;
moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
if (moduleValue.isIOS()) {
nodeHandle = findNodeHandle(a0);
if (nodeHandle != null) {
NativeModules.DCDChatManager.scrollTo(nodeHandle, a1, r5, r4, r3);
}
} else {
(require(9851) /* metro dependency 9851: ChatNativeComponent */).Commands.scrollTo(a0, a1, r5, r4, r3);
}
}
}
function scrollToBottom_77203(a0, a1) { // fn#77203, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10036:636, offset: 0x01df4c30, size: 129 bytes, params: 3, frame: 17
var moduleValue;
var nodeHandle;
if (a0 != null) {
moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
if (moduleValue.isIOS()) {
nodeHandle = findNodeHandle(a0);
if (nodeHandle != null) {
NativeModules.DCDChatManager.scrollToBottom(nodeHandle, a1);
}
} else {
(require(9851) /* metro dependency 9851: ChatNativeComponent */).Commands.scrollToBottom(a0, a1);
}
}
}
function scrollToTop_77204(a0, a1) { // fn#77204, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10036:808, offset: 0x01df4cb1, size: 89 bytes, params: 3, frame: 15
var moduleValue;
var nodeHandle;
if (a0 != null) {
moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
if (moduleValue.isIOS()) {
nodeHandle = findNodeHandle(a0);
if (nodeHandle != null) {
NativeModules.DCDChatManager.scrollToTop(nodeHandle, a1);
}
}
}
}
function scrollToRelativeOffset_77205(a0, a1, a2) { // fn#77205, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10036:942, offset: 0x01df4d0a, size: 93 bytes, params: 4, frame: 16
var moduleValue;
var nodeHandle;
if (a0 != null) {
moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
if (moduleValue.isIOS()) {
nodeHandle = findNodeHandle(a0);
if (nodeHandle != null) {
NativeModules.DCDChatManager.scrollToRelativeOffset(nodeHandle, a1, a2);
}
}
}
}
function scrollIntoView(a0, a1, a2) { // fn#77206, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10036:1094, offset: 0x01df4d67, size: 199 bytes, params: 4, frame: 21
var r0;
var r4;
var r3;
var animated;
var highlight;
var moduleValue;
var nodeHandle;
let value = a2;
if (a0 != null) {
r0 = value ?? ({});
animated = r0.animated;
value = animated !== undefined;
r4 = value && animated;
highlight = r0.highlight;
value = highlight !== undefined;
r3 = value && highlight;
moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
if (moduleValue.isIOS()) {
nodeHandle = findNodeHandle(a0);
if (nodeHandle != null) {
NativeModules.DCDChatManager.scrollIntoView(nodeHandle, a1, r4, r3);
}
} else {
(require(9851) /* metro dependency 9851: ChatNativeComponent */).Commands.scrollIntoView(a0, a1, r4, r3);
}
}
}
function updateRows(a0, a1) { // fn#77207, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10036:1355, offset: 0x01df4e2e, size: 709 bytes, params: 3, frame: 32
var r13;
var r7;
var r5;
var r3;
var r1;
var r12;
var r2;
var moduleValue2;
var nodeHandle;
var moduleValue3;
var updateRows;
var JSON;
var stringify;
var rows;
var value3;
var isLoadingAtTop;
var andIncrementChangesetIdForChat;
var HACK_iOSForceAnimations;
var forceReload;
var isAnimated;
var andIncrementChangesetIdForChat2;
var defaultImport2;
var addBreadcrumb;
var object2;
var length;
var Commands;
var value10;
let value = null;
if (value != a0) {
var moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
var isIOS = moduleValue.isIOS;
if (Reflect.apply(isIOS, moduleValue, [])) {
moduleValue2 = require(4020) /* metro dependency 4020: FabricUtils */;
if (moduleValue2.isFabric()) {
andIncrementChangesetIdForChat2 = (require(9852) /* metro dependency 9852: ChatChangesetUpdateTracker */).getAndIncrementChangesetIdForChat(a0);
rows = a1.rows;
forceReload = a1.forceReload;
r12 = value != forceReload && forceReload;
defaultImport2 = importDefault(1216) /* metro dependency 1216: SentryUtilsNative */;
addBreadcrumb = defaultImport2.addBreadcrumb;
object2 = {category: 'chat.dispatch'};
length = rows.length;
object2.message = 'updateRows dispatch id=' + andIncrementChangesetIdForChat2 + ' ops=' + length;
length = rows.length;
object2.data = {changesetUpdateId: andIncrementChangesetIdForChat2, opCount: length, rows: rows,
forceReload: r12};
Reflect.apply(addBreadcrumb, defaultImport2, [object2]);
Commands = (require(9851) /* metro dependency 9851: ChatNativeComponent */).Commands;
updateRows = Commands.updateRows;
JSON = global.JSON;
stringify = JSON.stringify;
rows = a1.rows;
value10 = Reflect.apply(stringify, JSON, [rows]);
isLoadingAtTop = a1.isLoadingAtTop;
r3 = value != a1.scrollData ? global.JSON.stringify(a1.scrollData) : '';
HACK_iOSForceAnimations = a1.HACK_iOSForceAnimations;
r2 = value != HACK_iOSForceAnimations && HACK_iOSForceAnimations;
forceReload = a1.forceReload;
r1 = value != forceReload && forceReload;
isAnimated = a1.isAnimated;
value = value == isAnimated;
Reflect.apply(updateRows, Commands, [a0, value10, isLoadingAtTop, r3, andIncrementChangesetIdForChat2,
r2,
r1,
value || isAnimated]);
return undefined;
}
nodeHandle = findNodeHandle(a0);
if (value == nodeHandle) {
return undefined;
}
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
r13 = moduleValue3.isIOS() ? NativeModules.DCDChatManager : importDefault(9853) /* metro dependency 9853: NativeChatModule */;
updateRows = r13.updateRows;
JSON = global.JSON;
stringify = JSON.stringify;
rows = a1.rows;
value3 = Reflect.apply(stringify, JSON, [rows]);
isLoadingAtTop = a1.isLoadingAtTop;
r7 = value != a1.scrollData ? global.JSON.stringify(a1.scrollData) : value;
andIncrementChangesetIdForChat = (require(9852) /* metro dependency 9852: ChatChangesetUpdateTracker */).getAndIncrementChangesetIdForChat(a0);
HACK_iOSForceAnimations = a1.HACK_iOSForceAnimations;
r5 = value != HACK_iOSForceAnimations && HACK_iOSForceAnimations;
forceReload = a1.forceReload;
r3 = value != forceReload && forceReload;
isAnimated = a1.isAnimated;
value = value == isAnimated;
r1 = value || isAnimated;
Reflect.apply(updateRows, r13, [nodeHandle, value3, isLoadingAtTop, r7, andIncrementChangesetIdForChat, r5,
r3,
r1]);
return undefined;
}
nodeHandle = findNodeHandle(a0);
if (value == nodeHandle) {
return undefined;
}
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
isIOS = moduleValue3.isIOS;
r13 = Reflect.apply(isIOS, moduleValue3,
[]) ? NativeModules.DCDChatManager : importDefault(9853) /* metro dependency 9853: NativeChatModule */;
updateRows = r13.updateRows;
JSON = global.JSON;
stringify = JSON.stringify;
rows = a1.rows;
value3 = Reflect.apply(stringify, JSON, [rows]);
isLoadingAtTop = a1.isLoadingAtTop;
r7 = value != a1.scrollData ? global.JSON.stringify(a1.scrollData) : value;
andIncrementChangesetIdForChat = (require(9852) /* metro dependency 9852: ChatChangesetUpdateTracker */).getAndIncrementChangesetIdForChat(a0);
HACK_iOSForceAnimations = a1.HACK_iOSForceAnimations;
r5 = value != HACK_iOSForceAnimations && HACK_iOSForceAnimations;
forceReload = a1.forceReload;
r3 = value != forceReload && forceReload;
isAnimated = a1.isAnimated;
value = value == isAnimated;
r1 = value || isAnimated;
Reflect.apply(updateRows, r13, [nodeHandle, value3, isLoadingAtTop, r7, andIncrementChangesetIdForChat, r5, r3,
r1]);
}
}
function clearRows_77208(a0) { // fn#77208, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10036:2294, offset: 0x01df50f3, size: 273 bytes, params: 2, frame: 18
var r4;
var moduleValue2;
var nodeHandle;
var moduleValue3;
var clearRows;
var Commands;
if (a0 != null) {
var value;
var moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
var isIOS = moduleValue.isIOS;
if (Reflect.apply(isIOS, moduleValue, [])) {
moduleValue2 = require(4020) /* metro dependency 4020: FabricUtils */;
if (moduleValue2.isFabric()) {
Commands = (require(9851) /* metro dependency 9851: ChatNativeComponent */).Commands;
clearRows = Commands.clearRows;
value = require(9852) /* metro dependency 9852: ChatChangesetUpdateTracker */;
Reflect.apply(clearRows, Commands, [a0, value.getAndIncrementChangesetIdForChat(a0)]);
return undefined;
}
nodeHandle = findNodeHandle(a0);
if (nodeHandle == null) {
return undefined;
}
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
r4 = moduleValue3.isIOS() ? NativeModules.DCDChatManager : importDefault(9853) /* metro dependency 9853: NativeChatModule */;
clearRows = r4.clearRows;
value = require(9852) /* metro dependency 9852: ChatChangesetUpdateTracker */;
Reflect.apply(clearRows, r4, [nodeHandle, value.getAndIncrementChangesetIdForChat(a0)]);
return undefined;
}
nodeHandle = findNodeHandle(a0);
if (nodeHandle == null) {
return undefined;
}
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
isIOS = moduleValue3.isIOS;
r4 = Reflect.apply(isIOS, moduleValue3,
[]) ? NativeModules.DCDChatManager : importDefault(9853) /* metro dependency 9853: NativeChatModule */;
clearRows = r4.clearRows;
value = require(9852) /* metro dependency 9852: ChatChangesetUpdateTracker */;
Reflect.apply(clearRows, r4, [nodeHandle, value.getAndIncrementChangesetIdForChat(a0)]);
}
}
function fadeIn(a0) { // fn#77209, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10036:2585, offset: 0x01df5204, size: 160 bytes, params: 2, frame: 15
var moduleValue;
var moduleValue2;
var nodeHandle;
if (a0 != null) {
moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
if (moduleValue.isIOS()) {
moduleValue2 = require(4020) /* metro dependency 4020: FabricUtils */;
if (moduleValue2.isFabric()) {
(require(9851) /* metro dependency 9851: ChatNativeComponent */).Commands.fadeIn(a0);
} else {
nodeHandle = findNodeHandle(a0);
if (nodeHandle != null) {
NativeModules.DCDChatManager.fadeIn(nodeHandle);
}
}
}
}
}