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

249 lines
11 KiB
TypeScript

/* Metro module 15860; source: modules/guild_settings/GuildSettingsModalChannelsStore.tsx; dependencies: [6, 7, 15, 17, 18, 29, 1383, 1935, 3784, 661, 5099, 22, 566, 694, 2] */
function _fun122053(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#122053, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:6, offset: 0x02558ef1, size: 604 bytes, params: 8, frame: 20
const sortCategoryList = function(a0, a1) {
var property = a0.channel;
var position = property.position;
property = property.type;
var channel = a1.channel;
var position2 = channel.position;
var type = channel.type;
return property === type || isGuildSelectableChannelType(property) && isGuildSelectableChannelType(type) || isGuildVocalChannelType(property) && isGuildVocalChannelType(type) ? position - position2 : property !== ChannelTypes.GUILD_TEXT ? 1 : -1;
};
const setIndex_122058 = function(a0, a1) {
a0.index = a1;
};
const env0_2 = ['lock_permissions', 'id'];
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
const env0_8 = importDefault(29) /* metro dependency 29 */;
let value = require(1383) /* metro dependency 1383: ChannelRecord */;
const env0_9 = value.isGuildSelectableChannelType;
const env0_10 = value.isGuildVocalChannelType;
value = require(1935) /* metro dependency 1935: GuildChannelStore */;
const env0_11 = value.GUILD_SELECTABLE_CHANNELS_KEY;
const env0_12 = value.GUILD_VOCAL_CHANNELS_KEY;
const guildChannelStore = importDefault(1935) /* metro dependency 1935: GuildChannelStore */;
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
value = require(661) /* metro dependency 661: Constants */;
const env0_15 = value.ChannelTypes;
const env0_16 = value.Permissions;
const env0_23 = {};
const env0_24 = (importDefault(22) /* metro dependency 22 */).debounce(_fun122069, 500);
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
_fun122070(Store).displayName = 'GuildSettingsModalChannelsStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{GUILD_SETTINGS_MODAL_CHANNELS_TERMINATE: function() {
env0_17 = null;
env0_18 = null;
env0_19 = null;
env0_21 = null;
env0_22 = null;
env0_20 = null;
}, GUILD_SETTINGS_MODAL_CHANNELS_START_REORDER: GUILD_SETTINGS_MODAL_CHANNELS_START_REORDER,
GUILD_SETTINGS_MODAL_CHANNELS_STOP_REORDER: function() {
env0_21 = null;
setupSortLists();
}, GUILD_SETTINGS_MODAL_LOCAL_SORT_CHANGE: function({updates}) {
updates.forEach(_fun122084);
buildSortedChannels();
}});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_settings/GuildSettingsModalChannelsStore.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_122054() { // fn#122054, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:397, offset: 0x0255914d, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_122054_isNativeReflectConstruct = function() {
return !!result;
})();
}
function buildSortedChannels() { // fn#122059, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:824, offset: 0x0255922b, size: 186 bytes, params: 1, frame: 14
env0_19 = {_categories: [], null: []};
const Object = global.Object;
const value2 = Object.keys(env0_23);
value2.forEach(_fun122060);
const _categories = env0_19._categories;
_categories.sort(sortCategoryList);
env0_19._categories.forEach(_fun122061);
const value3 = (importDefault(5099) /* metro dependency 5099: getFlattedChannelList */)(env0_19._categories,
env0_19);
value3.forEach(setIndex_122058);
setupSortLists();
}
function rebuildChannels_122062() { // fn#122062, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:1359, offset: 0x02559400, size: 139 bytes, params: 1, frame: 14
const channels = GuildChannelStore.getChannels(env0_17);
if (channels === env0_20) {
return false;
}
env0_23 = {};
channels[GUILD_SELECTABLE_CHANNELS_KEY].forEach(_fun122063);
channels[GUILD_VOCAL_CHANNELS_KEY].forEach(_fun122064);
const GUILD_CATEGORY = ChannelTypes.GUILD_CATEGORY;
channels[GUILD_CATEGORY].forEach(_fun122065);
buildSortedChannels();
}
function setupSortLists() { // fn#122066, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:1712, offset: 0x025594f1, size: 94 bytes, params: 1, frame: 17
if (env0_19 != null) {
env0_18 = (importDefault(5099) /* metro dependency 5099: getFlattedChannelList */)(env0_19._categories, env0_19,
_fun122067).map(function(a0) {
return a0.channel.id;
});
}
}
function _fun122069() { // fn#122069, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:1667, offset: 0x02559595, size: 29 bytes, params: 1, frame: 10
rebuildChannels_122062();
env0_25.emitChange();
}
function _fun122070(a0) { // fn#122070, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:1881, offset: 0x025595b2, size: 224 bytes, params: 2, frame: 16
const closure = GuildSettingsModalChannelsStoreClass;
env0_7(closure, a0);
return env0_4(closure, [{key: 'initialize', value: function() {
this.waitFor(GuildChannelStore, PermissionStore);
this.syncWith([GuildChannelStore], _fun122073);
}}, {key: 'initGuild', value: function(a0) {
env1_17 = a0;
rebuildChannels_122062();
}}, {key: 'channels', get: get_122075}, {key: 'order', get: get_122076}, {key: 'sortingType', get: get_122077},
{key: 'channelList', get: get_122078}, {key: 'getLocalChannel', value: value_122079}]);
}
function GUILD_SETTINGS_MODAL_CHANNELS_START_REORDER({sortingType}) { // fn#122081, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:2884, offset: 0x02559719, size: 73 bytes, params: 2, frame: 12
if (env0_19 == null) {
return false;
}
const Set = global.Set;
const set = new Set(sortingType);
setupSortLists();
}
function GUILD_SETTINGS_MODAL_LOCAL_SORT_CHANGE({updates}) { // fn#122083, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:3116, offset: 0x02559777, size: 43 bytes, params: 2, frame: 11
updates.forEach(_fun122084);
buildSortedChannels();
}
function _fun122060(a0) { // fn#122060, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:906, offset: 0x025592e5, size: 222 bytes, params: 2, frame: 15
var value3;
var property2;
var _categories;
const property = env1_23[a0];
if (property != null) {
if (env1_19 != null) {
if (property.type === ChannelTypes.GUILD_CATEGORY) {
_categories = env1_19._categories;
_categories.push({channel: property, index: -1});
if (env1_19[property.id] == null) {
env1_19[property.id] = [];
}
} else {
value3 = global.String(property.parent_id ?? 'null');
if (env1_19[value3] == null) {
env1_19[value3] = [];
}
property2 = env1_19[value3];
property2.push({channel: property, index: -1});
}
}
}
}
function _fun122061({channel}) { // fn#122061, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:1209, offset: 0x025593c3, size: 61 bytes, params: 2, frame: 12
var property;
if (env1_19 != null) {
if (channel != null) {
property = env1_19[channel.id];
if (property != null) {
property.sort(sortCategoryList);
}
}
}
}
function _fun122063({channel}) { // fn#122063, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:1450, offset: 0x0255948b, size: 26 bytes, params: 2, frame: 3
env1_23[channel.id] = channel;
return channel;
}
function _fun122065({channel}) { // fn#122065, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:1547, offset: 0x025594a5, size: 76 bytes, params: 2, frame: 14
var r0;
let value = channel.id === 'null';
if (value) {
r0 = value;
} else {
value = environment.__proto__;
value = PermissionStore.can(Permissions.VIEW_CHANNEL, channel);
r0 = value;
}
if (r0) {
value = environment.__proto__;
env1_23[channel.id] = channel;
}
}
function _fun122067({channel}) { // fn#122067, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:1776, offset: 0x0255954f, size: 70 bytes, params: 2, frame: 13
const type = channel.type;
const value = environment.__proto__;
const GUILD_CATEGORY = ChannelTypes.GUILD_CATEGORY;
return type === GUILD_CATEGORY || env1_21 != null && env1_21.has(channel.type);
}
function value_122072() { // fn#122072, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:2291, offset: 0x02559692, size: 63 bytes, params: 1, frame: 14
this.waitFor(GuildChannelStore, PermissionStore);
this.syncWith([GuildChannelStore], _fun122073);
}
function _fun122084(a0) { // fn#122084, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:3171, offset: 0x025597a2, size: 93 bytes, params: 2, frame: 14
var value2;
var property;
let binding = env1_23;
let id = a0.id;
if (binding[id] != null) {
a0.lock_permissions;
a0.id;
binding = env1_8;
value2 = binding(a0, env1_2);
binding = env1_23;
id = a0.id;
property = env1_23[a0.id];
binding[id] = property.merge(value2);
}
}
function _fun122073() { // fn#122073, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:2339, offset: 0x025596d1, size: 17 bytes, params: 1, frame: 9
env2_24();
return false;
}