decord/source/modules/activities/utils/confirmActivityLaunchChecks.tsx

512 lines
16 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 10845
// Function ID: 10846
2026-07-20 16:05:17 +00:00
// Name: getOrFetchApplicationForLaunch
2026-08-05 07:35:12 +00:00
// Dependencies: [5, 1372, 1371, 676, 10843, 10846, 709, 4154, 3873, 10847, 10509, 10848, 7482, 10850, 2]
2026-07-20 16:05:17 +00:00
// Exports: confirmActivityLaunchChecks
2026-08-05 07:35:12 +00:00
// Module 10845 (getOrFetchApplicationForLaunch)
2026-07-23 10:11:24 +00:00
import EmbeddedActivityLocationKind from "EmbeddedActivityLocationKind";
2026-07-29 08:29:29 +00:00
import ensureGuildLoaded from "ensureGuildLoaded";
import participantFromServer from "participantFromServer";
2026-07-23 10:11:24 +00:00
import { ApplicationFlags } from "ME";
const require = arg1;
2026-07-20 16:05:17 +00:00
function getOrFetchApplicationForLaunch() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _getOrFetchApplicationForLaunch.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
function _getOrFetchApplicationForLaunch() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback((arg0) => {
let closure_0 = arg0;
let c7 = 0;
let c8 = 0;
let c6 = 0;
const iter = (function*(arg0) {
let c0;
let c1;
let c2;
2026-08-04 21:03:28 +00:00
let ensureGuildLoaded = tmp3;
({ applicationId: c0, channelId: c1, guildId: c2 } = callback);
2026-08-05 07:35:12 +00:00
yield "PX_8";
2026-08-04 21:03:28 +00:00
let c6 = 1;
2026-08-05 07:35:12 +00:00
yield callback2(10843)(callback, callback2);
2026-08-04 21:03:28 +00:00
c6 = 0;
ensureGuildLoaded = participantFromServer;
if (null != dependencyMap) {
2026-08-05 07:35:12 +00:00
let PRIVATE_CHANNEL = callback(10846).EmbeddedActivityLocationKind.GUILD_CHANNEL;
2026-07-29 08:29:29 +00:00
} else {
2026-08-05 07:35:12 +00:00
PRIVATE_CHANNEL = callback(10846).EmbeddedActivityLocationKind.PRIVATE_CHANNEL;
2026-08-04 21:03:28 +00:00
}
const obj2 = callback2(709);
const obj3 = { type: "EMBEDDED_ACTIVITY_LAUNCH_FAIL", nonce: "", applicationId: null, channelId: null, guildId: null, error: null, locationKind: null };
obj3[2] = callback;
if (callback2 == null) {
callback2 = null;
}
obj3[3] = callback2;
if (dependencyMap == null) {
dependencyMap = null;
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
obj3[4] = dependencyMap;
2026-08-05 07:35:12 +00:00
const aPIError = new callback(4154).APIError(ensureGuildLoaded);
2026-08-04 21:03:28 +00:00
obj3[5] = aPIError;
obj3[6] = PRIVATE_CHANNEL;
obj2.dispatch(obj3);
2026-08-05 07:35:12 +00:00
yield "T";
2026-08-04 21:03:28 +00:00
c6 = 0;
return arg1;
2026-07-29 08:29:29 +00:00
})();
iter.next();
return iter;
});
const _getOrFetchApplicationForLaunch = tmp;
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
function _confirmActivityChange() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback((arg0) => {
let closure_0 = arg0;
let c2 = 0;
let c3 = 0;
const iter = (function*(arg0) {
let c0;
let c1;
let c2;
c1 = tmp2;
({ currentEmbeddedApplication: c0, shouldClosePopoutOnLeaveCurrentEmbeddedApplication: c1, onConfirmActivityLaunchChecksAlertOpen: c2 } = c0);
2026-08-05 07:35:12 +00:00
yield "PX_8";
2026-07-29 08:29:29 +00:00
if (1 === tmp5) {
if (arg0 === 1) {
2026-08-04 21:03:28 +00:00
let c3 = 3;
2026-07-29 08:29:29 +00:00
throw arg1;
} else if (arg0 === 2) {
c3 = 3;
const obj1 = { value: null, done: true };
obj1[0] = arg1;
return obj1;
} else if (null != c0) {
const promise = new Promise((arg0) => {
const _undefined = arg0;
const selfEmbeddedActivities = outer1_5.getSelfEmbeddedActivities();
const value = selfEmbeddedActivities.get(_undefined.id);
const _undefined2 = value;
let _location;
if (value != null) {
_location = value.location;
}
2026-08-05 07:35:12 +00:00
const channel = outer1_4.getChannel(_undefined(3873).getEmbeddedActivityLocationChannelId(_location));
2026-07-29 08:29:29 +00:00
if (null != value) {
if (null != channel) {
if (dependencyMap != null) {
dependencyMap();
}
2026-08-05 07:35:12 +00:00
_undefined2(10847)(tmp, channel, () => {
2026-07-29 08:29:29 +00:00
let obj = value(table[10])();
obj = { location: value.location, applicationId: lib.id, shouldClosePopout: value };
obj.leaveActivity(obj);
lib(true);
}, () => lib(false));
}
}
arg0(true);
});
c2 = 2;
c3 = 1;
const obj2 = { value: null, done: false };
obj2[0] = promise;
return obj2;
}
} else if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 3;
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else if (!arg1) {
c3 = 3;
return { value: false, done: true };
}
2026-08-04 21:03:28 +00:00
return true;
2026-07-29 08:29:29 +00:00
})();
iter.next();
return iter;
});
const _confirmActivityChange = tmp;
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
function _confirmActivityAgeGate() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback((arg0) => {
let closure_0 = arg0;
let c5 = 0;
let c6 = 0;
const iter = (function*(arg0) {
let c0;
let c2;
let c3;
let c4;
let closure_1;
if (c6 === 2) {
c6 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-05 07:35:12 +00:00
return { value: "T", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c6 = 2;
if (0 === obj) {
if (arg0 === 1) {
c6 = 3;
throw arg1;
} else if (arg0 === 2) {
c6 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c4 = tmp5;
let nsfwAllowed = tmp2;
c0 = undefined;
closure_1 = undefined;
let id;
nsfwAllowed = undefined;
c4 = undefined;
({ application: c0, applicationId: closure_1, channel: c2, user: c3, onConfirmActivityLaunchChecksAlertOpen: c4 } = c0);
obj = undefined;
obj = 1;
c6 = 1;
2026-08-05 07:35:12 +00:00
return { value: "PX_8", done: "Array" };
2026-07-29 08:29:29 +00:00
}
} else {
if (1 === tmp5) {
if (arg0 === 1) {
c6 = 3;
throw arg1;
} else if (arg0 === 2) {
c6 = 3;
const obj1 = { value: null, done: true };
obj1[0] = arg1;
return obj1;
} else {
if (null == nsfwAllowed.nsfwAllowed) {
closure_1 = c0;
if (c0 == null) {
const obj2 = { applicationId: null, channelId: null, guildId: null };
obj2[0] = closure_1;
id = undefined;
if (id != null) {
id = id.id;
}
obj2[1] = id;
let obj4 = id;
let guildId;
if (id != null) {
guildId = obj4.getGuildId();
}
id = guildId;
if (guildId == null) {
id = undefined;
}
obj2[2] = id;
obj = 2;
c6 = 1;
const obj3 = { value: null, done: false };
obj3[0] = closure_7(obj2);
return obj3;
}
}
c6 = 3;
return { value: true, done: true };
}
} else if (2 === tmp5) {
if (arg0 === 1) {
c6 = 3;
throw arg1;
} else if (arg0 === 2) {
c6 = 3;
obj4 = { value: null, done: true };
obj4[0] = arg1;
return obj4;
} else {
closure_1 = arg1;
}
} else if (arg0 === 1) {
c6 = 3;
throw arg1;
} else if (arg0 === 2) {
c6 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else if (!arg1) {
c6 = 3;
return { value: false, done: true };
}
obj = closure_1;
if (null == obj) {
c6 = 3;
return { value: false, done: true };
} else {
const embeddedActivityConfig = obj.embeddedActivityConfig;
let requires_age_gate;
if (embeddedActivityConfig != null) {
requires_age_gate = embeddedActivityConfig.requires_age_gate;
}
if (requires_age_gate != null) {
if (requires_age_gate) {
const promise = new Promise((arg0) => {
let closure_0 = arg0;
if (c4 != null) {
tmp();
}
let obj = _undefined(_undefined2[11]);
obj = { application: c5, channelId: null, onAgree: null, onDisagree: null };
let id;
if (_undefined2 != null) {
id = _undefined2.id;
}
obj[1] = id;
obj[2] = function onAgree() {
return callback(true);
};
obj[3] = function onDisagree() {
return callback(false);
};
const result = obj.confirmActivityAgeGateAlert(obj);
});
obj = 3;
c6 = 1;
const obj5 = { value: null, done: false };
obj5[0] = promise;
return obj5;
}
}
}
}
} catch (tmp28) {
c6 = tmp;
throw tmp28;
}
}
})();
iter.next();
return iter;
});
const _confirmActivityAgeGate = tmp;
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
function _confirmExternalAppLaunch() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback((arg0) => {
let closure_0 = arg0;
let c5 = 0;
let c6 = 0;
const iter = (function*(arg0) {
let c0;
let c2;
let c3;
let closure_1;
2026-08-04 21:03:28 +00:00
c3 = tmp2;
({ application: c0, applicationId: closure_1, channel: c2, onConfirmActivityLaunchChecksAlertOpen: c3 } = callback);
2026-08-05 07:35:12 +00:00
yield "PX_8";
2026-08-04 21:03:28 +00:00
if (1 === tmp5) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
2026-08-04 21:03:28 +00:00
let constants = 3;
2026-07-29 08:29:29 +00:00
throw arg1;
} else if (arg0 === 2) {
2026-08-04 21:03:28 +00:00
constants = 3;
let obj1 = { value: null, done: true };
obj1[0] = arg1;
return obj1;
2026-07-29 08:29:29 +00:00
} else {
2026-08-04 21:03:28 +00:00
closure_1 = callback;
if (callback == null) {
const obj2 = { applicationId: null, channelId: null, guildId: null };
obj2[0] = closure_1;
let id;
if (id != null) {
id = id.id;
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
obj2[1] = id;
const obj4 = id;
let guildId;
if (id != null) {
guildId = obj4.getGuildId();
}
id = guildId;
if (guildId == null) {
id = undefined;
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
obj2[2] = id;
let c5 = 2;
constants = 1;
const obj3 = { value: null, done: false };
obj3[0] = closure_7(obj2);
return obj3;
}
}
} else if (arg0 === 1) {
constants = 3;
throw arg1;
} else if (arg0 === 2) {
constants = 3;
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
closure_1 = arg1;
}
const isVerified = closure_1;
let tmp10 = null != isVerified;
if (tmp10) {
obj1 = callback(id[12]);
const hasApplicationFlagResult = obj1.hasApplicationFlag(isVerified, constants.EMBEDDED_RELEASED);
let tmp18 = !hasApplicationFlagResult;
if (!hasApplicationFlagResult) {
tmp18 = !isVerified.isVerified;
}
let tmp21 = !tmp18;
if (tmp18) {
let result = c5.hasActivityEverBeenLaunched(closure_1);
if (!result) {
result = new Promise((arg0) => {
let closure_0 = arg0;
if (c3 != null) {
tmp();
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
let obj = _undefined(_undefined2[13]);
obj = {
application: ensureGuildLoaded,
onConfirm() {
return callback(true);
},
onCancel() {
return callback(false);
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
};
const result = obj.confirmExternalAppLaunchAlert(obj);
});
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
tmp21 = result;
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
tmp10 = tmp21;
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
return tmp10;
2026-07-29 08:29:29 +00:00
})();
iter.next();
return iter;
});
const _confirmExternalAppLaunch = tmp;
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
function _confirmActivityLaunchChecks() {
2026-07-29 08:29:29 +00:00
let self = this;
const tmp = callback((arg0) => {
let closure_0 = arg0;
let c2 = 0;
let c3 = 0;
return (function*(arg0) {
2026-08-04 21:03:28 +00:00
let c1 = tmp2;
({ currentEmbeddedApplication: obj7[0], shouldClosePopoutOnLeaveCurrentEmbeddedApplication: obj7[1], onConfirmActivityLaunchChecksAlertOpen: obj7[2] } = closure_0);
const outer1_1 = yield (function confirmActivityChange(arg0) {
const self = this;
const apply = closure_9.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
2026-07-29 08:29:29 +00:00
} else {
2026-08-04 21:03:28 +00:00
applyArgumentsResult = apply(self, arguments);
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
return applyArgumentsResult;
})({ currentEmbeddedApplication: null, shouldClosePopoutOnLeaveCurrentEmbeddedApplication: null, onConfirmActivityLaunchChecksAlertOpen: null });
if (!outer1_1) {
return false;
}
let c2 = yield (function confirmActivityAgeGate(closure_0) {
const self = this;
const apply = closure_10.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
return applyArgumentsResult;
})(closure_0);
if (!c2) {
return false;
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
let c3 = yield (function confirmExternalAppLaunch(closure_0) {
const self = this;
const apply = closure_11.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
})(closure_0);
return c3;
2026-07-29 08:29:29 +00:00
})();
});
const _confirmActivityLaunchChecks = tmp;
let apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let result = require("participantFromServer").fileFinishedImporting("modules/activities/utils/confirmActivityLaunchChecks.tsx");
2026-07-20 16:05:17 +00:00
export const confirmActivityLaunchChecks = function confirmActivityLaunchChecks(arg0) {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _confirmActivityLaunchChecks.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
};