164 lines
4.7 KiB
TypeScript
164 lines
4.7 KiB
TypeScript
// Metro module 4400 (f4401).
|
|
import ChannelStore from "../../stores/ChannelStore";
|
|
import { createWithEqualityFn } from "../../_bundle/identity_700";
|
|
import { isStageVoicePanelEnabled } from "../stage_channels/StageVoicePanelExperiment";
|
|
import { batchUpdates } from "../../_bundle/Module705";
|
|
const withEqualityFn = createWithEqualityFn((c14232_0, c14232_1) => ({
|
|
channels: new Set(),
|
|
isActivityFocused: false,
|
|
isVoicePanelFullscreen: () => c14232_1().voicePanelsFullscreen.size > 0,
|
|
isAnyVoicePanelOpen: () => c14232_1().voicePanelsOpened.size > 0,
|
|
voicePanelsFullscreen: new Set(),
|
|
voicePanelsOpened: new Set(),
|
|
voicePanelsPIP: new Set(),
|
|
openChannel: (a0) => {
|
|
let c25157_0 = a0;
|
|
let r11 = isStageVoicePanelEnabled("voice_panel_store");
|
|
if (!r11) {
|
|
const channel = ChannelStore.getChannel(a0);
|
|
r11 = (channel == null ? void 0 : channel.isGuildStageVoice()) !== true;
|
|
}
|
|
if (r11 && !c14232_1().channels.has(a0)) {
|
|
batchUpdates(() => {
|
|
c14232_0((a0) => {
|
|
const r8 = Set;
|
|
return {
|
|
...a0,
|
|
channels: new r8([c25157_0, ...Array.from(a0.channels)]),
|
|
voicePanelsOpened: new Set([c25157_0, ...Array.from(a0.voicePanelsOpened)])
|
|
};
|
|
});
|
|
});
|
|
}
|
|
},
|
|
closeChannel: (c25158_0) => {
|
|
batchUpdates(() => {
|
|
c14232_0((a0) => {
|
|
let r17;
|
|
L10: {
|
|
const { channels, voicePanelsFullscreen, voicePanelsOpened } = a0;
|
|
if (!channels.has(c25158_0) && !voicePanelsFullscreen.has(c25158_0)) {
|
|
const r16 = voicePanelsOpened.has(c25158_0);
|
|
r17 = a0;
|
|
if (!r16) {
|
|
break L10;
|
|
}
|
|
}
|
|
const r19 = channels.has(c25158_0);
|
|
let channels2 = channels;
|
|
if (r19) {
|
|
const set = new Set(channels);
|
|
set.delete(c25158_0);
|
|
channels2 = set;
|
|
}
|
|
const r27 = voicePanelsFullscreen.has(c25158_0);
|
|
let voicePanelsFullscreen2 = voicePanelsFullscreen;
|
|
if (r27) {
|
|
const set2 = new Set(voicePanelsFullscreen);
|
|
set2.delete(c25158_0);
|
|
voicePanelsFullscreen2 = set2;
|
|
}
|
|
const r39 = voicePanelsOpened.has(c25158_0);
|
|
let voicePanelsOpened2 = voicePanelsOpened;
|
|
if (r39) {
|
|
const set3 = new Set(voicePanelsOpened);
|
|
set3.delete(c25158_0);
|
|
voicePanelsOpened2 = set3;
|
|
}
|
|
r17 = {
|
|
...a0,
|
|
channels: channels2,
|
|
voicePanelsFullscreen: voicePanelsFullscreen2,
|
|
voicePanelsOpened: voicePanelsOpened2
|
|
};
|
|
}
|
|
return r17;
|
|
});
|
|
});
|
|
},
|
|
isMounted: (a0) => c14232_1().channels.has(a0),
|
|
setIsActivityFocused: (isActivityFocused) => {
|
|
batchUpdates(() => {
|
|
c14232_0((a0) => a0.isActivityFocused !== isActivityFocused ? {
|
|
...a0,
|
|
isActivityFocused
|
|
} : a0);
|
|
});
|
|
},
|
|
setChannelPanelFullscreen: (c25160_0, c25160_1) => {
|
|
batchUpdates(() => {
|
|
c14232_0((a0) => {
|
|
const set = new Set(a0.voicePanelsFullscreen);
|
|
const r13 = set.has(c25160_0);
|
|
if (c25160_1) {
|
|
if (r13) {
|
|
return a0;
|
|
}
|
|
set.add(c25160_0);
|
|
} else {
|
|
if (!r13) {
|
|
return a0;
|
|
}
|
|
set.delete(c25160_0);
|
|
}
|
|
return {
|
|
...a0,
|
|
voicePanelsFullscreen: set
|
|
};
|
|
});
|
|
});
|
|
},
|
|
setChannelPanelOpen: (c25161_0, c25161_1) => {
|
|
batchUpdates(() => {
|
|
c14232_0((a0) => {
|
|
const channels = a0.channels;
|
|
if (channels.has(c25161_0)) {
|
|
const set = new Set(a0.voicePanelsOpened);
|
|
const r16 = set.has(c25161_0);
|
|
if (c25161_1) {
|
|
if (r16) {
|
|
return a0;
|
|
}
|
|
set.add(c25161_0);
|
|
} else {
|
|
if (!r16) {
|
|
return a0;
|
|
}
|
|
set.delete(c25161_0);
|
|
}
|
|
return {
|
|
...a0,
|
|
voicePanelsOpened: set
|
|
};
|
|
}
|
|
return a0;
|
|
});
|
|
});
|
|
},
|
|
isChannelOpen: (a0) => c14232_1().voicePanelsOpened.has(a0),
|
|
setChannelPanelPIP: (c25162_0, c25162_1) => {
|
|
batchUpdates(() => {
|
|
c14232_0((a0) => {
|
|
const set = new Set(a0.voicePanelsPIP);
|
|
const r13 = set.has(c25162_0);
|
|
if (c25162_1) {
|
|
if (r13) {
|
|
return a0;
|
|
}
|
|
set.add(c25162_0);
|
|
} else {
|
|
if (!r13) {
|
|
return a0;
|
|
}
|
|
set.delete(c25162_0);
|
|
}
|
|
return {
|
|
...a0,
|
|
voicePanelsPIP: set
|
|
};
|
|
});
|
|
});
|
|
}
|
|
}));
|
|
export default withEqualityFn;
|