decord/source/modules/activities/ActivitiesInTextUtils.tsx
github-actions ecf26fc058 chore: update source for alpha 347.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
2026-09-16 07:03:15 +00:00

113 lines
3.4 KiB
TypeScript

// Module ID: 9689
// Function ID: 9690
// Name: ActivitiesInTextUtils
// Dependencies: [1958, 4276, 1085, 1095, 504, 2]
// Exports: getIsAppLauncherEnabled, isActivitiesInTextEnabled, useIsActivitiesInTextEnabled, useIsAppLauncherEnabled
// Module 9689 (ActivitiesInTextUtils)
import ChannelTypes from "ChannelTypes" /* 1095 */;
import ChannelStore from "ChannelStore" /* 1958 */;
import PermissionStore from "PermissionStore" /* 4276 */;
const require = globalThis.__r;
require = fn;
function isActivityInTextSupportedForChannel(channel) {
if (null == channel) {
return false;
} else {
channel = ChannelStore.getChannel(channel.parent_id);
let hasItem = null == channel;
if (!hasItem) {
let type;
if (channel != null) {
type = channel.type;
}
hasItem = type === ChannelTypes.ChannelTypes.GUILD_CATEGORY;
}
if (hasItem) {
const items = [ChannelTypes.ChannelTypes.GUILD_TEXT, ChannelTypes.ChannelTypes.GUILD_VOICE, ChannelTypes.ChannelTypes.GROUP_DM, ChannelTypes.ChannelTypes.DM, ChannelTypes.ChannelTypes.GUILD_SPACE];
hasItem = items.includes(channel.type);
}
return hasItem;
}
}
const Permissions = fn(1085).Permissions;
const size = fn(2);
const result = size.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 (!PermissionStore.can(Permissions.USE_EMBEDDED_ACTIVITIES, channel)) {
flag = false;
}
}
}
}
}
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);
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)) {
flag = false;
}
}
}
}
}
return flag;
});
};
export const getIsAppLauncherEnabled = function getIsAppLauncherEnabled(channel) {
let guild_id;
if (channel != null) {
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);
let tmp2 = null != channel;
if (tmp2) {
let guild_id;
if (channel != null) {
guild_id = channel.guild_id;
}
let tmp4 = null != guild_id;
if (!tmp4) {
tmp4 = isActivityInTextSupportedForChannel(channel);
}
tmp2 = tmp4;
}
return tmp2;
});
};