decord/source/modules/presence_subscriptions/PresenceSubscriptionsStore.tsx

114 lines
3.7 KiB
TypeScript
Raw Normal View History

// Module ID: 11503
// Function ID: 11504
// Name: PresenceSubscriptionsStore
// Dependencies: [32, 4614, 1920, 11504, 4461, 504, 573, 2]
2026-07-23 10:11:24 +00:00
// Module 11503 (PresenceSubscriptionsStore)
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import ActivitiesActionCreatorsDefault from "ActivitiesActionCreators" /* 11504 */;
import _slicedToArray from "module_32" /* 32 */;
import PresenceStore from "PresenceStore" /* 4614 */;
2026-07-20 16:05:17 +00:00
function handleConnectionOpenOrResumed() {
2026-08-24 06:08:38 +00:00
closure_5 = {};
closure_6 = {};
2026-07-20 16:05:17 +00:00
}
const INVITE_EXPIRATION_MS = fn(1920).INVITE_EXPIRATION_MS;
2026-07-29 08:29:29 +00:00
let closure_5 = {};
let closure_6 = {};
const delayedCall = new fn(4461).DelayedCall(3000, function flush() {
2026-07-20 16:05:17 +00:00
const items = [];
2026-07-29 08:29:29 +00:00
const entries = Object.entries(closure_6);
while (tmp4 !== undefined) {
let tmp7 = _slicedToArray(tmp5, 2);
2026-07-29 08:29:29 +00:00
[tmp8, tmp9] = tmp7;
let arr = items.push(tmp9);
closure_5[tmp8] = tmp9;
delete tmp[tmp2];
continue;
2026-07-20 16:05:17 +00:00
}
if (0 !== items.length) {
ActivitiesActionCreatorsDefault.subscribeActivities(items);
2026-07-20 16:05:17 +00:00
}
});
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class PresenceSubscriptionsStore extends Store {
}
const prototype = PresenceSubscriptionsStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(PresenceStore);
2026-07-29 08:29:29 +00:00
};
prototype["isSubscribed"] = function isSubscribed(applicationId) {
const combined = "" + applicationId.applicationId + ":" + applicationId.partyId;
let tmp2 = combined in closure_5;
if (!tmp2) {
tmp2 = combined in closure_6;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp2;
};
PresenceSubscriptionsStore.displayName = "PresenceSubscriptionsStore";
const presenceSubscriptionsStore = new PresenceSubscriptionsStore(DispatcherDefault, {
2026-07-20 16:05:17 +00:00
PRESENCE_SUBSCRIPTIONS_ADD: function handleSubscriptionAdd(subscription) {
subscription = subscription.subscription;
2026-07-29 08:29:29 +00:00
const tmp = (function prune() {
let flag = false;
const timestamp = Date.now();
const entries = Object.entries(closure_1_5);
2026-07-29 08:29:29 +00:00
while (tmp7 !== undefined) {
let tmp10 = _slicedToArray(tmp8, 2);
2026-07-29 08:29:29 +00:00
if (tmp10[1].expiresAt < timestamp) {
delete tmp4[tmp3];
2026-07-20 16:05:17 +00:00
flag = true;
}
2026-07-29 08:29:29 +00:00
continue;
}
const entries1 = Object.entries(closure_1_6);
2026-07-29 08:29:29 +00:00
for (const item10033 of entries1) {
let tmp16 = _slicedToArray(item10033, 2);
2026-07-29 08:29:29 +00:00
if (tmp16[1].expiresAt < timestamp) {
delete tmp2[tmp];
flag = true;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
continue;
}
return flag;
})();
2026-07-20 16:05:17 +00:00
({ applicationId, partyId } = subscription);
({ userId, messageId, channelId, inviteTime } = subscription);
2026-07-29 08:29:29 +00:00
const combined = "" + subscription.applicationId + ":" + subscription.partyId;
let tmp3 = combined in closure_5;
if (!tmp3) {
tmp3 = combined in closure_6;
}
if (tmp3) {
return tmp;
2026-07-20 16:05:17 +00:00
} else {
const _Date = Date;
const sum = inviteTime + INVITE_EXPIRATION_MS;
if (sum < Date.now()) {
2026-07-29 08:29:29 +00:00
return tmp;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const _HermesInternal = HermesInternal;
2026-07-20 16:05:17 +00:00
const _Date2 = Date;
2026-07-29 08:29:29 +00:00
const combined1 = "" + applicationId + ":" + partyId;
const obj = { userId, applicationId, partyId, messageId, channelId, expiresAt: tmp5 + Date.now() };
2026-07-29 08:29:29 +00:00
closure_6[combined1] = obj;
2026-07-20 16:05:17 +00:00
delayedCall.delay();
return true;
}
2026-07-29 08:29:29 +00:00
tmp5 = INVITE_EXPIRATION_MS;
2026-07-20 16:05:17 +00:00
}
},
CONNECTION_OPEN: handleConnectionOpenOrResumed,
CONNECTION_RESUMED: handleConnectionOpenOrResumed,
LOGOUT: function handleLogout() {
2026-08-24 06:08:38 +00:00
closure_5 = {};
closure_6 = {};
2026-07-20 16:05:17 +00:00
}
});
const size = fn(2);
const result = size.fileFinishedImporting("modules/presence_subscriptions/PresenceSubscriptionsStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default presenceSubscriptionsStore;