decord/source/utils/native/ApplicationUtils.tsx

141 lines
4.9 KiB
TypeScript
Raw Normal View History

2026-07-27 11:26:19 +00:00
// Module ID: 10938
// Function ID: 84995
2026-07-20 16:05:17 +00:00
// Name: openOAuth2Modal
2026-07-27 11:26:19 +00:00
// Dependencies: [653, 10615, 675, 8138, 3828, 10939, 483, 4338, 9956, 1935, 8112, 2]
2026-07-20 16:05:17 +00:00
// Exports: installApplication, installPrivateChannelIntegration
2026-07-27 11:26:19 +00:00
// Module 10938 (openOAuth2Modal)
2026-07-23 10:11:24 +00:00
import { AnalyticEvents } from "ME";
import { OAUTH2_AUTHORIZE_MODAL_KEY as closure_5 } from "OAUTH2_AUTHORIZE_MODAL_KEY";
2026-07-20 16:05:17 +00:00
function openOAuth2Modal(arg0) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-07-25 08:10:48 +00:00
let obj = importDefault(4338);
2026-07-20 16:05:17 +00:00
obj.popWithKey(closure_5);
obj = {};
2026-07-25 08:10:48 +00:00
const obj2 = importDefault(4338);
2026-07-20 16:05:17 +00:00
const merged = Object.assign(arg0);
obj["dismissOAuthModal"] = function dismissOAuthModal() {
2026-07-23 10:11:24 +00:00
if (null != closure_0.dismissOAuthModal) {
closure_0.dismissOAuthModal();
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
outer1_1(outer1_3[7]).popWithKey(outer1_5);
2026-07-20 16:05:17 +00:00
};
2026-07-25 08:10:48 +00:00
obj2.pushLazy(_require(1935)(9956, dependencyMap.paths), obj, closure_5);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const result = require("expandLocation").fileFinishedImporting("utils/native/ApplicationUtils.tsx");
2026-07-20 16:05:17 +00:00
export const installApplication = function installApplication(arg0) {
let applicationId;
let channelId;
let customInstallUrl;
let disableGuildSelect;
let guildId;
2026-07-23 10:11:24 +00:00
let importDefault;
2026-07-20 16:05:17 +00:00
let installParams;
let integrationTypesConfig;
let source;
({ applicationId, customInstallUrl } = arg0);
2026-07-23 10:11:24 +00:00
({ installParams, integrationTypesConfig, guildId, channelId, disableGuildSelect, source, oauth2Callback: importDefault } = arg0);
2026-07-20 16:05:17 +00:00
if (null != customInstallUrl) {
let obj = { application_id: applicationId, auth_type: "custom_url", source, device_platform: "mobile_native" };
2026-07-23 10:11:24 +00:00
importDefault(675).track(AnalyticEvents.APPLICATION_ADD_TO_SERVER_CLICKED, obj);
const obj6 = importDefault(675);
2026-07-20 16:05:17 +00:00
obj = {
href: customInstallUrl,
onConfirm() {
2026-07-23 10:11:24 +00:00
outer1_1(outer1_3[4]).openURL(customInstallUrl);
2026-07-20 16:05:17 +00:00
}
};
2026-07-25 08:10:48 +00:00
return customInstallUrl(8138).handleClick(obj);
2026-07-20 16:05:17 +00:00
} else {
if (null != integrationTypesConfig) {
const _Object = Object;
const values = Object.values(integrationTypesConfig);
if (values.some((oauth2_install_params) => {
let prop;
if (null != oauth2_install_params) {
prop = oauth2_install_params.oauth2_install_params;
}
let tmp2 = null != prop;
if (!tmp2) {
let oauth2InstallParams;
if (null != oauth2_install_params) {
oauth2InstallParams = oauth2_install_params.oauth2InstallParams;
}
tmp2 = null != oauth2InstallParams;
}
return tmp2;
})) {
2026-07-23 10:11:24 +00:00
let obj2 = importDefault(675);
2026-07-20 16:05:17 +00:00
let obj1 = { application_id: applicationId, auth_type: "in_app", source, device_platform: "mobile_native" };
obj2.track(AnalyticEvents.APPLICATION_ADD_TO_SERVER_CLICKED, obj1);
obj2 = {
clientId: applicationId,
guildId,
channelId,
disableGuildSelect,
callback(arg0) {
2026-07-23 10:11:24 +00:00
outer1_1(outer1_3[5])(arg0);
2026-07-20 16:05:17 +00:00
if (null != callback) {
callback(arg0);
}
}
};
openOAuth2Modal(obj2);
}
}
if (null != installParams) {
const obj3 = { application_id: applicationId, auth_type: "in_app", source, device_platform: "mobile_native" };
2026-07-23 10:11:24 +00:00
importDefault(675).track(AnalyticEvents.APPLICATION_ADD_TO_SERVER_CLICKED, obj3);
2026-07-20 16:05:17 +00:00
const obj4 = { clientId: applicationId, guildId, channelId, disableGuildSelect };
let scopes;
if (null != installParams) {
scopes = installParams.scopes;
}
obj4.scopes = scopes;
let permissions;
if (null != installParams) {
permissions = installParams.permissions;
}
let deserializeResult;
if (null != permissions) {
2026-07-23 10:11:24 +00:00
obj1 = importAll(483);
2026-07-20 16:05:17 +00:00
let permissions1;
if (null != installParams) {
permissions1 = installParams.permissions;
}
deserializeResult = obj1.deserialize(permissions1);
}
obj4.permissions = deserializeResult;
obj4.callback = function callback(arg0) {
2026-07-23 10:11:24 +00:00
outer1_1(outer1_3[5])(arg0);
2026-07-20 16:05:17 +00:00
if (null != callback) {
callback(arg0);
}
};
openOAuth2Modal(obj4);
2026-07-23 10:11:24 +00:00
const obj10 = importDefault(675);
2026-07-20 16:05:17 +00:00
const tmp24 = openOAuth2Modal;
}
}
};
export { openOAuth2Modal };
export const installPrivateChannelIntegration = function installPrivateChannelIntegration(arg0) {
let applicationId;
let callback;
let channelId;
({ applicationId, channelId, callback } = arg0);
2026-07-25 08:10:48 +00:00
let obj = importDefault(4338);
2026-07-20 16:05:17 +00:00
obj = { clientId: applicationId };
2026-07-25 08:10:48 +00:00
const items = [require(8112) /* set */.OAuth2Scopes.APPLICATIONS_COMMANDS];
2026-07-20 16:05:17 +00:00
obj.scopes = items;
obj.channelId = channelId;
obj.dismissOAuthModal = function dismissOAuthModal() {
2026-07-23 10:11:24 +00:00
return outer1_1(outer1_3[7]).popWithKey(outer1_5);
2026-07-20 16:05:17 +00:00
};
obj.disableGuildSelect = true;
obj.callback = callback;
2026-07-25 08:10:48 +00:00
obj.pushLazy(require(1935) /* maybeLoadBundle */(9956, dependencyMap.paths), obj, closure_5);
2026-07-20 16:05:17 +00:00
};