Files
discord-decomp/sources/modules/messages/BackgroundTaskManager.native.tsx
2026-07-28 01:06:53 +03:00

134 lines
6.5 KiB
TypeScript

/* Metro module 7144; source: modules/messages/BackgroundTaskManager.native.tsx; dependencies: [5, 27, 477, 7145, 7146, 2] */
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as PlatformUtilsModule from '../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
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
const env0_0 = require;
const backgroundify2 = backgroundify;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const NativeModules = (ReactNativeModule).NativeModules;
let value = PlatformUtilsModule;
value = value.isAndroid();
const backgroundTaskIdentifierInvalid = value ? -1 : NativeModules.DCDBackgroundTaskManager.backgroundTaskIdentifierInvalid;
const startBackgroundTask2 = startBackgroundTask;
const endBackgroundTask2 = endBackgroundTask;
object = {backgroundTaskIdentifierInvalid: backgroundTaskIdentifierInvalid, backgroundify: backgroundify2,
startBackgroundTask: startBackgroundTask2, endBackgroundTask: endBackgroundTask2};
(FileImportTrackerModule).fileFinishedImporting('modules/messages/BackgroundTaskManager.native.tsx');
exports.default = object;
exports.backgroundTaskIdentifierInvalid = backgroundTaskIdentifierInvalid;
exports.startBackgroundTask = startBackgroundTask2;
exports.endBackgroundTask = endBackgroundTask2;
exports.backgroundify = backgroundify2;
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 Module00005(_fun57144);
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);
}
}
}
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 object;
var Promise;
var promise;
var value;
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;
object = {title: title, content: content};
object.priority = (require(7146) /* metro dependency 7146: ForegroundServiceManagerTypes */).ServiceNotificationPriority.MEDIUM;
object.type = (require(7146) /* metro dependency 7146: ForegroundServiceManagerTypes */).ServiceNotificationType.FILE_UPLOAD;
object.usesGateway = false;
return Reflect.apply(addServiceHandler, defaultImport, [object]);
}
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);
}
}
}
}
global.__d(_fun57141, 7144, [5, 27, 477, 7145, 7146,
2]) /* metro module 7144, dependencies: [5, 27, 477, 7145, 7146, 2] */;