221 lines
12 KiB
TypeScript
221 lines
12 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] */
|
|
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 Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import Durations from '../../utils/Durations.tsx'; /* Metro dependency 672 */
|
|
import RecentMentionsStore from '../recents/RecentMentionsStore.tsx'; /* Metro dependency 5215 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 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 LOAD_NOTIFICATION_CENTER_ITEMS_FAILURE_1115522 = LOAD_NOTIFICATION_CENTER_ITEMS_FAILURE_111552;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const Millis = (Durations).Millis;
|
|
const DAY = Millis.DAY;
|
|
const env0_10 = 90 * DAY;
|
|
({'tab': null, 'localItemAcks': null, 'hasNewMentions': false, 'isDataStale': false,
|
|
'isRefreshing': false}).localItemAcks = {};
|
|
const PersistedStore = (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: LOAD_NOTIFICATION_CENTER_ITEMS_FAILURE_1115522,
|
|
LOAD_NOTIFICATION_CENTER_ITEMS_SUCCESS: LOAD_NOTIFICATION_CENTER_ITEMS_FAILURE_1115522});
|
|
(FileImportTrackerModule).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 NotificationCenterStore2 = NotificationCenterStore;
|
|
Inherits(NotificationCenterStore2, a0);
|
|
return CreateClass(NotificationCenterStore2, [{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 NotificationCenterStore() { // fn#111554, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14972:486, offset: 0x0108afcb, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_3(this, NotificationCenterStore);
|
|
const value3 = env1_6(NotificationCenterStore);
|
|
return env1_5(this, _isNativeReflectConstruct_111549() ? global.Reflect.construct(value3, arguments,
|
|
env1_6(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
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 object;
|
|
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 ?? ({});
|
|
object = {};
|
|
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) {
|
|
object[property] = property2;
|
|
}
|
|
value6 = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
|
|
length = value2.length;
|
|
if (value6 < length) {
|
|
r4 = value6;
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
a0.localItemAcks = object;
|
|
env1_11.isDataStale = true;
|
|
}
|
|
}
|
|
|
|
function value_111556() { // fn#111556, offset: 0x00ef8482, size: 9 bytes, params: 1, frame: 1
|
|
return env1_11;
|
|
}
|
|
|
|
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 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
|
|
const recentMentionsStoreBinding = RecentMentionsStore;
|
|
if (recentMentionsStoreBinding.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 object = {};
|
|
copyDataProperties(object, env0_11, undefined);
|
|
object['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 _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 object = {};
|
|
copyDataProperties(object, env1_11, undefined);
|
|
const object2 = {};
|
|
copyDataProperties(object2, env1_11.localItemAcks, undefined);
|
|
const Date = global.Date;
|
|
object2[a0] = Date.now();
|
|
object['localItemAcks'] = object2;
|
|
}
|
|
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun111548, 14775, [6, 7, 15, 17, 18, 57, 5215, 672, 4624, 21, 566, 694,
|
|
2]) /* metro module 14775, dependencies: [6, 7, 15, 17, 18, 57, 5215, 672, 4624, 21, 566, 694, 2] */;
|