93 lines
4.6 KiB
TypeScript
93 lines
4.6 KiB
TypeScript
// Module ID: 10865
|
|
// Function ID: 84305
|
|
// Name: getEmbeddedActivityLaunchability
|
|
// Dependencies: [1348, 1838, 3758, 4146, 4155, 653, 10546, 566, 1212, 2]
|
|
// Exports: getEmbeddedActivityLaunchabilityForChannel, getEmbeddedActivityLaunchabilityLabel, useEmbeddedActivityLaunchability
|
|
|
|
// Module 10865 (getEmbeddedActivityLaunchability)
|
|
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
|
|
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
|
|
import closure_4 from "_isNativeReflectConstruct";
|
|
import closure_5 from "_isNativeReflectConstruct";
|
|
import { SUPPORTED_ACTIVITIES_CHANNEL_TYPES as closure_6 } from "items3";
|
|
import { Permissions } from "ME";
|
|
|
|
const require = arg1;
|
|
function getEmbeddedActivityLaunchability(arg0) {
|
|
let ChannelStore;
|
|
let GuildStore;
|
|
let PermissionStore;
|
|
let VoiceStateStore;
|
|
let channelId;
|
|
({ channelId, ChannelStore, GuildStore, PermissionStore, VoiceStateStore } = arg0);
|
|
const channel = ChannelStore.getChannel(channelId);
|
|
if (null == channel) {
|
|
return obj.NO_CHANNEL;
|
|
} else if (closure_6.includes(channel.type)) {
|
|
if (obj2.getIsActivitiesEnabledForCurrentPlatform()) {
|
|
if (null != channel) {
|
|
if (!channel.isPrivate()) {
|
|
const guildId = channel.getGuildId();
|
|
if (null == guildId) {
|
|
return obj.NO_GUILD;
|
|
} else {
|
|
const guild = GuildStore.getGuild(guildId);
|
|
let afkChannelId;
|
|
if (null != guild) {
|
|
afkChannelId = guild.afkChannelId;
|
|
}
|
|
if (afkChannelId === channel.id) {
|
|
return obj.IS_AFK_CHANNEL;
|
|
} else {
|
|
if (PermissionStore.can(Permissions.USE_EMBEDDED_ACTIVITIES, channel)) {
|
|
const currentClientVoiceChannelId = VoiceStateStore.getCurrentClientVoiceChannelId(channel.getGuildId());
|
|
if (channel.isVocal()) {
|
|
if (currentClientVoiceChannelId !== channelId) {
|
|
if (!canResult) {
|
|
return obj.NO_CHANNEL_CONNECT_PERMISSION;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
return obj.NO_USE_EMBEDDED_ACTIVITIES_PERMISSION;
|
|
}
|
|
canResult = PermissionStore.can(Permissions.CONNECT, channel);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return obj.CAN_LAUNCH;
|
|
} else {
|
|
return obj.ACTIVITIES_FEATURE_NOT_ENABLED_FOR_OS;
|
|
}
|
|
obj2 = require(10546) /* isActivitiesAllowed */;
|
|
} else {
|
|
return obj.ACTIVITIES_FEATURE_NOT_ENABLED_FOR_CHANNEL;
|
|
}
|
|
}
|
|
const obj = { CAN_LAUNCH: 0, [0]: "CAN_LAUNCH", NO_USE_EMBEDDED_ACTIVITIES_PERMISSION: 1, [1]: "NO_USE_EMBEDDED_ACTIVITIES_PERMISSION", NO_CHANNEL_CONNECT_PERMISSION: 2, [2]: "NO_CHANNEL_CONNECT_PERMISSION", NO_CHANNEL: 3, [3]: "NO_CHANNEL", NO_GUILD: 4, [4]: "NO_GUILD", IS_AFK_CHANNEL: 5, [5]: "IS_AFK_CHANNEL", ACTIVITIES_FEATURE_NOT_ENABLED_FOR_OS: 6, [6]: "ACTIVITIES_FEATURE_NOT_ENABLED_FOR_OS", ACTIVITIES_FEATURE_NOT_ENABLED_FOR_CHANNEL: 7, [7]: "ACTIVITIES_FEATURE_NOT_ENABLED_FOR_CHANNEL" };
|
|
const result = require("_isNativeReflectConstruct").fileFinishedImporting("modules/activities/utils/getEmbeddedActivityLaunchability.tsx");
|
|
|
|
export const EmbeddedActivityLaunchability = obj;
|
|
export { getEmbeddedActivityLaunchability };
|
|
export const getEmbeddedActivityLaunchabilityForChannel = function getEmbeddedActivityLaunchabilityForChannel(channelId) {
|
|
return getEmbeddedActivityLaunchability({ channelId, ChannelStore: _isNativeReflectConstruct, GuildStore: _createForOfIteratorHelperLoose, PermissionStore: closure_4, VoiceStateStore: closure_5 });
|
|
};
|
|
export const useEmbeddedActivityLaunchability = function useEmbeddedActivityLaunchability(channelId) {
|
|
const _require = channelId;
|
|
const items = [_isNativeReflectConstruct, _createForOfIteratorHelperLoose, closure_4, closure_5];
|
|
const items1 = [channelId];
|
|
return _require(566).useStateFromStores(items, () => outer1_9({ channelId: closure_0, ChannelStore: outer1_2, GuildStore: outer1_3, PermissionStore: outer1_4, VoiceStateStore: outer1_5 }), items1);
|
|
};
|
|
export const getEmbeddedActivityLaunchabilityLabel = function getEmbeddedActivityLaunchabilityLabel(arg0) {
|
|
if (obj.CAN_LAUNCH === arg0) {
|
|
const intl3 = require(1212) /* getSystemLocale */.intl;
|
|
return intl3.string(require(1212) /* getSystemLocale */.t.qJvTKQ);
|
|
} else if (obj.NO_USE_EMBEDDED_ACTIVITIES_PERMISSION === arg0) {
|
|
const intl2 = require(1212) /* getSystemLocale */.intl;
|
|
return intl2.string(require(1212) /* getSystemLocale */.t.hHGrWz);
|
|
} else {
|
|
const intl = require(1212) /* getSystemLocale */.intl;
|
|
return intl.string(require(1212) /* getSystemLocale */.t.j29zCr);
|
|
}
|
|
};
|