Files
discord-decomp/sources/stores/VoiceChannelSettingsManager.tsx
T
2026-07-27 16:20:00 +03:00

245 lines
9.4 KiB
TypeScript

/* Metro module 15843; source: stores/VoiceChannelSettingsManager.tsx; dependencies: [7, 6, 15, 17, 18, 1226, 4290, 1379, 1934, 12412, 661, 694, 4860, 2] */
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 = function({voiceStates}) {
voiceStates.forEach(_fun121823);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(7) /* metro dependency 7 */;
const env0_3 = importDefault(6) /* metro dependency 6 */;
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 bitRateStore = importDefault(4290) /* metro dependency 4290: BitRateStore */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */;
const videoQualityModeStore = importDefault(12412) /* metro dependency 12412: VideoQualityModeStore */;
const env0_12 = (require(661) /* metro dependency 661: Constants */).VideoQualityMode;
let value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
value = _fun121824(value);
value = new value();
(require(2) /* metro dependency 2 */).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 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({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 _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 closure = VoiceChannelSettingsManager;
env0_6(closure, a0);
return env0_2(closure);
}
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 items = [];
arraySpread(items, value, 0, items);
value = env1_5(VoiceChannelSettingsManager);
binding = env1_4;
if (_isNativeReflectConstruct_121814()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items, env1_5(this).constructor);
r0 = value;
} else {
value = value.apply(this, items);
r0 = value;
}
value = binding(this, r0);
value.actions = {CHANNEL_UPDATES: handleChannelUpdates_121821, VOICE_STATE_UPDATES: handleVoiceStateUpdates};
return value;
}