Files
discord-decomp/sources/stores/VoiceChannelSettingsManager.tsx
2026-07-28 01:06:53 +03:00

261 lines
11 KiB
TypeScript

/* Metro module 15843; source: stores/VoiceChannelSettingsManager.tsx; dependencies: [7, 6, 15, 17, 18, 1226, 4290, 1379, 1934, 12412, 661, 694, 4860, 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 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 AuthenticationStore from './AuthenticationStore.tsx'; /* Metro dependency 1226 */
import ChannelStore from './ChannelStore.tsx'; /* Metro dependency 1379 */
import SelectedChannelStore from './SelectedChannelStore.tsx'; /* Metro dependency 1934 */
import BitRateStore from './BitRateStore.tsx'; /* Metro dependency 4290 */
import AutomaticLifecycleManager from '../lib/AutomaticLifecycleManager.tsx'; /* Metro dependency 4860 */
import VideoQualityModeStore from './VideoQualityModeStore.tsx'; /* Metro dependency 12412 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
function _fun121813(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#121813, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16051:6, offset: 0x02551d68, size: 383 bytes, params: 8, frame: 19
const _arrayLikeToArray_121819 = 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 handleChannelUpdates_121821 = function({channels}) {
var r2;
var value4;
var value5;
var value2 = _createForOfIteratorHelperLoose_121817(channels);
var value3 = value2();
if (!value3.done) {
r2 = value3;
while (true) {
channels = r2.value;
value4 = SelectedChannelStore.getVoiceChannelId();
if (value4 === channels.id) {
updateVoiceSettings();
}
value5 = value2();
if (value5.done) {
break;
}
r2 = value5;
continue;
}
}
};
const handleVoiceStateUpdates_121822 = function({voiceStates}) {
voiceStates.forEach(_fun121823);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = AutomaticLifecycleManager;
value = _fun121824(value);
value = new value();
(FileImportTrackerModule).fileFinishedImporting('stores/VoiceChannelSettingsManager.tsx');
exports.default = value;
function _isNativeReflectConstruct_121814() { // fn#121814, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16051:229, offset: 0x02551ee7, 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_121814_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_121817(a0, a1) { // fn#121817, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16051:422, offset: 0x02551f49, 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 _fun121818;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_121819(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_121819(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_121819(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun121818;
}
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 _fun121818() { // fn#121818, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16051:993, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function updateVoiceSettings() { // fn#121820, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16051:1332, offset: 0x025520bd, size: 239 bytes, params: 1, frame: 15
var r3;
var channel;
var channel2;
var value;
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
if (voiceChannelId != null) {
channel = ChannelStore.getChannel(voiceChannelId);
if (channel != null && BitRateStore.bitrate !== channel.bitrate) {
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'SET_CHANNEL_BITRATE',
bitrate: channel.bitrate});
}
}
const voiceChannelId2 = SelectedChannelStore.getVoiceChannelId();
if (voiceChannelId2 != null) {
channel2 = ChannelStore.getChannel(voiceChannelId2);
if (channel2 != null) {
r3 = channel2.videoQualityMode ?? VideoQualityMode.AUTO;
if (VideoQualityModeStore.mode !== r3) {
value = importDefault(694) /* metro dependency 694: Dispatcher */;
value.dispatch({type: 'SET_CHANNEL_VIDEO_QUALITY_MODE', mode: r3});
}
}
}
}
function handleVoiceStateUpdates_121822({voiceStates}) { // fn#121822, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16051:1972, offset: 0x02552204, size: 32 bytes, params: 2, frame: 11
voiceStates.forEach(function(a0) {
if (AuthenticationStore.getSessionId() === a0.sessionId) {
updateVoiceSettings();
}
});
function _fun121823({sessionId}) { // fn#121823, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16051:2033, offset: 0x02552224, size: 44 bytes, params: 2, frame: 10
if (AuthenticationStore.getSessionId() === sessionId) {
updateVoiceSettings();
}
}
}
function _fun121824(a0) { // fn#121824, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16051:2104, offset: 0x02552250, size: 42 bytes, params: 2, frame: 14
const VoiceChannelSettingsManager2 = VoiceChannelSettingsManager;
Inherits(VoiceChannelSettingsManager2, a0);
return CreateClass(VoiceChannelSettingsManager2);
function VoiceChannelSettingsManager(a0) { // fn#121825, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16051:2116, offset: 0x0255227a, size: 152 bytes, params: 2, frame: 20
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_3;
binding(this, VoiceChannelSettingsManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_5(VoiceChannelSettingsManager);
binding = env1_4;
if (_isNativeReflectConstruct_121814()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_5(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
value.actions = {CHANNEL_UPDATES: handleChannelUpdates_121821, VOICE_STATE_UPDATES: handleVoiceStateUpdates_121822};
return value;
}
}
}
global.__d(_fun121813, 15843, [7, 6, 15, 17, 18, 1226, 4290, 1379, 1934, 12412, 661, 694, 4860,
2]) /* metro module 15843, dependencies: [7, 6, 15, 17, 18, 1226, 4290, 1379, 1934, 12412, 661, 694, 4860, 2] */;