decord/source/modules/activities/ActivitiesInTextUtils.tsx

111 lines
3.2 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 8492
// Function ID: 8493
2026-07-20 16:05:17 +00:00
// Name: isActivityInTextSupportedForChannel
2026-08-25 06:04:03 +00:00
// Dependencies: [1391, 4025, 505, 692, 589, 2]
2026-07-29 08:29:29 +00:00
// Exports: getIsAppLauncherEnabled, isActivitiesInTextEnabled, useIsActivitiesInTextEnabled, useIsAppLauncherEnabled
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 8492 (isActivityInTextSupportedForChannel)
2026-08-24 06:08:38 +00:00
import set from "set" /* 692 */;
import closure_2 from "ensureGuildLoaded" /* 1391 */;
2026-08-25 06:04:03 +00:00
import closure_3 from "getUncachedChannelPermissions" /* 4025 */;
2026-08-24 06:08:38 +00:00
import { Permissions } from "sum" /* 505 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function isActivityInTextSupportedForChannel(channel) {
if (null == channel) {
return false;
} else {
channel = channel.getChannel(channel.parent_id);
let hasItem = null == channel;
if (!hasItem) {
let type;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-07-20 16:05:17 +00:00
type = channel.type;
}
2026-08-24 06:08:38 +00:00
hasItem = type === set.ChannelTypes.GUILD_CATEGORY;
2026-07-20 16:05:17 +00:00
}
if (hasItem) {
2026-08-24 06:08:38 +00:00
const items = [set.ChannelTypes.GUILD_TEXT, set.ChannelTypes.GUILD_VOICE, set.ChannelTypes.GROUP_DM, set.ChannelTypes.DM, set.ChannelTypes.GUILD_SPACE];
2026-07-20 16:05:17 +00:00
hasItem = items.includes(channel.type);
}
return hasItem;
}
}
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/activities/ActivitiesInTextUtils.tsx");
2026-07-29 08:29:29 +00:00
export { isActivityInTextSupportedForChannel };
export const isActivitiesInTextEnabled = function isActivitiesInTextEnabled(channel) {
let flag = false;
if (null != channel) {
flag = false;
if (undefined !== channel) {
flag = false;
if (isActivityInTextSupportedForChannel(channel)) {
flag = true;
if (null != channel.guild_id) {
flag = true;
2026-08-24 06:08:38 +00:00
if (!closure_3.can(Permissions.USE_EMBEDDED_ACTIVITIES, channel)) {
2026-07-29 08:29:29 +00:00
flag = false;
2026-07-20 16:05:17 +00:00
}
}
}
}
}
2026-07-29 08:29:29 +00:00
return flag;
};
export const useIsActivitiesInTextEnabled = function useIsActivitiesInTextEnabled(id) {
const _require = id;
2026-08-24 06:08:38 +00:00
const items = [closure_2, closure_3];
2026-07-29 08:29:29 +00:00
return _require(589).useStateFromStores(items, () => {
2026-08-24 06:08:38 +00:00
const channel = closure_1_2.getChannel(closure_0);
2026-07-29 08:29:29 +00:00
let flag = false;
if (null != channel) {
flag = false;
if (undefined !== channel) {
flag = false;
2026-08-24 06:08:38 +00:00
if (closure_1_5(channel)) {
2026-07-29 08:29:29 +00:00
flag = true;
if (null != channel.guild_id) {
flag = true;
2026-08-24 06:08:38 +00:00
if (!closure_1_3.can(closure_1_4.USE_EMBEDDED_ACTIVITIES, channel)) {
2026-07-29 08:29:29 +00:00
flag = false;
}
}
}
}
}
return flag;
});
};
export const getIsAppLauncherEnabled = function getIsAppLauncherEnabled(channel) {
2026-07-20 16:05:17 +00:00
let guild_id;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-07-20 16:05:17 +00:00
guild_id = channel.guild_id;
}
let tmp2 = null != guild_id;
if (!tmp2) {
tmp2 = isActivityInTextSupportedForChannel(channel);
}
return tmp2;
};
export const useIsAppLauncherEnabled = function useIsAppLauncherEnabled(id) {
2026-07-23 10:11:24 +00:00
const _require = id;
2026-08-24 06:08:38 +00:00
const items = [closure_2];
2026-07-29 08:29:29 +00:00
return _require(589).useStateFromStores(items, () => {
2026-08-24 06:08:38 +00:00
const channel = closure_1_2.getChannel(closure_0);
2026-07-20 16:05:17 +00:00
let tmp2 = null != channel;
if (tmp2) {
2026-07-29 08:29:29 +00:00
let guild_id;
if (channel != null) {
guild_id = channel.guild_id;
}
let tmp4 = null != guild_id;
if (!tmp4) {
2026-08-24 06:08:38 +00:00
tmp4 = closure_1_5(channel);
2026-07-29 08:29:29 +00:00
}
tmp2 = tmp4;
2026-07-20 16:05:17 +00:00
}
return tmp2;
});
};