decord/source/modules/activities/ActivitiesInTextUtils.tsx

114 lines
3.4 KiB
TypeScript
Raw Normal View History

// Module ID: 9676
// Function ID: 9677
// Name: ActivitiesInTextUtils
// Dependencies: [1957, 4275, 1085, 1094, 504, 2]
2026-07-29 08:29:29 +00:00
// Exports: getIsAppLauncherEnabled, isActivitiesInTextEnabled, useIsActivitiesInTextEnabled, useIsAppLauncherEnabled
2026-07-20 16:05:17 +00:00
// Module 9676 (ActivitiesInTextUtils)
import ChannelTypes from "ChannelTypes" /* 1094 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import PermissionStore from "PermissionStore" /* 4275 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
require = fn;
2026-07-20 16:05:17 +00:00
function isActivityInTextSupportedForChannel(channel) {
if (null == channel) {
return false;
} else {
channel = ChannelStore.getChannel(channel.parent_id);
2026-07-20 16:05:17 +00:00
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;
}
hasItem = type === ChannelTypes.ChannelTypes.GUILD_CATEGORY;
2026-07-20 16:05:17 +00:00
}
if (hasItem) {
const items = [ChannelTypes.ChannelTypes.GUILD_TEXT, ChannelTypes.ChannelTypes.GUILD_VOICE, ChannelTypes.ChannelTypes.GROUP_DM, ChannelTypes.ChannelTypes.DM, ChannelTypes.ChannelTypes.GUILD_SPACE];
2026-07-20 16:05:17 +00:00
hasItem = items.includes(channel.type);
}
return hasItem;
}
}
const Permissions = fn(1085).Permissions;
const size = fn(2);
const result = size.fileFinishedImporting("modules/activities/ActivitiesInTextUtils.tsx");
2026-07-29 08:29:29 +00:00
export { isActivityInTextSupportedForChannel };
export const isActivitiesInTextEnabled = function isActivitiesInTextEnabled(channel) {
2026-07-29 08:29:29 +00:00
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;
if (!PermissionStore.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) {
_require = id;
const items = [ChannelStore, PermissionStore];
return require("initialize").useStateFromStores(items, () => {
const channel = ChannelStore.getChannel(closure_0);
2026-07-29 08:29:29 +00:00
let flag = false;
if (null != channel) {
flag = false;
if (undefined !== channel) {
flag = false;
if (isActivityInTextSupportedForChannel(channel)) {
2026-07-29 08:29:29 +00:00
flag = true;
if (null != channel.guild_id) {
flag = true;
if (!PermissionStore.can(Permissions.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) {
_require = id;
const items = [ChannelStore];
return require("initialize").useStateFromStores(items, () => {
const channel = ChannelStore.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) {
tmp4 = isActivityInTextSupportedForChannel(channel);
2026-07-29 08:29:29 +00:00
}
tmp2 = tmp4;
2026-07-20 16:05:17 +00:00
}
return tmp2;
});
};