Files
discord-decomp/modules/hotspot/HotspotStore.tsx
T
2026-11-01 12:12:55 +02:00

75 lines
2.1 KiB
TypeScript

// Metro module 5650 (f5651).
import { CONFERENCE_MODE_ENABLED } from "../conference_mode/ConferenceModeConstants";
import Module589 from "../../_bundle/Module589";
import { ProcessArgs } from "../../utils/ProcessArgs";
import Dispatcher from "../../Dispatcher";
let hiddenHotspots = new Set();
let hotspotOverrides = {};
class HotspotStore extends Module589.PersistedStore {
static displayName = "HotspotStore";
static persistKey = "hotspots";
static migrations = [(a0) => ({
hiddenHotspots: a0 == null ? [] : a0,
hotspotOverrides: {}
})];
initialize(a0) {
if (a0 != null) {
if (Array.isArray(a0.hiddenHotspots)) {
hiddenHotspots = new Set(a0.hiddenHotspots);
}
if (a0.hotspotOverrides != null) {
hotspotOverrides = a0.hotspotOverrides;
}
}
}
hasHotspot(a0, r2 = false) {
let r4 = r2 ? !r2 : hotspotOverrides[a0];
let r9 = !CONFERENCE_MODE_ENABLED;
if (!CONFERENCE_MODE_ENABLED) {
const isDisallowPopupsSet = ProcessArgs.isDisallowPopupsSet();
let r16 = !isDisallowPopupsSet;
if (!isDisallowPopupsSet) {
if (!r4) {
r4 = !hiddenHotspots.has(a0);
}
r16 = r4;
}
r9 = r16;
}
return r9;
}
hasHiddenHotspot(a0) {
return hiddenHotspots.has(a0);
}
getHotspotOverride(a0) {
return hotspotOverrides[a0];
}
getState() {
return {
hiddenHotspots,
hotspotOverrides
};
}
}
const hotspotStore = new HotspotStore(Dispatcher, {
OVERLAY_INITIALIZE: function handleOverlayInitialize(a0) {
hiddenHotspots = new Set(a0.hiddenHotspots);
},
HOTSPOT_HIDE: function handleHotspotHide({ location: location2 }) {
if (hiddenHotspots.has(location2)) {
return false;
}
hiddenHotspots.add(location2);
},
HOTSPOT_OVERRIDE_SET: function handleSetHotspotOverride(a0) {
hotspotOverrides[a0.location] = a0.enabled;
},
HOTSPOT_OVERRIDE_CLEAR: function handleClearHotspotOverride({ location: location2 }) {
if (hotspotOverrides[location2] == null) {
return false;
}
delete hotspotOverrides[location2];
}
});
export default hotspotStore;