decord/source/stores/ActivityTrackingStore.tsx
github-actions 67d978d9fb chore: update source for alpha 346.0
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9672_m.js (378.6 MB)
2026-09-07 16:44:02 +00:00

222 lines
7 KiB
TypeScript

// Module ID: 13747
// Function ID: 13748
// Name: stopActivity
// Dependencies: [1915, 1221, 502, 1931, 7397, 4583, 2011, 1074, 1090, 510, 7399, 11477, 4447, 4689, 504, 573, 2]
// Module 13747 (stopActivity)
import initializeDefault from "initialize" /* 504 */;
import Storage2 from "Storage" /* 510 */;
import dispatcherDefault from "dispatcher" /* 573 */;
import setDefault from "set" /* 1090 */;
import removeExecutablePathPrefix from "removeExecutablePathPrefix" /* 4689 */;
import _modDef11477 from "module_11477" /* 11477 */;
import closure_3 from "initialize" /* 1915 */;
import closure_4 from "handleConnectionClosedOrResumed" /* 1221 */;
import closure_5 from "fetchFingerprint" /* 502 */;
import closure_6 from "gameFromServer" /* 1931 */;
import closure_7 from "setLibraryApplications" /* 7397 */;
import closure_8 from "createRTCConnection" /* 4583 */;
import closure_9 from "handleConnectionOpen" /* 2011 */;
import { Distributors } from "ME" /* 1074 */;
import { Storage } from "Storage" /* 510 */;
require = arg1;
function stopActivity(applicationId, flag) {
if (flag === undefined) {
flag = true;
}
if (flag) {
updateActivity(applicationId, true);
}
if (null != dependencyMap[applicationId.applicationId]) {
obj.stop();
applicationId = applicationId.applicationId;
delete tmp3[tmp2];
}
delete tmp3[tmp];
const Storage = Storage2.Storage;
const result = Storage.set(ActivityTrackingStore, obj);
}
function updateActivity(applicationId) {
const _require = applicationId;
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
const timestamp = Date.now();
let num = 0;
if (null != applicationId.updatedAt) {
num = timestamp - applicationId.updatedAt;
}
if (num > closure_12 + closure_13) {
num = 0;
}
obj = _require(7399);
const result = obj.shouldShareApplicationActivity(applicationId.applicationId, closure_7);
voiceChannelId = voiceChannelId.getVoiceChannelId();
sessionId = sessionId.getSessionId();
mediaSessionId = mediaSessionId.getMediaSessionId();
obj = { applicationId: applicationId.applicationId, distributor: null, shareActivity: null, token: null, duration: null, closed: null, exePath: null, voiceChannelId: null, sessionId: null, mediaSessionId: null };
if (applicationId.isDiscordApplication) {
let distributor = Distributors.DISCORD;
} else {
distributor = applicationId.distributor;
}
obj[1] = distributor;
obj[2] = result;
obj[3] = applicationId.token;
obj[4] = Math.floor(num / 1000);
obj[5] = flag;
obj[6] = applicationId.exePath;
obj[7] = voiceChannelId;
obj[8] = sessionId;
obj[9] = mediaSessionId;
_modDef11477.updateActivity(obj);
applicationId.updatedAt = timestamp;
if (null == dependencyMap[applicationId.applicationId]) {
const interval = new tmp3(4447).Interval();
tmp11[applicationId.applicationId] = interval;
interval.start(closure_12, () => {
closure_1_18(closure_0);
});
}
if (!flag) {
obj[applicationId.applicationId] = applicationId;
const Storage = tmp3(510).Storage;
const result1 = Storage.set(ActivityTrackingStore, obj);
}
}
function handleRunningGamesChange(flag) {
if (flag === undefined) {
flag = true;
}
visibleRunningGames = visibleRunningGames.getVisibleRunningGames();
const set = new Set();
const iter = visibleRunningGames[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let tmp3 = nextResult;
let tmp4 = closure_6;
let findGameResult = closure_6.findGame(nextResult);
let tmp6 = findGameResult;
if (null != findGameResult) {
let tmp19 = findGameResult;
let addResult = set.add(tmp6.id);
let tmp21 = obj;
if (!(tmp6.id in obj)) {
obj = { applicationId: null, updatedAt: null, distributor: null, exePath: null };
let tmp8 = findGameResult;
obj[0] = tmp6.id;
let _Date = Date;
let tmp7 = updateActivity;
obj[1] = Date.now();
let tmp9 = nextResult;
obj[2] = tmp3.distributor;
let tmp10 = require;
let tmp11 = dependencyMap;
let obj3 = removeExecutablePathPrefix;
let str = tmp3.exePath;
if (str == null) {
str = "";
}
obj[3] = obj3.removeExecutablePathPrefix(str);
let tmp7Result = tmp7(obj);
}
}
continue;
}
const keys = Object.keys(obj);
for (const item10052 of keys) {
let tmp14 = item10052;
if (!set.has(item10052)) {
let tmp15 = stopActivity;
let tmp16 = obj;
let tmp17 = item10052;
let tmp18 = stopActivity(obj[tmp14], flag);
}
continue;
}
}
function handleLogout() {
const keys = Object.keys(obj);
while (tmp2 !== undefined) {
let tmp4 = stopActivity;
let tmp5 = obj;
let tmp6 = stopActivity(obj[tmp3]);
continue;
}
c16 = false;
}
const ActivityTrackingStore = "ActivityTrackingStore";
let closure_12 = 30 * setDefault.Millis.MINUTE;
let closure_13 = 5 * setDefault.Millis.MINUTE;
let obj = Storage.get("ActivityTrackingStore");
if (obj == null) {
obj = {};
}
let closure_15 = {};
let c16 = false;
const Store = initializeDefault.Store;
class ActivityTrackingStore extends Store {
}
const prototype = ActivityTrackingStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(closure_5, closure_6, closure_7, closure_8, closure_3, closure_9, closure_4);
const items = [closure_4];
this.syncWith(items, handleRunningGamesChange);
};
prototype["getActivities"] = function getActivities() {
return obj;
};
ActivityTrackingStore.displayName = "ActivityTrackingStore";
obj = {
RUNNING_GAMES_CHANGE() {
handleRunningGamesChange();
},
CONNECTION_OPEN: function handleConnectionOpen() {
if (c16) {
return false;
} else {
const _Object = Object;
const keys = Object.keys(obj);
const tmp5 = keys[Symbol.iterator]();
while (tmp5 !== undefined) {
let tmp9 = updateActivity;
let tmp10 = obj;
let tmp11 = updateActivity(obj[tmp7]);
continue;
}
handleRunningGamesChange(false);
c16 = true;
}
},
CONNECTION_CLOSED: function handleConnectionClosed(code) {
if (4004 === code.code) {
handleLogout();
}
},
LOGOUT: handleLogout,
ACTIVITY_UPDATE_SUCCESS: function handleActivityUpdate(arg0) {
if (null == obj[arg0.applicationId]) {
return false;
} else {
tmp3.token = tmp;
const Storage = Storage2.Storage;
const result = Storage.set(ActivityTrackingStore, tmp2);
}
},
ACTIVITY_UPDATE_FAIL: function handleActivityUpdateFail(arg0) {
if (null == obj[arg0.applicationId]) {
return false;
} else {
tmp2.token = null;
tmp2.updatedAt = null;
const Storage = Storage2.Storage;
const result = Storage.set(ActivityTrackingStore, tmp);
}
}
};
const activityTrackingStore = new ActivityTrackingStore(dispatcherDefault, obj);
let result = require("set").fileFinishedImporting("stores/ActivityTrackingStore.tsx");
export default activityTrackingStore;