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

149 lines
4.7 KiB
TypeScript
Raw Normal View History

2026-10-07 22:43:51 +00:00
// Module ID: 7251
// Function ID: 7252
// Name: BackgroundTaskManager
2026-10-07 22:43:51 +00:00
// Dependencies: [5, 17, 1369, 7252, 7254, 2]
// Exports: backgroundify, endBackgroundTask
2026-10-07 22:43:51 +00:00
// Module 7251 (BackgroundTaskManager)
2026-10-01 14:13:23 +00:00
import react_native from "react-native" /* 17 */;
2026-10-07 22:43:51 +00:00
import ForegroundServiceManagerDefault from "ForegroundServiceManager" /* 7252 */;
import ForegroundServiceManagerTypes from "ForegroundServiceManagerTypes" /* 7254 */;
2026-10-01 14:13:23 +00:00
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
2026-10-07 22:43:51 +00:00
import PlatformUtils from "PlatformUtils" /* 1369 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
let c4, c5;
function startBackgroundTask(arg0) {
2026-10-01 14:13:23 +00:00
let content;
let title;
const obj = PlatformUtils;
if (obj.isAndroid()) {
if (null == arg0) {
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const promise = new Promise((fn) => fn(num));
return promise;
} else {
({ title, content } = arg0);
2026-10-01 14:13:23 +00:00
const obj2 = { title, content, priority: ForegroundServiceManagerTypes.ServiceNotificationPriority.MEDIUM, type: ForegroundServiceManagerTypes.ServiceNotificationType.FILE_UPLOAD, usesGateway: false };
const addServiceHandler = ForegroundServiceManagerDefault.addServiceHandler;
return addServiceHandler(obj2);
}
} else {
const DCDBackgroundTaskManager = NativeModules.DCDBackgroundTaskManager;
return DCDBackgroundTaskManager.startBackgroundTask();
}
}
2026-10-01 14:13:23 +00:00
const NativeModules = react_native.NativeModules;
let num = -1;
if (!PlatformUtils.isAndroid()) {
num = NativeModules.DCDBackgroundTaskManager.backgroundTaskIdentifierInvalid;
}
2026-10-01 14:13:23 +00:00
function endBackgroundTask(value) {
if (value !== num) {
const obj = PlatformUtils;
if (obj.isAndroid()) {
2026-10-01 14:13:23 +00:00
const obj2 = ForegroundServiceManagerDefault;
obj2.removeServiceHandler(value);
} else {
const DCDBackgroundTaskManager = NativeModules.DCDBackgroundTaskManager;
2026-10-01 14:13:23 +00:00
DCDBackgroundTaskManager.endBackgroundTask(value);
}
}
}
function backgroundify(arg0, arg1) {
2026-10-01 14:13:23 +00:00
let closure_0 = arg0;
let closure_1 = arg1;
return _asyncToGenerator(async (arg0, value) => {
let tmp3;
if (c5 === 2) {
c5 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-10-01 14:13:23 +00:00
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
let obj2 = { value, done: true };
return obj2;
} else {
2026-10-02 13:37:24 +00:00
return { value: "IconComponent", done: null };
}
} else {
2026-10-01 14:13:23 +00:00
let c3;
try {
2026-10-01 14:13:23 +00:00
let cleanupPromise;
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 3;
const obj3 = { value, done: true };
return obj3;
} else {
2026-10-01 14:13:23 +00:00
closure_1 = tmp;
closure_0 = c5;
c3 = 1;
2026-10-01 14:13:23 +00:00
cleanupPromise = startBackgroundTask(closure_1);
c4 = 2;
c5 = 1;
2026-10-01 14:13:23 +00:00
const obj4 = { value: cleanupPromise, done: false };
return obj4;
}
2026-10-01 14:13:23 +00:00
} else if (1 === tmp4) {
c3 = 0;
2026-10-01 14:13:23 +00:00
cleanupPromise = closure_129_0();
c5 = 3;
2026-10-01 14:13:23 +00:00
const obj5 = { value: cleanupPromise, done: true };
return obj5;
} else if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
c3 = 0;
c5 = 3;
const obj6 = { value, done: true };
return obj6;
} else {
2026-10-01 14:13:23 +00:00
closure_0 = value;
c3 = 0;
2026-10-01 14:13:23 +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);
}
}
});
c5 = 3;
2026-10-01 14:13:23 +00:00
let obj = { value: cleanupPromise, done: true };
return obj;
}
2026-10-01 14:13:23 +00:00
} catch (tmp15) {
let closure_2 = tmp15;
if (0 === c3) {
c5 = 3;
throw tmp15;
} else {
2026-10-01 14:13:23 +00:00
c4 = 1;
}
}
}
});
}
const result = size.fileFinishedImporting("modules/messages/BackgroundTaskManager.native.tsx");
export default { backgroundTaskIdentifierInvalid: num, backgroundify, startBackgroundTask, endBackgroundTask };
export const backgroundTaskIdentifierInvalid = num;
export { startBackgroundTask };
export { endBackgroundTask };
export { backgroundify };