497 lines
19 KiB
TypeScript
497 lines
19 KiB
TypeScript
/* Metro module 9855; source: modules/messages/MessageViewTrackingManager.tsx; dependencies: [6, 7, 15, 17, 18, 661, 480, 6789, 1360, 1393, 683, 4860, 2] */
|
|
function _fun77250(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#77250, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:6, offset: 0x01df6cb7, size: 354 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_77253 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
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 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
|
|
let value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
|
|
value = _fun77259(value);
|
|
value = new value();
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/messages/MessageViewTrackingManager.tsx');
|
|
exports.default = value;
|
|
exports.MessageViewTrackingType = {ANNOUNCEMENT: 'announcement', APP_EMBED: 'app_embed',
|
|
OFFICIAL_MESSAGE: 'official_message', VOICE_INVITE_EMBED: 'voice_invite_embed'};
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_77251(a0, a1) { // fn#77251, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:176, offset: 0x01df6e19, size: 372 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun77252;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_77253(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_77253(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_77253(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun77252;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
}
|
|
|
|
function _isNativeReflectConstruct_77254() { // fn#77254, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:1086, offset: 0x01df6f8d, 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_77254_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function getAnalyticsConfig(a0) { // fn#77257, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:1445, offset: 0x01df6fef, size: 529 bytes, params: 2, frame: 19
|
|
var r4;
|
|
var object3;
|
|
var object4;
|
|
var treatmentRendered;
|
|
var INVITE_EMBED;
|
|
var items2;
|
|
const type = a0.type;
|
|
const ANNOUNCEMENT = env0_9.ANNOUNCEMENT;
|
|
if (ANNOUNCEMENT === type) {
|
|
return {event: AnalyticEvents.ANNOUNCEMENT_MESSAGE_VIEWED, properties: {message_id: a0.messageId,
|
|
channel_id: a0.channelId, guild_id: a0.guildId, source_channel_id: a0.sourceChannelId,
|
|
source_guild_id: a0.sourceGuildId}};
|
|
}
|
|
const APP_EMBED = env0_9.APP_EMBED;
|
|
if (APP_EMBED === type) {
|
|
return {event: AnalyticEvents.APP_EMBED_VIEWED, properties: {application_id: a0.applicationId,
|
|
link_type: a0.linkType, message_id: a0.messageId, channel_id: a0.channelId, guild_id: a0.guildId}};
|
|
}
|
|
const OFFICIAL_MESSAGE = env0_9.OFFICIAL_MESSAGE;
|
|
if (OFFICIAL_MESSAGE === type) {
|
|
return {event: AnalyticEvents.OFFICIAL_MESSAGE_VIEWED, properties: {message_id: a0.messageId,
|
|
channel_id: a0.channelId, guild_id: a0.guildId}};
|
|
}
|
|
const VOICE_INVITE_EMBED = env0_9.VOICE_INVITE_EMBED;
|
|
if (VOICE_INVITE_EMBED === type) {
|
|
object3 = {};
|
|
object3.event = (require(480) /* metro dependency 480: AnalyticsUtils */).ImpressionNames.VOICE_INVITE_EMBED;
|
|
object4 = {};
|
|
object4.impression_type = (require(480) /* metro dependency 480: AnalyticsUtils */).ImpressionTypes.VIEW;
|
|
object4.invite_code = a0.inviteCode;
|
|
object4.invite_guild_id = a0.inviteGuildId;
|
|
object4.invite_channel_id = a0.inviteChannelId;
|
|
object4.invite_instance_id = a0.inviteInstanceId;
|
|
object4.has_active_stream = a0.hasActiveStream;
|
|
treatmentRendered = a0.treatmentRendered;
|
|
INVITE_EMBED = (importDefault(6789) /* metro dependency 6789: AnalyticsLocation */).INVITE_EMBED;
|
|
if (treatmentRendered) {
|
|
items2 = [INVITE_EMBED];
|
|
items2[1] = (importDefault(6789) /* metro dependency 6789: AnalyticsLocation */).VOICE_CHANNEL_LIST_INVITE_EMBED;
|
|
r4 = items2;
|
|
} else {
|
|
r4 = [INVITE_EMBED];
|
|
}
|
|
object4.location_stack = r4;
|
|
object3.properties = object4;
|
|
return object3;
|
|
}
|
|
return (require(1360) /* metro dependency 1360: GlobalUtils */).assertNever(a0);
|
|
}
|
|
|
|
function getMessageViewKey(a0) { // fn#77258, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:2494, offset: 0x01df7200, size: 114 bytes, params: 2, frame: 19
|
|
const type = a0.type;
|
|
const VOICE_INVITE_EMBED = env0_9.VOICE_INVITE_EMBED;
|
|
return type === VOICE_INVITE_EMBED ? '' + a0.messageId + '-' + a0.inviteCode + '-' + a0.type : '' + a0.messageId + '-' + a0.type;
|
|
}
|
|
|
|
function _fun77259(a0) { // fn#77259, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:2641, offset: 0x01df7272, size: 228 bytes, params: 2, frame: 16
|
|
const closure = MessageViewTrackingManager;
|
|
env0_7(closure, a0);
|
|
return env0_4(closure, [{key: 'handleMessageBecameVisible', value: value_77262},
|
|
{key: 'handleMessageLostVisibility', value: value_77264}, {key: 'handleMessageListVisibilityChange',
|
|
value: value_77265}, {key: 'clearTimer', value: function(a0) {
|
|
var property = this.currentlyVisibleMessageTimers[a0];
|
|
if (property != null) {
|
|
(0, global.clearTimeout)(property);
|
|
delete this.currentlyVisibleMessageTimers[a0];
|
|
}
|
|
}}, {key: 'handleChannelSelect', value: function() {
|
|
var r3;
|
|
var value3;
|
|
var property = global.Object;
|
|
var value = property.values(this.currentlyVisibleMessageTimers);
|
|
var value2 = 0;
|
|
if (value2 < value.length) {
|
|
for (r3 = value2; true; r3 = value3) {
|
|
property = value[r3];
|
|
(0, global.clearTimeout)(property);
|
|
value3 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
|
|
if (!(value3 < value.length)) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
this.currentlyVisibleMessageTimers = {};
|
|
this.viewsInCurrentChannel.clear();
|
|
this.drainBuffer();
|
|
}}, {key: 'drainBuffer', value: value_77268}, {key: 'bufferViewTrack', value: function(a0) {
|
|
var env0_0 = this;
|
|
if (this.batchBuffer.length >= 10) {
|
|
this.drainBuffer();
|
|
}
|
|
this.batchBuffer.push(a0);
|
|
if (this.batchTimerId == null) {
|
|
this.batchTimerId = global.setTimeout(_fun77270, 2000);
|
|
}
|
|
}}]);
|
|
}
|
|
|
|
function MessageViewTrackingManager(a0) { // fn#77260, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:2653, offset: 0x01df7356, size: 272 bytes, params: 2, frame: 21
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_3;
|
|
binding(this, MessageViewTrackingManager);
|
|
const items = [];
|
|
arraySpread(items, value, 0, items);
|
|
value = env1_6(MessageViewTrackingManager);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_77254()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.currentlyVisibleMessageTimers = {};
|
|
const Set = global.Set;
|
|
const value4 = Object.create(Set.prototype, {constructor: {value: Set}});
|
|
const set = new Set();
|
|
value.viewsInCurrentChannel = set instanceof Object ? set : value4;
|
|
const defaultImport = importDefault(1393) /* metro dependency 1393 */;
|
|
const value6 = Object.create(defaultImport.prototype, {constructor: {value: defaultImport}});
|
|
const defaultImport2 = new defaultImport({'max': 500, 'maxAge': 60000});
|
|
value.recentViewTimes = defaultImport2 instanceof Object ? defaultImport2 : value6;
|
|
value.batchBuffer = [];
|
|
value.batchTimerId = null;
|
|
value.actions = {CHANNEL_SELECT: CHANNEL_SELECT_77261};
|
|
return value;
|
|
}
|
|
|
|
function value_77262(a0) { // fn#77262, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:3240, offset: 0x01df7479, size: 159 bytes, params: 2, frame: 16
|
|
var environment;
|
|
var viewsInCurrentChannel;
|
|
var value2;
|
|
var Date;
|
|
const env0_1 = a0;
|
|
let value = environment.__proto__;
|
|
value = getMessageViewKey(a0);
|
|
if (this.currentlyVisibleMessageTimers[value] == null) {
|
|
viewsInCurrentChannel = this.viewsInCurrentChannel;
|
|
if (!viewsInCurrentChannel.has(value)) {
|
|
value2 = this.recentViewTimes.get(value);
|
|
if (value2 == null) {
|
|
this.currentlyVisibleMessageTimers[value] = global.setTimeout(_fun77263, 1000);
|
|
} else {
|
|
Date = global.Date;
|
|
if (!(Date.now() - value2 < 60000)) {
|
|
this.currentlyVisibleMessageTimers[value] = global.setTimeout(_fun77263, 1000);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function value_77264(a0, a1, a2) { // fn#77264, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:3687, offset: 0x01df7574, size: 131 bytes, params: 4, frame: 21
|
|
const r1 = a2 != null ? '' + a0 + '-' + a2 + '-' + a1 : '' + a0 + '-' + a1;
|
|
const property = this.currentlyVisibleMessageTimers[r1];
|
|
if (property != null) {
|
|
global.clearTimeout(property);
|
|
delete this.currentlyVisibleMessageTimers[r1];
|
|
}
|
|
}
|
|
|
|
function value_77265(a0, a1) { // fn#77265, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:3907, offset: 0x01df75f7, size: 250 bytes, params: 3, frame: 19
|
|
var r3;
|
|
var r2;
|
|
var r1;
|
|
var value4;
|
|
var handleMessageBecameVisible;
|
|
var value5;
|
|
var Set;
|
|
var map;
|
|
var value7;
|
|
var prototype;
|
|
var value8;
|
|
var set;
|
|
var value9;
|
|
var value10;
|
|
var value11;
|
|
var endsWith;
|
|
var HermesInternal;
|
|
var concat;
|
|
var value12;
|
|
var has;
|
|
var value13;
|
|
var clearTimer;
|
|
var value14;
|
|
let value = environment.__proto__;
|
|
const value2 = _createForOfIteratorHelperLoose_77251(a0);
|
|
const value3 = value2();
|
|
let done = value3.done;
|
|
if (!done) {
|
|
r3 = value3;
|
|
reducibleLoop1: while (true) {
|
|
value4 = r3.value;
|
|
handleMessageBecameVisible = this.handleMessageBecameVisible;
|
|
Reflect.apply(handleMessageBecameVisible, this, [value4]);
|
|
value5 = value2();
|
|
done = value5.done;
|
|
if (done) {
|
|
break reducibleLoop1;
|
|
}
|
|
r3 = value5;
|
|
continue reducibleLoop1;
|
|
}
|
|
}
|
|
const Object = global.Object;
|
|
const value6 = Object.keys(this.currentlyVisibleMessageTimers);
|
|
reducibleJoin9: while (true) {
|
|
if (!(value6.length > 0)) {
|
|
break reducibleJoin9;
|
|
}
|
|
Set = global.Set;
|
|
map = a0.map;
|
|
value7 = Reflect.apply(map, a0, [getMessageViewKey]);
|
|
prototype = Set.prototype;
|
|
value8 = Object.create(prototype, {constructor: {value: Set}});
|
|
set = new Set();
|
|
value9 = set instanceof Object ? set : value8;
|
|
value = _createForOfIteratorHelperLoose_77251(value6);
|
|
value10 = value();
|
|
done = value10.done;
|
|
if (done) {
|
|
break reducibleJoin9;
|
|
}
|
|
r2 = value10;
|
|
reducibleLoop4: while (true) {
|
|
value11 = r2.value;
|
|
endsWith = value11.endsWith;
|
|
HermesInternal = global.HermesInternal;
|
|
concat = HermesInternal.concat;
|
|
value12 = Reflect.apply(endsWith, value11, ['-' + a1]);
|
|
reducibleJoin6: while (true) {
|
|
if (value12) {
|
|
has = value9.has;
|
|
value13 = !Reflect.apply(has, value9, [value11]);
|
|
r1 = value13;
|
|
break reducibleJoin6;
|
|
}
|
|
r1 = value12;
|
|
break reducibleJoin6;
|
|
}
|
|
reducibleJoin8: while (true) {
|
|
if (r1) {
|
|
clearTimer = this.clearTimer;
|
|
Reflect.apply(clearTimer, this, [value11]);
|
|
break reducibleJoin8;
|
|
}
|
|
break reducibleJoin8;
|
|
}
|
|
value14 = value();
|
|
done = value14.done;
|
|
if (done) {
|
|
break reducibleJoin9;
|
|
}
|
|
r2 = value14;
|
|
continue reducibleLoop4;
|
|
}
|
|
}
|
|
}
|
|
|
|
function value_77268() { // fn#77268, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:4692, offset: 0x01df778e, size: 156 bytes, params: 1, frame: 19
|
|
var r3;
|
|
var getAnalyticsConfigBinding;
|
|
var value4;
|
|
var analyticsConfigBinding;
|
|
var defaultImport;
|
|
var track;
|
|
var event;
|
|
var properties;
|
|
var value6;
|
|
var clearTimeout;
|
|
const value2 = _createForOfIteratorHelperLoose_77251(this.batchBuffer);
|
|
const value3 = value2();
|
|
let done = value3.done;
|
|
if (!done) {
|
|
r3 = value3;
|
|
reducibleLoop1: while (true) {
|
|
getAnalyticsConfigBinding = getAnalyticsConfig;
|
|
value4 = r3.value;
|
|
analyticsConfigBinding = getAnalyticsConfigBinding(value4);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport.track;
|
|
event = analyticsConfigBinding.event;
|
|
properties = analyticsConfigBinding.properties;
|
|
Reflect.apply(track, defaultImport, [event, properties]);
|
|
value6 = value2();
|
|
done = value6.done;
|
|
if (done) {
|
|
break reducibleLoop1;
|
|
}
|
|
r3 = value6;
|
|
continue reducibleLoop1;
|
|
}
|
|
}
|
|
this.batchBuffer = [];
|
|
let batchTimerId = this.batchTimerId;
|
|
reducibleJoin4: while (true) {
|
|
if (batchTimerId == null) {
|
|
break reducibleJoin4;
|
|
}
|
|
clearTimeout = global.clearTimeout;
|
|
batchTimerId = this.batchTimerId;
|
|
clearTimeout(batchTimerId);
|
|
this.batchTimerId = null;
|
|
break reducibleJoin4;
|
|
}
|
|
}
|
|
|
|
function value_77269(a0) { // fn#77269, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:4985, offset: 0x01df782a, size: 107 bytes, params: 2, frame: 14
|
|
if (this.batchBuffer.length >= 10) {
|
|
this.drainBuffer();
|
|
}
|
|
this.batchBuffer.push(a0);
|
|
if (this.batchTimerId == null) {
|
|
this.batchTimerId = global.setTimeout(_fun77270, 2000);
|
|
}
|
|
}
|
|
|
|
function MessageViewTrackingManagerCHANNEL_SELECT() { // fn#77261, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:3100, owner: MessageViewTrackingManager.CHANNEL_SELECT, offset: 0x01df7466, size: 19 bytes, params: 1, frame: 9
|
|
return env0_0.handleChannelSelect();
|
|
}
|
|
|
|
function _fun77263() { // fn#77263, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:3448, offset: 0x01df7518, size: 92 bytes, params: 1, frame: 16
|
|
const binding = env0_0;
|
|
const currentlyVisibleMessageTimers = binding.currentlyVisibleMessageTimers;
|
|
const binding2 = env0_2;
|
|
delete currentlyVisibleMessageTimers[binding2];
|
|
binding.viewsInCurrentChannel.add(binding2);
|
|
const recentViewTimes = binding.recentViewTimes;
|
|
const set = recentViewTimes.set;
|
|
const Date = global.Date;
|
|
Reflect.apply(set, recentViewTimes, [binding2, Date.now()]);
|
|
binding.bufferViewTrack(env0_1);
|
|
}
|
|
|
|
function _fun77270() { // fn#77270, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10041:5126, offset: 0x01df7895, size: 19 bytes, params: 1, frame: 9
|
|
return env0_0.drainBuffer();
|
|
}
|
|
|