decord/source/modules/request_to_stream/useCanFulfillStreamRequest.tsx

105 lines
3.8 KiB
TypeScript
Raw Normal View History

// Module ID: 11837
// Function ID: 11838
// Name: useCanFulfillStreamRequest
// Dependencies: [1915, 4627, 502, 1957, 1979, 4243, 4645, 4628, 1074, 10016, 1115, 504, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 11837 (useCanFulfillStreamRequest)
import RunningGameStore from "RunningGameStore" /* 1915 */;
import ApplicationStreamingStore from "ApplicationStreamingStore" /* 4627 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import GuildStore from "GuildStore" /* 1979 */;
import PermissionStore from "PermissionStore" /* 4243 */;
import PresenceStore from "PresenceStore" /* 4645 */;
import RTCConnectionStore from "RTCConnectionStore" /* 4628 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
const require = fn;
function canFulfillStreamRequest(channel_id, flag, ApplicationStreamingStore, ChannelStore, PresenceStore) {
if (flag === undefined) {
2026-07-20 16:05:17 +00:00
flag = false;
}
let obj = ApplicationStreamingStore;
if (ApplicationStreamingStore === undefined) {
obj = ApplicationStreamingStore;
2026-07-20 16:05:17 +00:00
}
let obj2 = ChannelStore;
if (ChannelStore === undefined) {
obj2 = ChannelStore;
2026-07-20 16:05:17 +00:00
}
let obj3 = PresenceStore;
if (PresenceStore === undefined) {
obj3 = PresenceStore;
2026-07-20 16:05:17 +00:00
}
let obj4 = RTCConnectionStore;
if (RTCConnectionStore === undefined) {
obj4 = RTCConnectionStore;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let id;
2026-07-20 16:05:17 +00:00
let DESKTOP;
const channel = obj2.getChannel(channel_id.channel_id);
if (null == channel) {
const items = [false, obj.NOT_IN_VOICE_CHANNEL];
return items;
} else {
const channelId = obj4.getChannelId();
2026-07-29 08:29:29 +00:00
const tmp15 = null != obj.getCurrentUserActiveStream();
const tmp16 = flag;
const tmp17 = id;
2026-07-20 16:05:17 +00:00
const application = channel_id.application;
2026-07-23 10:11:24 +00:00
id = undefined;
const videoPermission = flag(id[9]).getVideoPermission(channel);
2026-07-29 08:29:29 +00:00
if (application != null) {
2026-07-20 16:05:17 +00:00
id = application.id;
}
2026-07-23 10:11:24 +00:00
const obj6 = flag(id[9]);
2026-07-29 08:29:29 +00:00
DESKTOP = tmp16(tmp17[10]).isAndroid() ? tmp3.ANDROID : tmp3.IOS;
2026-07-20 16:05:17 +00:00
if (null == id) {
const items1 = [false, obj.NOT_RUNNING_GAME];
return items1;
} else {
const activities = obj3.getActivities(AuthenticationStore.getId(), channel.guild_id);
2026-07-29 08:29:29 +00:00
if (tmp15) {
2026-07-20 16:05:17 +00:00
const items2 = [false, obj.ALREADY_STREAMING];
let items4 = items2;
} else if (channelId === channel_id.channel_id) {
const items3 = [, ];
if (!videoPermission) {
items3[0] = false;
items3[1] = obj.NO_PERMISSION;
}
2026-07-29 08:29:29 +00:00
if (tmp21) {
2026-07-20 16:05:17 +00:00
items3[0] = true;
items3[1] = null;
} else {
items3[0] = false;
items3[1] = obj.NOT_RUNNING_GAME;
}
} else {
items4 = [false, obj.NOT_IN_VOICE_CHANNEL];
}
return items4;
}
2026-07-29 08:29:29 +00:00
const tmp16Result = tmp16(tmp17[10]);
2026-07-20 16:05:17 +00:00
}
}
const Constants = fn(1074);
({ ActivityGamePlatforms: c10, ActivityTypes: closure_11 } = Constants);
const StreamRequestUnfulfillableReason = { NOT_IN_VOICE_CHANNEL: "NOT_IN_VOICE_CHANNEL", NOT_RUNNING_GAME: "NOT_RUNNING_GAME", ALREADY_STREAMING: "ALREADY_STREAMING", NO_PERMISSION: "NO_PERMISSION", PENDING_REQUEST: "PENDING_REQUEST", EXPIRED: "EXPIRED" };
const size = fn(2);
const result = size.fileFinishedImporting("modules/request_to_stream/useCanFulfillStreamRequest.tsx");
2026-07-20 16:05:17 +00:00
export default function useCanFulfillStreamRequest(arg0) {
_require = arg0;
2026-07-29 08:29:29 +00:00
let flag = arg1;
2026-07-20 16:05:17 +00:00
if (arg1 === undefined) {
flag = false;
}
const items = [ApplicationStreamingStore, ChannelStore, PresenceStore, RunningGameStore, RTCConnectionStore, GuildStore, PermissionStore];
return require("initialize").useStateFromStores(items, () => canFulfillStreamRequest(closure_0, flag, ApplicationStreamingStore, ChannelStore, PresenceStore, RunningGameStore, RTCConnectionStore, GuildStore, PermissionStore));
2026-07-20 16:05:17 +00:00
};
export { StreamRequestUnfulfillableReason };
2026-07-20 16:05:17 +00:00
export { canFulfillStreamRequest };