decord/source/modules/gateway/LocalPresenceStateManager.tsx
2026-08-05 07:35:12 +00:00

48 lines
1.6 KiB
TypeScript

// Module ID: 12818
// Function ID: 12819
// Name: getInitialState
// Dependencies: [4947, 12819, 12820, 2]
// Module 12818 (getInitialState)
import filterPlayingActivities from "filterPlayingActivities";
import "shouldCommit";
class LocalPresenceStateManager extends tmp2 {
constructor(arg0) {
tmp3 = new LocalPresenceStateManager(false, tmp2, tmp, new.target, new.target);
// ThrowIfThisInitialized (0x7c)
tmp3.switchingAccounts = false;
emitPresenceUpdate = tmp3.emitPresenceUpdate;
tmp4 = require("rateLimit");
tmp3.didCommit = require("module_5");
tmp3.socket = global;
return tmp3;
}
}
const prototype = LocalPresenceStateManager.prototype;
prototype["getInitialState"] = function getInitialState() {
return store.getLocalPresence();
};
prototype["getNextState"] = function getNextState() {
return store.getLocalPresence();
};
prototype["shouldCommit"] = function shouldCommit() {
const socket = this.socket;
return socket.isSessionEstablished();
};
prototype["emitPresenceUpdate"] = function emitPresenceUpdate(state) {
const socket = this.socket;
socket.presenceUpdate(state.status, state.since, state.activities, state.afk);
};
prototype["handleConnectionOpen"] = function handleConnectionOpen() {
this.update({}, !this.switchingAccounts);
this.switchingAccounts = false;
};
prototype["handleAccountSwitch"] = function handleAccountSwitch() {
this.switchingAccounts = true;
this.reset();
this.emitPresenceUpdate(this.getState());
};
const result = require("rateLimit").fileFinishedImporting("modules/gateway/LocalPresenceStateManager.tsx");
export default LocalPresenceStateManager;