Files
discord-decomp/sources/modules/applications/installApplicationOnDemandIfNeeded.native.tsx
T
2026-07-27 16:20:00 +03:00

122 lines
6.5 KiB
TypeScript

/* Metro module 10658; source: modules/applications/installApplicationOnDemandIfNeeded.native.tsx; dependencies: [5, 4235, 4234, 661, 8063, 6772, 8042, 4863, 4015, 8870, 2] */
function _fun81978(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#81978, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10844:6, offset: 0x01ee60b7, size: 179 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(5) /* metro dependency 5 */;
const applicationRecord = importDefault(4235) /* metro dependency 4235: ApplicationRecord */;
const applicationStore = importDefault(4234) /* metro dependency 4234: ApplicationStore */;
const env0_5 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/applications/installApplicationOnDemandIfNeeded.native.tsx');
exports.installApplicationOnDemandIfNeeded = function() {
return _installApplicationOnDemandIfNeeded.apply(this, arguments);
};
}
function _installApplicationOnDemandIfNeeded() { // fn#81979, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10844:151, offset: 0x01ee616a, size: 50 bytes, params: 1, frame: 14
return env0_2(_fun81981).apply(this, arguments);
}
async function _fun81981({applicationId, channel, commandIntegrationTypes, appLauncherContext}) { // fn#81981, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10844:244, offset: 0x01ee61b0, size: 458 bytes, params: 2, frame: 22
var r10;
var scopes;
var Promise;
var application;
var value8;
var value9;
var USER_INSTALL;
var promise;
if (false) {
return undefined;
}
await undefined;
if (false) {
return undefined;
}
let binding = env2_0;
const value6 = binding(env2_1[4]);
if (value6.shouldInstallApplicationOnDemand({applicationId: applicationId, channel: channel,
commandIntegrationTypes: commandIntegrationTypes})) {
binding = env2_4;
application = binding.getApplication(applicationId);
if (application != null) {
r10 = application;
USER_INSTALL = env2_0(env2_1[6]).ApplicationIntegrationType.USER_INSTALL;
scopes = r10 == null || r10.integrationTypesConfig == null || (r10.integrationTypesConfig[USER_INSTALL] == null || r10.integrationTypesConfig[USER_INSTALL].oauth2InstallParams == null) ? value : r10.integrationTypesConfig[USER_INSTALL].oauth2InstallParams.scopes;
if (appLauncherContext != null) {
value = env2_0(env2_1[7]);
value.trackWithMetadata(env2_5.APP_LAUNCHER_OAUTH2_AUTHORIZE_OPENED, {application_id: applicationId,
location: appLauncherContext.location, section_name: appLauncherContext.sectionName,
source: appLauncherContext.entrypoint});
}
Promise = global.Promise;
value = Object.create(Promise.prototype, {constructor: {value: Promise}});
promise = new Promise(_fun81982);
return promise instanceof Object ? promise : value;
}
binding = env2_0;
value8 = binding(env2_1[5]);
await value8.fetchApplication(applicationId);
value9 = undefined;
if (false) {
return value9;
}
binding = env2_3;
r10 = binding.createFromServer(value9);
binding = env2_0;
USER_INSTALL = binding(env2_1[6]).ApplicationIntegrationType.USER_INSTALL;
scopes = r10 == null || r10.integrationTypesConfig == null || (r10.integrationTypesConfig[USER_INSTALL] == null || r10.integrationTypesConfig[USER_INSTALL].oauth2InstallParams == null) ? value : r10.integrationTypesConfig[USER_INSTALL].oauth2InstallParams.scopes;
if (appLauncherContext != null) {
value = env2_0(env2_1[7]);
value.trackWithMetadata(env2_5.APP_LAUNCHER_OAUTH2_AUTHORIZE_OPENED, {application_id: applicationId,
location: appLauncherContext.location, section_name: appLauncherContext.sectionName,
source: appLauncherContext.entrypoint});
}
Promise = global.Promise;
value = Object.create(Promise.prototype, {constructor: {value: Promise}});
promise = new Promise(_fun81982);
return promise instanceof Object ? promise : value;
}
Promise = global.Promise;
return Promise.resolve({isAuthorized: true});
}
function _fun81982(a0) { // fn#81982, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10844:930, offset: 0x01ee637a, size: 113 bytes, params: 2, frame: 15
var environment;
const env0_0 = a0;
const value = environment.__proto__.__proto__.__proto__;
const binding = env3_0;
const binding2 = env3_1;
binding(binding2[8]).dismissKeyboard();
binding(binding2[9]).openOAuth2Modal({clientId: applicationId, integrationType: USER_INSTALL, scopes: scopes,
callback: callback_81983});
}
function callback_81983({location}) { // fn#81983, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10844:1032, offset: 0x01ee63eb, size: 172 bytes, params: 2, frame: 15
var value;
var appLauncherContextBinding;
var value2;
var value3;
var trackWithMetadata;
var APP_LAUNCHER_OAUTH2_AUTHORIZE_SUCCEEDED;
if (location != null) {
value = environment.__proto__;
appLauncherContextBinding = appLauncherContext;
if (appLauncherContextBinding != null) {
value2 = environment.__proto__.__proto__.__proto__.__proto__;
value3 = env4_0(env4_1[7]);
trackWithMetadata = value3.trackWithMetadata;
APP_LAUNCHER_OAUTH2_AUTHORIZE_SUCCEEDED = env4_5.APP_LAUNCHER_OAUTH2_AUTHORIZE_SUCCEEDED;
appLauncherContextBinding = appLauncherContext;
Reflect.apply(trackWithMetadata, value3, [APP_LAUNCHER_OAUTH2_AUTHORIZE_SUCCEEDED,
{application_id: applicationId,
location: appLauncherContextBinding.location, section_name: appLauncherContextBinding.sectionName,
source: appLauncherContextBinding.entrypoint}]);
}
env0_0({isAuthorized: true});
} else {
env0_0({isAuthorized: false});
}
}