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

241 lines
11 KiB
TypeScript

/* Metro module 6611; source: modules/notifications/LastMentionTimestampStore.tsx; dependencies: [6, 7, 15, 17, 18, 1945, 4864, 1878, 694, 566, 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 Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import Dispatcher from '../../Dispatcher.tsx'; /* Metro dependency 694 */
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import GuildMemberStore from '../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */
import UserGuildSettingsStore from '../../stores/UserGuildSettingsStore.tsx'; /* Metro dependency 4864 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
function _fun52208(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#52208, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6789:6, offset: 0x013229fa, size: 368 bytes, params: 8, frame: 18
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_14 = {};
const env0_15 = {};
const env0_16 = {};
const env0_17 = {};
const Store = (Flux).Store;
let value = _fun52212(Store);
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{CONNECTION_OPEN: CONNECTION_OPEN_52219, MESSAGE_NOTIFICATION_SHOWN: MESSAGE_NOTIFICATION_SHOWN});
(FileImportTrackerModule).fileFinishedImporting('modules/notifications/LastMentionTimestampStore.tsx');
exports.default = value;
exports.trackMessageNotificationTimestamps = trackMessageNotificationTimestamps;
function _isNativeReflectConstruct_52209() { // fn#52209, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6789:178, offset: 0x01322b6a, 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_52209_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun52212(a0) { // fn#52212, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6789:429, offset: 0x01322bc8, size: 116 bytes, params: 2, frame: 16
const LastMentionTimestampStore2 = LastMentionTimestampStore;
Inherits(LastMentionTimestampStore2, a0);
return CreateClass(LastMentionTimestampStore2, [{key: 'initialize', value: function() {
this.waitFor(GuildMemberStore, UserGuildSettingsStore, UserStore);
}}, {key: 'getGlobalStats', value: value_52215}, {key: 'getStats', value: value_52217}]);
function LastMentionTimestampStore() { // fn#52213, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6789:441, offset: 0x01176269, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_2(this, LastMentionTimestampStore);
const value3 = env1_5(LastMentionTimestampStore);
return env1_4(this, _isNativeReflectConstruct_52209() ? global.Reflect.construct(value3, arguments,
env1_5(this).constructor) : value3.apply(this, arguments));
}
function value_52215() { // fn#52215, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6789:845, offset: 0x01322c5f, size: 72 bytes, params: 1, frame: 13
var environment;
const closure = function(a0) {
var r0;
var Math;
var value = null;
if (value == a0) {
r0 = value;
} else {
Math = global.Math;
value = global.Date.now() - a0;
value = Math.floor(value / 1000);
r0 = value;
}
return r0;
};
const object = {};
let value = environment.__proto__;
object.approx_seconds_since_last_notification = closure(env1_10);
object.approx_seconds_since_last_mention = closure(env1_11);
object.approx_seconds_since_last_role_mention = closure(env1_12);
object.approx_seconds_since_last_everyone_mention = closure(env1_13);
return object;
}
function value_52217(a0) { // fn#52217, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6789:1126, offset: 0x01322ce5, size: 193 bytes, params: 2, frame: 16
var environment;
const closure = function(a0) {
var r0;
var Math;
var value = null;
if (value == a0) {
r0 = value;
} else {
Math = global.Math;
value = global.Date.now() - a0;
value = Math.floor(value / 1000);
r0 = value;
}
return r0;
};
const object = {};
let value = environment.__proto__;
object.approx_seconds_since_last_notification = closure(env1_10);
object.approx_seconds_since_last_mention = closure(env1_11);
object.approx_seconds_since_last_role_mention = closure(env1_12);
object.approx_seconds_since_last_everyone_mention = closure(env1_13);
const value2 = null;
object.approx_seconds_since_last_guild_notification = value2 == a0 ? value2 : closure(env1_14[a0]);
object.approx_seconds_since_last_guild_mention = value2 == a0 ? value2 : closure(env1_15[a0]);
object.approx_seconds_since_last_guild_role_mention = value2 == a0 ? value2 : closure(env1_17[a0]);
object.approx_seconds_since_last_guild_everyone_mention = value2 == a0 ? value2 : closure(env1_16[a0]);
return object;
}
}
function CONNECTION_OPEN_52219() { // fn#52219, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6789:1708, offset: 0x01322da6, size: 286 bytes, params: 1, frame: 18
var r3;
var propertyName;
var propertyName2;
var propertyName3;
var propertyName4;
var propertyName5;
const closure = function(a0) {
var r0;
var value = a0 != null;
if (value) {
value = global.Date.now() - a0;
value = value < 60000;
r0 = value;
} else {
r0 = value;
}
return r0;
};
if (closure(env0_10)) {
}
if (closure(env0_11)) {
}
if (closure(env0_12)) {
}
if (closure(env0_13)) {
}
for (propertyName in env0_14) {
if (closure(env0_14[propertyName])) {
r3 = propertyName2;
continue;
}
delete env0_14[propertyName];
r3 = propertyName2;
}
for (propertyName in env0_15) {
if (closure(env0_15[propertyName])) {
r3 = propertyName3;
continue;
}
delete env0_15[propertyName];
r3 = propertyName3;
}
for (propertyName in env0_17) {
if (closure(env0_17[propertyName])) {
r3 = propertyName4;
continue;
}
delete env0_17[propertyName];
r3 = propertyName4;
}
for (propertyName in env0_16) {
if (closure(env0_16[propertyName])) {
r3 = propertyName5;
continue;
}
delete env0_16[propertyName];
r3 = propertyName5;
}
}
function MESSAGE_NOTIFICATION_SHOWN({guildId, mentioned, roleMentioned, everyoneMentioned}) { // fn#52221, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6789:2070, offset: 0x01322ef1, size: 125 bytes, params: 2, frame: 15
const Date = global.Date;
const value = Date.now();
if (guildId != null) {
env0_14[guildId] = value;
}
if (mentioned) {
if (guildId != null) {
env0_15[guildId] = value;
}
}
if (roleMentioned) {
if (guildId != null) {
env0_17[guildId] = value;
}
}
if (everyoneMentioned) {
if (guildId != null) {
env0_16[guildId] = value;
}
}
}
function trackMessageNotificationTimestamps(a0, a1) { // fn#52222, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6789:2431, offset: 0x01322f6e, size: 287 bytes, params: 3, frame: 22
const currentUser = UserStore.getCurrentUser();
const value3 = null;
const value4 = undefined;
const id = value3 == currentUser ? value4 : currentUser.id;
const userGuildSettingsStoreBinding = UserGuildSettingsStore;
const isSuppressEveryoneEnabled2 = userGuildSettingsStoreBinding.isSuppressEveryoneEnabled(a1);
const isSuppressRolesEnabled2 = userGuildSettingsStoreBinding.isSuppressRolesEnabled(a1);
const r8 = value3 != a0.mentions && a0.mentions.some(function({id}) {
return id === id;
});
const r3 = value3 == a1 || value3 == id ? value3 : GuildMemberStore.getMember(a1, id);
let r6 = value3 != a0.mention_roles && value3 != r3 && value3 != r3.roles && a0.mention_roles.some(_fun52224);
const dispatch = Dispatcher.dispatch;
r6 = r6 && !isSuppressRolesEnabled2;
Reflect.apply(dispatch, Dispatcher, [{type: 'MESSAGE_NOTIFICATION_SHOWN', guildId: a1, mentioned: r8, roleMentioned: r6,
everyoneMentioned: a0.mention_everyone === true && !isSuppressEveryoneEnabled2}]);
return value4;
function _fun52224(a0) { // fn#52224, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6789:2755, offset: 0x0132308d, size: 28 bytes, params: 2, frame: 11
return env0_1.roles.includes(a0);
}
}
}
global.__d(_fun52208, 6611, [6, 7, 15, 17, 18, 1945, 4864, 1878, 694, 566,
2]) /* metro module 6611, dependencies: [6, 7, 15, 17, 18, 1945, 4864, 1878, 694, 566, 2] */;