Files
discord-decomp/sources/modules/video_calls/native/usePipVideoOrStream.tsx
T
2026-07-28 01:06:53 +03:00

131 lines
8.8 KiB
TypeScript

/* Metro module 7734; source: modules/video_calls/native/usePipVideoOrStream.tsx; dependencies: [1378, 4606, 7735, 4492, 1226, 1379, 4259, 4294, 4299, 566, 4285, 4007, 7714, 2] */
import AuthenticationStore from '../../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import EmbeddedActivitiesStore from '../../activities/EmbeddedActivitiesStore.tsx'; /* Metro dependency 1378 */
import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import MediaEngineStore from '../../../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */
import RTCConnectionStore from '../../../stores/RTCConnectionStore.tsx'; /* Metro dependency 4294 */
import ApplicationStreamingStore from '../../../stores/ApplicationStreamingStore.tsx'; /* Metro dependency 4492 */
import ChannelRTCStore2 from '../../calls/ChannelRTCStore.tsx'; /* Metro dependency 4606 */
import VideoSpeakerStore2 from '../../calls/VideoSpeakerStore.tsx'; /* Metro dependency 7735 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as StreamKeyUtilsModule from '../../go_live/utils/StreamKeyUtils.tsx'; /* Metro dependency 4285 */
import * as CallConstantsModule from '../../calls/CallConstants.tsx'; /* Metro dependency 4299 */
function _fun61906(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#61906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7912:6, offset: 0x01b4ddba, size: 294 bytes, params: 8, frame: 19
let env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const channelRTCStore = ChannelRTCStore2;
const videoSpeakerStore = VideoSpeakerStore2;
const closure = function(a0) {
var env0_0 = a0;
return require(dependencyMap[9]).useStateFromStores([channelRTCStore, videoSpeakerStore,
ApplicationStreamingStore],
_fun61908, [a0]);
};
(FileImportTrackerModule).fileFinishedImporting('modules/video_calls/native/usePipVideoOrStream.tsx');
exports.default = closure;
exports.useHasPipParticipant = useHasPipParticipant;
function usePipVideoOrStream(a0) { // fn#61907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7912:273, offset: 0x01b4dee0, size: 89 bytes, params: 2, frame: 17
const env0_0 = a0;
return (FluxModule).useStateFromStores([channelRTCStore, videoSpeakerStore,
ApplicationStreamingStore], _fun61908, [a0]);
function _fun61908() { // fn#61908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7912:312, offset: 0x01b4df39, size: 398 bytes, params: 1, frame: 19
var value;
const value2 = null;
const r2 = value2 != env0_0 ? channelRTCStore.getVideoParticipants(env0_0) : [];
const r5 = value2 != env0_0 ? channelRTCStore.getSelectedParticipant(env0_0) : value2;
const value7 = r2.find(_fun61909);
const getVideoOrStreamParticipantBinding = getVideoOrStreamParticipant;
const binding = env0_0;
const value9 = undefined;
const videoOrStreamParticipantBinding = getVideoOrStreamParticipantBinding({channelId: binding,
VideoSpeakerStore: videoSpeakerStore, ChannelRTCStore: channelRTCStore});
const r10 = value2 != binding ? ApplicationStreamingStore.getAllActiveStreamsForChannel(env0_0) : [];
const r7 = isStreamParticipant(videoOrStreamParticipantBinding) ? r10.filter(_fun61910).length > 0 ? videoOrStreamParticipantBinding : value9 : videoOrStreamParticipantBinding;
let r1 = value2 == r7 ? value7 : r7;
let r4 = value2 != r5 && r5.id === (value2 == r7 ? value9 : r7.id) && value2 != r1 && r1.id === (value2 == r7 ? value9 : r7.id);
if (r4) {
value = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
value = value.isModalOpen(importDefault(7714) /* metro dependency 7714: ChannelCallModal */);
r4 = value;
}
r1 = r4 ? value7 : r1;
return value2 != r1 ? r1.type === ParticipantTypes.ACTIVITY ? value2 : value2 != r1.streamId ? r1 : value2 : value2;
function _fun61909(a0) { // fn#61909, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7912:417, offset: 0x01b4e0c7, size: 39 bytes, params: 2, frame: 3
const type = a0.type;
const value = environment.__proto__.__proto__;
const USER = ParticipantTypes.USER;
return type === USER && !a0.localVideoDisabled;
}
function _fun61910({streamType, guildId, channelId, ownerId}) { // fn#61910, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7912:613, offset: 0x01b4e0ee, size: 108 bytes, params: 2, frame: 14
let value = environment.__proto__.__proto__;
value = undefined;
const value2 = (StreamKeyUtilsModule).encodeStreamKey({streamType: streamType,
guildId: guildId, channelId: channelId, ownerId: ownerId});
const binding = env0_0;
return value2 === (binding == null ? value : binding.id);
}
}
}
function getVideoOrStreamParticipant({channelId, VideoSpeakerStore, ChannelRTCStore}) { // fn#61911, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7912:1031, offset: 0x01b4e15a, size: 135 bytes, params: 2, frame: 17
const r1 = (channelId != null ? ChannelRTCStore.getParticipant(channelId,
VideoSpeakerStore.getSpeaker(channelId)) : null) ?? (channelId != null ? ChannelRTCStore.getVideoParticipants(channelId) : []).find(_fun61912);
return isUserParticipant(r1) && r1.localVideoDisabled ? null : r1;
function _fun61912(a0) { // fn#61912, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7912:1138, offset: 0x01b4e1e1, size: 60 bytes, params: 2, frame: 13
var r0;
const id = a0.id;
let value = environment.__proto__;
const authenticationStoreBinding = AuthenticationStore;
const getId = authenticationStoreBinding.getId;
const value2 = id !== Reflect.apply(getId, authenticationStoreBinding, []);
if (value2) {
value = isUserParticipant(a0);
r0 = value ? a0.localVideoDisabled : !value;
} else {
r0 = value2;
}
return r0;
}
}
function useHasPipParticipant({isActivityViewFocused}) { // fn#61913, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7912:1440, offset: 0x01b4e21d, size: 183 bytes, params: 2, frame: 19
const value = undefined;
const channelId = (require(566) /* metro dependency 566: flux */).useStateFromStores([RTCConnectionStore],
function() {
return RTCConnectionStore.getChannelId();
});
return (require(566) /* metro dependency 566: flux */).useStateFromStores([ChannelStore, EmbeddedActivitiesStore,
MediaEngineStore], _fun61915, [channelId, usePipVideoOrStream(channelId ?? value), isActivityViewFocused]);
function _fun61915() { // fn#61915, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7912:1614, offset: 0x01b4e2e7, size: 136 bytes, params: 1, frame: 15
var r1;
const value = environment.__proto__;
const channelStoreBinding = ChannelStore;
const getChannel = channelStoreBinding.getChannel;
if (Reflect.apply(getChannel, channelStoreBinding, [channelId]) == null) {
return false;
}
const currentEmbeddedActivity = EmbeddedActivitiesStore.getCurrentEmbeddedActivity();
const r2 = env0_2 != null && MediaEngineStore.isLocalVideoDisabled(env0_2.id);
let r0 = currentEmbeddedActivity != null && !isActivityViewFocused;
if (!r0) {
r1 = env0_2 != null && env0_2.streamId != null;
r1 = r1 && !r2;
r0 = r1;
}
return r0;
}
}
}
global.__d(_fun61906, 7734, [1378, 4606, 7735, 4492, 1226, 1379, 4259, 4294, 4299, 566, 4285, 4007, 7714,
2]) /* metro module 7734, dependencies: [1378, 4606, 7735, 4492, 1226, 1379, 4259, 4294, 4299, 566, 4285, 4007, 7714, 2] */;