Files
discord-decomp/sources/modules/notification_center/NotificationCenterStore.tsx
T
2026-07-27 16:20:00 +03:00

201 lines
9.4 KiB
TypeScript

/* Metro module 14775; source: modules/notification_center/NotificationCenterStore.tsx; dependencies: [6, 7, 15, 17, 18, 57, 5215, 672, 4624, 21, 566, 694, 2] */
function _fun111548(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#111548, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:6, offset: 0x023a698e, size: 435 bytes, params: 8, frame: 20
const env0_0 = require;
const closure = LOAD_NOTIFICATION_CENTER_ITEMS_FAILURE_111552;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
const env0_8 = importDefault(57) /* metro dependency 57 */;
const recentMentionsStore = importDefault(5215) /* metro dependency 5215: RecentMentionsStore */;
const Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
const DAY = Millis.DAY;
const env0_10 = 90 * DAY;
({'tab': null, 'localItemAcks': null, 'hasNewMentions': false, 'isDataStale': false,
'isRefreshing': false}).localItemAcks = {};
const PersistedStore = (importDefault(566) /* metro dependency 566: flux */).PersistedStore;
let value = _fun111553(PersistedStore);
value.displayName = 'NotificationCenterStore';
value.persistKey = 'NotificationCenterStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {MESSAGE_CREATE: MESSAGE_CREATE_111563,
NOTIFICATION_CENTER_SET_TAB: NOTIFICATION_CENTER_SET_TAB,
NOTIFICATION_CENTER_ITEMS_LOCAL_ACK: function({localIds}) {
localIds.forEach(_fun111566);
}, NOTIFICATION_CENTER_REFRESH: NOTIFICATION_CENTER_REFRESH, LOAD_NOTIFICATION_CENTER_ITEMS_FAILURE: closure,
LOAD_NOTIFICATION_CENTER_ITEMS_SUCCESS: closure});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/notification_center/NotificationCenterStore.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_111549() { // fn#111549, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:168, offset: 0x023a6b41, size: 98 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_111549_isNativeReflectConstruct = function() {
return !!result;
})();
}
function LOAD_NOTIFICATION_CENTER_ITEMS_FAILURE_111552() { // fn#111552, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:1656, offset: 0x023a6ba3, size: 39 bytes, params: 1, frame: 3
env0_11.hasNewMentions = false;
env0_11.isDataStale = false;
env0_11.isRefreshing = false;
}
function _fun111553(a0) { // fn#111553, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:474, offset: 0x023a6bca, size: 251 bytes, params: 2, frame: 16
const closure = NotificationCenterStore;
env0_7(closure, a0);
return env0_4(closure, [{key: 'initialize', value: value_111555}, {key: 'getState', value: value_111556},
{key: 'getTab', value: value_111557}, {key: 'isLocalItemAcked', value: value_111558}, {key: 'hasNewMentions',
value: value_111559}, {key: 'isDataStale', value: value_111560}, {key: 'isRefreshing', value: value_111561},
{key: 'shouldReload', value: value_111562}]);
}
function MESSAGE_CREATE_111563({message}) { // fn#111563, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:1857, offset: 0x023a6e6a, size: 52 bytes, params: 2, frame: 12
if (RecentMentionsStore.hasMention(message.id)) {
env0_11.hasNewMentions = true;
}
}
function NOTIFICATION_CENTER_SET_TAB({tab}) { // fn#111564, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:1970, offset: 0x023a6e9e, size: 42 bytes, params: 2, frame: 13
const object2 = {};
copyDataProperties(object2, env0_11, undefined);
object2['tab'] = tab;
}
function NOTIFICATION_CENTER_ITEMS_LOCAL_ACK({localIds}) { // fn#111565, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:2051, offset: 0x023a6ec8, size: 32 bytes, params: 2, frame: 11
localIds.forEach(_fun111566);
}
function NOTIFICATION_CENTER_REFRESH() { // fn#111567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:2190, offset: 0x023a6f35, size: 19 bytes, params: 1, frame: 2
env0_11.isRefreshing = true;
}
function value_111555(a0) { // fn#111555, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:819, offset: 0x023a6cc5, size: 181 bytes, params: 2, frame: 23
var r5;
var r4;
var object2;
var value2;
var length;
var value3;
var property;
var value4;
var property2;
var Date;
var now;
var value5;
var value6;
this.waitFor(RecentMentionsStore);
if (a0 != null) {
env1_11 = a0;
r5 = a0.localItemAcks ?? ({});
object2 = {};
value2 = global.Object.entries(r5);
length = value2.length;
value3 = 0;
if (value3 < length) {
r4 = value3;
while (true) {
property = value2[r4];
value4 = env1_8(property, 2);
property = value4[value3];
property2 = value4[1];
Date = global.Date;
now = Date.now;
value5 = Reflect.apply(now, Date, []) - property2;
if (value5 < env1_10) {
object2[property] = property2;
}
value6 = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
length = value2.length;
if (value6 < length) {
r4 = value6;
continue;
}
break;
}
}
a0.localItemAcks = object2;
env1_11.isDataStale = true;
}
}
function value_111557() { // fn#111557, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:1141, offset: 0x023a6d7a, size: 55 bytes, params: 1, frame: 12
return env1_11.tab ?? (require(4624) /* metro dependency 4624: NotificationCenterItemsTypes */).NotificationCenterTabs.ForYou;
}
function value_111558(a0) { // fn#111558, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:1253, offset: 0x023a6db1, size: 99 bytes, params: 2, frame: 15
var r1;
var r0;
var value2;
var defaultImport;
let value = a0.local_id != null;
if (value) {
value = environment.__proto__;
value2 = env1_11.localItemAcks[a0.local_id] != null;
if (value2) {
r1 = value2;
} else {
defaultImport = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
r1 = defaultImport.age(a0.id) > env1_10;
}
r0 = r1;
} else {
r0 = value;
}
return r0;
}
function value_111559() { // fn#111559, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:1377, offset: 0x023a6e14, size: 15 bytes, params: 1, frame: 1
return env1_11.hasNewMentions;
}
function value_111560() { // fn#111560, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:1439, offset: 0x023a6e23, size: 15 bytes, params: 1, frame: 1
return env1_11.isDataStale;
}
function value_111561() { // fn#111561, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:1499, offset: 0x023a6e32, size: 15 bytes, params: 1, frame: 1
return env1_11.isRefreshing;
}
function value_111562() { // fn#111562, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:1560, offset: 0x023a6e41, size: 41 bytes, params: 1, frame: 3
let r0 = env1_11.hasNewMentions || env1_11.isDataStale;
r0 = !r0 ? env1_11.isRefreshing : r0;
return r0;
}
function _fun111566(a0) { // fn#111566, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:2095, offset: 0x023a6ee8, size: 77 bytes, params: 2, frame: 14
const object3 = {};
copyDataProperties(object3, env1_11, undefined);
const object4 = {};
copyDataProperties(object4, env1_11.localItemAcks, undefined);
const Date = global.Date;
object4[a0] = Date.now();
object3['localItemAcks'] = object4;
}