Files
discord-decomp/sources/modules/messages/tryInjectMessage.tsx
T
2026-07-28 01:06:53 +03:00

126 lines
7.0 KiB
TypeScript

/* Metro module 11520; source: modules/messages/tryInjectMessage.tsx; dependencies: [1226, 661, 7141, 4625, 1391, 11521, 11522, 2] */
import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import CreateMessage from './createMessage.tsx'; /* Metro dependency 7141 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as MessageRecordUtilsModule from './MessageRecordUtils.tsx'; /* Metro dependency 4625 */
import * as ChannelRecipientPrivateUserDataFlagsModule from '../../external/discord_common/js/shared/shared-constants/ChannelRecipientPrivateUserDataFlags.tsx'; /* Metro dependency 11521 */
function _fun88200(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#88200, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11706:6, offset: 0x01fd98fa, size: 201 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const Map = global.Map;
const map = new Map();
(FileImportTrackerModule).fileFinishedImporting('modules/messages/tryInjectMessage.tsx');
exports.tryCreateInjectedMessage = tryCreateInjectedMessage;
function createInjectedInGameNuxMessage({author, applicationId, timestamp}, a1) { // fn#88201, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11706:178, offset: 0x01fd99c3, size: 155 bytes, params: 3, frame: 15
const defaultImport = CreateMessage;
const IN_GAME_MESSAGE_NUX = MessageTypes.IN_GAME_MESSAGE_NUX;
const EPHEMERAL = MessageFlags.EPHEMERAL;
const SENT = MessageStates.SENT;
const value2 = defaultImport({channelId: a1, type: IN_GAME_MESSAGE_NUX, content: '', author: author,
flags: EPHEMERAL, state: SENT});
let value = MessageRecordUtilsModule;
value = value.createMessageRecord(value2);
value.applicationId = applicationId;
value.timestamp = timestamp;
return value;
}
function tryCreateInjectedMessage(a0, a1) { // fn#88202, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11706:533, offset: 0x01fd9a5e, size: 502 bytes, params: 3, frame: 24
var r2;
var applicationId;
var value3;
var moduleValue;
var hasFlag;
var authenticationStoreBinding;
var moduleValue2;
var recipientFlags;
var value4;
const ChannelRecipientPrivateUserDataFlags = (ChannelRecipientPrivateUserDataFlagsModule).ChannelRecipientPrivateUserDataFlags;
var has;
var createInjectedInGameNuxMessageBinding;
var injectedInGameNuxMessage;
var set;
var moduleValue3;
var setFlag;
var value5;
var updatePrivateChannelRecipientFlags;
var value;
let binding = env0_7;
const get = binding.get;
let id = a1.id;
const value2 = Reflect.apply(get, binding, [id]);
id = a0.id;
if (value2 === id) {
r2 = createInjectedInGameNuxMessage(a0, a1.id);
} else {
applicationId = a0.applicationId;
value3 = null;
if (value3 == applicationId) {
r2 = value3;
} else {
moduleValue = require(1391) /* metro dependency 1391: FlagUtils */;
hasFlag = moduleValue.hasFlag;
if (Reflect.apply(hasFlag, moduleValue, [a0.flags, MessageFlags.SENT_BY_SOCIAL_LAYER_INTEGRATION])) {
if (a1.isDM()) {
id = a0.author.id;
authenticationStoreBinding = AuthenticationStore;
if (id === authenticationStoreBinding.getId()) {
r2 = value3;
} else if (value3 != a0.activity) {
r2 = value3;
} else {
moduleValue2 = require(1391) /* metro dependency 1391: FlagUtils */;
hasFlag = moduleValue2.hasFlag;
recipientFlags = a1.recipientFlags;
value4 = 0;
if (Reflect.apply(hasFlag, moduleValue2, [value3 != recipientFlags ? recipientFlags : value4,
ChannelRecipientPrivateUserDataFlags.DISMISSED_IN_GAME_MESSAGE_NUX])) {
r2 = value3;
} else {
binding = env0_7;
has = binding.has;
id = a1.id;
if (Reflect.apply(has, binding, [id])) {
r2 = value3;
} else {
createInjectedInGameNuxMessageBinding = createInjectedInGameNuxMessage;
id = a1.id;
injectedInGameNuxMessage = createInjectedInGameNuxMessageBinding(a0, id);
binding = env0_7;
set = binding.set;
id = a1.id;
Reflect.apply(set, binding, [id, a0.id]);
moduleValue3 = require(1391) /* metro dependency 1391: FlagUtils */;
setFlag = moduleValue3.setFlag;
recipientFlags = a1.recipientFlags;
value5 = Reflect.apply(setFlag, moduleValue3,
[value3 != recipientFlags ? recipientFlags : value4,
ChannelRecipientPrivateUserDataFlags.DISMISSED_IN_GAME_MESSAGE_NUX, true]);
value = importDefault(11522) /* metro dependency 11522: PrivateChannelRecipientActionCreators */;
updatePrivateChannelRecipientFlags = value.updatePrivateChannelRecipientFlags;
id = a1.id;
Reflect.apply(updatePrivateChannelRecipientFlags, value, [id, value5]);
r2 = injectedInGameNuxMessage;
}
}
}
} else {
r2 = value3;
}
} else {
r2 = value3;
}
}
}
value = null;
return value != r2 ? {message: r2, position: 'before'} : value;
}
}
global.__d(_fun88200, 11520, [1226, 661, 7141, 4625, 1391, 11521, 11522,
2]) /* metro module 11520, dependencies: [1226, 661, 7141, 4625, 1391, 11521, 11522, 2] */;