148 lines
8.4 KiB
TypeScript
148 lines
8.4 KiB
TypeScript
/* Metro module 8870; source: utils/native/ApplicationUtils.tsx; dependencies: [661, 8871, 683, 8872, 3853, 10203, 483, 5080, 10206, 1962, 4122, 2] */
|
|
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 closure = openOAuth2Modal;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_4 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
|
|
const env0_5 = (require(8871) /* metro dependency 8871: Constants */).OAUTH2_AUTHORIZE_MODAL_KEY;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('utils/native/ApplicationUtils.tsx');
|
|
exports.installApplication = installApplication;
|
|
exports.openOAuth2Modal = closure;
|
|
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 object2 = {};
|
|
copyDataProperties(object2, a0, undefined);
|
|
object2['dismissOAuthModal'] = openOAuth2ModalDismissOAuthModal;
|
|
Reflect.apply(pushLazy, defaultImport2, [value2, object2, 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 object2;
|
|
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});
|
|
}
|
|
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;
|
|
object2 = {clientId: applicationId, guildId: guildId, channelId: channelId,
|
|
disableGuildSelect: disableGuildSelect};
|
|
object2.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;
|
|
}
|
|
object2.permissions = r8;
|
|
object2.callback = function(a0) {
|
|
importDefault(dependencyMap[5])(a0);
|
|
if (oauth2Callback != null) {
|
|
oauth2Callback(a0);
|
|
}
|
|
};
|
|
openOAuth2ModalBinding(object2);
|
|
}
|
|
} 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;
|
|
object2 = {clientId: applicationId, guildId: guildId, channelId: channelId,
|
|
disableGuildSelect: disableGuildSelect};
|
|
object2.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;
|
|
}
|
|
object2.permissions = r8;
|
|
object2.callback = function(a0) {
|
|
importDefault(dependencyMap[5])(a0);
|
|
if (oauth2Callback != null) {
|
|
oauth2Callback(a0);
|
|
}
|
|
};
|
|
openOAuth2ModalBinding(object2);
|
|
}
|
|
}
|
|
}
|
|
|
|
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 object2 = {clientId: applicationId};
|
|
const OAuth2Scopes = require(dependencyMap[10]).OAuth2Scopes;
|
|
const APPLICATIONS_COMMANDS = OAuth2Scopes.APPLICATIONS_COMMANDS;
|
|
object2.scopes = [APPLICATIONS_COMMANDS];
|
|
object2.channelId = channelId;
|
|
object2.dismissOAuthModal = function() {
|
|
return importDefault(dependencyMap[7]).popWithKey(OAUTH2_AUTHORIZE_MODAL_KEY);
|
|
};
|
|
object2.disableGuildSelect = true;
|
|
object2.callback = callback;
|
|
Reflect.apply(pushLazy, defaultImport, [value2, object2, 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();
|
|
}
|
|
(importDefault(5080) /* metro dependency 5080: ModalActionCreators */).popWithKey(OAUTH2_AUTHORIZE_MODAL_KEY);
|
|
}
|
|
|
|
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
|
|
(importDefault(10203) /* metro dependency 10203: authorizeCallback */)(a0);
|
|
if (oauth2Callback != null) {
|
|
oauth2Callback(a0);
|
|
}
|
|
}
|
|
|