decord/source/stores/PrivateChannelReadStateStore.tsx

213 lines
6.6 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 13221
// Function ID: 13222
2026-07-29 08:29:29 +00:00
// Name: rebuildUnreads
2026-08-25 06:04:03 +00:00
// Dependencies: [1395, 1391, 4395, 1981, 5946, 1991, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 13221 (rebuildUnreads)
2026-08-24 06:08:38 +00:00
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import createChannelRecord from "createChannelRecord" /* 1395 */;
2026-08-25 06:04:03 +00:00
import areArraysShallowlyEqual from "areArraysShallowlyEqual" /* 1991 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "ensureGuildLoaded" /* 1391 */;
2026-08-25 06:04:03 +00:00
import closure_4 from "generateOldThreadCutoff" /* 4395 */;
import closure_5 from "handleConnectionOpen" /* 1981 */;
import closure_6 from "makeSortedChannel" /* 5946 */;
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-07-20 16:05:17 +00:00
function rebuildUnreads() {
2026-07-29 08:29:29 +00:00
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
2026-07-20 16:05:17 +00:00
if (found.length > 20) {
found.length = 20;
}
2026-08-24 06:08:38 +00:00
const result = areArraysShallowlyEqual.areArraysShallowlyEqual(found, found);
2026-07-29 08:29:29 +00:00
let flag = !result;
if (!result) {
2026-07-20 16:05:17 +00:00
const _Set = Set;
2026-08-24 06:08:38 +00:00
set = new Set(found);
2026-07-20 16:05:17 +00:00
flag = true;
}
return flag;
}
function handleConnectionOpen() {
2026-07-29 08:29:29 +00:00
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
if (found.length > 20) {
found.length = 20;
}
2026-08-24 06:08:38 +00:00
const result = areArraysShallowlyEqual.areArraysShallowlyEqual(found, found);
2026-07-29 08:29:29 +00:00
let flag = !result;
if (!result) {
const _Set = Set;
2026-08-24 06:08:38 +00:00
set = new Set(found);
2026-07-29 08:29:29 +00:00
flag = true;
}
return flag;
2026-07-20 16:05:17 +00:00
}
function handleGenericUpdate(channelId) {
const channel = store.getChannel(channelId.channelId);
let tmp2 = null == channel;
if (!tmp2) {
tmp2 = !isPrivate(channel.type);
}
let tmp4 = !tmp2;
if (!tmp2) {
2026-07-29 08:29:29 +00:00
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
if (found.length > 20) {
found.length = 20;
}
2026-08-24 06:08:38 +00:00
const result = areArraysShallowlyEqual.areArraysShallowlyEqual(found, found);
2026-07-29 08:29:29 +00:00
let flag = !result;
if (!result) {
const _Set = Set;
2026-08-24 06:08:38 +00:00
set = new Set(found);
2026-07-29 08:29:29 +00:00
flag = true;
}
tmp4 = flag;
2026-08-24 06:08:38 +00:00
const obj = areArraysShallowlyEqual;
2026-07-20 16:05:17 +00:00
}
return tmp4;
}
2026-08-24 06:08:38 +00:00
const isPrivate = createChannelRecord.isPrivate;
2026-07-29 08:29:29 +00:00
let closure_7 = [];
2026-07-23 10:11:24 +00:00
let set = new Set();
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class PrivateChannelReadStateStore extends Store {
}
const prototype = PrivateChannelReadStateStore.prototype;
prototype["initialize"] = function initialize() {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_6, closure_3, closure_5, closure_4);
2026-07-29 08:29:29 +00:00
};
prototype["getUnreadPrivateChannelIds"] = function getUnreadPrivateChannelIds() {
return closure_7;
};
PrivateChannelReadStateStore.displayName = "PrivateChannelReadStateStore";
2026-08-24 06:08:38 +00:00
const privateChannelReadStateStore = new PrivateChannelReadStateStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: handleConnectionOpen,
OVERLAY_INITIALIZE: handleConnectionOpen,
MESSAGE_CREATE: handleGenericUpdate,
MESSAGE_ACK: handleGenericUpdate,
CHANNEL_SELECT: function handleChannelSelect(channelId) {
const channel = store.getChannel(channelId.channelId);
let tmp2 = null == channel;
if (!tmp2) {
tmp2 = !isPrivate(channel.type);
}
let tmp4 = !tmp2;
if (!tmp2) {
2026-07-29 08:29:29 +00:00
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
if (found.length > 20) {
found.length = 20;
}
2026-08-24 06:08:38 +00:00
const result = areArraysShallowlyEqual.areArraysShallowlyEqual(found, found);
2026-07-29 08:29:29 +00:00
let flag = !result;
if (!result) {
const _Set = Set;
2026-08-24 06:08:38 +00:00
set = new Set(found);
2026-07-29 08:29:29 +00:00
flag = true;
}
tmp4 = flag;
2026-08-24 06:08:38 +00:00
const obj = areArraysShallowlyEqual;
2026-07-20 16:05:17 +00:00
}
return tmp4;
},
CHANNEL_DELETE: function handleChannelDelete(channel) {
2026-07-29 08:29:29 +00:00
let hasItem = set.has(channel.channel.id);
if (hasItem) {
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
if (found.length > 20) {
found.length = 20;
}
2026-08-24 06:08:38 +00:00
const result = areArraysShallowlyEqual.areArraysShallowlyEqual(found, found);
2026-07-29 08:29:29 +00:00
let flag = !result;
if (!result) {
const _Set = Set;
set = new Set(found);
flag = true;
}
hasItem = flag;
2026-08-24 06:08:38 +00:00
const obj = areArraysShallowlyEqual;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return hasItem;
2026-07-20 16:05:17 +00:00
},
WINDOW_FOCUS: function handleWindowFocus() {
const channel = store.getChannel(channelId.getChannelId());
let tmp2 = null == channel;
if (!tmp2) {
tmp2 = !isPrivate(channel.type);
}
let tmp4 = !tmp2;
if (!tmp2) {
2026-07-29 08:29:29 +00:00
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
if (found.length > 20) {
found.length = 20;
}
2026-08-24 06:08:38 +00:00
const result = areArraysShallowlyEqual.areArraysShallowlyEqual(found, found);
2026-07-29 08:29:29 +00:00
let flag = !result;
if (!result) {
const _Set = Set;
2026-08-24 06:08:38 +00:00
set = new Set(found);
2026-07-29 08:29:29 +00:00
flag = true;
}
tmp4 = flag;
2026-08-24 06:08:38 +00:00
const obj = areArraysShallowlyEqual;
2026-07-20 16:05:17 +00:00
}
return tmp4;
},
CHANNEL_CREATE: function handleChannelCreate(channel) {
channel = store.getChannel(channel.channel.id);
let tmp2 = null == channel;
if (!tmp2) {
tmp2 = !isPrivate(channel.type);
}
let tmp4 = !tmp2;
if (!tmp2) {
2026-07-29 08:29:29 +00:00
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
if (found.length > 20) {
found.length = 20;
}
2026-08-24 06:08:38 +00:00
const result = areArraysShallowlyEqual.areArraysShallowlyEqual(found, found);
2026-07-29 08:29:29 +00:00
let flag = !result;
if (!result) {
const _Set = Set;
2026-08-24 06:08:38 +00:00
set = new Set(found);
2026-07-29 08:29:29 +00:00
flag = true;
}
tmp4 = flag;
2026-08-24 06:08:38 +00:00
const obj = areArraysShallowlyEqual;
2026-07-20 16:05:17 +00:00
}
return tmp4;
},
2026-07-29 08:29:29 +00:00
CHANNEL_UPDATES: function handleChannelUpdates(arg0) {
2026-07-20 16:05:17 +00:00
let flag = false;
2026-07-29 08:29:29 +00:00
const iter = arg0.channels[Symbol.iterator]();
while (iter !== undefined) {
let tmp = store;
let channel = store.getChannel(iter.next().id);
let tmp4 = null != channel;
if (tmp4) {
let tmp5 = isPrivate;
let tmp6 = channel;
tmp4 = isPrivate(tmp3.type);
}
if (tmp4) {
flag = true;
}
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp7 = flag;
if (tmp7) {
tmp7 = rebuildUnreads();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp7;
2026-07-20 16:05:17 +00:00
}
});
2026-07-23 10:11:24 +00:00
let result = set.fileFinishedImporting("stores/PrivateChannelReadStateStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default privateChannelReadStateStore;