708 lines
39 KiB
TypeScript
708 lines
39 KiB
TypeScript
/* Metro module 15679; source: modules/gateway/ChannelResyncManager.tsx; dependencies: [5, 6, 7, 15, 17, 18, 1226, 1379, 4646, 1867, 4257, 661, 1386, 3, 672, 4860, 683, 694, 5235, 12526, 1391, 491, 2] */
|
|
import Logger from '../debug/Logger.tsx'; /* Metro dependency 3 */
|
|
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 AnalyticsUtils from '../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
|
|
import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
|
|
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
|
|
import GatewayConnectionStore from './GatewayConnectionStore.tsx'; /* Metro dependency 4257 */
|
|
import GuildAvailabilityStore from '../../stores/GuildAvailabilityStore.tsx'; /* Metro dependency 4646 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as ChannelConstantsModule from '../channel/ChannelConstants.tsx'; /* Metro dependency 1386 */
|
|
import * as PrivateChannelHidingExperimentModule from './PrivateChannelHidingExperiment.tsx'; /* Metro dependency 12526 */
|
|
|
|
function _fun120268(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120268, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:6, offset: 0x02526273, size: 774 bytes, params: 8, frame: 22
|
|
const env0_0 = require;
|
|
const scheduleGuildResyncs = function() {
|
|
return _scheduleGuildResyncs.apply(this, arguments);
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = Logger;
|
|
value = new value('ChannelResyncManager');
|
|
let Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
let SECOND = Millis.SECOND;
|
|
const env0_17 = 2 * SECOND;
|
|
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
SECOND = Millis.SECOND;
|
|
const env0_18 = 30 * SECOND;
|
|
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
SECOND = Millis.SECOND;
|
|
const env0_19 = 300 * SECOND;
|
|
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
SECOND = Millis.SECOND;
|
|
const env0_20 = 30 * SECOND;
|
|
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
SECOND = Millis.SECOND;
|
|
const env0_21 = 60 * SECOND;
|
|
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
|
|
value = _fun120307(value);
|
|
const env0_22 = {};
|
|
const Set = global.Set;
|
|
const set = new Set();
|
|
const env0_24 = {};
|
|
const env0_25 = {};
|
|
const env0_26 = {};
|
|
const env0_27 = {};
|
|
const env0_28 = {};
|
|
value = new value();
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/gateway/ChannelResyncManager.tsx');
|
|
exports.default = value;
|
|
function _isNativeReflectConstruct_120269() { // fn#120269, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:259, offset: 0x02526579, 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_120269_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function setLatestRequest(a0, a1, a2) { // fn#120272, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:1549, offset: 0x025265db, size: 58 bytes, params: 4, frame: 12
|
|
const binding = env0_22;
|
|
const object = {guildId: a0, requestId: a1, source: a2};
|
|
object.requestedUserId = AuthenticationStore.getId();
|
|
binding[a0] = object;
|
|
}
|
|
|
|
function getLatestRequestId(a0) { // fn#120273, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:1646, offset: 0x02526615, size: 47 bytes, params: 2, frame: 4
|
|
return env0_22[a0]?.requestId ?? 'unknown';
|
|
}
|
|
|
|
function cleanupResyncState(a0) { // fn#120274, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:1748, offset: 0x02526644, size: 98 bytes, params: 2, frame: 14
|
|
if (env0_25[a0] != null) {
|
|
global.clearTimeout(env0_25[a0]);
|
|
delete env0_25[a0];
|
|
}
|
|
if (env0_24[a0] != null) {
|
|
global.clearTimeout(env0_24[a0]);
|
|
delete env0_24[a0];
|
|
}
|
|
}
|
|
|
|
function cleanupIntegrityCheckState(a0) { // fn#120275, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:1869, offset: 0x025266a6, size: 98 bytes, params: 2, frame: 14
|
|
if (env0_27[a0] != null) {
|
|
global.clearTimeout(env0_27[a0]);
|
|
delete env0_27[a0];
|
|
}
|
|
if (env0_26[a0] != null) {
|
|
global.clearTimeout(env0_26[a0]);
|
|
delete env0_26[a0];
|
|
}
|
|
}
|
|
|
|
function handleGuildCreate_120276({guild}) { // fn#120276, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:1998, offset: 0x02526708, size: 126 bytes, params: 2, frame: 16
|
|
var binding;
|
|
var id;
|
|
if (guild.unavailable !== true) {
|
|
binding = env0_28;
|
|
id = guild.id;
|
|
if (binding[id] != null) {
|
|
global.clearTimeout(env0_28[guild.id]);
|
|
}
|
|
binding = env0_28;
|
|
id = guild.id;
|
|
binding[id] = global.setTimeout(_fun120277, 0);
|
|
}
|
|
function _fun120277() { // fn#120277, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:2124, offset: 0x02526786, size: 92 bytes, params: 1, frame: 13
|
|
var scheduleGuildResyncsBinding;
|
|
var scheduleIntegrityCheckBinding;
|
|
let binding = env1_28;
|
|
let id = guild.id;
|
|
delete binding[id];
|
|
binding = env0_1;
|
|
if (binding === env1_29) {
|
|
binding = env1_23;
|
|
guildBinding = guild;
|
|
id = guildBinding.id;
|
|
binding.delete(id);
|
|
scheduleGuildResyncsBinding = scheduleGuildResyncs;
|
|
id = guildBinding.id;
|
|
scheduleGuildResyncsBinding(id);
|
|
scheduleIntegrityCheckBinding = scheduleIntegrityCheck;
|
|
id = guildBinding.id;
|
|
scheduleIntegrityCheckBinding(id);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function handlePostConnectionOpen_120278() { // fn#120278, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:2230, offset: 0x025267e2, size: 62 bytes, params: 1, frame: 12
|
|
env0_23.clear();
|
|
scheduleGuildResyncs();
|
|
GuildStore.getGuildIds().forEach(function(a0) {
|
|
scheduleIntegrityCheck(a0);
|
|
});
|
|
}
|
|
|
|
function handleChannelSync(a0) { // fn#120280, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:2357, offset: 0x02526833, size: 159 bytes, params: 2, frame: 18
|
|
var getLatestRequestIdBinding;
|
|
var guild_id;
|
|
var latestRequestIdBinding;
|
|
var defaultImport;
|
|
var track;
|
|
var GUILD_CHANNEL_RESYNC_COMPLETED;
|
|
var cleanupResyncStateBinding;
|
|
var scheduleIntegrityCheckBinding;
|
|
if (a0.integrity_check) {
|
|
doIntegrityCheck(a0);
|
|
} else {
|
|
getLatestRequestIdBinding = getLatestRequestId;
|
|
guild_id = a0.guild_id;
|
|
latestRequestIdBinding = getLatestRequestIdBinding(guild_id);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport.track;
|
|
GUILD_CHANNEL_RESYNC_COMPLETED = AnalyticEvents.GUILD_CHANNEL_RESYNC_COMPLETED;
|
|
guild_id = a0.guild_id;
|
|
Reflect.apply(track, defaultImport, [GUILD_CHANNEL_RESYNC_COMPLETED, {guild_id: guild_id,
|
|
request_id: latestRequestIdBinding, num_new_channels: a0.channels.length}]);
|
|
cleanupResyncStateBinding = cleanupResyncState;
|
|
guild_id = a0.guild_id;
|
|
cleanupResyncStateBinding(guild_id);
|
|
scheduleIntegrityCheckBinding = scheduleIntegrityCheck;
|
|
guild_id = a0.guild_id;
|
|
scheduleIntegrityCheckBinding(guild_id);
|
|
}
|
|
function doIntegrityCheck({guild_id, channels}) { // fn#120281, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:2409, owner: handleChannelSync.doIntegrityCheck, offset: 0x025268d2, size: 351 bytes, params: 2, frame: 23
|
|
const latestRequestId = getLatestRequestId(guild_id);
|
|
const env0_0 = ChannelStore.getMutableGuildChannelsForGuild(guild_id);
|
|
const Set = global.Set;
|
|
const set = new Set();
|
|
const items2 = [];
|
|
channels.forEach(_fun120282);
|
|
const Array = global.Array;
|
|
const value6 = Array.from(set).join(', ');
|
|
const r7 = items2.length > 0 ? global.JSON.stringify(items2) : null;
|
|
(set.size > 0 ? env1_16.warn : env1_16.verbose)('Integrity check for guild ' + guild_id + ' completed. Discrepancies found: ' + value6);
|
|
const defaultImport = AnalyticsUtils;
|
|
const track = defaultImport.track;
|
|
const GUILD_CHANNEL_INTEGRITY_CHECK_COMPLETED = AnalyticEvents.GUILD_CHANNEL_INTEGRITY_CHECK_COMPLETED;
|
|
Reflect.apply(track, defaultImport, [GUILD_CHANNEL_INTEGRITY_CHECK_COMPLETED, {guild_id: guild_id,
|
|
request_id: latestRequestId, num_channels_received: channels.length, num_discrepancies_found: set.size,
|
|
discrepancy_channel_ids: value6, discrepancies_details: r7}]);
|
|
cleanupIntegrityCheckState(guild_id);
|
|
env1_23.add(guild_id);
|
|
function _fun120282(a0) { // fn#120282, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:2553, offset: 0x02526a31, size: 401 bytes, params: 2, frame: 26
|
|
var r7;
|
|
var warn;
|
|
var value3;
|
|
var moduleValue;
|
|
var hasFlag;
|
|
var flags;
|
|
var value4;
|
|
var OBFUSCATED;
|
|
var hasFlag2;
|
|
var moduleValue2;
|
|
var hasFlag3;
|
|
var add;
|
|
var push;
|
|
var object;
|
|
var parent_id;
|
|
let binding = env0_0;
|
|
let id = a0.id;
|
|
const property = binding[id];
|
|
const value2 = null;
|
|
if (value2 != property) {
|
|
value3 = environment.__proto__.__proto__;
|
|
moduleValue = require(1391) /* metro dependency 1391: FlagUtils */;
|
|
hasFlag = moduleValue.hasFlag;
|
|
flags = a0.flags;
|
|
value4 = 0;
|
|
r7 = value2 != flags ? flags : value4;
|
|
OBFUSCATED = ChannelFlags.OBFUSCATED;
|
|
hasFlag2 = Reflect.apply(hasFlag, moduleValue, [r7, OBFUSCATED]);
|
|
moduleValue2 = require(1391) /* metro dependency 1391: FlagUtils */;
|
|
hasFlag = moduleValue2.hasFlag;
|
|
flags = property.flags;
|
|
OBFUSCATED = ChannelFlags.OBFUSCATED;
|
|
hasFlag3 = Reflect.apply(hasFlag, moduleValue2, [flags, OBFUSCATED]);
|
|
if (hasFlag2 !== hasFlag3) {
|
|
binding = env2_16;
|
|
warn = binding.warn;
|
|
id = a0.id;
|
|
Reflect.apply(warn, binding,
|
|
['Integrity check failure: ' + id + ' serverObfuscated: ' + hasFlag2 + ' != clientObfuscated: ' + hasFlag3]);
|
|
binding = env0_1;
|
|
add = binding.add;
|
|
id = a0.id;
|
|
Reflect.apply(add, binding, [id]);
|
|
binding = env0_2;
|
|
push = binding.push;
|
|
object = {};
|
|
id = a0.id;
|
|
object.channel_id = id;
|
|
object.server_obfuscated = hasFlag2;
|
|
object.client_obfuscated = hasFlag3;
|
|
flags = a0.flags;
|
|
object.server_flags = value2 != flags ? flags : value4;
|
|
flags = property.flags;
|
|
object.client_flags = value2 != flags ? flags : value4;
|
|
object.channel_type = a0.type;
|
|
parent_id = a0.parent_id;
|
|
object.parent_id = value2 != parent_id ? parent_id : value2;
|
|
Reflect.apply(push, binding, [object]);
|
|
}
|
|
} else {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_16;
|
|
binding.warn('Integrity check failure: ' + a0.id + ' was missing.');
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function handleLogout_120283({isSwitchingAccount}) { // fn#120283, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:3697, offset: 0x02526bc2, size: 329 bytes, params: 2, frame: 21
|
|
var propertyName;
|
|
var clearTimeout;
|
|
const binding = env0_29;
|
|
env0_29 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
|
|
const env0_0 = isSwitchingAccount !== true ? 'logout' : 'account_switch';
|
|
const Set = global.Set;
|
|
let Object = global.Object;
|
|
const value4 = Object.keys(env0_24);
|
|
const items2 = [];
|
|
const value5 = arraySpread(items2, value4, 0, undefined);
|
|
Object = global.Object;
|
|
const value6 = arraySpread(items2, Object.keys(env0_25), value5, undefined);
|
|
Object = global.Object;
|
|
const value7 = arraySpread(items2, Object.keys(env0_26), value6, undefined);
|
|
Object = global.Object;
|
|
arraySpread(items2, Object.keys(env0_27), value7, undefined);
|
|
const set = new Set(items2);
|
|
set.forEach(_fun120284);
|
|
set.forEach(function(a0) {
|
|
cleanupResyncState(a0);
|
|
cleanupIntegrityCheckState(a0);
|
|
});
|
|
for (propertyName in env0_28) {
|
|
clearTimeout = global.clearTimeout;
|
|
clearTimeout(env0_28[propertyName]);
|
|
delete env0_28[propertyName];
|
|
}
|
|
for (propertyName in env0_22) {
|
|
delete env0_22[propertyName];
|
|
}
|
|
env0_23.clear();
|
|
function _fun120284(a0) { // fn#120284, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:3893, offset: 0x02526d0b, size: 297 bytes, params: 2, frame: 22
|
|
var value3;
|
|
var value4;
|
|
var defaultImport;
|
|
var track;
|
|
var GUILD_CHANNEL_RESYNC_CANCELED;
|
|
var requestedUserId;
|
|
var value6;
|
|
var value7;
|
|
var defaultImport2;
|
|
var GUILD_CHANNEL_INTEGRITY_CHECK_CANCELED;
|
|
const property = env1_22[a0];
|
|
const value2 = null;
|
|
if (value2 != property) {
|
|
value3 = value2 != env1_24[a0];
|
|
value4 = value2 != env1_25[a0];
|
|
if (value3) {
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport.track;
|
|
GUILD_CHANNEL_RESYNC_CANCELED = AnalyticEvents.GUILD_CHANNEL_RESYNC_CANCELED;
|
|
requestedUserId = property.requestedUserId;
|
|
Reflect.apply(track, defaultImport, [GUILD_CHANNEL_RESYNC_CANCELED, {guild_id: a0,
|
|
request_id: property.requestId,
|
|
requested_user_id: value2 != requestedUserId ? requestedUserId : value2, cancellation_reason: env0_0,
|
|
had_scheduled_timer: value3, had_pending_timeout: value4}]);
|
|
} else if (value4) {
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport.track;
|
|
GUILD_CHANNEL_RESYNC_CANCELED = AnalyticEvents.GUILD_CHANNEL_RESYNC_CANCELED;
|
|
requestedUserId = property.requestedUserId;
|
|
Reflect.apply(track, defaultImport, [GUILD_CHANNEL_RESYNC_CANCELED, {guild_id: a0,
|
|
request_id: property.requestId,
|
|
requested_user_id: value2 != requestedUserId ? requestedUserId : value2, cancellation_reason: env0_0,
|
|
had_scheduled_timer: value3, had_pending_timeout: value4}]);
|
|
}
|
|
value6 = value2 != env1_26[a0];
|
|
value7 = value2 != env1_27[a0];
|
|
if (value6) {
|
|
defaultImport2 = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport2.track;
|
|
GUILD_CHANNEL_INTEGRITY_CHECK_CANCELED = AnalyticEvents.GUILD_CHANNEL_INTEGRITY_CHECK_CANCELED;
|
|
requestedUserId = property.requestedUserId;
|
|
Reflect.apply(track, defaultImport2, [GUILD_CHANNEL_INTEGRITY_CHECK_CANCELED, {guild_id: a0,
|
|
request_id: property.requestId, requested_user_id: value2 != requestedUserId ? requestedUserId : value2,
|
|
cancellation_reason: env0_0, had_scheduled_timer: value6, had_pending_timeout: value7}]);
|
|
} else if (value7) {
|
|
defaultImport2 = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport2.track;
|
|
GUILD_CHANNEL_INTEGRITY_CHECK_CANCELED = AnalyticEvents.GUILD_CHANNEL_INTEGRITY_CHECK_CANCELED;
|
|
requestedUserId = property.requestedUserId;
|
|
Reflect.apply(track, defaultImport2, [GUILD_CHANNEL_INTEGRITY_CHECK_CANCELED, {guild_id: a0,
|
|
request_id: property.requestId, requested_user_id: value2 != requestedUserId ? requestedUserId : value2,
|
|
cancellation_reason: env0_0, had_scheduled_timer: value6, had_pending_timeout: value7}]);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function _scheduleGuildResyncs() { // fn#120287, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:4642, offset: 0x02526e50, size: 50 bytes, params: 1, frame: 14
|
|
return Module00005(_fun120289).apply(this, arguments);
|
|
function* _fun120289(a0) { // fn#120289, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:4707, offset: 0x02526e8d, size: 295 bytes, params: 2, frame: 19
|
|
var environment;
|
|
var value6;
|
|
if (true) {
|
|
var env0_0 = a0;
|
|
value = environment.__proto__.__proto__;
|
|
var binding = env2_29;
|
|
yield getResyncGuilds();
|
|
var value3 = undefined;
|
|
if (false) {
|
|
return value3;
|
|
}
|
|
if (binding === env2_29) {
|
|
binding = env2_16;
|
|
binding.verbose('Resync guilds: ' + global.JSON.stringify(value3));
|
|
value3.eligible.forEach(_fun120291);
|
|
if (value3.ineligible.length > 0) {
|
|
value6 = value3.ineligible.map(function(a0) {
|
|
return a0.id;
|
|
});
|
|
binding = env2_16;
|
|
binding.verbose('Guilds we are no longer part of are marked for resync. Unmarking them. Guilds: ' + global.JSON.stringify(value6));
|
|
binding = env2_1;
|
|
value = binding(env2_2[17]);
|
|
value.dispatch({type: 'UNMARK_RESYNC_GUILDS', guildIds: value6});
|
|
}
|
|
}
|
|
}
|
|
function getResyncGuilds() { // fn#120290, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:4736, offset: 0x02526fb4, size: 30 bytes, params: 1, frame: 13
|
|
return env3_41.apply(this, arguments);
|
|
}
|
|
|
|
function _fun120291(a0) { // fn#120291, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:4892, offset: 0x02526fd2, size: 67 bytes, params: 2, frame: 13
|
|
if (!(env0_0 != null && a0.id !== env0_0)) {
|
|
scheduleGuildResync(a0.id, a0.requestId);
|
|
}
|
|
function scheduleGuildResync(a0, a1) { // fn#120292, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:4915, offset: 0x02527015, size: 141 bytes, params: 3, frame: 19
|
|
const env0_0 = a0;
|
|
env4_31(a0, a1, 'resync');
|
|
if (env4_24[a0] != null) {
|
|
global.clearTimeout(env4_24[a0]);
|
|
}
|
|
const Math = global.Math;
|
|
const ceil = Math.ceil;
|
|
const Math2 = global.Math;
|
|
env4_24[a0] = global.setTimeout(_fun120293, Reflect.apply(ceil, Math, [Math2.random() * env4_17]));
|
|
function _fun120293() { // fn#120293, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:5061, offset: 0x025270a2, size: 36 bytes, params: 1, frame: 11
|
|
const binding = env5_24;
|
|
const binding2 = env0_0;
|
|
delete binding[binding2];
|
|
triggerGuildChannelResync(binding2);
|
|
function triggerGuildChannelResync(a0) { // fn#120294, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:5078, offset: 0x025270c6, size: 396 bytes, params: 2, frame: 28
|
|
var r3;
|
|
var r10;
|
|
var r9;
|
|
var value3;
|
|
var items2;
|
|
var mutableGuildChannelsForGuild;
|
|
var value6;
|
|
var properties;
|
|
var properties2;
|
|
var properties3;
|
|
var propertyName;
|
|
var propertyName2;
|
|
var property;
|
|
var value7;
|
|
var hasFlag;
|
|
var flags;
|
|
var OBFUSCATED;
|
|
var value8;
|
|
var value9;
|
|
var value11;
|
|
let binding = env6_0;
|
|
const value2 = binding(env6_2[19]);
|
|
if (value2.isChannelMetadataObfuscationEnabled('triggerGuildChannelResync')) {
|
|
value3 = env6_32(a0);
|
|
binding = env6_12;
|
|
if (binding.getGuild(a0) == null) {
|
|
value11 = env6_1(env6_2[16]);
|
|
value11.track(env6_14.GUILD_CHANNEL_RESYNC_FAILED, {guild_id: a0, request_id: value3,
|
|
failure_reason: 'guild_not_found'});
|
|
env6_33(a0);
|
|
return undefined;
|
|
}
|
|
items2 = [];
|
|
binding = env6_10;
|
|
mutableGuildChannelsForGuild = binding.getMutableGuildChannelsForGuild(a0);
|
|
value6 = 0;
|
|
properties = Object.keys(mutableGuildChannelsForGuild);
|
|
properties2 = 0;
|
|
properties3 = properties.length;
|
|
if (properties === undefined) {
|
|
r9 = value6;
|
|
} else {
|
|
r3 = value6;
|
|
r10 = properties2;
|
|
while (true) {
|
|
propertyName = properties[r10];
|
|
propertyName2 = r10 + 1;
|
|
if (propertyName === undefined) {
|
|
r9 = r3;
|
|
break;
|
|
}
|
|
property = mutableGuildChannelsForGuild[propertyName];
|
|
binding = env6_0;
|
|
value7 = binding(env6_2[20]);
|
|
hasFlag = value7.hasFlag;
|
|
flags = property.flags;
|
|
OBFUSCATED = env6_15.OBFUSCATED;
|
|
if (!Reflect.apply(hasFlag, value7, [flags, OBFUSCATED])) {
|
|
continue;
|
|
}
|
|
items2.push(propertyName);
|
|
value8 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
|
|
r3 = value8;
|
|
r10 = propertyName2;
|
|
}
|
|
}
|
|
binding = env6_1;
|
|
value9 = binding(env6_2[16]);
|
|
value9.track(env6_14.GUILD_CHANNEL_RESYNC_EXECUTED, {guild_id: a0, request_id: value3,
|
|
num_obfuscated_channels: items2.length, num_total_channels: r9});
|
|
binding = env6_13;
|
|
binding.getSocket().triggerGuildChannelResync(a0, items2);
|
|
scheduleResyncTimeout(a0, value3);
|
|
env6_42(a0);
|
|
}
|
|
function scheduleResyncTimeout(a0, a1) { // fn#120295, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:5701, owner: triggerGuildChannelResync.scheduleResyncTimeout, offset: 0x02527252, size: 93 bytes, params: 3, frame: 15
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
if (env7_25[a0] != null) {
|
|
global.clearTimeout(env7_25[a0]);
|
|
}
|
|
env7_25[a0] = global.setTimeout(_fun120296, env7_20);
|
|
function _fun120296() { // fn#120296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:5785, offset: 0x025272af, size: 134 bytes, params: 1, frame: 19
|
|
const binding = env0_0;
|
|
env8_16.warn('Resync timeout for guild ' + binding + ' with request ' + require);
|
|
const value2 = env8_1(env8_2[16]);
|
|
const track = value2.track;
|
|
const GUILD_CHANNEL_RESYNC_FAILED = env8_14.GUILD_CHANNEL_RESYNC_FAILED;
|
|
Reflect.apply(track, value2, [GUILD_CHANNEL_RESYNC_FAILED, {guild_id: binding, request_id: require,
|
|
failure_reason: 'timeout'}]);
|
|
env8_33(binding);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function _getResyncGuilds() { // fn#120298, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:6355, offset: 0x02527335, size: 50 bytes, params: 1, frame: 14
|
|
return Module00005(_fun120300).apply(this, arguments);
|
|
function* _fun120300() { // fn#120300, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:6410, offset: 0x02527372, size: 102 bytes, params: 1, frame: 14
|
|
var environment;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
value = env2_1(env2_2[18]);
|
|
const getAll = value.getAll;
|
|
yield Reflect.apply(getAll, value, []);
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
return value.reduce(_fun120301, {eligible: [], ineligible: []});
|
|
function _fun120301(a0, a1) { // fn#120301, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:6462, offset: 0x025273d8, size: 94 bytes, params: 3, frame: 14
|
|
let binding = env3_12;
|
|
const getGuild = binding.getGuild;
|
|
if (Reflect.apply(getGuild, binding, [a1.id]) != null) {
|
|
a0.eligible.push(a1);
|
|
} else {
|
|
binding = env3_11;
|
|
if (binding.isUnavailable(a1.id)) {
|
|
a0.eligible.push(a1);
|
|
} else {
|
|
a0.ineligible.push(a1);
|
|
}
|
|
}
|
|
return a0;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function scheduleIntegrityCheck(a0) { // fn#120302, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:6615, offset: 0x02527436, size: 283 bytes, params: 2, frame: 20
|
|
var r8;
|
|
var value2;
|
|
var property;
|
|
var value3;
|
|
var defaultImport;
|
|
var Math;
|
|
const env0_0 = a0;
|
|
if (PrivateChannelHidingExperimentModule.isChannelMetadataIntegrityCheckEnabled('scheduleIntegrityCheck')) {
|
|
value2 = env0_26[a0] != null;
|
|
cleanupIntegrityCheckState(a0);
|
|
property = env0_22[a0];
|
|
if (property != null) {
|
|
r8 = property.requestId;
|
|
} else {
|
|
value3 = (require(491) /* metro dependency 491 */).v4();
|
|
setLatestRequest(a0, value3, 'integrity_check');
|
|
r8 = value3;
|
|
}
|
|
if (!value2) {
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.GUILD_CHANNEL_INTEGRITY_CHECK_REQUESTED, {guild_id: a0, request_id: r8});
|
|
}
|
|
Math = global.Math;
|
|
env0_26[a0] = global.setTimeout(_fun120303, env0_18 + Math.ceil(global.Math.random() * env0_19));
|
|
}
|
|
function _fun120303() { // fn#120303, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:7005, offset: 0x02527551, size: 36 bytes, params: 1, frame: 11
|
|
const binding = env1_26;
|
|
const binding2 = env0_0;
|
|
delete binding[binding2];
|
|
triggerIntegrityCheck(binding2);
|
|
function triggerIntegrityCheck(a0) { // fn#120304, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:7022, offset: 0x02527575, size: 271 bytes, params: 2, frame: 19
|
|
var environment;
|
|
var binding;
|
|
var latestRequestId;
|
|
var defaultImport;
|
|
var defaultImport2;
|
|
const value = environment.__proto__.__proto__;
|
|
if (PrivateChannelHidingExperimentModule.isChannelMetadataIntegrityCheckEnabled('triggerIntegrityCheck')) {
|
|
binding = env2_23;
|
|
if (binding.has(a0)) {
|
|
return undefined;
|
|
}
|
|
latestRequestId = getLatestRequestId(a0);
|
|
if (GuildStore.getGuild(a0) == null) {
|
|
defaultImport2 = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport2.track(AnalyticEvents.GUILD_CHANNEL_INTEGRITY_CHECK_FAILED, {guild_id: a0,
|
|
request_id: latestRequestId, failure_reason: 'guild_not_found'});
|
|
cleanupIntegrityCheckState(a0);
|
|
return undefined;
|
|
}
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.GUILD_CHANNEL_INTEGRITY_CHECK_EXECUTED, {guild_id: a0,
|
|
request_id: latestRequestId});
|
|
GatewayConnectionStore.getSocket().triggerGuildChannelResync(a0, null);
|
|
scheduleIntegrityCheckTimeout(a0, latestRequestId);
|
|
}
|
|
function scheduleIntegrityCheckTimeout(a0, a1) { // fn#120305, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:7497, owner: triggerIntegrityCheck.scheduleIntegrityCheckTimeout, offset: 0x02527684, size: 93 bytes, params: 3, frame: 15
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
if (env3_27[a0] != null) {
|
|
global.clearTimeout(env3_27[a0]);
|
|
}
|
|
env3_27[a0] = global.setTimeout(_fun120306, env3_21);
|
|
function _fun120306() { // fn#120306, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:7589, offset: 0x025276e1, size: 134 bytes, params: 1, frame: 19
|
|
const binding = env0_0;
|
|
env4_16.warn('Integrity check timeout for guild ' + binding + ' with request ' + require);
|
|
const defaultImport = AnalyticsUtils;
|
|
const track = defaultImport.track;
|
|
const GUILD_CHANNEL_INTEGRITY_CHECK_FAILED = AnalyticEvents.GUILD_CHANNEL_INTEGRITY_CHECK_FAILED;
|
|
Reflect.apply(track, defaultImport, [GUILD_CHANNEL_INTEGRITY_CHECK_FAILED, {guild_id: binding, request_id: require,
|
|
failure_reason: 'timeout'}]);
|
|
cleanupIntegrityCheckState(binding);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function _fun120307(a0) { // fn#120307, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:638, offset: 0x02527767, size: 74 bytes, params: 2, frame: 15
|
|
const ChannelResyncManager2 = ChannelResyncManager;
|
|
Inherits(ChannelResyncManager2, a0);
|
|
return CreateClass(ChannelResyncManager2, [{key: '__unsafeGetTestState', value: value_120309}]);
|
|
function ChannelResyncManager(a0) { // fn#120308, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:650, offset: 0x025277b1, size: 170 bytes, params: 2, frame: 20
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_4;
|
|
binding(this, ChannelResyncManager);
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_7(ChannelResyncManager);
|
|
binding = env1_6;
|
|
if (_isNativeReflectConstruct_120269()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items2, env1_7(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items2);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.actions = {GUILD_CREATE: handleGuildCreate_120276, POST_CONNECTION_OPEN: handlePostConnectionOpen_120278,
|
|
CHANNEL_SYNC: handleChannelSync, LOGOUT: handleLogout_120283};
|
|
return value;
|
|
}
|
|
|
|
function value_120309() { // fn#120309, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15887:1129, offset: 0x0252785b, size: 209 bytes, params: 1, frame: 14
|
|
const object = {};
|
|
let Object = global.Object;
|
|
object.scheduledResyncTimerGuildIds = Object.keys(env1_24);
|
|
Object = global.Object;
|
|
object.pendingResyncTimeoutGuildIds = Object.keys(env1_25);
|
|
Object = global.Object;
|
|
object.scheduledIntegrityCheckTimerGuildIds = Object.keys(env1_26);
|
|
Object = global.Object;
|
|
object.pendingIntegrityCheckTimeoutGuildIds = Object.keys(env1_27);
|
|
Object = global.Object;
|
|
object.pendingGuildCreateDeferredGuildIds = Object.keys(env1_28);
|
|
Object = global.Object;
|
|
object.guildIdsWithLatestRequest = Object.keys(env1_22);
|
|
const Array = global.Array;
|
|
object.guildsCompletedIntegrityCheck = Array.from(env1_23);
|
|
object.sessionEpoch = env1_29;
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun120268, 15679, [5, 6, 7, 15, 17, 18, 1226, 1379, 4646, 1867, 4257, 661, 1386, 3, 672, 4860, 683, 694,
|
|
5235, 12526, 1391, 491,
|
|
2]) /* metro module 15679, dependencies: [5, 6, 7, 15, 17, 18, 1226, 1379, 4646, 1867, 4257, 661, 1386, 3, 672, 4860, 683, 694, 5235, 12526, 1391, 491, 2] */;
|