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

149 lines
4.7 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 9702
// Function ID: 9703
// Name: BackgroundTaskManager
2026-10-12 06:59:38 +00:00
// Dependencies: [5, 17, 1382, 9703, 9705, 2]
2026-07-29 08:29:29 +00:00
// Exports: backgroundify, endBackgroundTask
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 9702 (BackgroundTaskManager)
2026-10-03 08:58:59 +00:00
import react_native from "react-native" /* 17 */;
2026-10-12 06:59:38 +00:00
import ForegroundServiceManagerDefault from "ForegroundServiceManager" /* 9703 */;
import ForegroundServiceManagerTypes from "ForegroundServiceManagerTypes" /* 9705 */;
2026-10-03 08:58:59 +00:00
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
2026-10-09 10:00:15 +00:00
import PlatformUtils from "PlatformUtils" /* 1382 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
let c4, c5;
2026-07-23 10:11:24 +00:00
2026-07-20 16:05:17 +00:00
function startBackgroundTask(arg0) {
2026-10-03 08:58:59 +00:00
let content;
let title;
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
if (null == arg0) {
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
const promise = new Promise((fn) => fn(num));
2026-07-20 16:05:17 +00:00
return promise;
} else {
({ title, content } = arg0);
2026-10-03 08:58:59 +00:00
const obj2 = { title, content, priority: ForegroundServiceManagerTypes.ServiceNotificationPriority.MEDIUM, type: ForegroundServiceManagerTypes.ServiceNotificationType.FILE_UPLOAD, usesGateway: false };
const addServiceHandler = ForegroundServiceManagerDefault.addServiceHandler;
return addServiceHandler(obj2);
2026-07-20 16:05:17 +00:00
}
} else {
const DCDBackgroundTaskManager = NativeModules.DCDBackgroundTaskManager;
return DCDBackgroundTaskManager.startBackgroundTask();
}
}
2026-10-03 08:58:59 +00:00
const NativeModules = react_native.NativeModules;
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;
}
2026-10-03 08:58:59 +00:00
function endBackgroundTask(value) {
if (value !== num) {
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
2026-10-03 08:58:59 +00:00
const obj2 = ForegroundServiceManagerDefault;
obj2.removeServiceHandler(value);
2026-07-20 16:05:17 +00:00
} else {
const DCDBackgroundTaskManager = NativeModules.DCDBackgroundTaskManager;
2026-10-03 08:58:59 +00:00
DCDBackgroundTaskManager.endBackgroundTask(value);
2026-07-20 16:05:17 +00:00
}
}
}
function backgroundify(arg0, arg1) {
2026-10-03 08:58:59 +00:00
let closure_0 = arg0;
let closure_1 = arg1;
return _asyncToGenerator(async (arg0, value) => {
let tmp3;
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-10-03 08:58:59 +00:00
} else if (tmp3 === 3) {
2026-07-29 08:29:29 +00:00
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-10-12 06:59:38 +00:00
return { value: "IconComponent", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
2026-10-03 08:58:59 +00:00
let c3;
2026-07-29 08:29:29 +00:00
try {
2026-10-03 08:58:59 +00:00
let cleanupPromise;
2026-07-29 08:29:29 +00:00
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-10-03 08:58:59 +00:00
closure_1 = tmp;
closure_0 = c5;
2026-08-24 06:08:38 +00:00
c3 = 1;
2026-10-03 08:58:59 +00:00
cleanupPromise = startBackgroundTask(closure_1);
2026-07-29 08:29:29 +00:00
c4 = 2;
c5 = 1;
2026-10-03 08:58:59 +00:00
const obj4 = { value: cleanupPromise, done: false };
return obj4;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
} else if (1 === tmp4) {
2026-07-29 08:29:29 +00:00
c3 = 0;
2026-10-03 08:58:59 +00:00
cleanupPromise = closure_129_0();
2026-07-29 08:29:29 +00:00
c5 = 3;
2026-10-03 08:58:59 +00:00
const obj5 = { value: cleanupPromise, 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 {
2026-10-03 08:58:59 +00:00
closure_0 = value;
2026-07-29 08:29:29 +00:00
c3 = 0;
2026-10-03 08:58:59 +00:00
const promise = closure_129_0();
cleanupPromise = promise.finally(() => {
if (closure_1_0 !== c5) {
const obj = cleanupPromise(closure_2[2]);
const tmp3 = closure_2;
if (obj.isAndroid()) {
const obj2 = closure_1(tmp3[3]);
obj2.removeServiceHandler(closure_1_0);
} else {
const DCDBackgroundTaskManager = c4.DCDBackgroundTaskManager;
DCDBackgroundTaskManager.endBackgroundTask(closure_1_0);
}
}
});
2026-07-29 08:29:29 +00:00
c5 = 3;
2026-10-03 08:58:59 +00:00
let obj = { value: cleanupPromise, done: true };
2026-07-29 08:29:29 +00:00
return obj;
}
2026-10-03 08:58:59 +00:00
} catch (tmp15) {
let closure_2 = tmp15;
if (0 === c3) {
c5 = 3;
throw tmp15;
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
c4 = 1;
2026-07-29 08:29:29 +00:00
}
}
}
2026-07-20 16:05:17 +00:00
});
}
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 };