564 lines
24 KiB
TypeScript
564 lines
24 KiB
TypeScript
// Module ID: 16788
|
|
// Function ID: 16789
|
|
// Name: _executeHeadlessTask
|
|
// Dependencies: [5, 17, 1218, 16069, 676, 3, 1208, 675, 15, 9, 12746, 698, 503, 4078, 2]
|
|
// Exports: default
|
|
|
|
// Module 16788 (_executeHeadlessTask)
|
|
import timestamp from "timestamp";
|
|
import { AppState } from "get ActivityIndicator";
|
|
import fetchFingerprint from "fetchFingerprint";
|
|
import linkFromAppsFlyer from "linkFromAppsFlyer";
|
|
import { AnalyticEvents } from "ME";
|
|
|
|
let error;
|
|
let metroImportAll;
|
|
const require = arg1;
|
|
function _executeHeadlessTask() {
|
|
const self = this;
|
|
const tmp = callback((arg0, arg1, arg2) => {
|
|
let closure_0 = arg0;
|
|
let closure_1 = arg1;
|
|
let closure_2 = arg2;
|
|
let c11 = 0;
|
|
let c12 = 0;
|
|
let c9 = 0;
|
|
return (function*(arg0, arg1, arg2) {
|
|
if (c12 === 2) {
|
|
c12 = 3;
|
|
let throwTypeErrorResult = HermesBuiltin.throwTypeError();
|
|
} else {
|
|
throwTypeErrorResult = arg1;
|
|
throwTypeErrorResult = arg0;
|
|
throwTypeErrorResult = tmp11;
|
|
throwTypeErrorResult = globalThis;
|
|
if (tmp12 === 3) {
|
|
if (arg0 === 1) {
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c12 = 2;
|
|
switch (c11) {
|
|
case 0:
|
|
if (arg0 === 1) {
|
|
c12 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c12 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
let closure_7 = tmp4;
|
|
let promise = tmp13;
|
|
throwTypeErrorResult = callback2;
|
|
throwTypeErrorResult = callback3;
|
|
let logger;
|
|
let timestamp;
|
|
let closure_5;
|
|
let authStore;
|
|
closure_7 = undefined;
|
|
throwTypeErrorResult = callback2;
|
|
throwTypeErrorResult = outer1_3;
|
|
throwTypeErrorResult = callback;
|
|
const _HermesInternal = HermesInternal;
|
|
throwTypeErrorResult = callback2(outer1_3[5]);
|
|
throwTypeErrorResult = new.target;
|
|
throwTypeErrorResult = new.target;
|
|
throwTypeErrorResult = new throwTypeErrorResult("Task " + callback);
|
|
logger = throwTypeErrorResult;
|
|
const _Date6 = Date;
|
|
timestamp = Date.now();
|
|
throwTypeErrorResult = callback2;
|
|
throwTypeErrorResult = outer1_3;
|
|
const obj1 = { message: "Executing headless task.", data: null };
|
|
const obj2 = { name: null };
|
|
obj2[0] = callback;
|
|
obj1[1] = obj2;
|
|
throwTypeErrorResult = callback2(outer1_3[6]).addBreadcrumb(obj1);
|
|
throwTypeErrorResult = callback3;
|
|
throwTypeErrorResult = outer1_3;
|
|
const obj56 = callback2(outer1_3[6]);
|
|
throwTypeErrorResult = callback3(outer1_3[7]).recordStartHeadlessTask();
|
|
throwTypeErrorResult = callback;
|
|
throwTypeErrorResult = outer1_3;
|
|
const obj59 = callback3(outer1_3[7]);
|
|
throwTypeErrorResult = callback(outer1_3[8]).closeFastConnectSocket();
|
|
closure_5 = false;
|
|
let constants = 1;
|
|
throwTypeErrorResult = callback2;
|
|
throwTypeErrorResult = outer1_3;
|
|
if (!callback2(outer1_3[9]).wasEverActive) {
|
|
throwTypeErrorResult = callback2;
|
|
throwTypeErrorResult = outer1_3;
|
|
callback2(outer1_3[9]).extraProperties.headless_task_ran = true;
|
|
}
|
|
throwTypeErrorResult = outer1_5;
|
|
if ("active" !== outer1_5.currentState) {
|
|
throwTypeErrorResult = throwTypeErrorResult.log("Pausing socket in headless task because app state is not active");
|
|
throwTypeErrorResult = callback3;
|
|
throwTypeErrorResult = outer1_3;
|
|
throwTypeErrorResult = callback3(outer1_3[10]).setIsPaused(true);
|
|
const obj41 = callback3(outer1_3[10]);
|
|
}
|
|
throwTypeErrorResult = callback2;
|
|
throwTypeErrorResult = outer1_3;
|
|
const obj60 = callback(outer1_3[8]);
|
|
throwTypeErrorResult = constants;
|
|
let obj3 = { client_app_state: null, name: null };
|
|
throwTypeErrorResult = outer1_5;
|
|
obj3[0] = outer1_5.currentState;
|
|
obj3[1] = throwTypeErrorResult;
|
|
throwTypeErrorResult = callback2(outer1_3[11]).track(constants.HEADLESS_TASK_INVOKED, obj3);
|
|
throwTypeErrorResult = outer1_7;
|
|
c11 = 3;
|
|
c12 = 1;
|
|
const obj4 = { value: null, done: false };
|
|
obj4[0] = outer1_7();
|
|
return obj4;
|
|
}
|
|
break;
|
|
case 1:
|
|
throwTypeErrorResult = promise;
|
|
throwTypeErrorResult = closure_7;
|
|
throwTypeErrorResult = closure_10;
|
|
throwTypeErrorResult = closure_10;
|
|
authStore = closure_10;
|
|
constants = 0;
|
|
const _Date4 = Date;
|
|
throwTypeErrorResult = timestamp;
|
|
authStore = Date.now() - timestamp;
|
|
throwTypeErrorResult = callback2;
|
|
throwTypeErrorResult = logger;
|
|
const obj5 = { message: "Finished headless task.", data: null };
|
|
let obj6 = { name: null, success: null, duration: null };
|
|
throwTypeErrorResult = callback;
|
|
obj6[0] = callback;
|
|
throwTypeErrorResult = closure_5;
|
|
obj6[1] = closure_5;
|
|
throwTypeErrorResult = authStore;
|
|
obj6[2] = authStore + "ms";
|
|
obj5[1] = obj6;
|
|
throwTypeErrorResult = callback2(logger[6]).addBreadcrumb(obj5);
|
|
throwTypeErrorResult = logger;
|
|
throwTypeErrorResult = logger.log("Unpausing socket");
|
|
throwTypeErrorResult = callback3;
|
|
throwTypeErrorResult = logger;
|
|
const obj33 = callback2(logger[6]);
|
|
throwTypeErrorResult = callback3(logger[10]).setIsPaused(false);
|
|
throwTypeErrorResult = callback2;
|
|
throwTypeErrorResult = logger;
|
|
const obj36 = callback3(logger[10]);
|
|
throwTypeErrorResult = constants;
|
|
let obj7 = { client_app_state: null, name: null, success: null, duration_ms: null };
|
|
throwTypeErrorResult = closure_5;
|
|
obj7[0] = closure_5.currentState;
|
|
throwTypeErrorResult = callback;
|
|
obj7[1] = callback;
|
|
throwTypeErrorResult = closure_5;
|
|
obj7[2] = closure_5;
|
|
throwTypeErrorResult = authStore;
|
|
obj7[3] = authStore;
|
|
closure_7 = callback2(logger[11]).track(constants.HEADLESS_TASK_COMPLETED, obj7, { flush: true });
|
|
throwTypeErrorResult = promise;
|
|
throwTypeErrorResult = closure_7;
|
|
constants = 2;
|
|
throwTypeErrorResult = closure_7;
|
|
const items = [closure_7, ];
|
|
throwTypeErrorResult = callback;
|
|
throwTypeErrorResult = logger;
|
|
const obj37 = callback2(logger[11]);
|
|
items[1] = callback(logger[13]).timeoutPromise(1500);
|
|
c11 = 14;
|
|
c12 = 1;
|
|
const obj8 = { value: null, done: false };
|
|
obj8[0] = Promise.race(items);
|
|
return obj8;
|
|
case 2:
|
|
throwTypeErrorResult = promise;
|
|
throwTypeErrorResult = closure_10;
|
|
throwTypeErrorResult = closure_10;
|
|
constants = 0;
|
|
promise = closure_10;
|
|
throwTypeErrorResult = logger;
|
|
throwTypeErrorResult = promise;
|
|
throwTypeErrorResult = logger.warn("Failed to submit analytics", promise);
|
|
throwTypeErrorResult = authStore;
|
|
throw authStore;
|
|
case 3:
|
|
if (arg0 === 1) {
|
|
c12 = 3;
|
|
throw arg1;
|
|
} else {
|
|
closure_5 = arg1;
|
|
if (arg0 === 2) {
|
|
constants = 0;
|
|
throwTypeErrorResult = promise;
|
|
throwTypeErrorResult = closure_7;
|
|
const _Date3 = Date;
|
|
throwTypeErrorResult = timestamp;
|
|
authStore = Date.now() - timestamp;
|
|
throwTypeErrorResult = callback2;
|
|
throwTypeErrorResult = logger;
|
|
let obj24 = callback2(logger[6]);
|
|
let obj9 = { message: "Finished headless task.", data: null };
|
|
const obj10 = { name: null, success: null, duration: null };
|
|
throwTypeErrorResult = callback;
|
|
obj10[0] = callback;
|
|
throwTypeErrorResult = closure_5;
|
|
obj10[1] = closure_5;
|
|
throwTypeErrorResult = authStore;
|
|
obj10[2] = authStore + "ms";
|
|
obj9[1] = obj10;
|
|
throwTypeErrorResult = obj24.addBreadcrumb(obj9);
|
|
throwTypeErrorResult = logger;
|
|
throwTypeErrorResult = logger.log("Unpausing socket");
|
|
throwTypeErrorResult = callback3;
|
|
throwTypeErrorResult = logger;
|
|
let obj27 = callback3(logger[10]);
|
|
throwTypeErrorResult = obj27.setIsPaused(false);
|
|
throwTypeErrorResult = callback2;
|
|
throwTypeErrorResult = logger;
|
|
let obj28 = callback2(logger[11]);
|
|
throwTypeErrorResult = constants;
|
|
const obj11 = { client_app_state: null, name: null, success: null, duration_ms: null };
|
|
throwTypeErrorResult = closure_5;
|
|
obj11[0] = closure_5.currentState;
|
|
throwTypeErrorResult = callback;
|
|
obj11[1] = callback;
|
|
throwTypeErrorResult = closure_5;
|
|
obj11[2] = closure_5;
|
|
throwTypeErrorResult = authStore;
|
|
obj11[3] = authStore;
|
|
closure_7 = obj28.track(constants.HEADLESS_TASK_COMPLETED, obj11, { flush: true });
|
|
throwTypeErrorResult = promise;
|
|
throwTypeErrorResult = closure_7;
|
|
constants = 3;
|
|
throwTypeErrorResult = closure_7;
|
|
const items1 = [closure_7, ];
|
|
throwTypeErrorResult = callback;
|
|
throwTypeErrorResult = logger;
|
|
let obj30 = callback(logger[13]);
|
|
items1[1] = obj30.timeoutPromise(1500);
|
|
c11 = 6;
|
|
c12 = 1;
|
|
const obj12 = { value: null, done: false };
|
|
obj12[0] = Promise.race(items1);
|
|
return obj12;
|
|
} else {
|
|
throwTypeErrorResult = promise;
|
|
throwTypeErrorResult = closure_7;
|
|
throwTypeErrorResult = logger;
|
|
throwTypeErrorResult = logger.log("initHeadlessTask completed");
|
|
throwTypeErrorResult = promise;
|
|
c11 = 4;
|
|
c12 = 1;
|
|
const obj13 = { value: null, done: false };
|
|
obj13[0] = promise.promise;
|
|
return obj13;
|
|
}
|
|
}
|
|
break;
|
|
case 4:
|
|
if (arg0 === 1) {
|
|
c12 = 3;
|
|
throw arg1;
|
|
} else {
|
|
timestamp = arg1;
|
|
if (arg0 === 2) {
|
|
constants = 0;
|
|
const _Date2 = Date;
|
|
authStore = Date.now() - timestamp;
|
|
let obj15 = callback2(logger[6]);
|
|
const obj14 = { message: "Finished headless task.", data: null };
|
|
obj15 = { name: null, success: null, duration: null };
|
|
obj15[0] = callback;
|
|
obj15[1] = closure_5;
|
|
obj15[2] = authStore + "ms";
|
|
obj14[1] = obj15;
|
|
obj15.addBreadcrumb(obj14);
|
|
logger.log("Unpausing socket");
|
|
let obj18 = callback3(logger[10]);
|
|
obj18.setIsPaused(false);
|
|
let obj19 = callback2(logger[11]);
|
|
const obj16 = { client_app_state: null, name: null, success: null, duration_ms: null };
|
|
obj16[0] = closure_5.currentState;
|
|
obj16[1] = callback;
|
|
obj16[2] = closure_5;
|
|
obj16[3] = authStore;
|
|
closure_7 = obj19.track(constants.HEADLESS_TASK_COMPLETED, obj16, { flush: true });
|
|
throwTypeErrorResult = closure_7;
|
|
constants = 4;
|
|
throwTypeErrorResult = closure_7;
|
|
const items2 = [closure_7, ];
|
|
throwTypeErrorResult = callback;
|
|
throwTypeErrorResult = logger;
|
|
let obj21 = callback(logger[13]);
|
|
items2[1] = obj21.timeoutPromise(1500);
|
|
c11 = 8;
|
|
c12 = 1;
|
|
const obj17 = { value: null, done: false };
|
|
obj17[0] = Promise.race(items2);
|
|
return obj17;
|
|
} else {
|
|
throwTypeErrorResult = promise;
|
|
throwTypeErrorResult = closure_7;
|
|
throwTypeErrorResult = logger;
|
|
throwTypeErrorResult = logger.log("Flux Initialized");
|
|
throwTypeErrorResult = authStore;
|
|
throwTypeErrorResult = promise;
|
|
if (authStore.isAuthenticated()) {
|
|
obj18 = { analyticsToken: null, user: null };
|
|
obj18[0] = authStore.getAnalyticsToken();
|
|
obj19 = { id: null };
|
|
obj19[0] = authStore.getId();
|
|
obj18[1] = obj19;
|
|
callback(logger[12]).AnalyticsActionHandlers.handleConnectionOpen(obj18);
|
|
logger.log("Analytics Initialized");
|
|
const AnalyticsActionHandlers = callback(logger[12]).AnalyticsActionHandlers;
|
|
} else {
|
|
logger.log("Analytics Init skipped; not authenticated");
|
|
}
|
|
callback2()(callback3);
|
|
c11 = 9;
|
|
c12 = 1;
|
|
}
|
|
}
|
|
break;
|
|
case 5:
|
|
constants = 0;
|
|
promise = closure_10;
|
|
logger.warn("Failed to submit analytics", promise);
|
|
c12 = 3;
|
|
constants = 0;
|
|
c12 = 3;
|
|
const obj20 = { value: null, done: true };
|
|
obj20[0] = arg1;
|
|
return obj20;
|
|
case 6:
|
|
if (arg0 === 1) {
|
|
c12 = 3;
|
|
throw arg1;
|
|
} else if (arg0 !== 2) {
|
|
constants = 0;
|
|
}
|
|
break;
|
|
case 7:
|
|
constants = 0;
|
|
promise = closure_10;
|
|
logger.warn("Failed to submit analytics", promise);
|
|
c12 = 3;
|
|
constants = 0;
|
|
c12 = 3;
|
|
obj21 = { value: null, done: true };
|
|
obj21[0] = arg1;
|
|
return obj21;
|
|
case 8:
|
|
if (arg0 === 1) {
|
|
c12 = 3;
|
|
throw arg1;
|
|
} else if (arg0 !== 2) {
|
|
constants = 0;
|
|
}
|
|
break;
|
|
case 9:
|
|
if (arg0 === 1) {
|
|
c12 = 3;
|
|
throw arg1;
|
|
} else {
|
|
logger = arg1;
|
|
if (arg0 === 2) {
|
|
constants = 0;
|
|
const _Date = Date;
|
|
authStore = Date.now() - timestamp;
|
|
obj3 = callback2(logger[6]);
|
|
const obj22 = { message: "Finished headless task.", data: null };
|
|
const obj23 = { name: null, success: null, duration: null };
|
|
obj23[0] = callback;
|
|
obj23[1] = closure_5;
|
|
obj23[2] = authStore + "ms";
|
|
obj22[1] = obj23;
|
|
obj3.addBreadcrumb(obj22);
|
|
logger.log("Unpausing socket");
|
|
obj6 = callback3(logger[10]);
|
|
obj6.setIsPaused(false);
|
|
obj7 = callback2(logger[11]);
|
|
obj24 = { client_app_state: null, name: null, success: null, duration_ms: null };
|
|
obj24[0] = closure_5.currentState;
|
|
obj24[1] = callback;
|
|
obj24[2] = closure_5;
|
|
obj24[3] = authStore;
|
|
closure_7 = obj7.track(constants.HEADLESS_TASK_COMPLETED, obj24, { flush: true });
|
|
constants = 5;
|
|
const items3 = [closure_7, ];
|
|
obj9 = callback(logger[13]);
|
|
items3[1] = obj9.timeoutPromise(1500);
|
|
c11 = 11;
|
|
c12 = 1;
|
|
const obj25 = { value: null, done: false };
|
|
obj25[0] = Promise.race(items3);
|
|
return obj25;
|
|
} else {
|
|
throwTypeErrorResult = promise;
|
|
closure_5 = true;
|
|
throwTypeErrorResult = logger;
|
|
throwTypeErrorResult = logger.log("Task completed successfully");
|
|
constants = 0;
|
|
throwTypeErrorResult = promise;
|
|
throwTypeErrorResult = closure_7;
|
|
const _Date5 = Date;
|
|
throwTypeErrorResult = timestamp;
|
|
authStore = Date.now() - timestamp;
|
|
throwTypeErrorResult = callback2;
|
|
throwTypeErrorResult = logger;
|
|
const obj26 = { message: "Finished headless task.", data: null };
|
|
obj27 = { name: null, success: null, duration: null };
|
|
throwTypeErrorResult = callback;
|
|
obj27[0] = callback;
|
|
throwTypeErrorResult = closure_5;
|
|
obj27[1] = closure_5;
|
|
throwTypeErrorResult = authStore;
|
|
obj27[2] = authStore + "ms";
|
|
obj26[1] = obj27;
|
|
throwTypeErrorResult = callback2(logger[6]).addBreadcrumb(obj26);
|
|
throwTypeErrorResult = logger;
|
|
throwTypeErrorResult = logger.log("Unpausing socket");
|
|
throwTypeErrorResult = callback3;
|
|
throwTypeErrorResult = logger;
|
|
const obj48 = callback2(logger[6]);
|
|
throwTypeErrorResult = callback3(logger[10]).setIsPaused(false);
|
|
throwTypeErrorResult = callback2;
|
|
throwTypeErrorResult = logger;
|
|
const obj51 = callback3(logger[10]);
|
|
throwTypeErrorResult = constants;
|
|
obj28 = { client_app_state: null, name: null, success: null, duration_ms: null };
|
|
throwTypeErrorResult = closure_5;
|
|
obj28[0] = closure_5.currentState;
|
|
throwTypeErrorResult = callback;
|
|
obj28[1] = callback;
|
|
throwTypeErrorResult = closure_5;
|
|
obj28[2] = closure_5;
|
|
throwTypeErrorResult = authStore;
|
|
obj28[3] = authStore;
|
|
closure_7 = callback2(logger[11]).track(constants.HEADLESS_TASK_COMPLETED, obj28, { flush: true });
|
|
throwTypeErrorResult = promise;
|
|
throwTypeErrorResult = closure_7;
|
|
constants = 6;
|
|
throwTypeErrorResult = closure_7;
|
|
const items4 = [closure_7, ];
|
|
throwTypeErrorResult = callback;
|
|
throwTypeErrorResult = logger;
|
|
const obj52 = callback2(logger[11]);
|
|
items4[1] = callback(logger[13]).timeoutPromise(1500);
|
|
c11 = 13;
|
|
c12 = 1;
|
|
const obj29 = { value: null, done: false };
|
|
obj29[0] = Promise.race(items4);
|
|
return obj29;
|
|
}
|
|
}
|
|
break;
|
|
case 10:
|
|
constants = 0;
|
|
promise = closure_10;
|
|
logger.warn("Failed to submit analytics", promise);
|
|
c12 = 3;
|
|
constants = 0;
|
|
c12 = 3;
|
|
obj30 = { value: null, done: true };
|
|
obj30[0] = arg1;
|
|
return obj30;
|
|
case 11:
|
|
if (arg0 === 1) {
|
|
c12 = 3;
|
|
throw arg1;
|
|
} else if (arg0 !== 2) {
|
|
constants = 0;
|
|
}
|
|
break;
|
|
case 12:
|
|
constants = 0;
|
|
promise = closure_10;
|
|
logger.warn("Failed to submit analytics", promise);
|
|
c12 = 3;
|
|
constants = 0;
|
|
c12 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
case 13:
|
|
if (arg0 === 1) {
|
|
c12 = 3;
|
|
throw arg1;
|
|
} else if (arg0 !== 2) {
|
|
constants = 0;
|
|
}
|
|
break;
|
|
default:
|
|
if (arg0 === 1) {
|
|
c12 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
constants = 0;
|
|
c12 = 3;
|
|
const obj31 = { value: null, done: true };
|
|
obj31[0] = arg1;
|
|
return obj31;
|
|
} else {
|
|
constants = 0;
|
|
}
|
|
}
|
|
} catch (throwTypeErrorResult) {
|
|
closure_10 = throwTypeErrorResult;
|
|
throwTypeErrorResult = constants;
|
|
if (tmp5 === constants) {
|
|
throwTypeErrorResult = tmp3;
|
|
c12 = tmp3;
|
|
throw throwTypeErrorResult;
|
|
} else if (tmp2 === throwTypeErrorResult) {
|
|
c11 = tmp2;
|
|
} else if (throwTypeErrorResult === throwTypeErrorResult) {
|
|
c11 = throwTypeErrorResult;
|
|
} else if (tmp3 === throwTypeErrorResult) {
|
|
c11 = tmp10;
|
|
} else if (tmp6 === throwTypeErrorResult) {
|
|
c11 = tmp9;
|
|
} else if (tmp10 === throwTypeErrorResult) {
|
|
c11 = tmp8;
|
|
} else {
|
|
c11 = tmp7;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})();
|
|
});
|
|
const _executeHeadlessTask = tmp;
|
|
const apply = tmp.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
({ initHeadlessTask: error, applicationReady: metroImportAll } = linkFromAppsFlyer);
|
|
const result = require("fetchFingerprint").fileFinishedImporting("modules/app_startup/native/executeHeadlessTask.tsx");
|
|
|
|
export default function executeHeadlessTask() {
|
|
const self = this;
|
|
const apply = _executeHeadlessTask.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
};
|