99 lines
2.7 KiB
TypeScript
99 lines
2.7 KiB
TypeScript
// Metro module 6041 (f6042).
|
|
import { NativeModules } from "react-native";
|
|
import { isAndroid } from "../../utils/PlatformUtils";
|
|
import ForegroundServiceManager_android from "../foreground_service/mobile/ForegroundServiceManager.android";
|
|
import { ServiceNotificationPriority, ServiceNotificationType } from "../foreground_service/mobile/ForegroundServiceManagerTypes";
|
|
function $mk114850($env) {
|
|
return () => {
|
|
const r3 = $env[0];
|
|
if (r3 !== c3827_5) {
|
|
if (isAndroid()) {
|
|
ForegroundServiceManager_android.removeServiceHandler(r3);
|
|
} else {
|
|
NativeModules.DCDBackgroundTaskManager.endBackgroundTask(r3);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
let c3827_5;
|
|
let env3827 = {};
|
|
export function startBackgroundTask(a0) {
|
|
if (isAndroid()) {
|
|
if (a0 == null) {
|
|
return new Promise((resolve) => resolve(c3827_5));
|
|
}
|
|
return ForegroundServiceManager_android.addServiceHandler({
|
|
title: a0.title,
|
|
content: a0.content,
|
|
priority: ServiceNotificationPriority.MEDIUM,
|
|
type: ServiceNotificationType.FILE_UPLOAD,
|
|
usesGateway: false
|
|
});
|
|
}
|
|
return NativeModules.DCDBackgroundTaskManager.startBackgroundTask();
|
|
}
|
|
export const backgroundTaskIdentifierInvalid = isAndroid() ? -1 : NativeModules.DCDBackgroundTaskManager.backgroundTaskIdentifierInvalid;
|
|
export function endBackgroundTask(a0) {
|
|
if (a0 !== c3827_5) {
|
|
if (isAndroid()) {
|
|
ForegroundServiceManager_android.removeServiceHandler(a0);
|
|
} else {
|
|
NativeModules.DCDBackgroundTaskManager.endBackgroundTask(a0);
|
|
}
|
|
}
|
|
}
|
|
export function backgroundify(c15373_0, c15373_1) {
|
|
return async () => {
|
|
let r49, r59;
|
|
let c25684_0, c25684_1, c25684_2;
|
|
let c25684_3 = 0;
|
|
const r11 = void 0;
|
|
const r10 = env3827;
|
|
try {
|
|
let env29653;
|
|
c25684_1 = r11;
|
|
const r14 = env29653 = {
|
|
$parent: r10
|
|
};
|
|
c25684_0 = r14;
|
|
env29653[0] = c3827_5;
|
|
c25684_3 = 1;
|
|
const r33 = await startBackgroundTask(c15373_1);
|
|
const r44 = c25684_0;
|
|
env29653[0] = r33;
|
|
c25684_3 = 0;
|
|
r49 = (0, c15373_0)().finally($mk114850(r44));
|
|
} catch ($e) {
|
|
const r22 = $e;
|
|
let r7 = r22;
|
|
c25684_2 = r22;
|
|
if (c25684_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
c25684_3 = 0;
|
|
r59 = (0, c15373_0)();
|
|
} catch (r54) {
|
|
r7 = r54;
|
|
c25684_2 = r54;
|
|
if (c25684_3 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
return r59;
|
|
}
|
|
}
|
|
throw r7;
|
|
}
|
|
return r49;
|
|
};
|
|
}
|
|
c3827_5 = backgroundTaskIdentifierInvalid;
|
|
const r26 = {
|
|
backgroundTaskIdentifierInvalid,
|
|
backgroundify,
|
|
startBackgroundTask,
|
|
endBackgroundTask
|
|
};
|
|
export default r26;
|