Files
discord-decomp/sources/modules/messages/BackgroundTaskManager.native.tsx
T
2026-07-27 16:20:00 +03:00

130 lines
5.5 KiB
TypeScript

/* Metro module 7144; source: modules/messages/BackgroundTaskManager.native.tsx; dependencies: [5, 27, 477, 7145, 7146, 2] */
function _fun57141(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57141, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7322:6, offset: 0x013ddbfb, size: 249 bytes, params: 8, frame: 20
var object2;
const env0_0 = require;
const closure = backgroundify;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(5) /* metro dependency 5 */;
const NativeModules = (require(27) /* metro dependency 27 */).NativeModules;
let value = require(477) /* metro dependency 477: PlatformUtils */;
value = value.isAndroid();
const backgroundTaskIdentifierInvalid = value ? -1 : NativeModules.DCDBackgroundTaskManager.backgroundTaskIdentifierInvalid;
const closure2 = startBackgroundTask;
const closure3 = endBackgroundTask;
object2 = {backgroundTaskIdentifierInvalid: backgroundTaskIdentifierInvalid, backgroundify: closure,
startBackgroundTask: closure2, endBackgroundTask: closure3};
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/messages/BackgroundTaskManager.native.tsx');
exports.default = object2;
exports.backgroundTaskIdentifierInvalid = backgroundTaskIdentifierInvalid;
exports.startBackgroundTask = closure2;
exports.endBackgroundTask = closure3;
exports.backgroundify = closure;
}
function backgroundify(a0, a1) { // fn#57142, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7322:688, offset: 0x013ddcf4, size: 37 bytes, params: 3, frame: 11
const env0_0 = a0;
const env0_1 = a1;
return env0_3(_fun57144);
}
function startBackgroundTask(a0) { // fn#57146, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7322:234, offset: 0x013ddda0, size: 224 bytes, params: 2, frame: 16
var title;
var content;
var defaultImport;
var addServiceHandler;
var object2;
var Promise;
var promise;
var value;
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
if (platformUtilsModule.isAndroid()) {
if (a0 == null) {
Promise = global.Promise;
value = Object.create(Promise.prototype, {constructor: {value: Promise}});
promise = new Promise(function(a0) {
return a0(backgroundTaskIdentifierInvalid);
});
return promise instanceof Object ? promise : value;
}
title = a0.title;
content = a0.content;
defaultImport = importDefault(7145) /* metro dependency 7145: ForegroundServiceManagerAndroid */;
addServiceHandler = defaultImport.addServiceHandler;
object2 = {title: title, content: content};
object2.priority = (require(7146) /* metro dependency 7146: ForegroundServiceManagerTypes */).ServiceNotificationPriority.MEDIUM;
object2.type = (require(7146) /* metro dependency 7146: ForegroundServiceManagerTypes */).ServiceNotificationType.FILE_UPLOAD;
object2.usesGateway = false;
return Reflect.apply(addServiceHandler, defaultImport, [object2]);
}
const DCDBackgroundTaskManager = NativeModules.DCDBackgroundTaskManager;
return DCDBackgroundTaskManager.startBackgroundTask();
}
function endBackgroundTask(a0) { // fn#57148, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7322:574, offset: 0x013dde93, size: 107 bytes, params: 2, frame: 13
var moduleValue;
if (a0 !== backgroundTaskIdentifierInvalid) {
moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
if (moduleValue.isAndroid()) {
(importDefault(7145) /* metro dependency 7145: ForegroundServiceManagerAndroid */).removeServiceHandler(a0);
} else {
NativeModules.DCDBackgroundTaskManager.endBackgroundTask(a0);
}
}
}
function* _fun57144() { // fn#57144, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7322:726, offset: 0x013ddd22, size: 103 bytes, params: 1, frame: 14
var environment;
var binding;
var value3;
var value4;
var value5;
var error;
if (false) {
return undefined;
}
value = environment.__proto__.__proto__;
var env0_0;
try {
binding = env2_6;
} catch (error) {
value = environment.__proto__;
return require();
}
value = environment.__proto__;
try {
} catch (error) {
value = environment.__proto__;
return require();
}
try {
value3 = binding(importDefault);
} catch (error) {
value = environment.__proto__;
return require();
}
yield value3;
try {
value4 = undefined;
value5 = false;
} catch (error) {
value = environment.__proto__;
return require();
}
if (value5) {
return value4;
}
try {
env0_0 = value4;
} catch (error) {
value = environment.__proto__;
return require();
}
return require().finally(_fun57145);
}
function _fun57145() { // fn#57145, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7322:821, offset: 0x013ddd89, size: 23 bytes, params: 1, frame: 11
env3_7(env0_0);
}