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

100 lines
4.2 KiB
TypeScript

/* Metro module 10718; source: modules/activities/utils/useEmbeddedActivityBackground.tsx; dependencies: [57, 31, 6873, 2] */
function _fun82351(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#82351, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10904:6, offset: 0x01ef40ff, size: 147 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(57) /* metro dependency 57 */;
const env0_3 = importAll(31) /* metro dependency 31 */;
const env0_4 = ['embedded_cover', 'embedded_background'];
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/activities/utils/useEmbeddedActivityBackground.tsx');
exports.default = useEmbeddedActivityBackground;
}
function useEmbeddedActivityBackground({applicationId, size, names, format}) { // fn#82352, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10904:261, offset: 0x01ef4192, size: 287 bytes, params: 2, frame: 27
const r4 = names !== undefined ? names : env0_4;
format = format === undefined ? 'png' : format;
let env0_2 = undefined;
let env0_3 = undefined;
var env0_4;
let binding = env0_3;
let useState = binding.useState;
const value2 = Reflect.apply(useState, binding, [null]);
const binding2 = env0_2;
const value3 = binding2(value2, 2);
const property = value3[0];
env0_2 = value3[1];
useState = binding.useState;
const value4 = binding2(Reflect.apply(useState, binding, [true]), 2);
const property2 = value4[0];
env0_3 = value4[1];
const assetImage = (require(6873) /* metro dependency 6873: ApplicationAssetUtils */).getAssetImage(applicationId,
property, size, format);
const r1 = property2 ? 'loading' : assetImage != null ? 'fetched' : 'not-found';
binding = env0_3;
env0_4 = binding.useRef(r4);
binding.useEffect(_fun82353);
binding.useEffect(_fun82354, [applicationId]);
return {url: assetImage, state: r1};
}
function _fun82354() { // fn#82354, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10904:581, offset: 0x01ef42c6, size: 89 bytes, params: 1, frame: 13
var environment;
var value2;
var moduleValue;
const env0_0 = env0_4.current;
if (applicationId != null) {
value2 = environment.__proto__;
moduleValue = require(6873) /* metro dependency 6873: ApplicationAssetUtils */;
moduleValue.getAssets(applicationId).then(_fun82355);
}
}
function _fun82355(a0) { // fn#82355, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10904:638, offset: 0x01ef431f, size: 161 bytes, params: 2, frame: 24
var r4;
var property;
var value6;
var id;
var currentBinding;
var includes;
var name;
var value7;
env1_3(false);
const Object = global.Object;
const value2 = Object.entries(a0);
let length = value2.length;
const value3 = 0;
if (value3 < length) {
r4 = value3;
reducibleLoop1: while (true) {
property = value2[r4];
value6 = env2_2(property, 2);
value6[value3];
property = value6[1];
if (property != null) {
id = property.id;
reducibleJoin4: while (true) {
if (id === '') {
break reducibleJoin4;
}
currentBinding = current;
includes = currentBinding.includes;
name = property.name;
if (Reflect.apply(includes, currentBinding, [name])) {
env1_2(property.id);
return undefined;
}
break reducibleJoin4;
}
}
value7 = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
length = value2.length;
if (!(value7 < length)) {
return undefined;
}
r4 = value7;
continue reducibleLoop1;
}
}
}