decord/source/modules/message_request/MessageRequestStore.tsx

146 lines
4.6 KiB
TypeScript
Raw Normal View History

// Module ID: 7322
// Function ID: 7323
// Name: MessageRequestStore
// Dependencies: [1957, 1073, 2]
2026-07-23 10:11:24 +00:00
// Module 7322 (MessageRequestStore)
import ChannelStore from "ChannelStore" /* 1957 */;
import MobileCacheSnapshotStore from "MobileCacheSnapshotStore" /* 1073 */;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
function processChannel(isMessageRequest) {
let tmp = isMessageRequest.isMessageRequest && !isMessageRequest.isSpam;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-07-29 08:29:29 +00:00
tmp = !set.has(isMessageRequest.id);
2026-07-20 16:05:17 +00:00
}
let flag = false;
if (tmp) {
2026-07-29 08:29:29 +00:00
set.add(isMessageRequest.id);
2026-07-20 16:05:17 +00:00
flag = true;
}
2026-07-29 08:29:29 +00:00
let hasItem = !tmp5;
if (!(isMessageRequest.isMessageRequest && !isMessageRequest.isSpam)) {
hasItem = set.has(isMessageRequest.id);
2026-07-20 16:05:17 +00:00
}
if (hasItem) {
2026-07-29 08:29:29 +00:00
set.delete(isMessageRequest.id);
2026-07-20 16:05:17 +00:00
flag = true;
}
2026-07-29 08:29:29 +00:00
let hasItem1 = !tmp10;
if (!(isMessageRequest.isMessageRequest && !isMessageRequest.isSpam)) {
hasItem1 = set1.has(isMessageRequest.id);
2026-07-20 16:05:17 +00:00
}
if (hasItem1) {
2026-07-29 08:29:29 +00:00
set1.delete(isMessageRequest.id);
2026-07-20 16:05:17 +00:00
flag = true;
}
return flag;
}
function handleConnectionOpen() {
set.clear();
set1.clear();
const values = Object.values(ChannelStore.getMutablePrivateChannels());
const item = values.forEach((item) => {
processChannel(item);
2026-07-20 16:05:17 +00:00
});
2026-08-24 06:08:38 +00:00
c3 = true;
2026-07-20 16:05:17 +00:00
}
function handleMessageRequestAcceptOptimistic(channelId) {
set1.add(channelId.channelId);
}
function handleChannelCreate(channel) {
return processChannel(channel.channel);
}
2026-07-29 08:29:29 +00:00
function handleChannelUpdates(arg0) {
while (tmp !== undefined) {
let tmp4 = processChannel(tmp2);
continue;
2026-07-20 16:05:17 +00:00
}
}
function handleChannelDelete(channel) {
channel = channel.channel;
2026-07-29 08:29:29 +00:00
let flag = set.has(channel.id);
if (flag) {
2026-07-20 16:05:17 +00:00
set.delete(channel.id);
flag = true;
}
return flag;
}
function handleOverlayInitialize(messageRequestChannelIds) {
const prop = messageRequestChannelIds.messageRequestChannelIds;
const item = prop.forEach((item) => set.add(item));
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let set = new Set();
2026-07-20 16:05:17 +00:00
const set1 = new Set();
2026-07-29 08:29:29 +00:00
let c3 = false;
let MessageRequestStore;
class MessageRequestStore extends tmp4 {
constructor() {
2026-08-24 06:08:38 +00:00
closure_0 = undefined;
2026-07-29 08:29:29 +00:00
obj = {
CONNECTION_OPEN: handleConnectionOpen,
CONNECTION_OPEN_SUPPLEMENTAL: handleConnectionOpen,
CACHE_LOADED_LAZY() {
return closure_0.loadCache();
2026-07-29 08:29:29 +00:00
},
OVERLAY_INITIALIZE: handleOverlayInitialize,
CHANNEL_CREATE: handleChannelCreate,
CHANNEL_UPDATES: handleChannelUpdates,
CHANNEL_DELETE: handleChannelDelete,
MESSAGE_REQUEST_ACCEPT_OPTIMISTIC: handleMessageRequestAcceptOptimistic
};
tmp1 = new tmp(obj, handleChannelDelete, new.target, tmp);
closure_0 = tmp1;
return tmp1;
2026-07-29 08:29:29 +00:00
}
}
const prototype = MessageRequestStore.prototype;
2026-07-29 08:29:29 +00:00
prototype["initialize"] = function initialize() {
this.waitFor(ChannelStore);
2026-07-29 08:29:29 +00:00
};
prototype["loadCache"] = function loadCache() {
const snapshot = this.readSnapshot(MessageRequestStore.LATEST_SNAPSHOT_VERSION);
if (null != snapshot) {
const _Set = Set;
2026-08-24 06:08:38 +00:00
set = new Set(snapshot);
2026-07-29 08:29:29 +00:00
}
};
prototype["takeSnapshot"] = function takeSnapshot() {
return { version: MessageRequestStore.LATEST_SNAPSHOT_VERSION, data: Array.from(set) };
};
prototype["getMessageRequestChannelIds"] = function getMessageRequestChannelIds() {
return set;
};
prototype["getMessageRequestsCount"] = function getMessageRequestsCount() {
return set.size;
};
prototype["isMessageRequest"] = function isMessageRequest(id) {
return set.has(id);
};
prototype["isAcceptedOptimistic"] = function isAcceptedOptimistic(arg0) {
return set1.has(arg0);
};
prototype["isReady"] = function isReady() {
return c3;
};
MessageRequestStore.displayName = "MessageRequestStore";
MessageRequestStore.LATEST_SNAPSHOT_VERSION = 1;
let closure_129_0;
2026-07-29 08:29:29 +00:00
const obj = { CONNECTION_OPEN: handleConnectionOpen, CONNECTION_OPEN_SUPPLEMENTAL: handleConnectionOpen, CACHE_LOADED_LAZY: null, OVERLAY_INITIALIZE: null, CHANNEL_CREATE: null, CHANNEL_UPDATES: null, CHANNEL_DELETE: null, MESSAGE_REQUEST_ACCEPT_OPTIMISTIC: null };
class CACHE_LOADED_LAZY {
constructor() {
return closure_0.loadCache();
2026-07-29 08:29:29 +00:00
}
}
obj.CACHE_LOADED_LAZY = CACHE_LOADED_LAZY;
obj.OVERLAY_INITIALIZE = handleOverlayInitialize;
obj.CHANNEL_CREATE = handleChannelCreate;
obj.CHANNEL_UPDATES = handleChannelUpdates;
obj.CHANNEL_DELETE = handleChannelDelete;
obj.MESSAGE_REQUEST_ACCEPT_OPTIMISTIC = handleMessageRequestAcceptOptimistic;
const prototype1 = new prototype(obj, tmp2, tmp, Object, defineProperty, CACHE_LOADED_LAZY, handleOverlayInitialize, handleChannelCreate, handleChannelUpdates);
closure_129_0 = prototype1;
const size = fn(2);
const result = size.fileFinishedImporting("modules/message_request/MessageRequestStore.tsx");
2026-07-20 16:05:17 +00:00
export default prototype1;