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

308 lines
14 KiB
TypeScript

/* Metro module 6612; source: modules/user_settings/UserGuildSettingsManager.tsx; dependencies: [7, 6, 15, 17, 18, 5, 5090, 1379, 661, 672, 507, 4860, 2] */
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
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 Durations from '../../utils/Durations.tsx'; /* Metro dependency 672 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import CategoryCollapseStore from '../../stores/CategoryCollapseStore.tsx'; /* Metro dependency 5090 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
function _fun52225(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#52225, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6790:6, offset: 0x013230a9, size: 420 bytes, params: 8, frame: 19
const env0_0 = require;
const handleConnectionOpen_52229 = function() {
var object = {};
var categoryCollapseStoreBinding = CategoryCollapseStore;
copyDataProperties(object, categoryCollapseStoreBinding.getCollapsedCategories(), categoryCollapseStoreBinding);
env0_13 = object;
};
const saveUserGuildSettings = function() {
return _saveUserGuildSettings.apply(this, arguments);
};
const saveUserGuildSettingsBulk = function() {
return _saveUserGuildSettingsBulk.apply(this, arguments);
};
const handleUserGuildSettingsFullUpdate_52240 = function() {
var object = {};
var categoryCollapseStoreBinding = CategoryCollapseStore;
copyDataProperties(object, categoryCollapseStoreBinding.getCollapsedCategories(), categoryCollapseStoreBinding);
env0_13 = object;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
const env0_10 = value.Endpoints;
const env0_11 = value.FAVORITES;
const env0_12 = value.ME;
let env0_13 = {};
const Millis = (Durations).Millis;
const SECOND = Millis.SECOND;
const env0_15 = 15 * SECOND;
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
value = _fun52241(value);
value = new value();
(FileImportTrackerModule).fileFinishedImporting('modules/user_settings/UserGuildSettingsManager.tsx');
exports.default = value;
function _isNativeReflectConstruct_52226() { // fn#52226, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6790:223, offset: 0x0132324d, size: 94 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_52226_isNativeReflectConstruct = function() {
return !!result;
})();
}
function scheduleSync() { // fn#52230, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6790:522, offset: 0x013232cd, size: 51 bytes, params: 1, frame: 14
global.clearTimeout(env0_14);
env0_14 = global.setTimeout(function() {
return saveUserGuildSettingsBulk({});
}, env0_15);
}
function _saveUserGuildSettings() { // fn#52233, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6790:699, offset: 0x01323312, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun52235).apply(this, arguments);
function* _fun52235(a0, a1) { // fn#52235, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6790:766, offset: 0x0132334b, size: 180 bytes, params: 3, frame: 16
var binding;
var object;
var HTTP;
var patch;
let value = a0;
if (true) {
if (value == null) {
value = environment.__proto__.__proto__;
binding = env2_0;
HTTP = binding(env2_1[10]).HTTP;
patch = HTTP.patch;
object = {};
binding = env2_10;
object.url = binding.USER_GUILD_SETTINGS(env2_12);
object.body = a1;
object.rejectWithError = false;
yield Reflect.apply(patch, HTTP, [object]);
value = undefined;
if (false) {
return value;
}
} else {
if (value === env2_12) {
value = environment.__proto__.__proto__;
binding = env2_0;
HTTP = binding(env2_1[10]).HTTP;
patch = HTTP.patch;
object = {};
binding = env2_10;
object.url = binding.USER_GUILD_SETTINGS(env2_12);
object.body = a1;
object.rejectWithError = false;
yield Reflect.apply(patch, HTTP, [object]);
value = undefined;
if (false) {
return value;
}
return undefined;
}
binding = env2_21;
yield binding(a1 != null ? {[value ?? env2_12]: a1} : {});
value = undefined;
if (false) {
return value;
}
}
}
}
}
function _saveUserGuildSettingsBulk() { // fn#52237, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6790:1061, offset: 0x013233ff, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun52239).apply(this, arguments);
function* _fun52239(a0) { // fn#52239, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6790:1136, offset: 0x01323438, size: 525 bytes, params: 2, frame: 30
var r20;
var r9;
var r2;
var r11;
var r15;
var r1;
var propertyName;
var propertyName2;
var property;
var propertyName3;
var propertyName4;
var channel;
var value8;
var guild_id;
var value9;
var channel_overrides;
var id;
var object;
var channel_overrides2;
var id2;
var id3;
var HTTP;
if (false) {
return undefined;
}
const clearTimeout = global.clearTimeout;
value = environment.__proto__.__proto__;
clearTimeout(env2_14);
const Object = global.Object;
const value3 = Object.keys(a0).length !== 0;
let binding = env2_8;
const collapsedCategories = binding.getCollapsedCategories();
const object2 = {};
const collapsedCategories2 = env2_8.getCollapsedCategories();
const value6 = true;
for (propertyName in collapsedCategories2) {
property = collapsedCategories2[propertyName];
if (property === env2_13[propertyName]) {
r9 = propertyName2;
continue;
}
object2[propertyName] = value6;
r9 = propertyName2;
}
for (propertyName in env2_13) {
property = collapsedCategories2[propertyName];
if (property === env2_13[propertyName]) {
r9 = propertyName3;
continue;
}
object2[propertyName] = value6;
r9 = propertyName3;
}
const properties = Object.keys(object2);
const properties6 = 0;
const properties7 = properties.length;
if (properties === undefined) {
r1 = value3;
} else {
r2 = value3;
r11 = properties6;
while (true) {
propertyName = properties[r11];
propertyName4 = r11 + 1;
if (propertyName === undefined) {
r1 = r2;
break;
}
binding = env2_9;
channel = binding.getChannel(propertyName);
value8 = channel != null;
if (!value8) {
r15 = value8;
continue;
}
guild_id = channel.guild_id;
value9 = guild_id != null;
r15 = value9;
if (!r15) {
r11 = propertyName4;
continue;
}
guild_id = channel.guild_id;
if (guild_id in a0) {
continue;
}
a0[channel.guild_id] = {};
guild_id = channel.guild_id;
channel_overrides = a0[guild_id].channel_overrides;
if (channel_overrides != null) {
continue;
}
property = a0[channel.guild_id];
property.channel_overrides = {};
guild_id = channel.guild_id;
channel_overrides = a0[guild_id].channel_overrides;
id = channel.id;
object = {};
guild_id = channel.guild_id;
channel_overrides2 = a0[guild_id].channel_overrides;
id2 = channel.id;
copyDataProperties(object, channel_overrides2[id2], channel_overrides2);
id3 = channel.id;
object['collapsed'] = id3 in collapsedCategories;
channel_overrides[id] = object;
r2 = value6;
r11 = propertyName4;
r20 = channel_overrides2;
}
}
if (r1) {
copyDataProperties({}, collapsedCategories, r20);
delete a0[env2_11];
HTTP = env2_0(env2_1[10]).HTTP;
yield HTTP.patch({url: env2_10.USER_GUILD_SETTINGS_BULK, body: {guilds: a0}, rejectWithError: false});
value = undefined;
if (false) {
return value;
}
return value.body;
}
return [];
}
}
function _fun52241(a0) { // fn#52241, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6790:1923, offset: 0x01323645, size: 40 bytes, params: 2, frame: 14
const UserGuildSettingsManager2 = UserGuildSettingsManager;
Inherits(UserGuildSettingsManager2, a0);
return CreateClass(UserGuildSettingsManager2);
function UserGuildSettingsManager(a0) { // fn#52242, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6790:1935, offset: 0x0132366d, size: 196 bytes, params: 2, frame: 20
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_3;
binding(this, UserGuildSettingsManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_5(UserGuildSettingsManager);
binding = env1_4;
if (_isNativeReflectConstruct_52226()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_5(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
const scheduleSyncBinding = scheduleSync;
value.actions = {CATEGORY_COLLAPSE: scheduleSyncBinding, CATEGORY_EXPAND: scheduleSyncBinding,
CATEGORY_COLLAPSE_ALL: scheduleSyncBinding, CATEGORY_EXPAND_ALL: scheduleSyncBinding,
POST_CONNECTION_OPEN: handleConnectionOpen_52229,
USER_GUILD_SETTINGS_FULL_UPDATE: handleUserGuildSettingsFullUpdate_52240};
value.saveUserGuildSettings = saveUserGuildSettings;
value.saveUserGuildSettingsBulk = saveUserGuildSettingsBulk;
return value;
}
}
}
global.__d(_fun52225, 6612, [7, 6, 15, 17, 18, 5, 5090, 1379, 661, 672, 507, 4860,
2]) /* metro module 6612, dependencies: [7, 6, 15, 17, 18, 5, 5090, 1379, 661, 672, 507, 4860, 2] */;