Files
discord-decomp/sources/modules/interaction_components/InteractionModalManager.tsx
T
2026-07-27 16:20:00 +03:00

188 lines
10 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] */
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});
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(6) /* metro dependency 6 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
const env0_8 = importDefault(5) /* metro dependency 5 */;
const applicationStore = importDefault(4234) /* metro dependency 4234: ApplicationStore */;
const interactionStore = importDefault(8057) /* metro dependency 8057: InteractionStore */;
const env0_11 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
let value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
value = _fun120815(value);
value = new value();
(require(2) /* metro dependency 2 */).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 env0_8(_fun120812).apply(this, arguments);
}
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 closure = InteractionModalManager;
env0_7(closure, a0);
return env0_3(closure);
}
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 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 items = [];
arraySpread(items, value, 0, items);
value = env1_6(InteractionModalManager);
binding = env1_5;
if (_isNativeReflectConstruct_120807()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items, env1_6(this).constructor);
r0 = value;
} else {
value = value.apply(this, items);
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 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 object2 = {};
object2.interactionId = a0.id;
object2.nonce = a0.nonce;
object2.channelId = a0.channelId;
object2.applicationId = a0.application.id;
object2.hasApplicationRecord = application != null;
object2.hasActionApplicationBot = a0.application.bot != null;
object2.componentCount = a0.components.length;
object2.componentTypes = a0.components.map(function(a0) {
return a0.type;
});
let interactionType = data == null ? value3 : data.interactionType;
object2.sourceInteractionType = interactionType;
object2.sourceApplicationId = data == null ? value3 : data.applicationId;
object2.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;
object2.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;
object2.hasSourceComponentId = interactionType !== MESSAGE_COMPONENT ? value3 : data.componentId != null;
return object2;
}
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 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();
(importDefault(15746) /* metro dependency 15746: openInteractionIframeModalNative */)(a0);
const defaultImport = importDefault(683) /* metro dependency 683: 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 = importDefault(683) /* metro dependency 683: 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;
}