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

137 lines
8.3 KiB
TypeScript

/* Metro module 10588; source: modules/activities/utils/getCanJoin.tsx; dependencies: [661, 10584, 10262, 10263, 10264, 10260, 10585, 10589, 6886, 477, 2] */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
function _fun81678(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#81678, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10774:6, offset: 0x01ed9c3e, size: 149 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/activities/utils/getCanJoin.tsx');
exports.getCanJoin = getCanJoin;
exports.getCanSync = getCanSync;
function getCanJoin({presenceActivity, currentUserPresenceActivity, currentUserId, message, application, isEmbeddedApplication, isFrameApplication, isGameLaunchable}) { // fn#81679, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10774:235, offset: 0x01ed9cd3, size: 601 bytes, params: 2, frame: 22
var partySize;
var moduleValue2;
var moduleValue3;
var moduleValue4;
var moduleValue5;
var activity;
var remoteJoinableActivityPlatform;
if (message.author.id !== currentUserId) {
var value;
var value2 = undefined;
if ((importDefault(10584) /* metro dependency 10584: isInviteActive */)(presenceActivity, message,
application.id)) {
partySize = (require(10262) /* metro dependency 10262: getPartySize */).getPartySize(presenceActivity);
moduleValue2 = require(10263) /* metro dependency 10263: hasPartySize */;
if (moduleValue2.hasPartySize(partySize)) {
moduleValue3 = require(10264) /* metro dependency 10264: isPartyFull */;
if (moduleValue3.isPartyFull(partySize)) {
return {'canJoin': false, 'remoteJoinPlatform': null};
}
moduleValue4 = require(10260) /* metro dependency 10260: getIsInParty */;
if (moduleValue4.getIsInParty(currentUserPresenceActivity, presenceActivity)) {
return {'canJoin': false, 'remoteJoinPlatform': null};
}
moduleValue5 = require(10585) /* metro dependency 10585: getIsAskToJoin */;
if (moduleValue5.getIsAskToJoin(message)) {
return {'canJoin': false, 'remoteJoinPlatform': null};
}
if (isEmbeddedApplication) {
if (isFrameApplication) {
return {'canJoin': true, 'remoteJoinPlatform': null};
}
activity = message.activity;
if ((activity == null ? value2 : activity.type) !== ActivityActionTypes.JOIN) {
value = require(477) /* metro dependency 477: PlatformUtils */;
return value.platformSupportsActivityJoin() && isGameLaunchable ? {'canJoin': true,
'remoteJoinPlatform': null} : {'canJoin': false, 'remoteJoinPlatform': null};
}
if (presenceActivity == null) {
value = require(477) /* metro dependency 477: PlatformUtils */;
return value.platformSupportsActivityJoin() && isGameLaunchable ? {'canJoin': true,
'remoteJoinPlatform': null} : {'canJoin': false, 'remoteJoinPlatform': null};
}
remoteJoinableActivityPlatform = (require(10589) /* metro dependency 10589: getRemoteJoinableActivityPlatform */).getRemoteJoinableActivityPlatform(presenceActivity);
if (remoteJoinableActivityPlatform != null) {
return {canJoin: true, remoteJoinPlatform: remoteJoinableActivityPlatform};
}
if ((importDefault(6886) /* metro dependency 6886: hasFlag */)(presenceActivity,
ActivityFlags.SUPPORTS_JOIN_URL)) {
return {'canJoin': true, 'remoteJoinPlatform': null};
}
value = require(477) /* metro dependency 477: PlatformUtils */;
return value.platformSupportsActivityJoin() && isGameLaunchable ? {'canJoin': true,
'remoteJoinPlatform': null} : {'canJoin': false, 'remoteJoinPlatform': null};
}
activity = message.activity;
if ((activity == null ? value2 : activity.type) !== ActivityActionTypes.JOIN) {
value = require(477) /* metro dependency 477: PlatformUtils */;
return value.platformSupportsActivityJoin() && isGameLaunchable ? {'canJoin': true,
'remoteJoinPlatform': null} : {'canJoin': false, 'remoteJoinPlatform': null};
}
if (presenceActivity == null) {
value = require(477) /* metro dependency 477: PlatformUtils */;
return value.platformSupportsActivityJoin() && isGameLaunchable ? {'canJoin': true,
'remoteJoinPlatform': null} : {'canJoin': false, 'remoteJoinPlatform': null};
}
remoteJoinableActivityPlatform = (require(10589) /* metro dependency 10589: getRemoteJoinableActivityPlatform */).getRemoteJoinableActivityPlatform(presenceActivity);
if (remoteJoinableActivityPlatform != null) {
return {canJoin: true, remoteJoinPlatform: remoteJoinableActivityPlatform};
}
if ((importDefault(6886) /* metro dependency 6886: hasFlag */)(presenceActivity,
ActivityFlags.SUPPORTS_JOIN_URL)) {
return {'canJoin': true, 'remoteJoinPlatform': null};
}
value = require(477) /* metro dependency 477: PlatformUtils */;
return value.platformSupportsActivityJoin() && isGameLaunchable ? {'canJoin': true,
'remoteJoinPlatform': null} : {'canJoin': false, 'remoteJoinPlatform': null};
}
return {'canJoin': false, 'remoteJoinPlatform': null};
}
}
return {'canJoin': false, 'remoteJoinPlatform': null};
}
function getCanSync(a0, a1, a2, a3) { // fn#81680, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10774:1239, offset: 0x01ed9f2c, size: 199 bytes, params: 5, frame: 19
var r3;
var r2;
var r1;
var r0;
var value2;
var value4;
var isPlatformEmbedded;
let value = a0 != null;
if (value) {
value2 = (importDefault(10584) /* metro dependency 10584: isInviteActive */)(a0, a2, a3.id);
if (value2) {
value4 = (importDefault(6886) /* metro dependency 6886: hasFlag */)(a0, ActivityFlags.SYNC);
if (value4) {
isPlatformEmbedded = (require(477) /* metro dependency 477: PlatformUtils */).isPlatformEmbedded;
if (isPlatformEmbedded) {
value = require(10260) /* metro dependency 10260: getIsInParty */;
value = !value.getIsInParty(a1, a0);
r3 = value;
} else {
r3 = !!isPlatformEmbedded;
}
r2 = r3;
} else {
r2 = !!value4;
}
r1 = r2;
} else {
r1 = !!value2;
}
r0 = r1;
} else {
r0 = value;
}
return r0;
}
}
global.__d(_fun81678, 10588, [661, 10584, 10262, 10263, 10264, 10260, 10585, 10589, 6886, 477,
2]) /* metro module 10588, dependencies: [661, 10584, 10262, 10263, 10264, 10260, 10585, 10589, 6886, 477, 2] */;