Files
discord-decomp/sources/modules/activities/utils/CustomActivityLinkUtils.tsx
T
2026-07-27 16:20:00 +03:00

219 lines
7.6 KiB
TypeScript

/* Metro module 9468; source: modules/activities/utils/CustomActivityLinkUtils.tsx; dependencies: [5, 9469, 661, 9471, 507, 694, 2] */
function _fun73625(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#73625, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9654:6, offset: 0x01d73770, size: 283 bytes, params: 8, frame: 22
const env0_0 = require;
const closure = function() {
return _fetchCustomActivityLink.apply(this, arguments);
};
const closure2 = function() {
return _loadCustomActivityLink.apply(this, arguments);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(5) /* metro dependency 5 */;
const customActivityLinksStore = importDefault(9469) /* metro dependency 9469: CustomActivityLinksStore */;
const env0_5 = (require(661) /* metro dependency 661: Constants */).Endpoints;
const Set = global.Set;
const set = new Set();
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/activities/utils/CustomActivityLinkUtils.tsx');
exports.fetchCustomActivityLink = closure;
exports.getCustomActivityLinkParams = function() {
return _getCustomActivityLinkParams.apply(this, arguments);
};
exports.getQuickLinkImage = function(a0) {
if (a0 != null) {
return '' + global.location.protocol + '//' + global.window.GLOBAL_ENV.CDN_HOST + '/attachments-quick-links/' + a0;
}
};
exports.loadCustomActivityLink = closure2;
exports.getOrFetchCustomActivityLink = getOrFetchCustomActivityLink;
}
function _fetchCustomActivityLink() { // fn#73627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9654:225, offset: 0x01d7388b, size: 50 bytes, params: 1, frame: 14
return env0_3(_fun73629).apply(this, arguments);
}
function _getCustomActivityLinkParams() { // fn#73630, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9654:779, offset: 0x01d73a22, size: 50 bytes, params: 1, frame: 14
return env0_3(_fun73632).apply(this, arguments);
}
function _loadCustomActivityLink() { // fn#73634, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9654:1206, offset: 0x01d73aef, size: 50 bytes, params: 1, frame: 14
return env0_3(_fun73636).apply(this, arguments);
}
function getOrFetchCustomActivityLink(a0, a1) { // fn#73639, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9654:2089, offset: 0x01d73c28, size: 82 bytes, params: 3, frame: 16
var r0;
var binding;
const one = CustomActivityLinksStore.getOne(a0, a1);
const value3 = null;
if (value3 != one) {
r0 = one;
} else {
binding = env0_6;
if (binding.has(a1)) {
r0 = value3;
} else {
loadCustomActivityLink(a0, a1);
env0_6.add(a1);
r0 = value3;
}
}
return r0;
}
function* _fun73629(a0, a1) { // fn#73629, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9654:296, offset: 0x01d738c8, size: 346 bytes, params: 3, frame: 21
var HTTP;
var get;
let value = undefined;
if (false) {
return value;
}
if (a0 != null) {
if (a1 == null) {
return null;
}
value = environment.__proto__.__proto__;
var binding = env2_0;
var value4 = binding(env2_2[3]).decodeCustomActivityLink(a1);
if (value4 == null) {
return null;
}
var type = value4.type;
binding = env2_0;
var CustomLinkType = binding(env2_2[3]).CustomLinkType;
var MANAGED = CustomLinkType.MANAGED;
if (MANAGED === type) {
binding = env2_0;
HTTP = binding(env2_2[4]).HTTP;
get = HTTP.get;
binding = env2_5;
yield Reflect.apply(get, HTTP, [{url: binding.APPLICATION_MANAGED_ACTIVITY_LINK(a0, value4.decodedLinkId),
rejectWithError: false}]);
value = undefined;
if (false) {
return value;
}
return value.body;
}
binding = env2_0;
CustomLinkType = binding(env2_2[3]).CustomLinkType;
var QUICK = CustomLinkType.QUICK;
if (QUICK === type) {
binding = env2_0;
HTTP = binding(env2_2[4]).HTTP;
get = HTTP.get;
binding = env2_5;
yield Reflect.apply(get, HTTP, [{url: binding.APPLICATION_QUICK_ACTIVITY_LINK(a0, value4.decodedLinkId),
rejectWithError: false}]);
value = undefined;
if (false) {
return value;
}
return value.body;
}
value4.type;
}
return null;
}
function* _fun73632(a0, a1, a2) { // fn#73632, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9654:858, offset: 0x01d73a5f, size: 144 bytes, params: 4, frame: 18
var r4;
var binding;
var value5;
var value6;
var object2;
var custom_id;
var error;
let value = a2;
if (false) {
return undefined;
}
const value4 = undefined;
const r2 = value ?? value4;
if (a1 == null) {
return {customId: r2};
}
if (r2 != null) {
return {customId: r2};
}
value = environment.__proto__.__proto__;
try {
binding = env2_7;
} catch (error) {
return {customId: value4};
}
try {
value = binding(a0, a1);
} catch (error) {
return {customId: value4};
}
yield value;
try {
value = undefined;
value5 = false;
} catch (error) {
return {customId: value4};
}
if (value5) {
return value;
}
try {
value6 = value == null;
} catch (error) {
return {customId: value4};
}
if (value6) {
try {
object2 = {};
} catch (error) {
return {customId: value4};
}
try {
object2.customId = value4;
} catch (error) {
return {customId: value4};
}
r4 = object2;
} else {
try {
object2 = {};
} catch (error) {
return {customId: value4};
}
try {
custom_id = value.custom_id;
} catch (error) {
return {customId: value4};
}
try {
object2.customId = custom_id;
} catch (error) {
return {customId: value4};
}
r4 = object2;
}
return r4;
}
function* _fun73636(a0, a1) { // fn#73636, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9654:1275, offset: 0x01d73b2c, size: 171 bytes, params: 3, frame: 17
if (true) {
if (a0 == null) {
return global.Promise.reject('appId or linkId null');
}
if (a1 == null) {
return global.Promise.reject('appId or linkId null');
}
value = environment.__proto__.__proto__;
yield env2_7(a0, a1);
var value3 = undefined;
if (false) {
return value3;
}
if (value3 == null) {
return global.Promise.reject('fetchCustomActivityLink body is null');
}
value = env2_1(env2_2[5]);
value.dispatch({type: 'CUSTOM_ACTIVITY_LINK_FETCH_SUCCESS', applicationId: a0, link: value3});
}
}