Files
discord-decomp/sources/modules/devtools/AnalyticsLogStore.tsx
T
2026-07-27 16:20:00 +03:00

158 lines
6.7 KiB
TypeScript

/* Metro module 12953; source: modules/devtools/AnalyticsLogStore.tsx; dependencies: [6, 7, 15, 17, 18, 1226, 7112, 490, 491, 566, 694, 2] */
function _fun98689(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#98689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:6, offset: 0x021b2524, size: 388 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(15) /* metro dependency 15 */;
const env0_5 = importDefault(17) /* metro dependency 17 */;
const env0_6 = importDefault(18) /* metro dependency 18 */;
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const developerExperimentStore = importDefault(7112) /* metro dependency 7112: DeveloperExperimentStore */;
const env0_10 = [];
const env0_12 = [];
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
let value = _fun98694(Store);
value.displayName = 'AnalyticsLogStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {TRACK: TRACK_98701,
TRACK_TRIGGER: TRACK_TRIGGER, SET_TRACK_TRIGGERS: function(a0) {
env0_13 = a0.enabled;
}, ANALYTICS_LOG_CLEAR: ANALYTICS_LOG_CLEAR});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/devtools/AnalyticsLogStore.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_98690() { // fn#98690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:168, offset: 0x021b26a8, 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_98690_isNativeReflectConstruct = function() {
return !!result;
})();
}
function resolveFingerprint(a0) { // fn#98693, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:388, offset: 0x021b270a, size: 66 bytes, params: 2, frame: 13
var r0;
var value;
if (a0 != null) {
value = require(490) /* metro dependency 490: FingerprintUtils */;
value = value.extractId(a0);
r0 = value;
} else {
r0 = AuthenticationStore.getId();
}
return r0;
}
function _fun98694(a0) { // fn#98694, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:471, offset: 0x021b274c, size: 180 bytes, params: 2, frame: 16
const closure = AnalyticsLogStore;
env0_6(closure, a0);
return env0_3(closure, [{key: 'initialize', value: function() {
this.waitFor(AuthenticationStore, DeveloperExperimentStore);
}}, {key: 'loggedEvents', get: get_98697}, {key: 'loggedEventsVersion', get: get_98698}, {key: 'loggedTriggers',
get: get_98699}, {key: 'trackTriggers', get: get_98700}]);
}
function TRACK_98701({event, properties, fingerprint}) { // fn#98701, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:1091, offset: 0x021b2800, size: 217 bytes, params: 2, frame: 17
var binding;
var push;
var object2;
var binding2;
var value2;
var Date;
var value3;
var date;
var slice;
var Math;
if (DeveloperExperimentStore.isDeveloper) {
binding = env0_10;
push = binding.push;
object2 = {};
binding2 = env0_9;
value2 = typeof binding2 === 'bigint' ? binding2 : +binding2;
env0_9 = typeof value2 === 'bigint' ? value2 + 1n : +value2 + 1;
object2.key = value2.toString();
object2.event = event;
object2.properties = properties;
object2.fingerprint = resolveFingerprint(fingerprint);
Date = global.Date;
value3 = Object.create(Date.prototype, {constructor: {value: Date}});
date = new Date();
object2.timestamp = date instanceof Object ? date : value3;
Reflect.apply(push, binding, [object2]);
binding = env0_11;
env0_11 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
if (env0_10.length > 500) {
binding = env0_10;
slice = binding.slice;
Math = global.Math;
env0_10 = Reflect.apply(slice, binding, [-Math.floor(250)]);
}
}
}
function TRACK_TRIGGER({experimentId, descriptor, exposureType, excluded, location, previouslyTracked}) { // fn#98702, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:1335, offset: 0x021b28d9, size: 233 bytes, params: 2, frame: 24
var binding;
var items2;
var value2;
var object2;
var Date;
var value3;
var date;
let r1 = DeveloperExperimentStore.isDeveloper && env0_13;
if (r1) {
binding = env0_12;
items2 = [];
value2 = arraySpread(items2, binding, 0, undefined);
object2 = {};
object2.key = (require(491) /* metro dependency 491 */).v4();
object2.experimentId = experimentId;
object2.descriptor = descriptor;
object2.exposureType = exposureType;
object2.excluded = excluded;
object2.location = location;
object2.previouslyTracked = previouslyTracked;
Date = global.Date;
value3 = Object.create(Date.prototype, {constructor: {value: Date}});
date = new Date();
object2.timestamp = date instanceof Object ? date : value3;
items2[value2] = object2;
value2 + 1;
env0_12 = items2;
r1 = items2.length > 500;
}
if (r1) {
env0_12.shift();
}
}
function ANALYTICS_LOG_CLEAR() { // fn#98704, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:1715, offset: 0x021b29d5, size: 34 bytes, params: 1, frame: 2
env0_10 = [];
const binding = env0_11;
env0_11 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
env0_12 = [];
}