Files
discord-decomp/sources/experiments/ChannelSummariesExperiment.tsx
T
2026-07-28 01:06:53 +03:00

118 lines
5.9 KiB
TypeScript

/* Metro module 9867; source: experiments/ChannelSummariesExperiment.tsx; dependencies: [1422, 1867, 661, 1386, 632, 2] */
import GuildStore from '../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as UseStateFromStoresModule from '../external/discord_common/js/packages/flux/useStateFromStores.tsx'; /* Metro dependency 632 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
import * as ChannelConstantsModule from '../modules/channel/ChannelConstants.tsx'; /* Metro dependency 1386 */
import * as GuildRecordModule from '../records/GuildRecord.tsx'; /* Metro dependency 1422 */
function _fun77433(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#77433, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10053:6, offset: 0x01dfbe48, size: 284 bytes, params: 8, frame: 20
let env0_0 = require;
const canSeeChannelSummaries2 = canSeeChannelSummaries;
const canGuildUseConversationSummaries2 = canGuildUseConversationSummaries;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('experiments/ChannelSummariesExperiment.tsx');
exports.channelEligibleForSummaries = function(a0) {
return canSeeChannelSummaries(a0, true, false);
};
exports.canSeeChannelSummaries = canSeeChannelSummaries2;
exports.canGuildUseConversationSummaries = canGuildUseConversationSummaries2;
exports.useChannelSummariesExperiment = useChannelSummariesExperiment;
exports.useGuildEligibleForSummaries = function(a0) {
var env0_0 = a0;
return require(dependencyMap[4]).useStateFromStores([GuildStore], _fun77439, [a0]);
};
function canSeeChannelSummaries(a0) { // fn#77434, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10053:251, offset: 0x01dfbf64, size: 269 bytes, params: 2, frame: 23
var r9;
var r7;
var r1;
var r2;
var r0;
var guildStoreBinding;
var getGuild;
var value6;
var isGuildNSFW2;
var SUMMARIZEABLE;
let value = a1;
const value2 = a2;
const value3 = undefined;
const r4 = value !== value3 ? value : false;
const r6 = !(value2 !== value3) || value2;
value = a0 != null;
if (value) {
value = false;
if (a0 == null) {
r1 = value;
} else {
guildStoreBinding = GuildStore;
getGuild = guildStoreBinding.getGuild;
r9 = (a0 == null ? value3 : a0.guild_id) ?? '';
value6 = Reflect.apply(getGuild, guildStoreBinding, [r9]);
r9 = value6 != null && value6.rulesChannelId === a0.id;
isGuildNSFW2 = isGuildNSFW(value6);
SUMMARIZEABLE = ChannelTypesSets.SUMMARIZEABLE;
r7 = SUMMARIZEABLE.has(a0.type) && !a0.isNSFW();
r7 = r7 && !r9;
r7 = r7 && !isGuildNSFW2;
r1 = r7;
}
if (r1) {
value = value !== r4;
r2 = value || !a0.hasFlag(ChannelFlags.SUMMARIES_DISABLED);
r2 = r2 && canGuildUseConversationSummaries(GuildStore.getGuild(a0.guild_id), r6);
r1 = r2;
} else {
r1 = !!r1;
}
r0 = r1;
} else {
r0 = value;
}
return r0;
}
function canGuildUseConversationSummaries(a0) { // fn#77435, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10053:642, offset: 0x01dfc071, size: 150 bytes, params: 2, frame: 16
var r2;
var r0;
var id;
let value = a1;
const r3 = !(value !== undefined) || value;
value = a0 != null;
if (value) {
id = a0.id;
value = id != null;
r2 = value && (id === ME || id === FAVORITES);
value = !r2;
r0 = r2 ? value : a0.features.has(GuildFeatures.SUMMARIES_ENABLED_GA) ? r3 ? a0.features.has(GuildFeatures.SUMMARIES_ENABLED_BY_USER) : !r3 : !!a0.features.has(GuildFeatures.SUMMARIES_ENABLED_GA);
} else {
r0 = value;
}
return r0;
}
function useChannelSummariesExperiment(a0) { // fn#77437, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10053:1213, offset: 0x01dfc120, size: 29 bytes, params: 2, frame: 13
const value = a2;
return canSeeChannelSummaries(a0, value !== undefined ? value : false);
}
function useGuildEligibleForSummaries(a0) { // fn#77438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10053:1332, offset: 0x01dfc13d, size: 75 bytes, params: 2, frame: 16
const env0_0 = a0;
return (UseStateFromStoresModule).useStateFromStores([GuildStore], _fun77439,
[a0]);
function _fun77439() { // fn#77439, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10053:1417, offset: 0x01dfc188, size: 69 bytes, params: 1, frame: 18
const value = environment.__proto__;
const canGuildUseConversationSummariesBinding = canGuildUseConversationSummaries;
const guildStoreBinding = GuildStore;
const getGuild = guildStoreBinding.getGuild;
return canGuildUseConversationSummariesBinding(Reflect.apply(getGuild, guildStoreBinding,
[env0_0?.id ?? EMPTY_STRING_SNOWFLAKE_ID]), false);
}
}
}
global.__d(_fun77433, 9867, [1422, 1867, 661, 1386, 632,
2]) /* metro module 9867, dependencies: [1422, 1867, 661, 1386, 632, 2] */;