331 lines
17 KiB
TypeScript
331 lines
17 KiB
TypeScript
/* Metro module 11360; source: modules/opt_in_channels/OptInChannelsUtils.tsx; dependencies: [31, 1379, 5098, 4605, 3793, 1878, 661, 1386, 5101, 4865, 5103, 6590, 4805, 5099, 5092, 11361, 5097, 1230, 3968, 1365, 566, 1244, 3738, 21, 2] */
|
|
import SnowflakeUtils from '../../utils/SnowflakeUtils.tsx'; /* Metro dependency 21 */
|
|
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import Module03738 from '../../by-id/module-03738.js'; /* Metro dependency 3738 */
|
|
import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
|
|
import ReadStateStore from '../../stores/ReadStateStore.tsx'; /* Metro dependency 4605 */
|
|
import GuildCategoryStore from '../../stores/GuildCategoryStore.tsx'; /* Metro dependency 5098 */
|
|
import GetFlattedChannelList from '../channel/getFlattedChannelList.tsx'; /* Metro dependency 5099 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as Dismissible_contentModule from '../../external/discord_common/js/packages/protos/discord_protos/discord_users/v1/dismissible_content.tsx'; /* Metro dependency 1365 */
|
|
import * as DismissibleContentUnsafeUtilsModule from '../dismissible_content/DismissibleContentUnsafeUtils.tsx'; /* Metro dependency 3968 */
|
|
import * as ReadStateConstantsModule from '../read_states/ReadStateConstants.tsx'; /* Metro dependency 4865 */
|
|
import * as ChannelListStateModule from '../guild_sidebar/ChannelListState.tsx'; /* Metro dependency 5092 */
|
|
import * as ReadStateActionCreatorsModule from '../../actions/ReadStateActionCreators.tsx'; /* Metro dependency 5097 */
|
|
import * as GuildSidebarConstantsModule from '../guild_sidebar/GuildSidebarConstants.tsx'; /* Metro dependency 5101 */
|
|
import * as OnboardingHomeUtilsModule from '../guild_onboarding_home/OnboardingHomeUtils.tsx'; /* Metro dependency 5103 */
|
|
import * as RecentChannelsActionCreatorsModule from '../recent_channels/RecentChannelsActionCreators.tsx'; /* Metro dependency 11361 */
|
|
|
|
function _fun87029(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#87029, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:6, offset: 0x01fac2b2, size: 389 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const setIndex_87030 = function(a0, a1) {
|
|
a0.index = a1;
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ConstantsModule;
|
|
const env0_9 = value.Routes;
|
|
const env0_10 = value.ChannelTypes;
|
|
value = require(1386) /* metro dependency 1386: ChannelConstants */;
|
|
const env0_11 = value.ChannelFlags;
|
|
const env0_12 = value.StaticChannelRoute;
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/opt_in_channels/OptInChannelsUtils.tsx');
|
|
exports.useFilterCategoriesByQuery = useFilterCategoriesByQuery;
|
|
exports.getFirstRouteFor = getFirstRouteFor;
|
|
exports.clearRecentChannels = clearRecentChannels;
|
|
exports.useChannelBrowserSections = useChannelBrowserSections;
|
|
exports.useChannelBrowserChannelCount = useChannelBrowserChannelCount;
|
|
exports.getActiveAgoTimestamp = getActiveAgoTimestamp;
|
|
function useFilterCategoriesByQuery(a0, a1, a2, a3) { // fn#87031, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:448, offset: 0x01fac437, size: 150 bytes, params: 5, frame: 17
|
|
const env0_0 = a1;
|
|
const env0_1 = a2;
|
|
const value = a3.toLowerCase();
|
|
const value3 = (OnboardingHomeUtilsModule).useCanSeeOnboardingHome(a0);
|
|
const binding = value3;
|
|
return binding.useMemo(_fun87033, [a1, a2, binding.useCallback(_fun87032, [value3]), value]);
|
|
function _fun87032(a0, a1) { // fn#87032, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:570, offset: 0x01fac4cd, size: 229 bytes, params: 3, frame: 22
|
|
var r0;
|
|
var r3;
|
|
var r2;
|
|
var r1;
|
|
var channel;
|
|
var hasFlag;
|
|
var type;
|
|
var value2;
|
|
var value3;
|
|
var defaultImport;
|
|
var moduleValue;
|
|
let value = !ReactModule;
|
|
if (ReactModule) {
|
|
channel = a0.channel;
|
|
hasFlag = channel.hasFlag;
|
|
value = environment.__proto__;
|
|
value = !Reflect.apply(hasFlag, channel, [ChannelFlags.IS_GUILD_RESOURCE_CHANNEL]);
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
if (r0) {
|
|
type = a0.channel.type;
|
|
value = environment.__proto__;
|
|
value2 = type !== ChannelTypes.GUILD_DIRECTORY;
|
|
if (value2) {
|
|
value3 = a1.length === 0;
|
|
if (value3) {
|
|
r2 = value3;
|
|
} else {
|
|
defaultImport = importDefault(6590) /* metro dependency 6590 */;
|
|
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
|
|
value = moduleValue.computeChannelName(a0.channel, UserStore, RelationshipStore);
|
|
value = defaultImport(a1, value.toLowerCase());
|
|
if (value) {
|
|
r3 = value;
|
|
} else {
|
|
value = a0.channel.topic.toLowerCase();
|
|
value = value.includes(a1);
|
|
r3 = value;
|
|
}
|
|
r2 = r3;
|
|
}
|
|
r1 = r2;
|
|
} else {
|
|
r1 = value2;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun87033() { // fn#87033, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:824, offset: 0x01fac5b2, size: 150 bytes, params: 1, frame: 16
|
|
const object = {null: [], _categories: []};
|
|
const GUILD_CATEGORY = ChannelTypes.GUILD_CATEGORY;
|
|
const property = importDefault[GUILD_CATEGORY];
|
|
property.forEach(_fun87034);
|
|
object._categories = require._categories.filter(_fun87037);
|
|
let value = GetFlattedChannelList;
|
|
value = value(object._categories, object);
|
|
value.forEach(setIndex_87030);
|
|
return object;
|
|
function _fun87034({channel}) { // fn#87034, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:896, offset: 0x01fac648, size: 119 bytes, params: 2, frame: 14
|
|
var environment;
|
|
var value;
|
|
var binding;
|
|
let id = channel.id;
|
|
if (id === 'null') {
|
|
binding = env0_0;
|
|
value = environment.__proto__;
|
|
binding.null = require.null.filter(_fun87035);
|
|
}
|
|
binding = env0_0;
|
|
id = channel.id;
|
|
const property = require[channel.id];
|
|
binding[id] = property.filter(_fun87036);
|
|
function _fun87035(a0) { // fn#87035, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:950, offset: 0x01fac6bf, size: 24 bytes, params: 2, frame: 13
|
|
return env2_4(a0, env2_2);
|
|
}
|
|
|
|
function _fun87036(a0) { // fn#87036, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:987, offset: 0x01fac6bf, size: 24 bytes, params: 2, frame: 13
|
|
return env2_4(a0, env2_2);
|
|
}
|
|
|
|
}
|
|
|
|
function _fun87037(a0) { // fn#87037, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:1038, offset: 0x01fac6d7, size: 79 bytes, params: 2, frame: 4
|
|
var r0;
|
|
let value = a0.channel.id === 'null';
|
|
if (value) {
|
|
r0 = value;
|
|
} else {
|
|
value = environment.__proto__;
|
|
value = env1_2.length === 0;
|
|
r0 = value;
|
|
}
|
|
r0 = !r0 ? env0_0[a0.channel.id].length > 0 : r0;
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function getFirstRouteFor(a0) { // fn#87038, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:1184, offset: 0x01fac726, size: 270 bytes, params: 2, frame: 21
|
|
var r6;
|
|
var channel;
|
|
var row;
|
|
var getChannelFromSectionRow;
|
|
var value6;
|
|
var value7;
|
|
const sections = a0.getSections(false);
|
|
const value3 = undefined;
|
|
const SECTION_INDEX_GUILD_ACTIONS = (ChannelListStateModule).SECTION_INDEX_GUILD_ACTIONS;
|
|
if (sections[SECTION_INDEX_GUILD_ACTIONS] > 0) {
|
|
row = a0.getGuildActionSection().getRow(0);
|
|
if (ChannelListGuildActionRow.GUILD_HOME === row) {
|
|
return StaticChannelRoute.GUILD_HOME;
|
|
}
|
|
if (ChannelListGuildActionRow.GUILD_ROLE_SUBSCRIPTIONS === row) {
|
|
return StaticChannelRoute.ROLE_SUBSCRIPTIONS;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (ChannelListGuildActionRow.GUILD_MOD_DASH_MEMBER_SAFETY === row) {
|
|
return StaticChannelRoute.MEMBER_SAFETY;
|
|
}
|
|
break reducibleJoin4;
|
|
}
|
|
}
|
|
const SECTION_INDEX_UNCATEGORIZED_CHANNELS = (ChannelListStateModule).SECTION_INDEX_UNCATEGORIZED_CHANNELS;
|
|
let voiceChannelsSectionNumber = a0.voiceChannelsSectionNumber;
|
|
if (SECTION_INDEX_UNCATEGORIZED_CHANNELS < voiceChannelsSectionNumber) {
|
|
r6 = SECTION_INDEX_UNCATEGORIZED_CHANNELS;
|
|
reducibleLoop5: while (true) {
|
|
if (sections[r6] > 0) {
|
|
getChannelFromSectionRow = a0.getChannelFromSectionRow;
|
|
value6 = Reflect.apply(getChannelFromSectionRow, a0, [r6, 0]);
|
|
reducibleJoin8: while (true) {
|
|
if (value6 == null) {
|
|
channel = value3;
|
|
break reducibleJoin8;
|
|
}
|
|
channel = value6.channel;
|
|
break reducibleJoin8;
|
|
}
|
|
reducibleJoin9: while (true) {
|
|
if (channel != null) {
|
|
return channel.id;
|
|
}
|
|
break reducibleJoin9;
|
|
}
|
|
}
|
|
value7 = typeof r6 === 'bigint' ? r6 + 1n : +r6 + 1;
|
|
voiceChannelsSectionNumber = a0.voiceChannelsSectionNumber;
|
|
if (!(value7 < voiceChannelsSectionNumber)) {
|
|
return null;
|
|
}
|
|
r6 = value7;
|
|
continue reducibleLoop5;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function clearRecentChannels(a0, a1) { // fn#87039, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:1710, offset: 0x01fac834, size: 149 bytes, params: 3, frame: 18
|
|
var moduleValue3;
|
|
const value = a2;
|
|
const r5 = value !== undefined ? value : null;
|
|
(RecentChannelsActionCreatorsModule).bulkClearRecents(a0, a1);
|
|
ReadStateActionCreatorsModule.bulkAck(a1.map(function(a0) {
|
|
var object = {channelId: a0};
|
|
object.readStateType = ReadStateTypes.CHANNEL;
|
|
object.messageId = ReadStateStore.lastMessageId(a0);
|
|
return object;
|
|
}));
|
|
if (r5 != null) {
|
|
moduleValue3 = require(1230) /* metro dependency 1230: router_utils */;
|
|
moduleValue3.transitionTo(Routes.CHANNEL(a0, r5));
|
|
}
|
|
}
|
|
|
|
function useChannelBrowserSections(a0, a1, a2, a3) { // fn#87041, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:1957, offset: 0x01fac8f9, size: 205 bytes, params: 5, frame: 21
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const env0_2 = a2;
|
|
const UNSAFE_useIsDismissibleContentDismissed = DismissibleContentUnsafeUtilsModule.UNSAFE_useIsDismissibleContentDismissed;
|
|
const DismissibleContent = (Dismissible_contentModule).DismissibleContent;
|
|
const CHANNEL_BROWSER_NUX = DismissibleContent.CHANNEL_BROWSER_NUX;
|
|
const value2 = Reflect.apply(UNSAFE_useIsDismissibleContentDismissed, DismissibleContentUnsafeUtilsModule,
|
|
[CHANNEL_BROWSER_NUX]);
|
|
const env0_3 = (FluxModule).useStateFromStoresObject([ChannelStore], _fun87042,
|
|
[a0]);
|
|
const value = a1._categories.map(_fun87043);
|
|
if (!(value2 || a3 == null)) {
|
|
value.unshift({rowCount: 1, rowHeight: a3});
|
|
}
|
|
return value;
|
|
function _fun87042() { // fn#87042, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:2146, offset: 0x01fac9c6, size: 99 bytes, params: 1, frame: 22
|
|
var r7;
|
|
var r11;
|
|
var propertyName;
|
|
var propertyName2;
|
|
var parent_id;
|
|
var property;
|
|
var value2;
|
|
const object = {};
|
|
let value = environment.__proto__;
|
|
value = ChannelStore.getMutableGuildChannelsForGuild(env0_0);
|
|
for (propertyName in value) {
|
|
parent_id = value[propertyName].parent_id;
|
|
if (parent_id == null) {
|
|
r7 = propertyName2;
|
|
continue;
|
|
}
|
|
property = object[parent_id];
|
|
value2 = 0;
|
|
if (property != null) {
|
|
r11 = property;
|
|
continue;
|
|
}
|
|
r11 = value2;
|
|
continue;
|
|
object[parent_id] = r11 + 1;
|
|
r7 = propertyName2;
|
|
}
|
|
return object;
|
|
}
|
|
|
|
function _fun87043(a0) { // fn#87043, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:2314, offset: 0x01faca29, size: 103 bytes, params: 2, frame: 6
|
|
const property = require[a0.channel.id];
|
|
const object = {};
|
|
let length = a0.channel.id === 'null' ? property.length : env0_3[a0.channel.id] === 0 ? 1 : property.length;
|
|
object.rowCount = length;
|
|
length = property.length;
|
|
const value3 = 0;
|
|
object.rowHeight = value3 === length ? value3 : importDefault;
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
function useChannelBrowserChannelCount(a0) { // fn#87044, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:2531, offset: 0x01faca90, size: 222 bytes, params: 2, frame: 17
|
|
const env0_0 = a0;
|
|
const value2 = undefined;
|
|
const categories = (FluxModule).useStateFromStores([GuildCategoryStore],
|
|
_fun87045);
|
|
const length = categories._categories.length;
|
|
const property = categories._categories[categories._categories.length - 1];
|
|
if (property == null) {
|
|
return 0;
|
|
}
|
|
const channel = property.channel;
|
|
const property2 = categories[(channel == null ? value2 : channel.id) ?? 'null'];
|
|
const value = 0;
|
|
return property2 == null ? value : value === property2.length ? property.index + 2 - length : property2[property2.length - 1].index + 2 - length;
|
|
function _fun87045() { // fn#87045, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:2616, offset: 0x01facb6e, size: 27 bytes, params: 1, frame: 11
|
|
return GuildCategoryStore.getCategories(env0_0);
|
|
}
|
|
|
|
}
|
|
|
|
function getActiveAgoTimestamp(a0) { // fn#87046, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11546:2875, offset: 0x01facb89, size: 155 bytes, params: 2, frame: 20
|
|
let value = a0;
|
|
const intl = (IndexNativeModule).intl;
|
|
const formatToPlainString = intl.formatToPlainString;
|
|
const property = (IndexNativeModule).t['8N0BHR'];
|
|
const object = {};
|
|
const defaultImport = Module03738;
|
|
const defaultImport2 = SnowflakeUtils;
|
|
value = defaultImport(defaultImport2.extractTimestamp(ReadStateStore.lastMessageId(value) ?? value));
|
|
object.timeAgo = value.fromNow();
|
|
return Reflect.apply(formatToPlainString, intl, [property, object]);
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun87029, 11360, [31, 1379, 5098, 4605, 3793, 1878, 661, 1386, 5101, 4865, 5103, 6590, 4805, 5099, 5092,
|
|
11361, 5097, 1230, 3968, 1365, 566, 1244, 3738, 21,
|
|
2]) /* metro module 11360, dependencies: [31, 1379, 5098, 4605, 3793, 1878, 661, 1386, 5101, 4865, 5103, 6590, 4805, 5099, 5092, 11361, 5097, 1230, 3968, 1365, 566, 1244, 3738, 21, 2] */;
|