decord/beta/source/stores/LocalActivityStore.tsx
github-actions 19e52f659f chore: update source for beta 347.11
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
2026-09-26 17:57:22 +00:00

383 lines
12 KiB
TypeScript

// Module ID: 9657
// Function ID: 9658
// Name: LocalActivityStore
// Dependencies: [32, 2040, 5015, 1999, 9658, 5529, 1220, 4810, 2041, 2015, 9661, 2095, 4806, 1074, 2019, 9662, 12, 9663, 4918, 1331, 9664, 1385, 504, 573, 2]
// Module 9657 (LocalActivityStore)
import _modDef12 from "module_12" /* 12 */;
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import _modDef1331 from "module_1331" /* 1331 */;
import FlagUtils from "FlagUtils" /* 1385 */;
import UserSettings from "UserSettings" /* 2019 */;
import ActivityFlagUtils from "ActivityFlagUtils" /* 9664 */;
import _slicedToArray from "module_32" /* 32 */;
import EmbeddedActivitiesStore from "EmbeddedActivitiesStore" /* 2040 */;
import ApplicationStore from "ApplicationStore" /* 5015 */;
import RunningGameStore from "RunningGameStore" /* 1999 */;
import FirstPartyRichPresenceStore from "FirstPartyRichPresenceStore" /* 9658 */;
import SpotifyStore from "SpotifyStore" /* 5529 */;
import UserSettingsProtoStore from "UserSettingsProtoStore" /* 1220 */;
import ApplicationStreamingStore from "ApplicationStreamingStore" /* 4810 */;
import ChannelStore from "ChannelStore" /* 2041 */;
import DetectableGameStore from "DetectableGameStore" /* 2015 */;
import ExternalStreamingStore from "ExternalStreamingStore" /* 9661 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2095 */;
import SessionsStore from "SessionsStore" /* 4806 */;
require = fn;
function updateActivities() {
items = [];
const CustomStatusSetting = UserSettings.CustomStatusSetting;
const setting = CustomStatusSetting.getSetting();
let tmp4 = null != setting;
if (tmp4) {
let tmp5 = "0" === setting.expiresAtMs;
if (!tmp5) {
const _Date = Date;
const _Number = Number;
const date = new Date(Number(setting.expiresAtMs));
const _Date2 = Date;
const time = date.getTime();
const date1 = new Date();
tmp5 = time - date1.getTime() > 0;
}
tmp4 = tmp5;
}
if (tmp4) {
items.push(tmp(9662).getActivityFromCustomStatus(setting));
const tmpResult = tmp(9662);
}
const items1 = [...FirstPartyRichPresenceStore.getActivities()];
items.push.apply(items1);
const stream = ExternalStreamingStore.getStream();
if (null != stream) {
const obj = { type: constants.STREAMING };
const merged = Object.assign(stream);
items.push(obj);
}
const set = new Set();
const item = _modDef12.forEach(closure_20, (arg0) => {
[, tmp] = arg0;
if (null != tmp.application_id) {
set.add(tmp.name);
items.push(tmp);
}
});
const tmp24 = null != ApplicationStreamingStore.getCurrentUserActiveStream();
const visibleGame = RunningGameStore.getVisibleGame();
if (tmp24) {
const streamerActiveStreamMetadata = ApplicationStreamingStore.getStreamerActiveStreamMetadata();
const visibleRunningGames = RunningGameStore.getVisibleRunningGames();
let pid;
if (streamerActiveStreamMetadata != null) {
pid = streamerActiveStreamMetadata.pid;
}
let tmp29 = null;
if (null != pid) {
let found = visibleRunningGames.find((pid) => pid.pid === streamerActiveStreamMetadata.pid);
if (found == null) {
found = null;
}
tmp29 = found;
}
let tmp31 = null == tmp29;
if (tmp31) {
let id1;
if (streamerActiveStreamMetadata != null) {
id1 = streamerActiveStreamMetadata.id;
}
tmp31 = null != id1;
}
if (tmp31) {
let found1 = visibleRunningGames.find((id) => id.id === streamerActiveStreamMetadata.id);
if (found1 == null) {
found1 = null;
}
tmp29 = found1;
}
if (null != tmp29) {
let tmp26 = tmp29;
if (null == c25) {
let start = tmp29.start;
if (start == null) {
const _Date3 = Date;
start = Date.now();
}
c25 = start;
tmp26 = tmp29;
}
} else {
c25 = null;
tmp26 = visibleGame;
}
} else {
c25 = null;
tmp26 = visibleGame;
}
let tmp35 = null != tmp26 && null != tmp26.name;
if (tmp35) {
let hasItem = set.has(tmp26.name);
if (!hasItem) {
const items2 = [];
const tmpResult3 = tmp(9663);
HermesBuiltin.arraySpread(SessionsStore.getRemoteActivities(), HermesBuiltin.arraySpread(items, 0));
hasItem = tmpResult3.doesGameHaveRichPresence(tmp26, items2);
const arraySpreadResult = HermesBuiltin.arraySpread(items, 0);
}
tmp35 = hasItem;
}
if (null != tmp26) {
if (null != tmp26.name) {
if (!tmp35) {
if (!tmp43) {
const findGameResult = DetectableGameStore.findGame(tmp26);
const obj2 = { type: constants.PLAYING, name: null, application_id: null, timestamps: null };
({ name: obj9.name, id } = tmp26);
if (id == null) {
let id2;
if (findGameResult != null) {
id2 = findGameResult.id;
}
id = id2;
}
obj2.application_id = id;
let start2 = c25;
if (c25 == null) {
start2 = tmp26.start;
}
const obj3 = { start: start2 };
obj2.timestamps = obj3;
const merged1 = Object.assign(tmp(4918).maybeAddAdditionalGameMetadata(tmp26));
items.push(obj2);
const tmpResult4 = tmp(4918);
}
}
}
}
const activity = SpotifyStore.getActivity();
if (null != activity) {
const obj4 = { type: constants.LISTENING };
const merged2 = Object.assign(activity);
items.push(obj4);
}
}
const Constants = fn(1074);
({ ActivityFlags: closure_16, ActivityGamePlatforms: closure_17, ActivityTypes: closure_18 } = Constants);
let items = [];
const dependencyMap = {};
let closure_21 = {};
let c22 = 0;
const dependencyMap2 = {};
const dependencyMap3 = {};
let c25 = null;
const Store = initializeDefault.Store;
class LocalActivityStore extends Store {
}
const prototype = LocalActivityStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(ApplicationStore, ApplicationStreamingStore, ChannelStore, EmbeddedActivitiesStore, ExternalStreamingStore, FirstPartyRichPresenceStore, DetectableGameStore, RunningGameStore, SelectedChannelStore, SessionsStore, SpotifyStore, UserSettingsProtoStore);
items = [FirstPartyRichPresenceStore];
this.syncWith(items, () => {
updateActivities();
});
};
prototype["getActivities"] = function getActivities() {
return items;
};
prototype["getPrimaryActivity"] = function getPrimaryActivity() {
return items[0];
};
prototype["getApplicationActivity"] = function getApplicationActivity(arg0) {
closure_0 = arg0;
return this.findActivity((application_id) => application_id.application_id === closure_0);
};
prototype["getCustomStatusActivity"] = function getCustomStatusActivity() {
return this.findActivity((type) => type.type === constants.CUSTOM_STATUS);
};
prototype["findActivity"] = function findActivity(_messages) {
return items.find(_messages);
};
prototype["getApplicationActivities"] = function getApplicationActivities() {
return closure_20;
};
prototype["getActivityForPID"] = function getActivityForPID(arg0) {
const values = Object.values(closure_20);
const obj = values[Symbol.iterator]();
while (obj !== undefined) {
let tmp4 = _slicedToArray(tmp2, 2);
if (tmp4[0] === arg0) {
obj.return();
return tmp5;
}
}
return null;
};
prototype["getApplicationIdForPID"] = function getApplicationIdForPID(pid) {
const entries = Object.entries(closure_21);
const obj = entries[Symbol.iterator]();
while (obj !== undefined) {
let tmp5 = _slicedToArray(tmp3, 2);
let first = tmp5[0];
let tmp7 = _slicedToArray(tmp5[1], 2);
if (tmp7[0] === pid) {
obj.return();
return tmp8;
}
continue;
}
};
LocalActivityStore.displayName = "LocalActivityStore";
const localActivityStore = new LocalActivityStore(DispatcherDefault, {
ROBLOX_SUBGAME_UPDATE: updateActivities,
ROBLOX_SUBGAME_APPLICATION_FETCH_SUCCESS: updateActivities,
OVERLAY_INITIALIZE: function handleOverlayInitialize(localActivities) {
const merged = Object.assign(localActivities.localActivities);
closure_20 = {};
updateActivities();
},
START_SESSION: function handleStartSession() {
closure_20 = {};
closure_21 = {};
c22 = 0;
closure_23 = {};
closure_24 = {};
updateActivities();
},
LOCAL_ACTIVITY_UPDATE: function handleLocalActivityUpdate(arg0) {
({ socketId, pid, applicationId, activity, partyPrivacy } = arg0);
closure_0 = undefined;
let tmp3 = dependencyMap2[socketId];
if (null == tmp3) {
const sum = c22 + 1;
c22 = sum;
dependencyMap2[socketId] = sum;
tmp3 = sum;
}
let flag = false;
if (null != pid) {
closure_0 = tmp8;
let someResult = null != tmp8;
if (someResult) {
const _Object = Object;
const keys = Object.keys(closure_21);
someResult = keys.some((item) => closure_23[item] === closure_0);
}
flag = false;
if (tmp12) {
flag = tmp3 !== tmp8;
dependencyMap3[pid] = tmp3;
}
tmp12 = null == dependencyMap3[pid] || tmp3 >= dependencyMap3[pid] || !someResult;
}
if (null == activity) {
let tmp17 = null == dependencyMap[socketId];
} else {
items = [pid, activity, partyPrivacy];
tmp17 = _modDef1331(dependencyMap[socketId], items);
}
let tmp19 = null == applicationId;
if (!tmp19) {
const items1 = [pid, applicationId];
tmp19 = _modDef1331(closure_21[socketId], items1);
}
if (tmp17) {
if (tmp19) {
if (!flag) {
return false;
}
}
}
if (null != applicationId) {
const items2 = [pid, applicationId];
closure_21[socketId] = items2;
}
if (null != activity) {
const items3 = [pid, activity, partyPrivacy];
dependencyMap[socketId] = items3;
} else {
delete tmp[tmp2];
}
updateActivities();
},
RPC_APP_CONNECTED: function handleRPCAppConnected(socketId) {
const sum = c22 + 1;
c22 = sum;
closure_23[socketId.socketId] = sum;
},
RPC_APP_DISCONNECTED: function handleRPCAppDisconnected(arg0) {
delete tmp[tmp2];
delete tmp[tmp2];
updateActivities();
},
RUNNING_GAMES_CHANGE: updateActivities,
LIBRARY_APPLICATION_FLAGS_UPDATE_SUCCESS: updateActivities,
SPOTIFY_PLAYER_STATE: updateActivities,
SPOTIFY_PLAYER_PLAY: updateActivities,
STREAMING_UPDATE: updateActivities,
USER_CONNECTIONS_UPDATE: updateActivities,
STREAM_START: updateActivities,
STREAM_STOP: updateActivities,
USER_SETTINGS_PROTO_UPDATE: function handleUserSettingsProtoUpdate() {
(function recalculateActivityPartyPrivacyFlags() {
obj = {};
let flag = false;
const entries = Object.entries(obj);
while (tmp2 !== undefined) {
let tmp5 = _slicedToArray(tmp3, 2);
let first = tmp5[0];
let tmp7 = _slicedToArray(tmp5[1], 3);
[tmp8, tmp9] = tmp7;
let tmp10 = tmp9;
let tmp11 = tmp7[2];
let num = tmp9.flags;
if (num == null) {
num = 0;
}
let tmp12 = num;
let tmp13 = require;
let obj2 = ActivityFlagUtils;
let tmp15 = tmp9;
let obj3 = FlagUtils;
let num2;
if (tmp10 != null) {
num2 = tmp10.flags;
}
if (num2 == null) {
num2 = 0;
}
let hasFlagResult = obj3.hasFlag(num2, constants.INSTANCE);
let tmp13Result = tmp13(9664);
let activityFlags = obj2.computeActivityFlags(tmp15, hasFlagResult, tmp10.platform === constants2.EMBEDDED, tmp13Result.isContextlessEmbeddedActivity(tmp10), tmp11);
if (activityFlags !== tmp12) {
items = [tmp8, , ];
let obj4 = {};
let merged = Object.assign(tmp10);
obj4.flags = tmp24;
items[1] = obj4;
items[2] = tmp11;
obj[first] = items;
flag = true;
} else {
let items1 = [tmp8, , ];
items1[1] = tmp10;
items1[2] = tmp11;
obj[first] = items1;
}
continue;
}
let str = "NO_CHANGES";
if (flag) {
str = "APPLICATION_ACTIVITIES_CHANGED";
}
return str;
})();
updateActivities();
},
EMBEDDED_ACTIVITY_CLOSE: updateActivities,
RUNNING_GAME_TOGGLE_DETECTION: updateActivities
});
const size = fn(2);
const result = size.fileFinishedImporting("stores/LocalActivityStore.tsx");
export default localActivityStore;