Files
discord-decomp/sources/modules/activities/ActivitiesInTextUtils.tsx
T
2026-07-28 01:06:53 +03:00

83 lines
4.8 KiB
TypeScript

/* Metro module 8448; source: modules/activities/ActivitiesInTextUtils.tsx; dependencies: [1379, 3784, 482, 677, 566, 2] */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ChannelTypesModule from '../../external/discord_common/js/shared/shared-constants/ChannelTypes.tsx'; /* Metro dependency 677 */
function _fun67023(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#67023, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8633:6, offset: 0x01c13185, size: 223 bytes, params: 8, frame: 21
let env0_0 = require;
const isActivityInTextSupportedForChannel2 = isActivityInTextSupportedForChannel;
const isActivitiesInTextEnabledForChannelWithPermissions = function(a0, a1) {
if (a0 != null) {
if (a0 === undefined) {
return false;
}
if (isActivityInTextSupportedForChannel(a0)) {
if (a0.guild_id == null) {
return true;
}
if (a1.can(Permissions.USE_EMBEDDED_ACTIVITIES, a0)) {
return true;
}
return false;
}
}
return false;
};
const closure2 = function(a0) {
return a0?.guild_id != null || isActivityInTextSupportedForChannel(a0);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/activities/ActivitiesInTextUtils.tsx');
exports.isActivityInTextSupportedForChannel = isActivityInTextSupportedForChannel2;
exports.isActivitiesInTextEnabled = function(a0) {
return isActivitiesInTextEnabledForChannelWithPermissions(a0, PermissionStore);
};
exports.useIsActivitiesInTextEnabled = function(a0) {
var env0_0 = a0;
return require(dependencyMap[4]).useStateFromStores([ChannelStore, PermissionStore], _fun67029);
};
exports.getIsAppLauncherEnabled = closure2;
exports.useIsAppLauncherEnabled = function(a0) {
var env0_0 = a0;
return require(dependencyMap[4]).useStateFromStores([ChannelStore], _fun67031);
};
function isActivityInTextSupportedForChannel(a0) { // fn#67024, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8633:138, offset: 0x01c13264, size: 238 bytes, params: 2, frame: 16
const ChannelTypes = (ChannelTypesModule).ChannelTypes;
if (a0 == null) {
return false;
}
const channel = ChannelStore.getChannel(a0.parent_id);
return (channel == null || channel?.type === ChannelTypes.GUILD_CATEGORY) && [ChannelTypes.GUILD_TEXT,
ChannelTypes.GUILD_VOICE, ChannelTypes.GROUP_DM, ChannelTypes.DM].includes(a0.type);
}
function useIsActivitiesInTextEnabled(a0) { // fn#67028, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8633:1172, offset: 0x01c133e7, size: 74 bytes, params: 2, frame: 15
const env0_0 = a0;
return (FluxModule).useStateFromStores([ChannelStore, PermissionStore],
_fun67029);
function _fun67029() { // fn#67029, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8633:1254, offset: 0x01c13431, size: 42 bytes, params: 1, frame: 14
return isActivitiesInTextEnabledForChannelWithPermissions(ChannelStore.getChannel(env0_0), PermissionStore);
}
}
function useIsAppLauncherEnabled(a0) { // fn#67030, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8633:1407, offset: 0x01c1345b, size: 66 bytes, params: 2, frame: 14
const env0_0 = a0;
return (FluxModule).useStateFromStores([ChannelStore], _fun67031);
function _fun67031() { // fn#67031, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8633:1482, offset: 0x01c1349d, size: 46 bytes, params: 1, frame: 12
const value = environment.__proto__;
const channel = ChannelStore.getChannel(env0_0);
return channel != null && getIsAppLauncherEnabled(channel);
}
}
}
global.__d(_fun67023, 8448, [1379, 3784, 482, 677, 566,
2]) /* metro module 8448, dependencies: [1379, 3784, 482, 677, 566, 2] */;