Files
discord-decomp/sources/modules/video_calls/native/usePipVideoOrStream.tsx
T
2026-07-27 16:20:00 +03:00

124 lines
7.6 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] */
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 embeddedActivitiesStore = importDefault(1378) /* metro dependency 1378: EmbeddedActivitiesStore */;
const channelRTCStore = importDefault(4606) /* metro dependency 4606: ChannelRTCStore */;
const videoSpeakerStore = importDefault(7735) /* metro dependency 7735: VideoSpeakerStore */;
const applicationStreamingStore = importDefault(4492) /* metro dependency 4492: ApplicationStreamingStore */;
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const mediaEngineStore = importDefault(4259) /* metro dependency 4259: MediaEngineStore */;
const rtcConnectionStore = importDefault(4294) /* metro dependency 4294: RTCConnectionStore */;
const callConstantsModule = require(4299) /* metro dependency 4299: CallConstants */;
const env0_11 = callConstantsModule.isStreamParticipant;
const env0_12 = callConstantsModule.isUserParticipant;
const env0_13 = callConstantsModule.ParticipantTypes;
const closure = function(a0) {
var env0_0 = a0;
return require(dependencyMap[9]).useStateFromStores([ChannelRTCStore, VideoSpeakerStore,
ApplicationStreamingStore],
_fun61908, [a0]);
};
(require(2) /* metro dependency 2 */).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 (require(566) /* metro dependency 566: flux */).useStateFromStores([ChannelRTCStore, VideoSpeakerStore,
ApplicationStreamingStore], _fun61908, [a0]);
}
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 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 _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 _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 getId = AuthenticationStore.getId;
const value2 = id !== Reflect.apply(getId, AuthenticationStore, []);
if (value2) {
value = isUserParticipant(a0);
r0 = value ? a0.localVideoDisabled : !value;
} else {
r0 = value2;
}
return r0;
}
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 getChannel = ChannelStore.getChannel;
if (Reflect.apply(getChannel, ChannelStore, [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;
}
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 = (require(4285) /* metro dependency 4285: StreamKeyUtils */).encodeStreamKey({streamType: streamType,
guildId: guildId, channelId: channelId, ownerId: ownerId});
const binding = env0_0;
return value2 === (binding == null ? value : binding.id);
}