Files
discord-decomp/sources/modules/guild_settings/GuildSettingsModalChannelsStore.tsx
T
2026-07-28 01:06:53 +03:00

293 lines
15 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] */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Module00022 from '../../by-id/module-00022.js'; /* Metro dependency 22 */
import ObjectWithoutProperties from '../../by-id/module-00029-ObjectWithoutProperties.js'; /* Metro dependency 29 */
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import GuildChannelStore from '../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
import GetFlattedChannelList from '../channel/getFlattedChannelList.tsx'; /* Metro dependency 5099 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ChannelRecordModule from '../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
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});
let value = ChannelRecordModule;
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;
value = require(661) /* metro dependency 661: Constants */;
const env0_15 = value.ChannelTypes;
const env0_16 = value.Permissions;
const env0_23 = {};
const env0_24 = (Module00022).debounce(_fun122069, 500);
const Store = (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();
}});
(FileImportTrackerModule).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
var object2;
object2 = {_categories: [], null: []};
const Object = global.Object;
const value2 = Object.keys(env0_23);
value2.forEach(_fun122060);
const _categories = object2._categories;
_categories.sort(sortCategoryList);
object2._categories.forEach(_fun122061);
const value3 = (GetFlattedChannelList)(object2._categories,
object2);
value3.forEach(setIndex_122058);
setupSortLists();
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 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 _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 _fun122064({channel}) { // fn#122064, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:1491, 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;
var permissionStoreBinding;
let value = channel.id === 'null';
if (value) {
r0 = value;
} else {
value = environment.__proto__;
permissionStoreBinding = PermissionStore;
value = permissionStoreBinding.can(Permissions.VIEW_CHANNEL, channel);
r0 = value;
}
if (r0) {
value = environment.__proto__;
env1_23[channel.id] = channel;
}
}
}
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 _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 _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 GuildSettingsModalChannelsStoreClass2 = GuildSettingsModalChannelsStoreClass;
Inherits(GuildSettingsModalChannelsStoreClass2, a0);
return CreateClass(GuildSettingsModalChannelsStoreClass2, [{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 GuildSettingsModalChannelsStoreClass() { // fn#122071, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:1893, offset: 0x011a274a, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_3(this, GuildSettingsModalChannelsStoreClass);
const value3 = env1_6(GuildSettingsModalChannelsStoreClass);
return env1_5(this, _isNativeReflectConstruct_122054() ? global.Reflect.construct(value3, arguments,
env1_6(this).constructor) : value3.apply(this, arguments));
}
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 _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;
}
}
function get_122075() { // fn#122075, offset: 0x00d406a2, size: 9 bytes, params: 1, frame: 1
return env1_19;
}
function get_122076() { // fn#122076, offset: 0x00df0e82, size: 9 bytes, params: 1, frame: 1
return env1_18;
}
function get_122077() { // fn#122077, offset: 0x00f854d6, size: 9 bytes, params: 1, frame: 1
return env1_21;
}
function get_122078() { // fn#122078, offset: 0x00e425c8, size: 9 bytes, params: 1, frame: 1
return env1_22;
}
function value_122079(a0) { // fn#122079, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16068:2615, offset: 0x0109f057, size: 16 bytes, params: 2, frame: 2
return env1_23[a0];
}
}
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 _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);
}
}
}
}
global.__d(_fun122053, 15860, [6, 7, 15, 17, 18, 29, 1383, 1935, 3784, 661, 5099, 22, 566, 694,
2]) /* metro module 15860, dependencies: [6, 7, 15, 17, 18, 29, 1383, 1935, 3784, 661, 5099, 22, 566, 694, 2] */;