/* Metro module 8870; source: utils/native/ApplicationUtils.tsx; dependencies: [661, 8871, 683, 8872, 3853, 10203, 483, 5080, 10206, 1962, 4122, 2] */ import ModalActionCreators from '../../actions/ModalActionCreators.tsx'; /* Metro dependency 5080 */ import AuthorizeCallback from '../../modules/oauth2/native/authorizeCallback.tsx'; /* Metro dependency 10203 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as ConstantsModule2 from '../../modules/oauth2/native/Constants.tsx'; /* Metro dependency 8871 */ function _fun69146(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69146, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9055:6, offset: 0x01c6ace9, size: 185 bytes, params: 8, frame: 19 const env0_0 = require; const openOAuth2Modal2 = openOAuth2Modal; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('utils/native/ApplicationUtils.tsx'); exports.installApplication = installApplication; exports.openOAuth2Modal = openOAuth2Modal2; exports.installPrivateChannelIntegration = installPrivateChannelIntegration; function openOAuth2Modal(a0) { // fn#69147, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9055:158, offset: 0x01c6ada2, size: 139 bytes, params: 2, frame: 20 const env0_0 = a0; importDefault(dependencyMap[7]).popWithKey(OAUTH2_AUTHORIZE_MODAL_KEY); const defaultImport2 = importDefault(dependencyMap[7]); const pushLazy = defaultImport2.pushLazy; const value2 = require(dependencyMap[9])(dependencyMap[8], dependencyMap.paths); const object = {}; copyDataProperties(object, a0, undefined); object['dismissOAuthModal'] = openOAuth2ModalDismissOAuthModal; Reflect.apply(pushLazy, defaultImport2, [value2, object, OAUTH2_AUTHORIZE_MODAL_KEY]); function openOAuth2ModalDismissOAuthModal() { // fn#69148, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9055:271, owner: openOAuth2Modal.dismissOAuthModal, offset: 0x01c6ae2d, size: 75 bytes, params: 1, frame: 12 if (env0_0.dismissOAuthModal != null) { env0_0.dismissOAuthModal(); } (ModalActionCreators).popWithKey(OAUTH2_AUTHORIZE_MODAL_KEY); } } function installApplication({applicationId, customInstallUrl, installParams, integrationTypesConfig, guildId, channelId, disableGuildSelect, source, oauth2Callback}) { // fn#69149, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9055:441, offset: 0x01c6ae78, size: 591 bytes, params: 2, frame: 25 var r8; var value; var value2; var defaultImport; var object; var openOAuth2ModalBinding; var defaultImport2; var defaultImport3; if (customInstallUrl != null) { defaultImport3 = importDefault(683) /* metro dependency 683: AnalyticsUtils */; defaultImport3.track(AnalyticEvents.APPLICATION_ADD_TO_SERVER_CLICKED, {application_id: applicationId, auth_type: 'custom_url', source: source, device_platform: 'mobile_native'}); return (require(8872) /* metro dependency 8872: MaskedLinkUtils */).handleClick({href: customInstallUrl, onConfirm: onConfirm_69150}); } if (integrationTypesConfig == null) { if (installParams != null) { value2 = undefined; defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; defaultImport.track(AnalyticEvents.APPLICATION_ADD_TO_SERVER_CLICKED, {application_id: applicationId, auth_type: 'in_app', source: source, device_platform: 'mobile_native'}); openOAuth2ModalBinding = openOAuth2Modal; object = {clientId: applicationId, guildId: guildId, channelId: channelId, disableGuildSelect: disableGuildSelect}; object.scopes = installParams == null ? value2 : installParams.scopes; if ((installParams == null ? value2 : installParams.permissions) != null) { value = importAll(483) /* metro dependency 483: BigFlagUtils */; value = value.deserialize(installParams == null ? value2 : installParams.permissions); r8 = value; } else { r8 = value2; } object.permissions = r8; object.callback = function(a0) { importDefault(dependencyMap[5])(a0); if (oauth2Callback != null) { oauth2Callback(a0); } }; openOAuth2ModalBinding(object); } } else { var Object = global.Object; value = Object.values(integrationTypesConfig); if (value.some(function(a0) { var value = undefined; return (a0 == null ? value : a0.oauth2_install_params) != null || (a0 == null ? value : a0.oauth2InstallParams) != null; })) { defaultImport2 = importDefault(683) /* metro dependency 683: AnalyticsUtils */; defaultImport2.track(AnalyticEvents.APPLICATION_ADD_TO_SERVER_CLICKED, {application_id: applicationId, auth_type: 'in_app', source: source, device_platform: 'mobile_native'}); openOAuth2Modal({clientId: applicationId, guildId: guildId, channelId: channelId, disableGuildSelect: disableGuildSelect, callback: callback_69152}); return undefined; } if (installParams != null) { value2 = undefined; defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; defaultImport.track(AnalyticEvents.APPLICATION_ADD_TO_SERVER_CLICKED, {application_id: applicationId, auth_type: 'in_app', source: source, device_platform: 'mobile_native'}); openOAuth2ModalBinding = openOAuth2Modal; object = {clientId: applicationId, guildId: guildId, channelId: channelId, disableGuildSelect: disableGuildSelect}; object.scopes = installParams == null ? value2 : installParams.scopes; if ((installParams == null ? value2 : installParams.permissions) != null) { value = importAll(483) /* metro dependency 483: BigFlagUtils */; value = value.deserialize(installParams == null ? value2 : installParams.permissions); r8 = value; } else { r8 = value2; } object.permissions = r8; object.callback = function(a0) { importDefault(dependencyMap[5])(a0); if (oauth2Callback != null) { oauth2Callback(a0); } }; openOAuth2ModalBinding(object); } } function installApplicationOnConfirm() { // fn#69150, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9055:807, owner: installApplication.onConfirm, offset: 0x01c6b0c7, size: 45 bytes, params: 1, frame: 12 let value = environment.__proto__; value = importDefault(3853) /* metro dependency 3853: Linking */; value.openURL(customInstallUrl); } function installApplicationCallback(a0) { // fn#69152, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9055:1189, owner: installApplication.callback, offset: 0x01c6b0f4, size: 57 bytes, params: 2, frame: 13 (AuthorizeCallback)(a0); if (oauth2Callback != null) { oauth2Callback(a0); } } } function installPrivateChannelIntegration({applicationId, channelId, callback}) { // fn#69154, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9055:1681, offset: 0x01c6b12d, size: 171 bytes, params: 2, frame: 22 const defaultImport = importDefault(dependencyMap[7]); const pushLazy = defaultImport.pushLazy; const value2 = require(dependencyMap[9])(dependencyMap[8], dependencyMap.paths); const object = {clientId: applicationId}; const OAuth2Scopes = require(dependencyMap[10]).OAuth2Scopes; const APPLICATIONS_COMMANDS = OAuth2Scopes.APPLICATIONS_COMMANDS; object.scopes = [APPLICATIONS_COMMANDS]; object.channelId = channelId; object.dismissOAuthModal = function() { return importDefault(dependencyMap[7]).popWithKey(OAUTH2_AUTHORIZE_MODAL_KEY); }; object.disableGuildSelect = true; object.callback = callback; Reflect.apply(pushLazy, defaultImport, [value2, object, OAUTH2_AUTHORIZE_MODAL_KEY]); } } global.__d(_fun69146, 8870, [661, 8871, 683, 8872, 3853, 10203, 483, 5080, 10206, 1962, 4122, 2]) /* metro module 8870, dependencies: [661, 8871, 683, 8872, 3853, 10203, 483, 5080, 10206, 1962, 4122, 2] */;