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

267 lines
13 KiB
TypeScript

/* Metro module 15662; source: modules/app_analytics/AppAnalyticsManager.tsx; dependencies: [6, 7, 15, 17, 18, 4266, 4259, 4294, 6876, 4607, 4300, 661, 672, 4041, 4863, 15128, 4483, 4860, 2] */
function _fun120065(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120065, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:6, offset: 0x0251fe22, size: 390 bytes, params: 8, frame: 19
const env0_0 = require;
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 runningGameStoreNative = importDefault(4266) /* metro dependency 4266: RunningGameStoreNative */;
const mediaEngineStore = importDefault(4259) /* metro dependency 4259: MediaEngineStore */;
const rtcConnectionStore = importDefault(4294) /* metro dependency 4294: RTCConnectionStore */;
const selfPresenceStore = importDefault(6876) /* metro dependency 6876: SelfPresenceStore */;
const speakingStore = importDefault(4607) /* metro dependency 4607: SpeakingStore */;
const sortedVoiceStateStore = importDefault(4300) /* metro dependency 4300: SortedVoiceStateStore */;
let value = require(661) /* metro dependency 661: Constants */;
const env0_14 = value.AnalyticEvents;
const env0_15 = value.ActivityTypes;
const Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
const MINUTE = Millis.MINUTE;
const env0_16 = 1 * MINUTE;
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
value = _fun120069(value);
value = new value();
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/app_analytics/AppAnalyticsManager.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_120066() { // fn#120066, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:257, offset: 0x0251ffa8, 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_120066_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun120069(a0) { // fn#120069, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:487, offset: 0x0252000a, size: 197 bytes, params: 2, frame: 16
const closure = AppAnalyticsManager;
env0_7(closure, a0);
return env0_4(closure, [{key: '_initialize', value: function() {
var env0_0 = this;
var Map = global.Map;
var value2 = new Map();
value2 = value2.set(SpeakingStore, _fun120075);
this.stores = value2.set(RTCConnectionStore, _fun120076);
this._reset();
}}, {key: '_reset', value: function() {
this._currentUserSpeaking = false;
this._anyoneElseSpeaking = false;
if (this._reportInterval != null) {
this._reportInterval.stop();
this._reportInterval = null;
}
}}, {key: '_trackStartSpeaking', value: value_120078}, {key: '_trackStartListening', value: value_120079},
{key: '_terminate', value: function() {
this._reset();
SpeakingStore.removeChangeListener(this._handleSpeakingStoreChanged);
RTCConnectionStore.removeChangeListener(this._handleRTCConnectionStoreChanged);
}}, {key: 'getGameMetadata', value: value_120081}]);
}
function AppAnalyticsManager(a0) { // fn#120070, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:499, offset: 0x025200cf, size: 172 bytes, params: 2, frame: 20
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_3;
binding(this, AppAnalyticsManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_6(AppAnalyticsManager);
binding = env1_5;
if (_isNativeReflectConstruct_120066()) {
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);
value._currentUserSpeaking = false;
value._anyoneElseSpeaking = false;
value._handleRTCConnectionStoreChanged = _handleRTCConnectionStoreChanged;
value._handleSpeakingStoreChanged = _handleSpeakingStoreChanged;
return value;
}
function value_120074() { // fn#120074, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:1411, offset: 0x025202b5, size: 104 bytes, params: 1, frame: 16
const Map = global.Map;
let map = new Map();
map = map.set(SpeakingStore, _fun120075);
this.stores = map.set(RTCConnectionStore, _fun120076);
this._reset();
}
function value_120078() { // fn#120078, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:1768, offset: 0x0252037a, size: 238 bytes, params: 1, frame: 20
var value;
var channelId;
var guildId;
var moduleValue;
var trackWithMetadata;
var START_SPEAKING;
var object2;
if (this._currentUserSpeaking) {
value = environment.__proto__;
channelId = RTCConnectionStore.getChannelId();
guildId = RTCConnectionStore.getGuildId();
moduleValue = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
trackWithMetadata = moduleValue.trackWithMetadata;
START_SPEAKING = AnalyticEvents.START_SPEAKING;
object2 = {};
object2.mode = MediaEngineStore.getMode();
object2.priority = SpeakingStore.isCurrentUserPrioritySpeaking();
object2.channel = channelId;
object2.server = guildId;
object2.channel_id = channelId;
object2.guild_id = guildId;
object2.rtc_connection_id = RTCConnectionStore.getRTCConnectionId();
object2.media_session_id = RTCConnectionStore.getMediaSessionId();
object2.voice_state_count = SortedVoiceStateStore.countVoiceStatesForChannel(this._voiceChannelId);
copyDataProperties(object2, this.getGameMetadata(), SpeakingStore);
copyDataProperties(object2, RTCConnectionStore.getPacketStats(), SpeakingStore);
Reflect.apply(trackWithMetadata, moduleValue, [START_SPEAKING, object2]);
}
}
function value_120079() { // fn#120079, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:2233, offset: 0x02520468, size: 244 bytes, params: 1, frame: 20
var channelId;
var guildId;
var moduleValue;
var trackWithMetadata;
var START_LISTENING;
var object2;
if (!MediaEngineStore.isDeaf()) {
if (this._anyoneElseSpeaking) {
channelId = RTCConnectionStore.getChannelId();
guildId = RTCConnectionStore.getGuildId();
moduleValue = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
trackWithMetadata = moduleValue.trackWithMetadata;
START_LISTENING = AnalyticEvents.START_LISTENING;
object2 = {};
object2.mute = MediaEngineStore.isMute();
object2.anyone_priority = SpeakingStore.isAnyonePrioritySpeaking();
object2.channel = channelId;
object2.server = guildId;
object2.channel_id = channelId;
object2.guild_id = guildId;
object2.rtc_connection_id = RTCConnectionStore.getRTCConnectionId();
object2.media_session_id = RTCConnectionStore.getMediaSessionId();
object2.voice_state_count = SortedVoiceStateStore.countVoiceStatesForChannel(this._voiceChannelId);
copyDataProperties(object2, this.getGameMetadata(), SpeakingStore);
Reflect.apply(trackWithMetadata, moduleValue, [START_LISTENING, object2]);
}
}
}
function value_120081() { // fn#120081, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:2855, offset: 0x0252059a, size: 231 bytes, params: 1, frame: 16
var environment;
var r1;
let value = environment.__proto__;
const activity = SelfPresenceStore.findActivity(function({type}) {
return type === ActivityTypes.PLAYING;
});
const currentGameForAnalytics = RunningGameStoreNative.getCurrentGameForAnalytics();
const object2 = {};
object2.game_platform = (importDefault(15128) /* metro dependency 15128: getGamePlatform */)(activity);
const value3 = null;
object2.game_name = value3 != activity ? activity.name : value3;
object2.game_exe_name = value3 != currentGameForAnalytics ? currentGameForAnalytics.exeName : value3;
object2.game_id = value3 != activity ? activity.application_id : value3;
object2.game_distributor = value3 != currentGameForAnalytics ? currentGameForAnalytics.distributor : value3;
object2.game_distributor_game_id = value3 != currentGameForAnalytics ? currentGameForAnalytics.sku : value3;
if (value3 != currentGameForAnalytics) {
value = require(4483) /* metro dependency 4483: RobloxSubgameUtils */;
value = value.getSubgameMetadata(currentGameForAnalytics);
r1 = value;
} else {
r1 = value3;
}
object2.game_metadata = r1;
return object2;
}
function _handleRTCConnectionStoreChanged() { // fn#120071, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:828, owner: AppAnalyticsManager._handleRTCConnectionStoreChanged, offset: 0x0252017b, size: 175 bytes, params: 1, frame: 14
var binding;
var _reportInterval;
var Interval;
var value4;
var interval;
var start;
const channelId = RTCConnectionStore.getChannelId();
if (env0_0._voiceChannelId !== channelId) {
env0_0._voiceChannelId = channelId;
if (channelId != null) {
_reportInterval = env0_0._reportInterval;
if (_reportInterval == null) {
binding = env0_0;
Interval = (require(4041) /* metro dependency 4041: Timers */).Interval;
value4 = Object.create(Interval.prototype, {constructor: {value: Interval}});
interval = new Interval();
binding._reportInterval = interval instanceof Object ? interval : value4;
_reportInterval = binding._reportInterval;
start = _reportInterval.start;
binding = env2_16;
Reflect.apply(start, _reportInterval, [binding, _fun120072]);
}
} else {
env0_0._reset();
}
}
}
function _handleSpeakingStoreChanged() { // fn#120073, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:1103, owner: AppAnalyticsManager._handleSpeakingStoreChanged, offset: 0x02520249, size: 108 bytes, params: 1, frame: 11
var binding;
let value = environment.__proto__.__proto__;
const isCurrentUserSpeaking2 = SpeakingStore.isCurrentUserSpeaking();
if (env0_0._currentUserSpeaking !== isCurrentUserSpeaking2) {
binding = env0_0;
binding._currentUserSpeaking = isCurrentUserSpeaking2;
binding._trackStartSpeaking();
}
value = SpeakingStore.isAnyoneElseSpeaking();
if (env0_0._anyoneElseSpeaking !== value) {
binding = env0_0;
binding._anyoneElseSpeaking = value;
binding._trackStartListening();
}
}
function _fun120075() { // fn#120075, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:1451, offset: 0x0252031d, size: 19 bytes, params: 1, frame: 9
return env0_0._handleSpeakingStoreChanged();
}
function _fun120076() { // fn#120076, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:1499, offset: 0x02520330, size: 19 bytes, params: 1, frame: 9
return env0_0._handleRTCConnectionStoreChanged();
}
function _fun120072() { // fn#120072, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15870:1002, offset: 0x0252022a, size: 31 bytes, params: 1, frame: 9
const binding = env1_0;
binding._trackStartSpeaking();
binding._trackStartListening();
}