decord/alpha/source/modules/activities/utils/getCanJoin.tsx
2026-10-09 10:00:15 +00:00

108 lines
4.1 KiB
TypeScript

// Module ID: 10754
// Function ID: 10755
// Name: getCanJoin
// Dependencies: [1085, 10755, 10756, 10757, 10758, 10759, 10760, 10761, 7006, 1382, 2]
// Exports: getCanJoin, getCanSync
// Module 10754 (getCanJoin)
import PlatformUtils from "PlatformUtils" /* 1382 */;
import isInviteActiveDefault from "isInviteActive" /* 10755 */;
import _slicedToArray from "_slicedToArray" /* 10756 */;
import hasPartySize from "hasPartySize" /* 10757 */;
import isPartyFull from "isPartyFull" /* 10758 */;
import getIsInParty from "getIsInParty" /* 10759 */;
import getIsAskToJoin from "getIsAskToJoin" /* 10760 */;
import getRemoteJoinableActivityPlatform from "getRemoteJoinableActivityPlatform" /* 10761 */;
import Constants from "Constants" /* 1085 */;
import size from "module_2" /* 2 */;
let c3;
let closure_4;
({ ActivityActionTypes: c3, ActivityFlags: closure_4 } = Constants);
const result = size.fileFinishedImporting("modules/activities/utils/getCanJoin.tsx");
export const getCanJoin = function getCanJoin(currentUserId) {
let message;
let presenceActivity;
({ presenceActivity, message } = currentUserId);
if (message.author.id === currentUserId.currentUserId) {
return { canJoin: false, remoteJoinPlatform: null };
} else {
const tmp13 = importDefault;
if (isInviteActiveDefault(presenceActivity, message, tmp2.id)) {
const obj = _slicedToArray;
const partySize = obj.getPartySize(presenceActivity);
const obj2 = hasPartySize;
if (obj2.hasPartySize(partySize)) {
const tmp6Result = isPartyFull;
if (!tmp6Result.isPartyFull(partySize)) {
const tmp6Result5 = getIsInParty;
if (tmp6Result5.getIsInParty(tmp, presenceActivity)) {
return { canJoin: false, remoteJoinPlatform: null };
} else {
const tmp6Result6 = getIsAskToJoin;
if (tmp6Result6.getIsAskToJoin(message)) {
return { canJoin: false, remoteJoinPlatform: null };
} else {
if (tmp3) {
if (tmp4) {
return { canJoin: true, remoteJoinPlatform: null };
}
}
const activity = message.activity;
let type;
if (activity != null) {
type = activity.type;
}
if (type === constants.JOIN) {
if (null != presenceActivity) {
const tmp6Result7 = getRemoteJoinableActivityPlatform;
const remoteJoinableActivityPlatform = tmp6Result7.getRemoteJoinableActivityPlatform(presenceActivity);
if (null != remoteJoinableActivityPlatform) {
return { canJoin: true, remoteJoinPlatform: remoteJoinableActivityPlatform };
} else if (tmp13(7006)(presenceActivity, constants2.SUPPORTS_JOIN_URL)) {
return { canJoin: true, remoteJoinPlatform: null };
}
}
}
const tmp6Result8 = PlatformUtils;
if (tmp6Result8.platformSupportsActivityJoin()) {
let obj4;
if (tmp5) {
obj4 = { canJoin: true, remoteJoinPlatform: null };
}
return obj4;
}
obj4 = { canJoin: false, remoteJoinPlatform: null };
}
}
}
}
return { canJoin: false, remoteJoinPlatform: null };
} else {
return { canJoin: false, remoteJoinPlatform: null };
}
}
};
export const getCanSync = function getCanSync(activity, tmp8Result, arg2, id) {
let tmp = null != activity;
if (tmp) {
let tmp6 = isInviteActiveDefault(activity, arg2, id.id);
const tmp4 = importDefault;
if (tmp6) {
let tmp8 = tmp4(7006)(activity, constants2.SYNC);
if (tmp8) {
let isPlatformEmbedded = PlatformUtils.isPlatformEmbedded;
const tmp9 = require;
if (isPlatformEmbedded) {
const tmp9Result = tmp9(10759);
isPlatformEmbedded = !tmp9Result.getIsInParty(tmp8Result, activity);
}
tmp8 = isPlatformEmbedded;
}
tmp6 = tmp8;
}
tmp = tmp6;
}
return tmp;
};