decord/source/modules/notification_center/NotificationCenterStore.tsx

128 lines
4 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 15382
// Function ID: 15383
2026-07-29 08:29:29 +00:00
// Name: handleLoadFinished
2026-08-05 07:35:12 +00:00
// Dependencies: [32, 6992, 687, 589, 6995, 11, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-05 07:35:12 +00:00
// Module 15382 (handleLoadFinished)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import findOrCreateMessageRecord from "findOrCreateMessageRecord";
import { PersistedStore } from "initialize";
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function handleLoadFinished() {
2026-07-29 08:29:29 +00:00
closure_6.hasNewMentions = false;
closure_6.isDataStale = false;
closure_6.isRefreshing = false;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let closure_5 = 90 * require("set").Millis.DAY;
let closure_6 = { tab: null, localItemAcks: {}, hasNewMentions: false, isDataStale: false, isRefreshing: false };
class NotificationCenterStore extends PersistedStore {
}
const prototype = NotificationCenterStore.prototype;
prototype["initialize"] = function initialize(localItemAcks) {
this.waitFor(findOrCreateMessageRecord);
if (null != localItemAcks) {
let closure_6 = localItemAcks;
localItemAcks = localItemAcks.localItemAcks;
if (localItemAcks == null) {
localItemAcks = {};
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
localItemAcks.localItemAcks = (function purge(localItemAcks) {
let tmp6;
let tmp7;
const obj = {};
const entries = Object.entries(localItemAcks);
while (tmp2 !== undefined) {
let tmp4 = callback;
let tmp5 = callback(tmp3, 2);
[tmp6, tmp7] = tmp5;
let _Date = Date;
let tmp8 = tmp7;
let tmp9 = closure_5;
if (Date.now() - tmp7 < closure_5) {
let tmp10 = tmp6;
let tmp11 = tmp7;
obj[tmp6] = tmp8;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return obj;
})(localItemAcks);
closure_6.isDataStale = true;
}
};
prototype["getState"] = function getState() {
return closure_6;
};
prototype["getTab"] = function getTab() {
let ForYou = closure_6.tab;
if (ForYou == null) {
2026-08-05 07:35:12 +00:00
ForYou = require(6995) /* NotificationCenterScenes */.NotificationCenterTabs.ForYou;
2026-07-29 08:29:29 +00:00
}
return ForYou;
};
prototype["isLocalItemAcked"] = function isLocalItemAcked(addResult) {
let tmp = null != addResult.local_id;
if (tmp) {
let tmp3 = null != closure_6.localItemAcks[addResult.local_id];
if (!tmp3) {
tmp3 = importDefault(11).age(addResult.id) > closure_5;
const obj = importDefault(11);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = tmp3;
}
return tmp;
};
prototype["hasNewMentions"] = function hasNewMentions() {
return closure_6.hasNewMentions;
};
prototype["isDataStale"] = function isDataStale() {
return closure_6.isDataStale;
};
prototype["isRefreshing"] = function isRefreshing() {
return closure_6.isRefreshing;
};
prototype["shouldReload"] = function shouldReload() {
let isRefreshing = closure_6.hasNewMentions;
if (!isRefreshing) {
isRefreshing = closure_6.isDataStale;
}
if (!isRefreshing) {
isRefreshing = closure_6.isRefreshing;
}
return isRefreshing;
};
NotificationCenterStore.displayName = "NotificationCenterStore";
NotificationCenterStore.persistKey = "NotificationCenterStore";
const notificationCenterStore = new NotificationCenterStore(require("dispatcher"), {
2026-07-20 16:05:17 +00:00
MESSAGE_CREATE: function handleMessageCreate(message) {
2026-07-29 08:29:29 +00:00
if (findOrCreateMessageRecord.hasMention(message.message.id)) {
closure_6.hasNewMentions = true;
2026-07-20 16:05:17 +00:00
}
},
NOTIFICATION_CENTER_SET_TAB: function handleSetTab(tab) {
const obj = {};
2026-07-23 10:11:24 +00:00
const merged = Object.assign(obj);
2026-07-29 08:29:29 +00:00
obj.tab = tab.tab;
2026-07-20 16:05:17 +00:00
},
NOTIFICATION_CENTER_ITEMS_LOCAL_ACK: function handleAck(localIds) {
localIds = localIds.localIds;
const item = localIds.forEach((arg0) => {
let obj = {};
2026-07-29 08:29:29 +00:00
const merged = Object.assign(obj);
2026-07-20 16:05:17 +00:00
obj = {};
2026-07-29 08:29:29 +00:00
const merged1 = Object.assign(obj.localItemAcks);
2026-07-20 16:05:17 +00:00
obj[arg0] = Date.now();
2026-07-29 08:29:29 +00:00
obj.localItemAcks = obj;
2026-07-20 16:05:17 +00:00
});
},
NOTIFICATION_CENTER_REFRESH: function handleRefreshData() {
2026-07-29 08:29:29 +00:00
closure_6.isRefreshing = true;
2026-07-20 16:05:17 +00:00
},
LOAD_NOTIFICATION_CENTER_ITEMS_FAILURE: handleLoadFinished,
LOAD_NOTIFICATION_CENTER_ITEMS_SUCCESS: handleLoadFinished
2026-07-29 08:29:29 +00:00
});
const result = require("set").fileFinishedImporting("modules/notification_center/NotificationCenterStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default notificationCenterStore;