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

66 lines
1.7 KiB
TypeScript

// Metro module 7728 (f7729).
import AuthenticationStore from "../../stores/AuthenticationStore";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c4861_1 = {
users: {}
};
class ChannelSpoilerAgreeStore extends Module589.DeviceSettingsStore {
static displayName = "ChannelSpoilerAgreeStore";
static persistKey = "ChannelSpoilerAgreeStore";
initialize(a0) {
this.waitFor(AuthenticationStore);
c4861_1 = a0 != null && a0.users != null ? {
users: a0.users
} : {
users: {}
};
}
didAgree(a0) {
if (a0 == null) {
return false;
}
const id = AuthenticationStore.getId();
let r6 = id != null;
if (r6) {
const r9 = c4861_1.users[id];
r6 = (r9 == null ? void 0 : r9.channels[a0]) || false;
}
return r6;
}
getState() {
return c4861_1;
}
getUserAgnosticState() {
return c4861_1;
}
}
const channelSpoilerAgreeStore = new ChannelSpoilerAgreeStore(Dispatcher, {
CHANNEL_SPOILER_AGREE: function handleChannelSpoilerAgree({ channelId }) {
const id = AuthenticationStore.getId();
if (id == null) {
return false;
}
if (c4861_1.users[id] == null) {
c4861_1.users[id] = {
channels: {}
};
}
c4861_1.users[id].channels[channelId] = true;
},
CHANNEL_SPOILER_AGREE_CLEAR: function handleChannelSpoilerAgreeClear({ channelId }) {
const id = AuthenticationStore.getId();
let r1 = id != null;
if (r1) {
let r12 = c4861_1.users[id] != null;
if (r12) {
delete c4861_1.users[id].channels[channelId];
r12 = void 0;
}
r1 = r12;
}
return r1;
}
});
export default channelSpoilerAgreeStore;