Files
discord-decomp/sources/modules/interaction_components/InteractionModalManager.tsx
T
2026-07-28 01:06:53 +03:00

200 lines
12 KiB
TypeScript

/* Metro module 15734; source: modules/interaction_components/InteractionModalManager.tsx; dependencies: [7, 6, 15, 17, 18, 5, 4234, 8057, 661, 1909, 15735, 1962, 683, 1870, 1216, 15746, 15749, 4860, 2] */
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import AnalyticsUtils from '../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
import ApplicationStore from '../applications/ApplicationStore.tsx'; /* Metro dependency 4234 */
import AutomaticLifecycleManager from '../../lib/AutomaticLifecycleManager.tsx'; /* Metro dependency 4860 */
import InteractionStore from '../interactions/InteractionStore.tsx'; /* Metro dependency 8057 */
import OpenInteractionIframeModalNative from './openInteractionIframeModal.native.tsx'; /* Metro dependency 15746 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
function _fun120806(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120806, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15942:6, offset: 0x02536057, size: 325 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = AutomaticLifecycleManager;
value = _fun120815(value);
value = new value();
(FileImportTrackerModule).fileFinishedImporting('modules/interaction_components/InteractionModalManager.tsx');
exports.default = value;
exports.INTERACTION_IFRAME_MODAL_ANALYTICS_TYPE = 'interaction_iframe_modal';
function _isNativeReflectConstruct_120807() { // fn#120807, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15942:203, offset: 0x0253619c, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_120807_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _handleInteractionModalCreate() { // fn#120810, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15942:429, offset: 0x025361fe, size: 50 bytes, params: 1, frame: 14
return Module00005(_fun120812).apply(this, arguments);
function* _fun120812(a0) { // fn#120812, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15942:510, offset: 0x0253623b, size: 265 bytes, params: 2, frame: 20
var environment;
if (true) {
value = environment.__proto__.__proto__;
var binding = env2_0;
var binding2 = env2_2;
yield binding(binding2[11])(binding2[10], binding2.paths);
var value4 = undefined;
if (false) {
return value4;
}
value4.openInteractionModal(a0);
binding = env2_1;
var binding3 = env2_2;
var value6 = binding(binding3[12]);
var track = value6.track;
var OPEN_MODAL = env2_11.OPEN_MODAL;
Reflect.apply(track, value6, [OPEN_MODAL, {type: 'interaction_modal', application_id: a0.application.id}]);
var AndroidPullModeRenderingExperiment = env2_0(binding3[13]).AndroidPullModeRenderingExperiment;
var getCurrentConfig = AndroidPullModeRenderingExperiment.getCurrentConfig;
if (Reflect.apply(getCurrentConfig, AndroidPullModeRenderingExperiment, []).treatmentId >= 2) {
env2_1(env2_2[14]).addBreadcrumb({'category': 'interaction_modal', 'message': 'Interaction modal opened',
data: getInteractionModalDebugData(a0)});
}
}
function getInteractionModalDebugData(a0) { // fn#120813, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15942:759, offset: 0x02536344, size: 410 bytes, params: 2, frame: 17
var environment;
const value = environment.__proto__.__proto__.__proto__;
const interactionDebugContext = env3_10.getInteractionDebugContext(a0.nonce);
const value3 = undefined;
const data = interactionDebugContext == null ? value3 : interactionDebugContext.interaction.data;
const application = env3_9.getApplication(a0.application.id);
const object = {};
object.interactionId = a0.id;
object.nonce = a0.nonce;
object.channelId = a0.channelId;
object.applicationId = a0.application.id;
object.hasApplicationRecord = application != null;
object.hasActionApplicationBot = a0.application.bot != null;
object.componentCount = a0.components.length;
object.componentTypes = a0.components.map(function(a0) {
return a0.type;
});
let interactionType = data == null ? value3 : data.interactionType;
object.sourceInteractionType = interactionType;
object.sourceApplicationId = data == null ? value3 : data.applicationId;
object.sourceMessageId = interactionDebugContext == null ? value3 : interactionDebugContext.messageId;
interactionType = data == null ? value3 : data.interactionType;
let InteractionTypes = env3_0(env3_2[9]).InteractionTypes;
let MESSAGE_COMPONENT = InteractionTypes.MESSAGE_COMPONENT;
object.hasSourceCustomId = interactionType !== MESSAGE_COMPONENT ? value3 : data.customId != null;
interactionType = data == null ? value3 : data.interactionType;
InteractionTypes = env3_0(env3_2[9]).InteractionTypes;
MESSAGE_COMPONENT = InteractionTypes.MESSAGE_COMPONENT;
object.hasSourceComponentId = interactionType !== MESSAGE_COMPONENT ? value3 : data.componentId != null;
return object;
}
}
}
function _fun120815(a0) { // fn#120815, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15942:1701, offset: 0x025364de, size: 42 bytes, params: 2, frame: 14
const InteractionModalManager2 = InteractionModalManager;
Inherits(InteractionModalManager2, a0);
return CreateClass(InteractionModalManager2);
function InteractionModalManager(a0) { // fn#120816, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15942:1713, offset: 0x02536508, size: 194 bytes, params: 2, frame: 20
var environment;
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let value2 = environment.__proto__;
let binding = env1_4;
binding(this, InteractionModalManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_6(InteractionModalManager);
binding = env1_5;
if (_isNativeReflectConstruct_120807()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_6(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
value.iframeModalOpenTimeMs = undefined;
value.actions = {INTERACTION_MODAL_CREATE: function(a0) {
_fun120818(a0);
}, INTERACTION_IFRAME_MODAL_CREATE: INTERACTION_IFRAME_MODAL_CREATE_120819,
INTERACTION_IFRAME_MODAL_CLOSE: INTERACTION_IFRAME_MODAL_CLOSE_120820,
RPC_APP_DISCONNECTED: function({application}) {
var value2 = InteractionStore.getIFrameModalApplicationId();
if (application.id === value2 && value2 != null) {
importDefault(dependencyMap[16])(value2, InteractionStore.getIFrameModalKey());
}
}};
return value;
function InteractionModalManagerINTERACTION_MODAL_CREATE(a0) { // fn#120817, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15942:2035, owner: InteractionModalManager.INTERACTION_MODAL_CREATE, offset: 0x025365ca, size: 24 bytes, params: 2, frame: 11
(function() {
return _handleInteractionModalCreate.apply(this, arguments);
})(a0);
function INTERACTION_MODAL_CREATEHandleInteractionModalCreate() { // fn#120818, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15942:2040, owner: InteractionModalManager.INTERACTION_MODAL_CREATE.handleInteractionModalCreate, offset: 0x01d570a1, size: 30 bytes, params: 1, frame: 13
return _handleInteractionModalCreate.apply(this, arguments);
}
}
function InteractionModalManagerINTERACTION_IFRAME_MODAL_CREATE(a0) { // fn#120819, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15942:2176, owner: InteractionModalManager.INTERACTION_IFRAME_MODAL_CREATE, offset: 0x025365e2, size: 125 bytes, params: 2, frame: 16
const binding = env0_0;
const Date = global.Date;
binding.iframeModalOpenTimeMs = Date.now();
(OpenInteractionIframeModalNative)(a0);
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const OPEN_MODAL = AnalyticEvents.OPEN_MODAL;
Reflect.apply(track, defaultImport, [OPEN_MODAL, {type: 'interaction_iframe_modal',
application_id: a0.application.id}]);
}
function InteractionModalManagerINTERACTION_IFRAME_MODAL_CLOSE({applicationId}) { // fn#120820, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15942:2380, owner: InteractionModalManager.INTERACTION_IFRAME_MODAL_CLOSE, offset: 0x0253665f, size: 129 bytes, params: 2, frame: 17
const binding = env0_0;
const iframeModalOpenTimeMs = binding.iframeModalOpenTimeMs;
const r6 = iframeModalOpenTimeMs != null ? global.Date.now() - iframeModalOpenTimeMs : undefined;
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const MODAL_DISMISSED = AnalyticEvents.MODAL_DISMISSED;
Reflect.apply(track, defaultImport, [MODAL_DISMISSED, {type: 'interaction_iframe_modal',
application_id: applicationId, duration_open_ms: r6}]);
binding.iframeModalOpenTimeMs = undefined;
}
}
}
}
global.__d(_fun120806, 15734, [7, 6, 15, 17, 18, 5, 4234, 8057, 661, 1909, 15735, 1962, 683, 1870, 1216, 15746,
15749, 4860,
2]) /* metro module 15734, dependencies: [7, 6, 15, 17, 18, 5, 4234, 8057, 661, 1909, 15735, 1962, 683, 1870, 1216, 15746, 15749, 4860, 2] */;