decord/source/modules/activities/ActivitiesInTextUtils.tsx

110 lines
3.3 KiB
TypeScript
Raw Normal View History

2026-08-06 08:05:19 +00:00
// Module ID: 8260
// Function ID: 8261
2026-07-20 16:05:17 +00:00
// Name: isActivityInTextSupportedForChannel
2026-08-06 08:05:19 +00:00
// Dependencies: [1372, 3912, 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-06 08:05:19 +00:00
// Module 8260 (isActivityInTextSupportedForChannel)
2026-07-29 08:29:29 +00:00
import ensureGuildLoaded from "ensureGuildLoaded";
import getUncachedChannelPermissions from "getUncachedChannelPermissions";
2026-07-23 10:11:24 +00:00
import { Permissions } from "sum";
const 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-07-29 08:29:29 +00:00
hasItem = type === require(692) /* set */.ChannelTypes.GUILD_CATEGORY;
2026-07-20 16:05:17 +00:00
}
if (hasItem) {
2026-07-29 08:29:29 +00:00
const items = [require(692) /* set */.ChannelTypes.GUILD_TEXT, require(692) /* set */.ChannelTypes.GUILD_VOICE, require(692) /* set */.ChannelTypes.GROUP_DM, require(692) /* set */.ChannelTypes.DM];
2026-07-20 16:05:17 +00:00
hasItem = items.includes(channel.type);
}
return hasItem;
}
}
2026-07-29 08:29:29 +00:00
const result = require("sum").fileFinishedImporting("modules/activities/ActivitiesInTextUtils.tsx");
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;
if (!getUncachedChannelPermissions.can(Permissions.USE_EMBEDDED_ACTIVITIES, channel)) {
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;
const items = [ensureGuildLoaded, getUncachedChannelPermissions];
return _require(589).useStateFromStores(items, () => {
const channel = outer1_2.getChannel(closure_0);
let flag = false;
if (null != channel) {
flag = false;
if (undefined !== channel) {
flag = false;
if (outer1_5(channel)) {
flag = true;
if (null != channel.guild_id) {
flag = true;
if (!outer1_3.can(outer1_4.USE_EMBEDDED_ACTIVITIES, channel)) {
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-07-29 08:29:29 +00:00
const items = [ensureGuildLoaded];
return _require(589).useStateFromStores(items, () => {
2026-07-23 10:11:24 +00:00
const channel = outer1_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) {
tmp4 = outer1_5(channel);
}
tmp2 = tmp4;
2026-07-20 16:05:17 +00:00
}
return tmp2;
});
};