Files
discord-decomp/sources/lib/VoiceStateAnalytics.tsx
T
2026-07-28 01:06:53 +03:00

218 lines
11 KiB
TypeScript

/* Metro module 12410; source: lib/VoiceStateAnalytics.tsx; dependencies: [6, 7, 4259, 4297, 4300, 4291, 22, 2] */
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 MediaEngineStore from '../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */
import VoiceStateStore from '../stores/VoiceStateStore.tsx'; /* Metro dependency 4297 */
import SortedVoiceStateStore from '../stores/views/SortedVoiceStateStore.tsx'; /* Metro dependency 4300 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../external/discord_common/js/packages/media-engine/Constants.tsx'; /* Metro dependency 4291 */
function _fun94684(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#94684, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12596:6, offset: 0x02123918, size: 204 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const value = _fun94685();
(FileImportTrackerModule).fileFinishedImporting('lib/VoiceStateAnalytics.tsx');
exports.default = value;
function _fun94685() { // fn#94685, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12596:172, offset: 0x021239e4, size: 163 bytes, params: 1, frame: 15
return CreateClass(VoiceStateAnalytics, [{key: 'updateVoiceStates', value: value_94687}, {key: 'getStats',
value: function() {
var object = {max_voice_state_count: this.maxVoiceStateCount,
total_voice_state_count: this.totalParticipants.size,
max_listener_count: this.maxListenerCount, total_listener_count: this.totalListeners.size,
max_speaker_count: this.maxSpeakerCount};
var Object = global.Object;
object.total_speaker_count = Object.keys(this.totalSpeakers).length;
return object;
}}, {key: 'getUserVoiceSettingsStats', value: value_94689}, {key: 'setSpeaking', value: value_94690},
{key: 'setChannelId', value: value_94694}]);
function VoiceStateAnalytics(a0, a1) { // fn#94686, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12596:193, offset: 0x02123a87, size: 163 bytes, params: 3, frame: 15
const value = environment.__proto__;
env1_2(this, VoiceStateAnalytics);
this.maxVoiceStateCount = 1;
let Set = global.Set;
const value3 = Object.create(Set.prototype, {constructor: {value: Set}});
const set = new Set();
this.totalParticipants = set instanceof Object ? set : value3;
const NONE = SpeakingFlags.NONE;
this.speaking = NONE;
this.maxListenerCount = 0;
Set = global.Set;
this.totalListeners = new Set();
this.maxSpeakerCount = 0;
this.totalSpeakers = {};
this.userId = a0;
this.setChannelId(a1);
}
function value_94687(a0, a1) { // fn#94687, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12596:499, offset: 0x02123b2a, size: 164 bytes, params: 3, frame: 15
var r0;
var value;
var totalSpeakers;
var Math;
var max;
if (a1 === this.channelId) {
this.totalParticipants.add(a0);
Math = global.Math;
max = Math.max;
value = environment.__proto__;
value = SortedVoiceStateStore.countVoiceStatesForChannel(a1);
this.maxVoiceStateCount = Reflect.apply(max, Math, [value, this.maxVoiceStateCount]);
} else {
value = a1 == null;
r0 = value && a0 in this.totalSpeakers;
if (r0) {
totalSpeakers = this.totalSpeakers;
value = environment.__proto__;
totalSpeakers[a0] = SpeakingFlags.NONE;
}
value = a0 === this.userId;
r0 = value && a1 != null;
if (r0) {
this.setChannelId(a1);
}
}
}
function value_94689(a0) { // fn#94689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12596:1135, offset: 0x02123c42, size: 311 bytes, params: 2, frame: 23
let value = environment.__proto__;
const settings = MediaEngineStore.getSettings(a0);
let Set = global.Set;
let Object = global.Object;
let set = new Set(Object.keys(settings.localMutes));
Set = global.Set;
Object = global.Object;
set = new Set(Object.keys(settings.localVolumes));
let userId = this.userId;
set.delete(userId);
userId = this.userId;
set.delete(userId);
const object = {};
value = require(22) /* metro dependency 22 */;
let intersection = value.intersection;
let Array = global.Array;
const value9 = Array.from(set);
Array = global.Array;
object.num_local_voice_user_mutes = Reflect.apply(intersection, value, [value9,
Array.from(this.totalParticipants)]).length;
value = require(22) /* metro dependency 22 */;
intersection = value.intersection;
Array = global.Array;
const value10 = Array.from(set);
Array = global.Array;
object.num_local_voice_volumes = Reflect.apply(intersection, value, [value10,
Array.from(this.totalParticipants)]).length;
return object;
}
function value_94690(a0, a1) { // fn#94690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12596:1533, offset: 0x02123d79, size: 362 bytes, params: 3, frame: 18
var environment;
var totalSpeakers;
var voiceStateStoreBinding;
var value2;
var Object;
var values;
var value3;
var length;
var Math;
let value = environment.__proto__;
const NONE = SpeakingFlags.NONE;
if (a1 !== NONE) {
voiceStateStoreBinding = VoiceStateStore;
value2 = voiceStateStoreBinding.getVoiceStateForChannel(this.channelId, a0);
if (value2 != null) {
if (!value2.selfMute) {
if (!value2.mute) {
totalSpeakers = this.totalSpeakers;
totalSpeakers[a0] = a1;
Object = global.Object;
values = Object.values;
totalSpeakers = this.totalSpeakers;
value3 = Reflect.apply(values, Object, [totalSpeakers]);
length = value3.filter(function(a0) {
return a0 !== SpeakingFlags.NONE;
}).length;
Math = global.Math;
this.maxSpeakerCount = Math.max(this.maxSpeakerCount, length);
}
}
}
} else if (a0 in this.totalSpeakers) {
this.totalSpeakers[a0] = SpeakingFlags.NONE;
}
const userId = this.userId;
if (userId === a0) {
if (a1 === this.speaking) {
return undefined;
}
if (a1 !== SpeakingFlags.NONE) {
Object = global.Object;
values = Object.values;
voiceStateStoreBinding = VoiceStateStore;
value = Reflect.apply(values, Object, [voiceStateStoreBinding.getVoiceStatesForChannel(this.channelId)]);
value = value.filter(function(a0) {
return !a0.selfDeaf && !a0.deaf;
});
value.forEach(_fun94693);
Math = global.Math;
this.maxListenerCount = Math.max(value.length, this.maxListenerCount);
}
this.speaking = a1;
}
function _fun94693({userId}) { // fn#94693, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12596:2029, offset: 0x02123f13, size: 33 bytes, params: 2, frame: 11
return env0_0.totalListeners.add(userId);
}
}
function value_94694(a0) { // fn#94694, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12596:2176, offset: 0x02123f34, size: 221 bytes, params: 2, frame: 17
var environment;
var Set;
var items;
var prototype;
var value;
var set;
var Object;
var keys;
var voiceStateStoreBinding;
var value2;
if (a0 !== this.channelId) {
this.channelId = a0;
Set = global.Set;
items = [this.userId];
prototype = Set.prototype;
value = Object.create(prototype, {constructor: {value: Set}});
set = new Set();
value = set instanceof Object ? set : value;
this.totalParticipants = value;
Object = global.Object;
keys = Object.keys;
value = environment.__proto__;
voiceStateStoreBinding = VoiceStateStore;
value2 = Reflect.apply(keys, Object, [voiceStateStoreBinding.getVoiceStatesForChannel(this.channelId)]);
value2.forEach(_fun94695);
this.maxVoiceStateCount = value2.length;
this.speaking = SpeakingFlags.NONE;
this.maxListenerCount = 0;
Set = global.Set;
prototype = Set.prototype;
value = Object.create(prototype, {constructor: {value: Set}});
set = new Set();
value = set instanceof Object ? set : value;
this.totalListeners = value;
this.maxSpeakerCount = 0;
this.totalSpeakers = {};
}
function _fun94695(a0) { // fn#94695, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12596:2347, offset: 0x02124011, size: 28 bytes, params: 2, frame: 11
return env0_0.totalParticipants.add(a0);
}
}
}
}
global.__d(_fun94684, 12410, [6, 7, 4259, 4297, 4300, 4291, 22,
2]) /* metro module 12410, dependencies: [6, 7, 4259, 4297, 4300, 4291, 22, 2] */;