Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5014.js (118.4 MB)
113 lines
3.4 KiB
TypeScript
113 lines
3.4 KiB
TypeScript
// Module ID: 8781
|
|
// Function ID: 8782
|
|
// Name: ActivitiesInTextUtils
|
|
// Dependencies: [2044, 4466, 1085, 1095, 504, 2]
|
|
// Exports: getIsAppLauncherEnabled, isActivitiesInTextEnabled, useIsActivitiesInTextEnabled, useIsAppLauncherEnabled
|
|
|
|
// Module 8781 (ActivitiesInTextUtils)
|
|
import ChannelTypes from "ChannelTypes" /* 1095 */;
|
|
import ChannelStore from "ChannelStore" /* 2044 */;
|
|
import PermissionStore from "PermissionStore" /* 4466 */;
|
|
|
|
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;
|
|
});
|
|
};
|