218 lines
12 KiB
TypeScript
218 lines
12 KiB
TypeScript
/* Metro module 7070; source: modules/messages/MessageRoundtripTrackerStore.tsx; dependencies: [6, 7, 15, 17, 18, 1379, 4111, 4401, 661, 3, 4873, 683, 7071, 566, 694, 2] */
|
|
import Logger from '../debug/Logger.tsx'; /* Metro dependency 3 */
|
|
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 Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import GuildMemberCountStore from '../../stores/GuildMemberCountStore.tsx'; /* Metro dependency 4111 */
|
|
import NetworkStore from '../../stores/NetworkStore.tsx'; /* Metro dependency 4401 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
|
|
function _fun56334(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#56334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7248:6, offset: 0x013c52ba, size: 393 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const isCompleted = function(a0) {
|
|
return a0.apiResponseTimestamp != null && a0.gatewaySeenTimestamp != null;
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = Logger;
|
|
value = new value('MessageRoundtripTrackerStore');
|
|
const Store = (Flux).Store;
|
|
value = _fun56340(Store);
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {MESSAGE_CREATE: MESSAGE_CREATE_56347});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/messages/MessageRoundtripTrackerStore.tsx');
|
|
exports.default = value;
|
|
function _isNativeReflectConstruct_56335() { // fn#56335, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7248:203, offset: 0x013c5443, 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_56335_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function trackRoundtrip(a0) { // fn#56339, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7248:537, offset: 0x013c54bf, size: 440 bytes, params: 2, frame: 24
|
|
var r11;
|
|
var r10;
|
|
var binding;
|
|
var signalStrength;
|
|
var defaultImport;
|
|
var track;
|
|
var SEND_MESSAGE_ROUNDTRIP;
|
|
var object;
|
|
var guild_id;
|
|
var guildMemberCountStoreBinding;
|
|
var getMemberCount;
|
|
var value;
|
|
const basicChannel = ChannelStore.getBasicChannel(a0.channelId);
|
|
const value3 = null;
|
|
if (value3 != basicChannel) {
|
|
if (!(global.Math.random() > 0.1)) {
|
|
r11 = value3 == a0.apiResponseTimestamp ? value3 : a0.apiResponseTimestamp - a0.initialSendTimestamp;
|
|
r10 = value3 == a0.gatewaySeenTimestamp ? value3 : a0.gatewaySeenTimestamp - a0.initialSendTimestamp;
|
|
signalStrength = require(dependencyMap[10]).getSignalStrength();
|
|
defaultImport = importDefault(dependencyMap[11]);
|
|
track = defaultImport.track;
|
|
SEND_MESSAGE_ROUNDTRIP = AnalyticEvents.SEND_MESSAGE_ROUNDTRIP;
|
|
object = {};
|
|
copyDataProperties(object, importDefault(dependencyMap[12])(), dependencyMap);
|
|
object['api_latency_ms'] = r11;
|
|
object['gateway_latency_ms'] = r10;
|
|
object['channel_id'] = basicChannel.id;
|
|
object['channel_type'] = basicChannel.type;
|
|
guild_id = basicChannel.guild_id;
|
|
object['guild_id'] = guild_id;
|
|
guildMemberCountStoreBinding = GuildMemberCountStore;
|
|
getMemberCount = guildMemberCountStoreBinding.getMemberCount;
|
|
guild_id = basicChannel.guild_id;
|
|
object['guild_size'] = Reflect.apply(getMemberCount, guildMemberCountStoreBinding, [guild_id]);
|
|
value = NetworkStore.getType();
|
|
object['mobile_network_type'] = value;
|
|
object['num_attachments'] = a0.attachmentCount;
|
|
value = value3 != signalStrength;
|
|
copyDataProperties(object, value && ({mobile_signal_strength_level: signalStrength}), dependencyMap);
|
|
Reflect.apply(track, defaultImport, [SEND_MESSAGE_ROUNDTRIP, object]);
|
|
}
|
|
} else {
|
|
binding = env0_12;
|
|
binding.warn('Ignoring a messageData for channel ' + a0.channelId + " because we can't find that channel.");
|
|
}
|
|
}
|
|
|
|
function _fun56340(a0) { // fn#56340, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7248:1250, offset: 0x013c5677, size: 143 bytes, params: 2, frame: 16
|
|
const MessageRoundtripTrackerStoreClass2 = MessageRoundtripTrackerStoreClass;
|
|
Inherits(MessageRoundtripTrackerStoreClass2, a0);
|
|
return CreateClass(MessageRoundtripTrackerStoreClass2, [{key: 'initialize', value: function() {
|
|
this.waitFor(ChannelStore, GuildMemberCountStore, NetworkStore);
|
|
}}, {key: 'recordMessageSendAttempt', value: value_56343}, {key: 'recordMessageSendApiResponse',
|
|
value: value_56345}, {key: 'recordGatewayResponse', value: value_56346}]);
|
|
function MessageRoundtripTrackerStoreClass(a0) { // fn#56341, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7248:1262, offset: 0x013c5706, size: 160 bytes, params: 2, frame: 19
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_3;
|
|
binding(this, MessageRoundtripTrackerStoreClass);
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_6(MessageRoundtripTrackerStoreClass);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_56335()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items2, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items2);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
const Map = global.Map;
|
|
const value4 = Object.create(Map.prototype, {constructor: {value: Map}});
|
|
const map = new Map();
|
|
value.pendingMessages = map instanceof Object ? map : value4;
|
|
return value;
|
|
}
|
|
|
|
function value_56343(a0, a1) { // fn#56343, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7248:1753, offset: 0x013c57a6, size: 188 bytes, params: 3, frame: 19
|
|
let value = a2;
|
|
const env0_1 = a1;
|
|
const value2 = undefined;
|
|
const r5 = value !== value2 ? value : {};
|
|
const attachments = r5.attachments;
|
|
const r2 = (attachments == null ? value2 : attachments.length) ?? 0;
|
|
const attachmentsToUpload = r5.attachmentsToUpload;
|
|
value = r2 + ((attachmentsToUpload == null ? value2 : attachmentsToUpload.length) ?? value);
|
|
const object = {'initialSendTimestamp': null, 'apiResponseTimestamp': null, 'gatewaySeenTimestamp': null};
|
|
const Date = global.Date;
|
|
object.initialSendTimestamp = Date.now();
|
|
object.channelId = a0;
|
|
object.attachmentCount = value;
|
|
this.pendingMessages.set(a1, object);
|
|
global.setTimeout(_fun56344, 30000);
|
|
return value2;
|
|
function _fun56344() { // fn#56344, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7248:2066, offset: 0x013c5862, size: 75 bytes, params: 1, frame: 12
|
|
var value3;
|
|
const value2 = env0_0.pendingMessages.get(require);
|
|
if (value2 != null) {
|
|
value3 = environment.__proto__.__proto__;
|
|
trackRoundtrip(value2);
|
|
env0_0.pendingMessages.delete(require);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function value_56345(a0) { // fn#56345, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7248:2216, offset: 0x013c58ad, size: 131 bytes, params: 2, frame: 16
|
|
var object;
|
|
let value = this.pendingMessages.get(a0);
|
|
if (value != null) {
|
|
object = {};
|
|
copyDataProperties(object, value, undefined);
|
|
value = global.Date.now();
|
|
object['apiResponseTimestamp'] = value;
|
|
value = environment.__proto__;
|
|
if (isCompleted(object)) {
|
|
trackRoundtrip(object);
|
|
this.pendingMessages.delete(a0);
|
|
} else {
|
|
this.pendingMessages.set(a0, object);
|
|
}
|
|
}
|
|
}
|
|
|
|
function value_56346(a0) { // fn#56346, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7248:2453, offset: 0x013c5930, size: 131 bytes, params: 2, frame: 16
|
|
var object;
|
|
let value = this.pendingMessages.get(a0);
|
|
if (value != null) {
|
|
object = {};
|
|
copyDataProperties(object, value, undefined);
|
|
value = global.Date.now();
|
|
object['gatewaySeenTimestamp'] = value;
|
|
value = environment.__proto__;
|
|
if (isCompleted(object)) {
|
|
trackRoundtrip(object);
|
|
this.pendingMessages.delete(a0);
|
|
} else {
|
|
this.pendingMessages.set(a0, object);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function MESSAGE_CREATE_56347({optimistic, message}) { // fn#56347, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7248:2700, offset: 0x013c59b3, size: 56 bytes, params: 2, frame: 11
|
|
const nonce = message.nonce;
|
|
if (!(optimistic || nonce == null)) {
|
|
env0_13.recordGatewayResponse(nonce);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun56334, 7070, [6, 7, 15, 17, 18, 1379, 4111, 4401, 661, 3, 4873, 683, 7071, 566, 694,
|
|
2]) /* metro module 7070, dependencies: [6, 7, 15, 17, 18, 1379, 4111, 4401, 661, 3, 4873, 683, 7071, 566, 694, 2] */;
|