// Metro module 12731 (f12732). import SelfPresenceStore from "../../stores/SelfPresenceStore"; import StateManager from "../../lib/StateManager"; import rateLimit from "../../lib/rateLimit"; class LocalPresenceStateManager extends StateManager { switchingAccounts = false; didCommit = rateLimit(5, 20000, this.emitPresenceUpdate.bind(this)); constructor(a0) { super(false); this.socket = a0; } getInitialState() { return SelfPresenceStore.getLocalPresence(); } getNextState() { return SelfPresenceStore.getLocalPresence(); } shouldCommit() { return this.socket.isSessionEstablished(); } emitPresenceUpdate(a0) { this.socket.presenceUpdate(a0.status, a0.since, a0.activities, a0.afk); } handleConnectionOpen() { this.update({}, !this.switchingAccounts); this.switchingAccounts = false; } handleAccountSwitch() { this.switchingAccounts = true; this.reset(); this.emitPresenceUpdate(this.getState()); } } export default LocalPresenceStateManager;