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

782 lines
40 KiB
TypeScript

/* Metro module 5215; source: modules/recents/RecentMentionsStore.tsx; dependencies: [6, 7, 15, 17, 18, 3794, 1226, 1379, 4814, 4605, 3793, 3969, 4864, 1878, 661, 587, 4625, 5072, 4639, 22, 4303, 5216, 5217, 566, 694, 2] */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Module00022 from '../../by-id/module-00022.js'; /* Metro dependency 22 */
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
import MessageRecord from '../../records/MessageRecord.tsx'; /* Metro dependency 3794 */
import SelectedGuildStore from '../../stores/SelectedGuildStore.tsx'; /* Metro dependency 3969 */
import ReadStateStore from '../../stores/ReadStateStore.tsx'; /* Metro dependency 4605 */
import MessageStore from '../../stores/MessageStore.tsx'; /* Metro dependency 4814 */
import UserGuildSettingsStore from '../../stores/UserGuildSettingsStore.tsx'; /* Metro dependency 4864 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as StorageModule from '../../external/discord_common/js/packages/storage/Storage.tsx'; /* Metro dependency 587 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
function _fun46077(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#46077, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:6, offset: 0x0119f948, size: 839 bytes, params: 8, frame: 30
const env0_0 = require;
const updateChannelMentionCount = function({addedMessages, deletedMessages}) {
if (addedMessages != null) {
addedMessages.forEach(_fun46082);
}
if (deletedMessages != null) {
deletedMessages.forEach(_fun46083);
}
};
const hasMentionNotificationEnabled2 = hasMentionNotificationEnabled;
const parseMessage2 = parseMessage;
const closure3 = function({id}) {
return deleteMessage(id);
};
const SET_RECENT_MENTIONS_FILTER_460912 = SET_RECENT_MENTIONS_FILTER_46091;
const closure5 = function() {
env0_23 = [];
env0_25 = {};
env0_29 = false;
env0_31 = false;
env0_24 = {};
};
const RELATIONSHIP_ADD_460972 = RELATIONSHIP_ADD_46097;
const CHANNEL_DELETE_461002 = CHANNEL_DELETE_46100;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
const RecentMentionsFilters = value.RecentMentionsFilters;
const env0_18 = value.ChannelTypes;
const env0_19 = value.MessageTypesSets;
const env0_20 = value.UserNotificationSettings;
const env0_21 = value.ChannelTypesSets;
let env0_23 = [];
let env0_24 = {};
let env0_25 = {};
const Storage = (StorageModule).Storage;
const get = Storage.get;
const ALL_SERVERS = RecentMentionsFilters.ALL_SERVERS;
const env0_28 = Reflect.apply(get, Storage, ['recentMentionFilterSettings', {'guildFilter': null,
'everyoneFilter': true, 'roleFilter': true, guildFilter: ALL_SERVERS}]);
const Store = (Flux).Store;
_fun46102(Store).displayName = 'RecentMentionsStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{LOAD_RECENT_MENTIONS: LOAD_RECENT_MENTIONS, LOAD_RECENT_MENTIONS_SUCCESS: LOAD_RECENT_MENTIONS_SUCCESS,
LOAD_RECENT_MENTIONS_FAILURE: function() {
env0_26 = false;
}, SET_RECENT_MENTIONS_FILTER: SET_RECENT_MENTIONS_FILTER_460912, CLEAR_MENTIONS: function() {
CONNECTION_OPEN_46096();
}, TRUNCATE_MENTIONS: TRUNCATE_MENTIONS, CHANNEL_SELECT: CHANNEL_SELECT_46124, CONNECTION_OPEN: closure5,
GUILD_DELETE: GUILD_DELETE_46125, MESSAGE_CREATE: MESSAGE_CREATE_46127, MESSAGE_UPDATE: MESSAGE_UPDATE_46128,
MESSAGE_DELETE: closure3, RECENT_MENTION_DELETE: closure3, MESSAGE_DELETE_BULK: function({ids}) {
importDefault(dependencyMap[19]).forEach(ids, deleteMessage);
}, CHANNEL_DELETE: CHANNEL_DELETE_461002, THREAD_DELETE: CHANNEL_DELETE_461002,
RELATIONSHIP_ADD: RELATIONSHIP_ADD_460972, RELATIONSHIP_REMOVE: RELATIONSHIP_ADD_460972,
RELATIONSHIP_UPDATE: RELATIONSHIP_ADD_460972, SET_RECENT_MENTIONS_STALE: function() {
env0_31 = true;
}});
(FileImportTrackerModule).fileFinishedImporting('modules/recents/RecentMentionsStore.tsx');
exports.default = value;
exports.hasMentionNotificationEnabled = hasMentionNotificationEnabled2;
exports.parseMessage = parseMessage2;
function _isNativeReflectConstruct_46078() { // fn#46078, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:382, offset: 0x0119fc8f, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_46078_isNativeReflectConstruct = function() {
return !!result;
})();
}
function updateChannelMentionCount({addedMessages, deletedMessages}) { // fn#46081, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:736, offset: 0x0119fced, size: 61 bytes, params: 2, frame: 14
if (addedMessages != null) {
addedMessages.forEach(_fun46082);
}
if (deletedMessages != null) {
deletedMessages.forEach(_fun46083);
}
function _fun46082(a0) { // fn#46082, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:828, offset: 0x0119fd2a, size: 79 bytes, params: 2, frame: 12
let value = environment.__proto__;
let binding = env1_24;
const getChannelId = a0.getChannelId;
let property = binding[Reflect.apply(getChannelId, a0, [])];
if (property == null) {
env1_24[a0.getChannelId()] = 0;
}
binding = env1_24;
value = a0.getChannelId();
property = binding[value];
binding[value] = typeof property === 'bigint' ? property + 1n : +property + 1;
}
function _fun46083(a0) { // fn#46083, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:928, offset: 0x0119fd79, size: 98 bytes, params: 2, frame: 16
var channelId;
var Math;
let binding = env1_24;
const getChannelId = a0.getChannelId;
if (binding[Reflect.apply(getChannelId, a0, [])] != null) {
binding = env1_24;
channelId = a0.getChannelId();
Math = global.Math;
binding[channelId] = Math.max(0, env1_24[a0.getChannelId()] - 1);
}
}
}
function findOrCreateMessageRecord(a0) { // fn#46084, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:1018, offset: 0x0119fddb, size: 86 bytes, params: 2, frame: 15
var r1;
var value;
if (a0 instanceof MessageRecord) {
return a0;
}
const message = MessageStore.getMessage(a0.channel_id, a0.id);
if (message != null) {
r1 = message;
} else {
value = require(4625) /* metro dependency 4625: MessageRecordUtils */;
value = value.createMessageRecord(a0);
r1 = value;
}
return r1;
}
function hasMentionNotificationEnabled(a0) { // fn#46085, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:1170, offset: 0x0119fe31, size: 330 bytes, params: 2, frame: 18
var r0;
var userGuildSettingsStoreBinding;
var isGuildOrCategoryOrChannelMuted;
var guild_id;
var id;
var moduleValue;
var shouldShowAgeGateForChannelId;
var value3;
var isSuppressEveryoneEnabled;
var isSuppressEveryoneEnabled2;
var isSuppressRolesEnabled;
var isSuppressRolesEnabled2;
var currentUser;
var value5;
var value;
const basicChannel = ChannelStore.getBasicChannel(a0.channel_id);
if (basicChannel != null) {
var GUILD_TEXTUAL = ChannelTypesSets.GUILD_TEXTUAL;
if (GUILD_TEXTUAL.has(basicChannel.type)) {
userGuildSettingsStoreBinding = UserGuildSettingsStore;
isGuildOrCategoryOrChannelMuted = userGuildSettingsStoreBinding.isGuildOrCategoryOrChannelMuted;
guild_id = basicChannel.guild_id;
id = basicChannel.id;
if (Reflect.apply(isGuildOrCategoryOrChannelMuted, userGuildSettingsStoreBinding, [guild_id, id])) {
return false;
}
moduleValue = require(5072) /* metro dependency 5072: AgeGateUtils */;
shouldShowAgeGateForChannelId = moduleValue.shouldShowAgeGateForChannelId;
id = basicChannel.id;
if (Reflect.apply(shouldShowAgeGateForChannelId, moduleValue, [id])) {
return false;
}
value3 = UserGuildSettingsStore.resolvedMessageNotifications(basicChannel);
if (UserNotificationSettings.ALL_MESSAGES === value3) {
return true;
}
if (UserNotificationSettings.ONLY_MENTIONS === value3) {
userGuildSettingsStoreBinding = UserGuildSettingsStore;
isSuppressEveryoneEnabled = userGuildSettingsStoreBinding.isSuppressEveryoneEnabled;
guild_id = basicChannel.guild_id;
isSuppressEveryoneEnabled2 = Reflect.apply(isSuppressEveryoneEnabled, userGuildSettingsStoreBinding,
[guild_id]);
userGuildSettingsStoreBinding = UserGuildSettingsStore;
isSuppressRolesEnabled = userGuildSettingsStoreBinding.isSuppressRolesEnabled;
guild_id = basicChannel.guild_id;
isSuppressRolesEnabled2 = Reflect.apply(isSuppressRolesEnabled, userGuildSettingsStoreBinding,
[guild_id]);
currentUser = UserStore.getCurrentUser();
value5 = currentUser != null;
if (value5) {
value = importDefault(4639) /* metro dependency 4639: isMessageMentioned */;
value = value({message: a0, userId: currentUser.id, suppressEveryone: isSuppressEveryoneEnabled2,
suppressRoles: isSuppressRolesEnabled2});
r0 = value;
} else {
r0 = value5;
}
return r0;
}
UserNotificationSettings.NO_MESSAGES;
return false;
}
}
return false;
}
function parseMessage(a0) { // fn#46086, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:1741, offset: 0x0119ff7b, size: 495 bytes, params: 2, frame: 21
var r3;
var r1;
var SELF_MENTIONABLE_SYSTEM;
var value2;
var channel;
var getGuildId;
var guildId;
var selectedGuildStoreBinding;
var id2;
var relationshipStoreBinding;
var orCreateMessageRecord;
var everyoneFilter;
var roleFilter;
var defaultImport;
var object;
var binding;
var readStateStoreBinding;
var ackMessageId;
var id;
var value6;
var defaultImport2;
var userGuildSettingsStoreBinding;
var isSuppressEveryoneEnabled;
var isSuppressRolesEnabled;
const value = a1;
let r5 = value !== undefined ? value : null;
if ((importDefault(5216) /* metro dependency 5216: isSystemMessage */)(a0)) {
SELF_MENTIONABLE_SYSTEM = MessageTypesSets.SELF_MENTIONABLE_SYSTEM;
if (SELF_MENTIONABLE_SYSTEM.has(a0.type)) {
value2 = null;
r5 = value2 == r5 ? a0.channel_id : r5;
channel = ChannelStore.getChannel(r5);
if (value2 == channel) {
return value2;
}
if (channel.type === ChannelTypes.DM) {
return value2;
}
if (env0_28.guildFilter !== RecentMentionsFilters.THIS_SERVER) {
id2 = AuthenticationStore.getId();
relationshipStoreBinding = RelationshipStore;
if (relationshipStoreBinding.isBlockedOrIgnoredForMessage(a0)) {
return value2;
}
if ((importDefault(5217) /* metro dependency 5217: shouldRemoveSelfMention */)(a0, id2)) {
return value2;
}
orCreateMessageRecord = findOrCreateMessageRecord(a0);
everyoneFilter = env0_28.everyoneFilter;
roleFilter = env0_28.roleFilter;
defaultImport = importDefault(4639) /* metro dependency 4639: isMessageMentioned */;
object = {message: orCreateMessageRecord, userId: id2, suppressEveryone: !everyoneFilter,
suppressRoles: !roleFilter};
if (defaultImport(object)) {
binding = env0_31;
if (binding) {
readStateStoreBinding = ReadStateStore;
ackMessageId = readStateStoreBinding.ackMessageId;
id = channel.id;
value6 = Reflect.apply(ackMessageId, readStateStoreBinding, [id]);
id = orCreateMessageRecord.id;
r3 = value6 !== id;
} else {
r3 = binding;
}
if (r3) {
defaultImport2 = importDefault(4639) /* metro dependency 4639: isMessageMentioned */;
object = {message: orCreateMessageRecord, userId: id2};
userGuildSettingsStoreBinding = UserGuildSettingsStore;
isSuppressEveryoneEnabled = userGuildSettingsStoreBinding.isSuppressEveryoneEnabled;
getGuildId = channel.getGuildId;
object.suppressEveryone = Reflect.apply(isSuppressEveryoneEnabled,
userGuildSettingsStoreBinding,
[Reflect.apply(getGuildId, channel, [])]);
userGuildSettingsStoreBinding = UserGuildSettingsStore;
isSuppressRolesEnabled = userGuildSettingsStoreBinding.isSuppressRolesEnabled;
getGuildId = channel.getGuildId;
object.suppressRoles = Reflect.apply(isSuppressRolesEnabled, userGuildSettingsStoreBinding,
[Reflect.apply(getGuildId, channel, [])]);
r3 = defaultImport2(object);
}
r1 = r3 ? orCreateMessageRecord : orCreateMessageRecord;
} else {
r1 = value2;
}
return r1;
}
guildId = channel.getGuildId();
selectedGuildStoreBinding = SelectedGuildStore;
getGuildId = selectedGuildStoreBinding.getGuildId;
if (guildId !== Reflect.apply(getGuildId, selectedGuildStoreBinding, [])) {
return value2;
}
id2 = AuthenticationStore.getId();
relationshipStoreBinding = RelationshipStore;
if (relationshipStoreBinding.isBlockedOrIgnoredForMessage(a0)) {
return value2;
}
if ((importDefault(5217) /* metro dependency 5217: shouldRemoveSelfMention */)(a0, id2)) {
return value2;
}
orCreateMessageRecord = findOrCreateMessageRecord(a0);
everyoneFilter = env0_28.everyoneFilter;
roleFilter = env0_28.roleFilter;
defaultImport = importDefault(4639) /* metro dependency 4639: isMessageMentioned */;
object = {message: orCreateMessageRecord, userId: id2, suppressEveryone: !everyoneFilter,
suppressRoles: !roleFilter};
if (defaultImport(object)) {
binding = env0_31;
if (binding) {
readStateStoreBinding = ReadStateStore;
ackMessageId = readStateStoreBinding.ackMessageId;
id = channel.id;
value6 = Reflect.apply(ackMessageId, readStateStoreBinding, [id]);
id = orCreateMessageRecord.id;
r3 = value6 !== id;
} else {
r3 = binding;
}
if (r3) {
defaultImport2 = importDefault(4639) /* metro dependency 4639: isMessageMentioned */;
object = {message: orCreateMessageRecord, userId: id2};
userGuildSettingsStoreBinding = UserGuildSettingsStore;
isSuppressEveryoneEnabled = userGuildSettingsStoreBinding.isSuppressEveryoneEnabled;
getGuildId = channel.getGuildId;
object.suppressEveryone = Reflect.apply(isSuppressEveryoneEnabled, userGuildSettingsStoreBinding,
[Reflect.apply(getGuildId, channel, [])]);
userGuildSettingsStoreBinding = UserGuildSettingsStore;
isSuppressRolesEnabled = userGuildSettingsStoreBinding.isSuppressRolesEnabled;
getGuildId = channel.getGuildId;
object.suppressRoles = Reflect.apply(isSuppressRolesEnabled, userGuildSettingsStoreBinding,
[Reflect.apply(getGuildId, channel, [])]);
r3 = defaultImport2(object);
}
r1 = r3 ? orCreateMessageRecord : orCreateMessageRecord;
} else {
r1 = value2;
}
return r1;
}
return null;
}
value2 = null;
r5 = value2 == r5 ? a0.channel_id : r5;
channel = ChannelStore.getChannel(r5);
if (value2 == channel) {
return value2;
}
const type = channel.type;
const DM = ChannelTypes.DM;
if (type === DM) {
return value2;
}
const guildFilter = env0_28.guildFilter;
const THIS_SERVER = RecentMentionsFilters.THIS_SERVER;
if (guildFilter === THIS_SERVER) {
guildId = channel.getGuildId();
selectedGuildStoreBinding = SelectedGuildStore;
if (guildId !== selectedGuildStoreBinding.getGuildId()) {
return value2;
}
}
id2 = AuthenticationStore.getId();
relationshipStoreBinding = RelationshipStore;
if (relationshipStoreBinding.isBlockedOrIgnoredForMessage(a0)) {
return value2;
}
if ((importDefault(5217) /* metro dependency 5217: shouldRemoveSelfMention */)(a0, id2)) {
return value2;
}
orCreateMessageRecord = findOrCreateMessageRecord(a0);
everyoneFilter = env0_28.everyoneFilter;
roleFilter = env0_28.roleFilter;
defaultImport = importDefault(4639) /* metro dependency 4639: isMessageMentioned */;
object = {message: orCreateMessageRecord, userId: id2, suppressEveryone: !everyoneFilter,
suppressRoles: !roleFilter};
if (defaultImport(object)) {
binding = env0_31;
if (binding) {
readStateStoreBinding = ReadStateStore;
ackMessageId = readStateStoreBinding.ackMessageId;
id = channel.id;
value6 = Reflect.apply(ackMessageId, readStateStoreBinding, [id]);
id = orCreateMessageRecord.id;
r3 = value6 !== id;
} else {
r3 = binding;
}
if (r3) {
defaultImport2 = importDefault(4639) /* metro dependency 4639: isMessageMentioned */;
object = {message: orCreateMessageRecord, userId: id2};
userGuildSettingsStoreBinding = UserGuildSettingsStore;
isSuppressEveryoneEnabled = userGuildSettingsStoreBinding.isSuppressEveryoneEnabled;
getGuildId = channel.getGuildId;
object.suppressEveryone = Reflect.apply(isSuppressEveryoneEnabled, userGuildSettingsStoreBinding,
[Reflect.apply(getGuildId, channel, [])]);
userGuildSettingsStoreBinding = UserGuildSettingsStore;
isSuppressRolesEnabled = userGuildSettingsStoreBinding.isSuppressRolesEnabled;
getGuildId = channel.getGuildId;
object.suppressRoles = Reflect.apply(isSuppressRolesEnabled, userGuildSettingsStoreBinding,
[Reflect.apply(getGuildId, channel, [])]);
r3 = defaultImport2(object);
}
r1 = r3 ? orCreateMessageRecord : orCreateMessageRecord;
} else {
r1 = value2;
}
return r1;
}
function deleteMessage(a0) { // fn#46087, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:2428, offset: 0x011a016a, size: 131 bytes, params: 2, frame: 21
const env0_0 = a0;
if (env0_25[a0] == null) {
return false;
}
delete env0_25[a0];
const updateChannelMentionCountBinding = updateChannelMentionCount;
const defaultImport = Module00022;
updateChannelMentionCountBinding({deletedMessages: defaultImport.filter(env0_23, _fun46088)});
const defaultImport2 = defaultImport;
env0_23 = defaultImport2.filter(env0_23, _fun46089);
function _fun46088({id}) { // fn#46088, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:2552, offset: 0x00db0c48, size: 21 bytes, params: 2, frame: 2
return id === env0_0;
}
function _fun46089({id}) { // fn#46089, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:2594, offset: 0x010190b8, size: 21 bytes, params: 2, frame: 2
return id !== env0_0;
}
}
function SET_RECENT_MENTIONS_FILTER_46091(a0) { // fn#46091, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:2673, offset: 0x011a0205, size: 267 bytes, params: 2, frame: 19
var object2;
copyDataProperties({}, env0_28, undefined);
const defaultImport = Module00022;
env0_28 = defaultImport.defaults(defaultImport.pick(a0, ['guildFilter', 'roleFilter', 'everyoneFilter']), env0_28);
const Storage = (StorageModule).Storage;
Storage.set(env0_22, env0_28);
const changesTo2 = changesTo;
const THIS_SERVER = RecentMentionsFilters.THIS_SERVER;
let r4 = changesTo2('guildFilter', THIS_SERVER) || changesTo2('everyoneFilter', false);
r4 = !r4 ? changesTo2('roleFilter', false) : r4;
env0_25 = {};
items2 = [];
if (r4) {
object2.forEach(_fun46093);
}
object2 = items2;
((a0) => {
env1_24 = {};
a0.forEach(_fun46095);
})(items2);
if (object2.length !== 0) {
}
function changesTo(a0, a1) { // fn#46092, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:2857, owner: SET_RECENT_MENTIONS_FILTER_46091.changesTo, offset: 0x011a0310, size: 49 bytes, params: 3, frame: 4
const property = env0_0[a0];
const value = environment.__proto__;
return property !== env1_28[a0] && env1_28[a0] === a1;
}
function _fun46093(a0) { // fn#46093, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:3015, offset: 0x011a0341, size: 57 bytes, params: 2, frame: 13
var binding;
const message = parseMessage(a0);
if (message != null) {
binding = env0_1;
binding.push(message);
binding = env1_25;
binding[message.id] = true;
}
}
function resetChannelMentionCount(a0) { // fn#46094, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:3076, owner: SET_RECENT_MENTIONS_FILTER_46091.resetChannelMentionCount, offset: 0x011a037a, size: 33 bytes, params: 2, frame: 11
env1_24 = {};
a0.forEach(_fun46095);
function _fun46095(a0) { // fn#46095, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:3129, offset: 0x011a039b, size: 79 bytes, params: 2, frame: 12
let value = environment.__proto__.__proto__;
let binding = env2_24;
const getChannelId = a0.getChannelId;
let property = binding[Reflect.apply(getChannelId, a0, [])];
if (property == null) {
env2_24[a0.getChannelId()] = 0;
}
binding = env2_24;
value = a0.getChannelId();
property = binding[value];
binding[value] = typeof property === 'bigint' ? property + 1n : +property + 1;
}
}
}
function RELATIONSHIP_ADD_46097() { // fn#46097, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:3293, offset: 0x011a040f, size: 88 bytes, params: 1, frame: 18
const updateChannelMentionCountBinding = updateChannelMentionCount;
const defaultImport = Module00022;
updateChannelMentionCountBinding({deletedMessages: defaultImport.filter(env0_23, function(a0) {
return RelationshipStore.isBlockedOrIgnoredForMessage(a0);
})});
env0_23 = env0_23.filter(function(a0) {
return !RelationshipStore.isBlockedOrIgnoredForMessage(a0);
});
}
function CHANNEL_DELETE_46100({channel}) { // fn#46100, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:3485, offset: 0x011a0498, size: 89 bytes, params: 2, frame: 16
const defaultImport = Module00022;
env0_23 = defaultImport.filter(env0_23, _fun46101);
updateChannelMentionCount({deletedMessages: []});
function _fun46101(a0) { // fn#46101, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:3558, offset: 0x011a04f1, size: 61 bytes, params: 2, frame: 13
var r0;
var value3;
var binding;
const value2 = a0.channel_id !== channel.id;
if (value2) {
r0 = value2;
} else {
value3 = environment.__proto__;
binding = env1_25;
delete binding[a0.id];
binding = env0_1;
binding.push(a0);
r0 = false;
}
return r0;
}
}
function _fun46102(a0) { // fn#46102, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:3667, offset: 0x011a052e, size: 383 bytes, params: 2, frame: 16
const RecentMentionsStore2 = RecentMentionsStore;
Inherits(RecentMentionsStore2, a0);
return CreateClass(RecentMentionsStore2, [{key: 'initialize', value: function() {
this.waitFor(AuthenticationStore, ChannelStore, MessageStore, ReadStateStore, RelationshipStore,
SelectedGuildStore,
UserGuildSettingsStore, UserStore);
}}, {key: 'hasLoadedEver', get: get_46105}, {key: 'lastLoaded', get: get_46106}, {key: 'getMentions',
value: value_46107}, {key: 'getSettingsFilteredMentions', value: value_46108}, {key: 'hasMention',
value: value_46109}, {key: 'loading', get: get_46110}, {key: 'hasMore', get: get_46111}, {key: 'guildFilter',
get: get_46112}, {key: 'everyoneFilter', get: get_46113}, {key: 'roleFilter', get: get_46114},
{key: 'mentionsAreStale', get: get_46115}, {key: 'mentionCountByChannel', get: get_46116},
{key: 'getMentionCountForChannel', value: value_46117}]);
function RecentMentionsStore() { // fn#46103, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:3679, offset: 0x011293ae, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_3(this, RecentMentionsStore);
const value3 = env1_6(RecentMentionsStore);
return env1_5(this, _isNativeReflectConstruct_46078() ? global.Reflect.construct(value3, arguments,
env1_6(this).constructor) : value3.apply(this, arguments));
}
function get_46105() { // fn#46105, offset: 0x00ef0ca7, size: 9 bytes, params: 1, frame: 1
return env1_29;
}
function get_46106() { // fn#46106, offset: 0x00e45481, size: 9 bytes, params: 1, frame: 1
return env1_30;
}
function value_46107() { // fn#46107, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:4151, offset: 0x011a06e4, size: 36 bytes, params: 1, frame: 3
return env1_29 || env1_23.length > 0 ? env1_23 : null;
}
function value_46108() { // fn#46108, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:4233, offset: 0x011a0708, size: 50 bytes, params: 1, frame: 12
const value = environment.__proto__;
return env1_29 || env1_23.length > 0 ? env1_23.filter(hasMentionNotificationEnabled) : null;
}
function value_46109(a0) { // fn#46109, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:4336, offset: 0x011a073a, size: 16 bytes, params: 2, frame: 2
return env1_25[a0];
}
function get_46110() { // fn#46110, offset: 0x00df3adf, size: 9 bytes, params: 1, frame: 1
return env1_26;
}
function get_46111() { // fn#46111, offset: 0x00df3b32, size: 9 bytes, params: 1, frame: 1
return env1_27;
}
function get_46112() { // fn#46112, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:4467, offset: 0x011a074a, size: 15 bytes, params: 1, frame: 1
return env1_28.guildFilter;
}
function get_46113() { // fn#46113, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:4527, offset: 0x011a0759, size: 15 bytes, params: 1, frame: 1
return env1_28.everyoneFilter;
}
function get_46114() { // fn#46114, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:4586, offset: 0x011a0768, size: 15 bytes, params: 1, frame: 1
return env1_28.roleFilter;
}
function get_46115() { // fn#46115, offset: 0x00df3abb, size: 9 bytes, params: 1, frame: 1
return env1_31;
}
function get_46116() { // fn#46116, offset: 0x00df3acd, size: 9 bytes, params: 1, frame: 1
return env1_24;
}
function value_46117(a0) { // fn#46117, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:4763, offset: 0x011a0777, size: 30 bytes, params: 2, frame: 3
const value = environment.__proto__;
return env1_24[a0] ?? 0;
}
}
function LOAD_RECENT_MENTIONS({guildId}) { // fn#46118, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:4909, offset: 0x011a0795, size: 85 bytes, params: 2, frame: 12
if (guildId == null && env0_28.guildFilter === RecentMentionsFilters.THIS_SERVER) {
SET_RECENT_MENTIONS_FILTER_46091({guildFilter: RecentMentionsFilters.ALL_SERVERS});
}
}
function LOAD_RECENT_MENTIONS_SUCCESS({hasMoreAfter, messages, isAfter}) { // fn#46119, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:5085, offset: 0x011a07ea, size: 192 bytes, params: 2, frame: 18
const defaultImport = Module00022;
const value2 = defaultImport.map(messages, findOrCreateMessageRecord);
updateChannelMentionCount({addedMessages: value2});
if (isAfter) {
env0_23 = env0_23.concat(value2);
} else {
env0_25 = {};
}
defaultImport.forEach(value2, _fun46120);
env0_30 = (require(4303) /* metro dependency 4303: TimeUtils */).now();
function _fun46120({id}) { // fn#46120, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:5301, offset: 0x011a08aa, size: 25 bytes, params: 2, frame: 3
env1_25[id] = true;
}
}
function TRUNCATE_MENTIONS({size}) { // fn#46123, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:5569, offset: 0x011a08df, size: 143 bytes, params: 2, frame: 16
var r3;
var id;
var value2;
const updateChannelMentionCountBinding = updateChannelMentionCount;
const object = {};
let binding = env0_23;
object.deletedMessages = binding.slice(size);
updateChannelMentionCountBinding(object);
let length = env0_23.length;
if (size < length) {
r3 = size;
reducibleLoop1: while (true) {
binding = env0_25;
id = env0_23[r3].id;
delete binding[id];
value2 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
length = env0_23.length;
if (value2 < length) {
r3 = value2;
continue reducibleLoop1;
}
break reducibleLoop1;
}
}
reducibleJoin4: while (true) {
if (env0_23.length > env0_23.slice(0, size).length) {
env0_27 = true;
break reducibleJoin4;
}
break reducibleJoin4;
}
}
function CHANNEL_SELECT_46124() { // fn#46124, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:5769, offset: 0x011a096e, size: 41 bytes, params: 1, frame: 3
const guildFilter = env0_28.guildFilter;
const THIS_SERVER = RecentMentionsFilters.THIS_SERVER;
if (guildFilter !== THIS_SERVER) {
return false;
}
}
function GUILD_DELETE_46125({guild}) { // fn#46125, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:5898, offset: 0x011a0997, size: 89 bytes, params: 2, frame: 16
const defaultImport = Module00022;
env0_23 = defaultImport.filter(env0_23, _fun46126);
updateChannelMentionCount({deletedMessages: []});
function _fun46126(a0) { // fn#46126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:5967, offset: 0x011a09f0, size: 97 bytes, params: 2, frame: 13
var binding;
const value = environment.__proto__;
const channel = ChannelStore.getChannel(a0.channel_id);
let r0 = channel != null && channel.getGuildId() !== guild.id;
if (!r0) {
binding = env1_25;
delete binding[a0.id];
binding = env0_1;
binding.push(a0);
r0 = false;
}
return r0;
}
}
function MESSAGE_CREATE_46127({channelId, message}) { // fn#46127, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:6139, offset: 0x011a0a51, size: 191 bytes, params: 2, frame: 19
var message2;
var binding;
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
var moduleValue = require(4639) /* metro dependency 4639: isMessageMentioned */;
var isRawMessageMentioned = moduleValue.isRawMessageMentioned;
var object = {rawMessage: message};
object.userId = currentUser.id;
object.suppressRoles = false;
object.suppressEveryone = false;
if (Reflect.apply(isRawMessageMentioned, moduleValue, [object])) {
message2 = parseMessage(message, channelId);
if (message2 == null) {
return false;
}
binding = env0_23;
binding.slice().unshift(message2);
binding = env0_25;
binding[message2.id] = true;
updateChannelMentionCount({addedMessages: [message2]});
return undefined;
}
}
return false;
}
function MESSAGE_UPDATE_46128(a0) { // fn#46128, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5393:6481, offset: 0x011a0b10, size: 162 bytes, params: 2, frame: 17
const id = a0.message.id;
if (id == null) {
return false;
}
var value;
if (env0_25[id] == null) {
return false;
}
const defaultImport = Module00022;
const findIndex = defaultImport.findIndex;
let binding = env0_23;
const index = Reflect.apply(findIndex, defaultImport, [binding, function({id}) {
return id === id;
}]);
const value2 = env0_23.slice();
env0_23 = value2;
const property = value2[index];
if (property != null) {
binding = env0_23;
value = require(4625) /* metro dependency 4625: MessageRecordUtils */;
binding[index] = value.updateMessageRecord(property, a0.message);
}
}
}
global.__d(_fun46077, 5215, [6, 7, 15, 17, 18, 3794, 1226, 1379, 4814, 4605, 3793, 3969, 4864, 1878, 661, 587, 4625,
5072, 4639, 22, 4303, 5216, 5217, 566, 694,
2]) /* metro module 5215, dependencies: [6, 7, 15, 17, 18, 3794, 1226, 1379, 4814, 4605, 3793, 3969, 4864, 1878, 661, 587, 4625, 5072, 4639, 22, 4303, 5216, 5217, 566, 694, 2] */;