101 lines
5.8 KiB
TypeScript
101 lines
5.8 KiB
TypeScript
/* Metro module 11356; source: modules/opt_in_channels/OptInOnboardingUtils.tsx; dependencies: [1348, 1935, 1945, 4864, 3772, 5102, 1391, 6609, 6606, 1314, 2] */
|
|
function _fun86987(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#86987, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11542:6, offset: 0x01faa674, size: 266 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const closure = hasNotSetUpChannelOptIn;
|
|
const closure2 = optIntoAllChannelsForExistingMember;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const userSettingsProtoStore = importDefault(1348) /* metro dependency 1348: UserSettingsProtoStore */;
|
|
const guildChannelStoreModule = require(1935) /* metro dependency 1935: GuildChannelStore */;
|
|
const env0_4 = guildChannelStoreModule.GUILD_SELECTABLE_CHANNELS_KEY;
|
|
const env0_5 = guildChannelStoreModule.GUILD_VOCAL_CHANNELS_KEY;
|
|
const guildChannelStore = importDefault(1935) /* metro dependency 1935: GuildChannelStore */;
|
|
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
|
|
const userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */;
|
|
const env0_9 = (require(3772) /* metro dependency 3772: GuildMemberConstants */).GuildMemberFlags;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/opt_in_channels/OptInOnboardingUtils.tsx');
|
|
exports.hasNotSetUpChannelOptIn = closure;
|
|
exports.toggleShowAllChannels = toggleShowAllChannels;
|
|
exports.optIntoAllChannelsForExistingMember = closure2;
|
|
exports.hasClearedGuildOnboardingNotice = hasClearedGuildOnboardingNotice;
|
|
}
|
|
|
|
function hasNotSetUpChannelOptIn(a0) { // fn#86988, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11542:236, offset: 0x01faa77e, size: 167 bytes, params: 2, frame: 18
|
|
const value2 = undefined;
|
|
const isOptInEnabledForGuild2 = (require(5102) /* metro dependency 5102: isOptInEnabled */).isOptInEnabledForGuild(a0);
|
|
const selfMember = GuildMemberStore.getSelfMember(a0);
|
|
const flags = selfMember == null ? value2 : selfMember.flags;
|
|
const value4 = 0;
|
|
const r7 = flags ?? value4;
|
|
const flagUtilsModule = require(1391) /* metro dependency 1391: FlagUtils */;
|
|
const hasFlag = flagUtilsModule.hasFlag;
|
|
const COMPLETED_ONBOARDING = GuildMemberFlags.COMPLETED_ONBOARDING;
|
|
const hasFlag2 = Reflect.apply(hasFlag, flagUtilsModule, [r7, COMPLETED_ONBOARDING]);
|
|
const getOptedInChannels = UserGuildSettingsStore.getOptedInChannels;
|
|
return !isOptInEnabledForGuild2 && !hasFlag2 && !(Reflect.apply(getOptedInChannels, UserGuildSettingsStore,
|
|
[a0]).size > value4);
|
|
}
|
|
|
|
function optIntoAllChannelsForExistingMember(a0) { // fn#86989, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11542:470, offset: 0x01faa825, size: 274 bytes, params: 2, frame: 19
|
|
var set;
|
|
let value = a1;
|
|
const r1 = value !== undefined ? value : {};
|
|
const include = r1.include;
|
|
const r5 = include !== undefined ? include : new global.Set();
|
|
if (r1.exclude === undefined) {
|
|
set = new global.Set();
|
|
}
|
|
const channels = GuildChannelStore.getChannels(a0);
|
|
const property = channels[GUILD_SELECTABLE_CHANNELS_KEY];
|
|
const items = [];
|
|
arraySpread(items, channels[GUILD_VOCAL_CHANNELS_KEY], arraySpread(items, property, 0, channels), channels);
|
|
const value5 = items.filter(_fun86990).map(function(a0) {
|
|
return a0.channel.id;
|
|
});
|
|
r5.forEach(_fun86992);
|
|
value = importDefault(6606) /* metro dependency 6606: GuildOnboardingActionCreators */;
|
|
const onboardExistingMember = value.onboardExistingMember;
|
|
const Set = global.Set;
|
|
const value6 = Object.create(Set.prototype, {constructor: {value: Set}});
|
|
set = new Set(value5);
|
|
Reflect.apply(onboardExistingMember, value, [a0, set instanceof Object ? set : value6]);
|
|
}
|
|
|
|
function toggleShowAllChannels(a0) { // fn#86993, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11542:909, offset: 0x01faa96a, size: 91 bytes, params: 2, frame: 16
|
|
var value;
|
|
if (hasNotSetUpChannelOptIn(a0)) {
|
|
optIntoAllChannelsForExistingMember(a0);
|
|
} else {
|
|
value = require(5102) /* metro dependency 5102: isOptInEnabled */;
|
|
value = value.isOptInEnabledForGuild(a0);
|
|
(require(6609) /* metro dependency 6609: OptInChannelsActionCreators */).setGuildOptIn(a0, !value);
|
|
}
|
|
}
|
|
|
|
function hasClearedGuildOnboardingNotice(a0) { // fn#86994, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11542:1195, offset: 0x01faa9c5, size: 158 bytes, params: 2, frame: 19
|
|
var r0;
|
|
var moduleValue;
|
|
var hasFlag;
|
|
var guilds;
|
|
let value = a1;
|
|
const value2 = undefined;
|
|
const r5 = value !== value2 ? value : UserSettingsProtoStore;
|
|
value = a0 != null;
|
|
if (value) {
|
|
moduleValue = require(1391) /* metro dependency 1391: FlagUtils */;
|
|
hasFlag = moduleValue.hasFlag;
|
|
guilds = r5.settings.guilds;
|
|
r0 = Reflect.apply(hasFlag, moduleValue,
|
|
[(guilds == null || guilds.guilds[a0] == null ? value2 : guilds.guilds[a0].guildOnboardingProgress) ?? 0,
|
|
(require(1314) /* metro dependency 1314: preloaded_user_settings */).GuildOnboardingProgress.GUILD_NOTICE_CLEARED]);
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun86990({channel}) { // fn#86990, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11542:610, offset: 0x01faa937, size: 51 bytes, params: 2, frame: 12
|
|
return !channel.isThread() && !env0_0.has(channel.id);
|
|
}
|
|
|