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

73 lines
4.3 KiB
TypeScript

/* Metro module 6632; source: modules/guild_role_subscriptions/useChannelRoleSubscriptionStatus.tsx; dependencies: [1936, 1379, 3784, 661, 566, 2] */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import GatedChannelStore from '../channel/GatedChannelStore.tsx'; /* Metro dependency 1936 */
import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
function _fun52516(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#52516, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6810:6, offset: 0x0132ef7f, size: 199 bytes, params: 8, frame: 20
let env0_0 = require;
const getChannelRoleSubscriptionStatus2 = getChannelRoleSubscriptionStatus;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_6 = {'needSubscriptionToAccess': false, 'isSubscriptionGated': false};
(FileImportTrackerModule).fileFinishedImporting('modules/guild_role_subscriptions/useChannelRoleSubscriptionStatus.tsx');
exports.default = function(a0) {
var env0_0 = a0;
return require(dependencyMap[4]).useStateFromStoresObject([ChannelStore, GatedChannelStore, PermissionStore],
_fun52519, [a0]);
};
exports.getChannelRoleSubscriptionStatus = getChannelRoleSubscriptionStatus2;
function getChannelRoleSubscriptionStatus(a0) { // fn#52517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6810:203, offset: 0x0132f046, size: 209 bytes, params: 2, frame: 17
var r0;
var isGuildVocal2;
var can;
let value = a1;
const value2 = a2;
const value3 = a3;
const r2 = value !== undefined ? value : ChannelStore;
const r3 = value2 !== undefined ? value2 : GatedChannelStore;
const r6 = value3 !== undefined ? value3 : PermissionStore;
value = r2.getChannel(a0);
if (value == null) {
if (value == null) {
r0 = env0_6;
} else if (r3.isChannelGated(value.guild_id, value.id)) {
isGuildVocal2 = value.isGuildVocal();
can = r6.can;
r0 = {isSubscriptionGated: true, needSubscriptionToAccess: isGuildVocal2 ? !Reflect.apply(can, r6,
[Permissions.CONNECT, value]) : !Reflect.apply(can, r6, [Permissions.VIEW_CHANNEL, value])};
} else {
r0 = env0_6;
}
} else if (value.isRoleSubscriptionTemplatePreviewChannel()) {
r0 = {'isSubscriptionGated': true, 'needSubscriptionToAccess': true};
} else if (value == null) {
r0 = env0_6;
} else if (r3.isChannelGated(value.guild_id, value.id)) {
isGuildVocal2 = value.isGuildVocal();
can = r6.can;
r0 = {isSubscriptionGated: true, needSubscriptionToAccess: isGuildVocal2 ? !Reflect.apply(can, r6,
[Permissions.CONNECT, value]) : !Reflect.apply(can, r6, [Permissions.VIEW_CHANNEL, value])};
} else {
r0 = env0_6;
}
return r0;
}
function useChannelRoleSubscriptionStatus(a0) { // fn#52518, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6810:666, offset: 0x0132f117, size: 90 bytes, params: 2, frame: 17
const env0_0 = a0;
return (FluxModule).useStateFromStoresObject([ChannelStore, GatedChannelStore,
PermissionStore], _fun52519, [a0]);
function _fun52519() { // fn#52519, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6810:760, offset: 0x0132f171, size: 34 bytes, params: 1, frame: 17
return getChannelRoleSubscriptionStatus(env0_0, ChannelStore, GatedChannelStore, PermissionStore);
}
}
}
global.__d(_fun52516, 6632, [1936, 1379, 3784, 661, 566,
2]) /* metro module 6632, dependencies: [1936, 1379, 3784, 661, 566, 2] */;