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

249 lines
13 KiB
TypeScript

/* Metro module 12603; source: stores/RTCConnectionDesyncStore.tsx; dependencies: [6, 7, 15, 17, 18, 4298, 1379, 4294, 1878, 4297, 4300, 661, 4299, 4268, 4617, 4618, 4406, 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 ChannelStore from './ChannelStore.tsx'; /* Metro dependency 1379 */
import UserStore from './UserStore.tsx'; /* Metro dependency 1878 */
import RTCConnectionStore from './RTCConnectionStore.tsx'; /* Metro dependency 4294 */
import VoiceStateStore from './VoiceStateStore.tsx'; /* Metro dependency 4297 */
import VoiceStateRecord from '../records/VoiceStateRecord.tsx'; /* Metro dependency 4298 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
import * as CallConstantsModule from '../modules/calls/CallConstants.tsx'; /* Metro dependency 4299 */
import * as SortedVoiceStateStoreModule from './views/SortedVoiceStateStore.tsx'; /* Metro dependency 4300 */
import * as MediaEngineModule from '../external/discord_common/js/packages/media-engine/index.tsx'; /* Metro dependency 4406 */
function _fun96668(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#96668, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:6, offset: 0x02163050, size: 629 bytes, params: 8, frame: 21
const env0_0 = require;
const VOICE_CHANNEL_SELECT_966762 = VOICE_CHANNEL_SELECT_96676;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
const env0_14 = value.ME;
const env0_15 = value.RTCConnectionStates;
value = importDefault(4268) /* metro dependency 4268: CachedEntriesMap */;
value = new value();
value = importDefault(4268) /* metro dependency 4268: CachedEntriesMap */;
value = new value();
const Set = global.Set;
let set = new Set();
const Store = (Flux).Store;
_fun96677(Store).displayName = 'RTCConnectionDesyncStore';
set = new set(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: function() {
VOICE_CHANNEL_SELECT_96676();
}, VOICE_CHANNEL_SELECT: VOICE_CHANNEL_SELECT_966762, RTC_CONNECTION_STATE: function({state, context}) {
var r1;
var r0;
var value4;
var value2 = undefined;
var value3 = context === require(dependencyMap[16]).MediaEngineContextTypes.DEFAULT;
if (value3) {
value4 = state === RTCConnectionStates.DISCONNECTED;
if (value4) {
VOICE_CHANNEL_SELECT_96676();
r1 = value2;
} else {
r1 = value4;
}
r0 = r1;
} else {
r0 = value3;
}
return r0;
}, VOICE_STATE_UPDATES: VOICE_STATE_UPDATES_96686,
RTC_CONNECTION_CLIENT_CONNECT: RTC_CONNECTION_CLIENT_CONNECT_96688,
RTC_CONNECTION_CLIENT_DISCONNECT: RTC_CONNECTION_CLIENT_DISCONNECT});
(FileImportTrackerModule).fileFinishedImporting('stores/RTCConnectionDesyncStore.tsx');
exports.default = set;
function _isNativeReflectConstruct_96669() { // fn#96669, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:300, offset: 0x021632c5, 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_96669_isNativeReflectConstruct = function() {
return !!result;
})();
}
function upsert_96672(a0, a1, a2) { // fn#96672, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:539, offset: 0x02163327, size: 276 bytes, params: 4, frame: 21
const value = a1;
const voiceStateRecord2 = new VoiceStateRecord({userId: a0.id, channelId: a2});
const sortedVoiceState = makeSortedVoiceState(voiceStateRecord2, value ?? ME, a0.id);
let binding = env0_17;
binding.set(a0.id, sortedVoiceState);
object = {};
const USER = ParticipantTypes.USER;
object.type = USER;
object.user = a0;
object.id = a0.id;
object.streamId = null;
object.voiceState = voiceStateRecord2;
object.voicePlatform = null;
object.speaking = false;
object.lastSpoke = 0;
object.soundsharing = false;
object.ringing = false;
object.userNick = (importDefault(4617) /* metro dependency 4617: NicknameUtils */).getName(value, a2, a0);
object.userAvatarDecoration = (require(4618) /* metro dependency 4618: useAvatarDecoration */).getAvatarDecoration(a0,
value);
object.localVideoDisabled = false;
object.isPoppedOut = false;
binding = env0_18;
binding.set(a0.id, object);
}
function deleteUserDesyncData(a0) { // fn#96673, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:910, offset: 0x0216343b, size: 62 bytes, params: 2, frame: 13
const value2 = env0_17.delete(a0);
const value3 = env0_18.delete(a0);
const value = env0_19.delete(a0);
let r0 = value2 || value3;
r0 = !r0 ? value : r0;
return r0;
}
function retryFailedUsers() { // fn#96674, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:1004, offset: 0x02163479, size: 103 bytes, params: 1, frame: 14
var value5;
const channelId = RTCConnectionStore.getChannelId();
if (channelId == null) {
return false;
}
const channel = ChannelStore.getChannel(channelId);
if (channel != null) {
value5 = channel.getGuildId();
}
const env0_2 = false;
env0_19.forEach(_fun96675);
return env0_2;
function _fun96675(a0) { // fn#96675, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:1154, offset: 0x021634e0, size: 115 bytes, params: 2, frame: 16
var binding;
var user;
var upsert_96672Binding;
if (VoiceStateStore.getVoiceStateForChannel(env0_0, a0) == null) {
user = UserStore.getUser(a0);
if (user != null) {
binding = env1_19;
binding.delete(a0);
upsert_96672Binding = upsert_96672;
binding = env0_1;
upsert_96672Binding(user, binding, env0_0);
}
} else {
env1_19.delete(a0);
}
}
}
function VOICE_CHANNEL_SELECT_96676() { // fn#96676, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:1282, offset: 0x02163553, size: 49 bytes, params: 1, frame: 10
env0_17.clear();
env0_18.clear();
env0_19.clear();
}
function _fun96677(a0) { // fn#96677, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:1341, offset: 0x02163584, size: 180 bytes, params: 2, frame: 16
const RTCConnectionDesyncStore2 = RTCConnectionDesyncStore;
Inherits(RTCConnectionDesyncStore2, a0);
return CreateClass(RTCConnectionDesyncStore2, [{key: 'initialize', value: function() {
this.waitFor(VoiceStateStore, UserStore, ChannelStore, RTCConnectionStore);
this.syncWith([UserStore], retryFailedUsers);
}}, {key: 'desyncedVoiceStatesCount', get: get_96680}, {key: 'getDesyncedUserIds', value: value_96681},
{key: 'getDesyncedVoiceStates', value: value_96682}, {key: 'getDesyncedParticipants', value: value_96683}]);
function RTCConnectionDesyncStore() { // fn#96678, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:1353, offset: 0x01121ae9, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_3(this, RTCConnectionDesyncStore);
const value3 = env1_6(RTCConnectionDesyncStore);
return env1_5(this, _isNativeReflectConstruct_96669() ? global.Reflect.construct(value3, arguments,
env1_6(this).constructor) : value3.apply(this, arguments));
}
function get_96680() { // fn#96680, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:1798, offset: 0x0216367b, size: 18 bytes, params: 1, frame: 9
return env1_17.size();
}
function value_96681() { // fn#96681, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:1859, offset: 0x0216368d, size: 18 bytes, params: 1, frame: 9
return env1_17.keys();
}
function value_96682() { // fn#96682, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:1924, offset: 0x0216369f, size: 18 bytes, params: 1, frame: 9
return env1_17.values();
}
function value_96683() { // fn#96683, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:1992, offset: 0x021636b1, size: 18 bytes, params: 1, frame: 9
return env1_18.values();
}
}
function VOICE_STATE_UPDATES_96686({voiceStates}) { // fn#96686, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:2392, offset: 0x0216372b, size: 64 bytes, params: 2, frame: 14
let value = RTCConnectionStore.getChannelId();
value = value != null;
return value && voiceStates.reduce(_fun96687, false);
function _fun96687(a0, {userId, channelId}) { // fn#96687, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:2491, offset: 0x0216376b, size: 58 bytes, params: 3, frame: 13
const value = a0;
let r0 = channelId === env0_0 && !!deleteUserDesyncData(userId);
r0 = !r0 ? value : r0;
return r0;
}
}
function RTC_CONNECTION_CLIENT_CONNECT_96688({userIds, guildId, channelId, context}) { // fn#96688, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:2591, offset: 0x021637a5, size: 101 bytes, params: 2, frame: 15
const MediaEngineContextTypes = (MediaEngineModule).MediaEngineContextTypes;
const DEFAULT = MediaEngineContextTypes.DEFAULT;
return context === DEFAULT && userIds.reduce(_fun96689, false);
function _fun96689(a0, a1) { // fn#96689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:2741, offset: 0x0216380a, size: 103 bytes, params: 3, frame: 18
var r1;
const value = a0;
const voiceStateStoreBinding = VoiceStateStore;
const getVoiceStateForChannel = voiceStateStoreBinding.getVoiceStateForChannel;
if (Reflect.apply(getVoiceStateForChannel, voiceStateStoreBinding, [channelId, a1]) != null) {
return value;
}
const user = UserStore.getUser(a1);
if (user == null) {
env1_19.add(a1);
r1 = value;
} else {
upsert_96672(user, guildId, channelId);
r1 = true;
}
return r1;
}
}
function RTC_CONNECTION_CLIENT_DISCONNECT({userId, context}) { // fn#96690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12793:2904, offset: 0x02163871, size: 68 bytes, params: 2, frame: 14
const MediaEngineContextTypes = (MediaEngineModule).MediaEngineContextTypes;
const DEFAULT = MediaEngineContextTypes.DEFAULT;
return context === DEFAULT && deleteUserDesyncData(userId);
}
}
global.__d(_fun96668, 12603, [6, 7, 15, 17, 18, 4298, 1379, 4294, 1878, 4297, 4300, 661, 4299, 4268, 4617, 4618,
4406, 566, 694,
2]) /* metro module 12603, dependencies: [6, 7, 15, 17, 18, 4298, 1379, 4294, 1878, 4297, 4300, 661, 4299, 4268, 4617, 4618, 4406, 566, 694, 2] */;