decord/alpha/source/modules/messages/BackgroundTaskManager.native.tsx

138 lines
4.3 KiB
TypeScript
Raw Normal View History

// Module ID: 7347
// Function ID: 7348
// Name: BackgroundTaskManager
// Dependencies: [5, 17, 1364, 7348, 7350, 2]
2026-07-29 08:29:29 +00:00
// Exports: backgroundify, endBackgroundTask
2026-07-20 16:05:17 +00:00
// Module 7347 (BackgroundTaskManager)
import PlatformUtils2 from "PlatformUtils" /* 1364 */;
import ForegroundServiceManagerDefault from "ForegroundServiceManager" /* 7348 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
2026-07-23 10:11:24 +00:00
require = fn;
2026-07-20 16:05:17 +00:00
function startBackgroundTask(arg0) {
if (obj.isAndroid()) {
if (null == arg0) {
const promise = new Promise((fn) => fn(num));
2026-07-20 16:05:17 +00:00
return promise;
} else {
({ title, content } = arg0);
const obj3 = { title, content, priority: tmp(7350).ServiceNotificationPriority.MEDIUM, type: tmp(7350).ServiceNotificationType.FILE_UPLOAD, usesGateway: false };
return ForegroundServiceManagerDefault.addServiceHandler(obj3);
2026-07-20 16:05:17 +00:00
}
} else {
const DCDBackgroundTaskManager = NativeModules.DCDBackgroundTaskManager;
return DCDBackgroundTaskManager.startBackgroundTask();
}
obj = PlatformUtils2;
2026-07-20 16:05:17 +00:00
}
const NativeModules = fn(17).NativeModules;
const PlatformUtils = fn(1364);
2026-07-29 08:29:29 +00:00
let num = -1;
if (!PlatformUtils.isAndroid()) {
2026-07-29 08:29:29 +00:00
num = NativeModules.DCDBackgroundTaskManager.backgroundTaskIdentifierInvalid;
}
function endBackgroundTask(arg0) {
if (arg0 !== num) {
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
ForegroundServiceManagerDefault.removeServiceHandler(arg0);
2026-07-20 16:05:17 +00:00
} else {
const DCDBackgroundTaskManager = NativeModules.DCDBackgroundTaskManager;
DCDBackgroundTaskManager.endBackgroundTask(arg0);
2026-07-20 16:05:17 +00:00
}
obj = PlatformUtils2;
2026-07-20 16:05:17 +00:00
}
}
function backgroundify(arg0, arg1) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
return asyncGeneratorStep(async (arg0, value) => {
2026-07-29 08:29:29 +00:00
if (c5 === 2) {
c5 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-07-29 08:29:29 +00:00
} else if (tmp7 === 3) {
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
let obj2 = { value, done: true };
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c5 = 3;
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp3;
closure_0 = tmp5;
closure_128_0 = c5;
2026-08-24 06:08:38 +00:00
c3 = 1;
2026-07-29 08:29:29 +00:00
c4 = 2;
c5 = 1;
const obj4 = { value: startBackgroundTask(closure_1), done: false };
return obj4;
2026-07-29 08:29:29 +00:00
}
} else if (1 === tmp8) {
c3 = 0;
c5 = 3;
const obj5 = { value: closure_129_0(), done: true };
return obj5;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 1) {
c5 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c3 = 0;
c5 = 3;
const obj6 = { value, done: true };
return obj6;
2026-07-29 08:29:29 +00:00
} else {
closure_128_0 = value;
2026-07-29 08:29:29 +00:00
c3 = 0;
c5 = 3;
let obj = {
value: closure_129_0().finally(() => {
if (closure_1_0 !== c5) {
if (obj.isAndroid()) {
closure_1(tmp3[3]).removeServiceHandler(tmp);
const obj2 = closure_1(tmp3[3]);
} else {
const DCDBackgroundTaskManager = c4.DCDBackgroundTaskManager;
DCDBackgroundTaskManager.endBackgroundTask(tmp);
}
obj = closure_0(closure_2[2]);
tmp3 = closure_2;
}
}),
done: true
};
2026-07-29 08:29:29 +00:00
return obj;
}
} catch (tmp18) {
2026-08-24 06:08:38 +00:00
closure_2 = tmp18;
2026-07-29 08:29:29 +00:00
if (tmp4 === c3) {
c5 = tmp2;
throw tmp18;
} else {
c4 = tmp;
}
}
}
2026-07-20 16:05:17 +00:00
});
}
const size = fn(2);
const result = size.fileFinishedImporting("modules/messages/BackgroundTaskManager.native.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default { backgroundTaskIdentifierInvalid: num, backgroundify, startBackgroundTask, endBackgroundTask };
2026-07-20 16:05:17 +00:00
export const backgroundTaskIdentifierInvalid = num;
export { startBackgroundTask };
export { endBackgroundTask };
export { backgroundify };