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

247 lines
12 KiB
TypeScript

/* Metro module 4609; source: stores/VideoStreamStore.tsx; dependencies: [6, 7, 15, 17, 18, 661, 4291, 566, 694, 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 Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
import * as ConstantsModule2 from '../external/discord_common/js/packages/media-engine/Constants.tsx'; /* Metro dependency 4291 */
function _fun39522(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#39522, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:6, offset: 0x010e4191, size: 393 bytes, params: 8, frame: 19
const makeTimeoutKey = function(a0, a1) {
return '' + a0 + ':' + a1;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_9 = {};
const env0_10 = {};
const Store = (Flux).Store;
let value = _fun39528(Store);
value.displayName = 'VideoStreamStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: function({user,
sessionId}) {
env0_7 = user.id;
env0_8 = sessionId;
}, OVERLAY_INITIALIZE: function({user, sessionId}) {
env0_7 = user.id;
env0_8 = sessionId;
}, RTC_CONNECTION_VIDEO: RTC_CONNECTION_VIDEO_39536, VOICE_STATE_UPDATES: function({voiceStates}) {
return voiceStates.reduce(_fun39538, false);
}, VIDEO_STREAM_READY_TIMEOUT: VIDEO_STREAM_READY_TIMEOUT,
CLEAR_VIDEO_STREAM_READY_TIMEOUT: CLEAR_VIDEO_STREAM_READY_TIMEOUT});
(FileImportTrackerModule).fileFinishedImporting('stores/VideoStreamStore.tsx');
exports.default = value;
function _isNativeReflectConstruct_39523() { // fn#39523, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:213, offset: 0x010e431a, size: 94 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_39523_isNativeReflectConstruct = function() {
return !!result;
})();
}
function clearUser_39527(a0, a1) { // fn#39527, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:481, offset: 0x010e4378, size: 173 bytes, params: 3, frame: 22
var r1;
var r7;
var r11;
var value5;
var length;
var value6;
var property2;
var value7;
var value8;
var binding;
var makeTimeoutKeyBinding;
var value9;
const value = a1;
const value2 = a2;
const r9 = value2 !== undefined ? value2 : null;
let property = env0_9[a0];
if (property != null) {
r1 = value ?? NULL_STRING_GUILD_ID;
property = property[r1];
if (property != null) {
value5 = global.Object.values(MediaEngineContextTypes);
length = value5.length;
value6 = 0;
if (value6 < length) {
r7 = value6;
while (true) {
property2 = value5[r7];
value7 = r9 !== property2;
if (value7) {
value8 = r9 != null;
r1 = value8;
} else {
r1 = value7;
}
if (r1) {
continue;
}
delete property[property2];
binding = env0_10;
makeTimeoutKeyBinding = makeTimeoutKey;
if (r9 == null) {
r11 = property2;
continue;
}
r11 = r9;
continue;
delete binding[makeTimeoutKeyBinding(r11, a0)];
value9 = typeof r7 === 'bigint' ? r7 + 1n : +r7 + 1;
length = value5.length;
if (value9 < length) {
r7 = value9;
continue;
}
break;
}
}
env0_9[a0][value ?? NULL_STRING_GUILD_ID] = property;
}
}
}
function _fun39528(a0) { // fn#39528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:724, offset: 0x010e4425, size: 141 bytes, params: 2, frame: 16
const VideoStreamStore2 = VideoStreamStore;
Inherits(VideoStreamStore2, a0);
return CreateClass(VideoStreamStore2, [{key: 'getStreamId', value: value_39530}, {key: 'getUserStreamData',
value: value_39531}, {key: 'getTimedoutVideos', value: value_39532}, {key: 'getTimedoutVideo',
value: value_39533}]);
function VideoStreamStore() { // fn#39529, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:736, offset: 0x010a3f4a, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_0(this, VideoStreamStore);
const value3 = env1_3(VideoStreamStore);
return env1_2(this, _isNativeReflectConstruct_39523() ? global.Reflect.construct(value3, arguments,
env1_3(this).constructor) : value3.apply(this, arguments));
}
function value_39530(a0, a1) { // fn#39530, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:1035, offset: 0x010e44b2, size: 92 bytes, params: 3, frame: 8
const value = a1;
const value2 = a2;
const value3 = undefined;
const r4 = value2 !== value3 ? value2 : MediaEngineContextTypes.DEFAULT;
const property = env1_9[a0];
return property == null || property[value ?? NULL_STRING_GUILD_ID] == null || property[value ?? NULL_STRING_GUILD_ID][r4] == null ? value3 : property[value ?? NULL_STRING_GUILD_ID][r4].streamId;
}
function value_39531(a0, a1) { // fn#39531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:1182, offset: 0x010e450e, size: 77 bytes, params: 3, frame: 8
const value = a1;
const value2 = a2;
const value3 = undefined;
const r2 = value2 !== value3 ? value2 : MediaEngineContextTypes.DEFAULT;
const property = env1_9[a0];
return property == null || property[value ?? NULL_STRING_GUILD_ID] == null ? value3 : property[value ?? NULL_STRING_GUILD_ID][r2];
}
function value_39532() { // fn#39532, offset: 0x00fbd9ec, size: 9 bytes, params: 1, frame: 1
return env1_10;
}
function value_39533(a0, a1) { // fn#39533, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:1359, offset: 0x010e455b, size: 31 bytes, params: 3, frame: 14
return env1_10[makeTimeoutKey(a0, a1)];
}
}
function RTC_CONNECTION_VIDEO_39536({userId, guildId, streamId, context}) { // fn#39536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:1664, offset: 0x010e459c, size: 169 bytes, params: 2, frame: 19
var r6;
var r2;
var property;
var object;
if (streamId != null) {
if (!(userId in env0_9)) {
env0_9[userId] = {};
}
property = env0_9[userId];
property = property[guildId ?? NULL_STRING_GUILD_ID];
r6 = property ?? ({});
property = env0_9[userId];
r2 = guildId ?? NULL_STRING_GUILD_ID;
object = {};
copyDataProperties(object, r6, undefined);
object[context] = {streamId: streamId};
property[r2] = object;
delete env0_10[makeTimeoutKey(context, userId)];
} else {
clearUser_39527(userId, guildId, context);
}
}
function VOICE_STATE_UPDATES_39537({voiceStates}) { // fn#39537, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:1948, offset: 0x010e4645, size: 32 bytes, params: 2, frame: 13
return voiceStates.reduce(_fun39538, false);
function _fun39538(a0, {userId, sessionId, channelId, guildId}) { // fn#39538, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:2015, offset: 0x010e4665, size: 129 bytes, params: 3, frame: 21
var object2;
var value;
if (channelId != null) {
if (channelId != null) {
return a0;
}
value = environment.__proto__;
if (object2[userId]?.[guildId ?? NULL_STRING_GUILD_ID] == null) {
return a0;
}
clearUser_39527(userId, guildId);
} else {
if (userId === env1_7) {
if (sessionId !== env1_8) {
return a0;
}
object2 = {};
env1_10 = {};
return true;
}
if (channelId != null) {
return a0;
}
if (object2[userId]?.[guildId ?? NULL_STRING_GUILD_ID] == null) {
return a0;
}
clearUser_39527(userId, guildId);
}
return true;
}
}
function VIDEO_STREAM_READY_TIMEOUT({videoStreamId, userId, streamKey, mediaContext}) { // fn#39539, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:2248, offset: 0x010e46e6, size: 72 bytes, params: 2, frame: 17
env0_10[makeTimeoutKey(mediaContext, userId)] = {videoStreamId: videoStreamId, userId: userId, streamKey: streamKey,
mediaContext: mediaContext};
}
function CLEAR_VIDEO_STREAM_READY_TIMEOUT({mediaContext, userId}) { // fn#39540, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4787:2453, offset: 0x010e472e, size: 57 bytes, params: 2, frame: 14
const timeoutKey = makeTimeoutKey(mediaContext, userId);
if (env0_10[timeoutKey] == null) {
return false;
}
delete env0_10[timeoutKey];
}
}
global.__d(_fun39522, 4609, [6, 7, 15, 17, 18, 661, 4291, 566, 694,
2]) /* metro module 4609, dependencies: [6, 7, 15, 17, 18, 661, 4291, 566, 694, 2] */;