Files
discord-decomp/sources/modules/guild_sidebar/SectionFooterHelpers.tsx
T
2026-07-27 16:20:00 +03:00

132 lines
6.1 KiB
TypeScript

/* Metro module 14708; source: modules/guild_sidebar/SectionFooterHelpers.tsx; dependencies: [5090, 3784, 5101, 661, 1417, 5092, 2] */
function _fun110963(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#110963, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14905:6, offset: 0x0238dc68, size: 250 bytes, params: 8, frame: 20
const env0_0 = require;
const closure = getSectionFooterActiveVoiceChannels;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const categoryCollapseStore = importDefault(5090) /* metro dependency 5090: CategoryCollapseStore */;
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
const env0_4 = (require(5101) /* metro dependency 5101: GuildSidebarConstants */).ChannelListGuildActionRow;
const env0_5 = (require(661) /* metro dependency 661: Constants */).Permissions;
const env0_6 = (require(1417) /* metro dependency 1417: FavoritesConstants */).FAVORITES_RAW_GUILD_ID;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_sidebar/SectionFooterHelpers.tsx');
exports.getSectionFooterConfig = function(a0, a1, a2) {
var object = {};
object.hasDivider = isSectionFooterWithDivider(a0, a1, a2);
object.canHaveVoiceSummary = isSectionFooterVoiceSummaryEligible(a0, a2);
return object;
};
exports.getSectionFooterActiveVoiceChannels = closure;
exports.isSectionFooterWithActiveVoiceChannels = function({category, voiceStates, selectedChannelId,
selectedVoiceChannelId}) {
category = getSectionFooterActiveVoiceChannels({category: category, selectedChannelId: selectedChannelId,
selectedVoiceChannelId: selectedVoiceChannelId, voiceStates: voiceStates}).length;
return category > 0;
};
}
function isSectionFooterWithDivider(a0, a1, a2) { // fn#110964, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14905:207, offset: 0x0238dd62, size: 343 bytes, params: 4, frame: 18
var r1;
var r0;
var r7;
var r5;
var r3;
var r2;
var rows;
var value9;
var value10;
var value;
const SECTION_INDEX_GUILD_ACTIONS = (require(5092) /* metro dependency 5092: ChannelListState */).SECTION_INDEX_GUILD_ACTIONS;
if (a2 === SECTION_INDEX_GUILD_ACTIONS) {
rows = a0.getGuildActionSection().getRows();
r1 = rows.length === 1 && rows[0] === ChannelListGuildActionRow.GUILD_PREMIUM_PROGRESS_BAR;
r1 = !r1 ? a0.getGuildActionSection().isEmpty() : r1;
r0 = r1;
} else {
r0 = a0.getSections(false)[a2] === 0;
}
if (r0) {
r0 = !r0;
} else {
value9 = a2 === SECTION_INDEX_GUILD_ACTIONS;
if (value9) {
r1 = value9;
} else {
if (a0.id === FAVORITES_RAW_GUILD_ID) {
r2 = a2 !== a0.getSections(false).length - 1;
} else {
value10 = a2 === (require(5092) /* metro dependency 5092: ChannelListState */).SECTION_INDEX_FAVORITES;
if (value10) {
r2 = value10;
} else {
if (a1) {
value = a2 !== (require(5092) /* metro dependency 5092: ChannelListState */).SECTION_INDEX_UNCATEGORIZED_CHANNELS;
if (value) {
value = a2 === a0.recentsSectionNumber;
if (value) {
r7 = value;
} else {
a0.voiceChannelsSectionNumber;
r7 = false;
}
r5 = r7;
} else {
r5 = value;
}
r3 = r5;
} else {
r3 = !!a1;
}
r2 = r3;
}
}
r1 = r2;
}
r0 = r1;
}
return r0;
}
function isSectionFooterVoiceSummaryEligible(a0, a1) { // fn#110965, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14905:748, offset: 0x0238deb9, size: 132 bytes, params: 3, frame: 16
const SECTION_INDEX_GUILD_ACTIONS = (require(5092) /* metro dependency 5092: ChannelListState */).SECTION_INDEX_GUILD_ACTIONS;
let r0 = a1 === SECTION_INDEX_GUILD_ACTIONS || a1 === (require(5092) /* metro dependency 5092: ChannelListState */).SECTION_INDEX_FAVORITES;
r0 = !r0 ? a1 === (require(5092) /* metro dependency 5092: ChannelListState */).SECTION_INDEX_UNCATEGORIZED_CHANNELS : r0;
r0 = !r0 ? a1 === a0.recentsSectionNumber : r0;
r0 = !r0 ? a1 === a0.voiceChannelsSectionNumber : r0;
return !r0;
}
function getSectionFooterActiveVoiceChannels({category, voiceStates, selectedChannelId, selectedVoiceChannelId}) { // fn#110966, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14905:996, offset: 0x0238df3d, size: 110 bytes, params: 2, frame: 13
var r0;
let value = CategoryCollapseStore.isCollapsed(category.record.id);
if (value !== true) {
r0 = [];
} else {
value = category.getChannelRecords();
value = value.filter(_fun110967);
r0 = value;
}
return r0;
}
function _fun110967(a0) { // fn#110967, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14905:1185, offset: 0x0238dfab, size: 110 bytes, params: 2, frame: 14
var r1;
var r0;
var voiceStatesBinding;
var id;
const value = environment.__proto__;
const can = PermissionStore.can;
const VIEW_CHANNEL = Permissions.VIEW_CHANNEL;
if (Reflect.apply(can, PermissionStore, [VIEW_CHANNEL, a0])) {
voiceStatesBinding = voiceStates;
id = a0.id;
r1 = voiceStatesBinding[id] ?? [];
id = a0.id;
r0 = id !== selectedVoiceChannelId && a0.id !== selectedChannelId;
r0 = r0 && r1.length > 0;
return r0;
}
return false;
}