decord/source/modules/errors/native/SentryInitUtils.tsx

704 lines
21 KiB
TypeScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 1209
// Function ID: 1210
2026-07-20 16:05:17 +00:00
// Name: _maybeBackfillMissingBreadcrumbsFromTelemetryRing
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 17, 676, 505, 810, 3, 1210, 1222, 698, 13625, 5011, 5016, 13626, 1208, 1626, 5012, 500, 4358, 1625, 5427, 673, 2]
2026-07-20 16:05:17 +00:00
// Exports: initSentry
2026-07-29 08:29:29 +00:00
// Module 1209 (_maybeBackfillMissingBreadcrumbsFromTelemetryRing)
2026-08-24 06:08:38 +00:00
import timestampDefault from "timestamp" /* 3 */;
import expandEventPropertiesDefault from "expandEventProperties" /* 698 */;
import _modDef1208 from "module_1208" /* 1208 */;
import transitionTo from "transitionTo" /* 1222 */;
import closure_4 from "asyncGeneratorStep" /* 5 */;
import { NativeModules } from "get ActivityIndicator" /* 17 */;
import ME from "ME" /* 676 */;
import { PRIMARY_DOMAIN } from "sum" /* 505 */;
import addBreadcrumb from "addBreadcrumb" /* 810 */;
import IGNORE_ANALYTICS_BREADCRUMB_EVENTS from "IGNORE_ANALYTICS_BREADCRUMB_EVENTS" /* 13626 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
function _maybeBackfillMissingBreadcrumbsFromTelemetryRing() {
const self = this;
const tmp = callback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c2 = 0;
c3 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0) {
if (table === 2) {
table = 3;
HermesBuiltin.throwTypeError();
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
} else {
try {
table = 2;
if (0 === c2) {
if (arg0 === 1) {
table = 3;
throw arg1;
} else if (arg0 === 2) {
table = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp2;
2026-07-29 08:29:29 +00:00
closure_1 = undefined;
const breadcrumbs = lib.breadcrumbs;
const _Array2 = Array;
if (Array.isArray(breadcrumbs)) {
if (breadcrumbs.length > 0) {
table = 3;
}
}
const SentryTelemetry = lib(table[6]).SentryTelemetry;
2026-08-24 06:08:38 +00:00
items = [SentryTelemetry.snapshotForBreadcrumbs(), ];
2026-07-29 08:29:29 +00:00
const promise = new Promise((arg0, arg1) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg1;
2026-07-29 08:29:29 +00:00
return setTimeout(() => {
2026-08-24 06:08:38 +00:00
error = new Error("TelemetryRing breadcrumb timeout");
2026-07-29 08:29:29 +00:00
return callback(error);
}, 200);
});
items[1] = promise;
c2 = 1;
table = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
2026-07-29 08:29:29 +00:00
obj1[0] = Promise.race(items).catch(() => null);
return obj1;
}
} else if (arg0 === 1) {
table = 3;
throw arg1;
} else if (arg0 !== 2) {
closure_1 = arg1;
let isArray = null != closure_1;
if (isArray) {
const _Array = Array;
isArray = Array.isArray(closure_1.entries);
}
if (isArray) {
isArray = 0 !== closure_1.entries.length;
}
if (isArray) {
const entries = closure_1.entries;
lib.breadcrumbs = entries.map((data) => {
let key = data.message;
if (key == null) {
key = data.key;
}
return { message: key, category: "telemetry_ring", timestamp: data.timestamp / 1000, data: data.data };
});
}
}
table = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} catch (tmp21) {
table = tmp;
throw tmp21;
}
}
})();
});
2026-08-24 06:08:38 +00:00
closure_15 = tmp;
2026-07-29 08:29:29 +00:00
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
function filterError(event_id, originalException) {
2026-08-24 06:08:38 +00:00
closure_0 = event_id;
importDefault = originalException;
2026-07-20 16:05:17 +00:00
originalException = undefined;
2026-07-29 08:29:29 +00:00
if (originalException != null) {
2026-07-20 16:05:17 +00:00
originalException = originalException.originalException;
}
let status;
2026-07-29 08:29:29 +00:00
if (originalException != null) {
2026-07-20 16:05:17 +00:00
status = originalException.status;
}
if (!status) {
let captchaFields;
2026-07-29 08:29:29 +00:00
if (originalException != null) {
2026-07-20 16:05:17 +00:00
captchaFields = originalException.captchaFields;
}
let tmp4 = null;
if (null != captchaFields) {
let code;
2026-07-29 08:29:29 +00:00
if (originalException != null) {
2026-07-20 16:05:17 +00:00
code = originalException.code;
}
tmp4 = code;
}
let flag = false;
if (tmp4) {
flag = false;
if (tmp4 < 0) {
flag = true;
}
}
} else {
flag = true;
}
if (!flag) {
let originalException1;
2026-07-29 08:29:29 +00:00
if (originalException != null) {
2026-07-20 16:05:17 +00:00
originalException1 = originalException.originalException;
}
let code1;
2026-07-29 08:29:29 +00:00
if (originalException1 != null) {
if (originalException1.err != null) {
2026-07-20 16:05:17 +00:00
code1 = err.code;
}
}
let flag2 = false;
if ("ABORTED" === code1) {
flag2 = true;
}
flag = flag2;
}
if (flag) {
2026-07-29 08:29:29 +00:00
event_id = event_id.event_id;
2026-08-04 21:03:28 +00:00
let tmp17 = typeof event_id === "string";
if (typeof event_id === "string") {
2026-07-29 08:29:29 +00:00
tmp17 = 0 !== event_id.length;
}
if (tmp17) {
2026-08-24 06:08:38 +00:00
_modDef1208.markCrashHandled(event_id);
const obj = _modDef1208;
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
} else {
let originalException2;
2026-07-29 08:29:29 +00:00
if (originalException != null) {
2026-07-20 16:05:17 +00:00
originalException2 = originalException.originalException;
}
let status1;
2026-07-29 08:29:29 +00:00
if (originalException2 != null) {
2026-07-20 16:05:17 +00:00
status1 = originalException2.status;
}
if (null != status1) {
if (null == event_id.tags) {
event_id.tags = {};
}
event_id.tags.httpStatusCode = status1;
}
2026-07-23 10:11:24 +00:00
let tmp10 = c12;
2026-07-20 16:05:17 +00:00
if ("error" === event_id.level) {
2026-07-23 10:11:24 +00:00
tmp10 = c13;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if (!c14) {
2026-07-29 08:29:29 +00:00
if (callback2()) {
const _Math = Math;
}
2026-07-20 16:05:17 +00:00
trackCrash(event_id, originalException, false);
}
2026-07-29 08:29:29 +00:00
return callback(function*() {
2026-08-24 06:08:38 +00:00
closure_1 = tmp3;
closure_0 = tmp3;
c2 = 1;
const ZoomedInTelemetry = closure_1_0(table[6]).ZoomedInTelemetry;
items = [ZoomedInTelemetry.flushNow(), ];
2026-08-04 21:03:28 +00:00
const promise = new Promise((arg0) => setTimeout(arg0, 200));
items[1] = promise;
yield Promise.race(items);
if (1 === tmp7) {
c2 = 0;
2026-08-24 06:08:38 +00:00
closure_1_19(closure_1_0, closure_1_1);
c4 = 3;
2026-08-04 21:03:28 +00:00
} else if (2 === tmp7) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
2026-08-04 21:03:28 +00:00
c4 = 3;
2026-07-29 08:29:29 +00:00
throw arg1;
} else if (arg0 === 2) {
2026-08-04 21:03:28 +00:00
c2 = 0;
c4 = 3;
const obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-08-04 21:03:28 +00:00
table = 3;
c4 = 1;
const obj3 = { value: null, done: false };
obj3[0] = (function maybeBackfillMissingBreadcrumbsFromTelemetryRing(closure_0) {
const self = this;
const apply = closure_15.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
2026-07-29 08:29:29 +00:00
} else {
2026-08-04 21:03:28 +00:00
applyArgumentsResult = apply(self, arguments);
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
return applyArgumentsResult;
})(closure_0);
return obj3;
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
} else if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 !== 2) {
c2 = 0;
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
c2 = 0;
return arg1;
2026-07-20 16:05:17 +00:00
})();
}
return null;
}
function getCrashErrorMessage(exception) {
exception = exception.exception;
let first;
2026-07-29 08:29:29 +00:00
if (exception != null) {
2026-07-20 16:05:17 +00:00
const values = exception.values;
2026-07-29 08:29:29 +00:00
if (values != null) {
2026-07-20 16:05:17 +00:00
first = values[0];
}
}
if (null == first) {
const extra2 = exception.extra;
let prop;
2026-07-29 08:29:29 +00:00
if (extra2 != null) {
2026-07-20 16:05:17 +00:00
prop = extra2.persisted_error_message;
}
let message;
2026-08-04 21:03:28 +00:00
if (typeof prop === "string") {
2026-07-20 16:05:17 +00:00
if (prop.length > 0) {
message = prop;
}
}
2026-07-29 08:29:29 +00:00
if (message == null) {
2026-07-20 16:05:17 +00:00
message = exception.message;
}
return message;
} else {
({ type, value } = first);
if (null != type) {
if (null != value) {
const _HermesInternal = HermesInternal;
return "" + type + ": " + value;
}
}
const extra = exception.extra;
2026-07-29 08:29:29 +00:00
if (extra != null) {
2026-07-20 16:05:17 +00:00
const prop1 = extra.persisted_error_message;
}
2026-07-29 08:29:29 +00:00
message = type;
if (type == null) {
message = value;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (message == null) {
2026-07-20 16:05:17 +00:00
message = exception.message;
}
2026-07-29 08:29:29 +00:00
if (message == null) {
2026-07-20 16:05:17 +00:00
let tmp2;
2026-08-04 21:03:28 +00:00
if (typeof prop1 === "string") {
2026-07-20 16:05:17 +00:00
if (prop1.length > 0) {
tmp2 = prop1;
}
}
message = tmp2;
}
return message;
}
}
function getErrorStackTrace(exception) {
exception = exception.exception;
let first;
2026-07-29 08:29:29 +00:00
if (exception != null) {
2026-07-20 16:05:17 +00:00
const values = exception.values;
2026-07-29 08:29:29 +00:00
if (values != null) {
2026-07-20 16:05:17 +00:00
first = values[0];
}
}
if (null == first) {
const extra2 = exception.extra;
let prop;
2026-07-29 08:29:29 +00:00
if (extra2 != null) {
2026-07-20 16:05:17 +00:00
prop = extra2.persisted_error_stack;
}
let tmp6;
2026-08-04 21:03:28 +00:00
if (typeof prop === "string") {
2026-07-20 16:05:17 +00:00
if (prop.length > 0) {
tmp6 = prop;
}
}
return tmp6;
} else {
const stacktrace = first.stacktrace;
let joined;
2026-07-29 08:29:29 +00:00
if (stacktrace != null) {
2026-07-20 16:05:17 +00:00
const frames = stacktrace.frames;
2026-07-29 08:29:29 +00:00
if (frames != null) {
2026-07-20 16:05:17 +00:00
const mapped = frames.map((filename) => "" + filename.filename + ":" + filename.lineno + ":" + filename.colno);
joined = mapped.join("\n");
}
}
if (null != joined) {
if (joined.length > 0) {
return joined;
}
}
const extra = exception.extra;
let prop1;
2026-07-29 08:29:29 +00:00
if (extra != null) {
2026-07-20 16:05:17 +00:00
prop1 = extra.persisted_error_stack;
}
let tmp4;
2026-08-04 21:03:28 +00:00
if (typeof prop1 === "string") {
2026-07-20 16:05:17 +00:00
if (prop1.length > 0) {
tmp4 = prop1;
}
}
return tmp4;
}
}
2026-07-29 08:29:29 +00:00
function trackCrash(event, hint, arg2) {
2026-07-20 16:05:17 +00:00
let flag = arg2;
if (arg2 === undefined) {
flag = true;
}
2026-07-29 08:29:29 +00:00
let obj = { event, hint };
2026-08-24 06:08:38 +00:00
logger.info("Crash", obj);
2026-07-20 16:05:17 +00:00
({ level, extra } = event);
let native_is_native;
2026-07-29 08:29:29 +00:00
if (extra != null) {
2026-07-20 16:05:17 +00:00
native_is_native = extra.native_is_native;
}
if (null != native_is_native) {
let tmp4 = "true" === event.extra.native_is_native;
} else {
const tags = event.tags;
let prop;
2026-07-29 08:29:29 +00:00
if (tags != null) {
2026-07-23 10:11:24 +00:00
prop = tags["event.origin"];
2026-07-20 16:05:17 +00:00
}
tmp4 = "javascript" !== prop;
}
if ("fatal" !== level) {
return event;
}
let tmp5 = tmp4;
if (!tmp4) {
tmp5 = "error" !== level;
}
let num = 1;
if (!tmp5) {
num = 0.01;
}
2026-07-23 10:11:24 +00:00
if (!c14) {
2026-07-29 08:29:29 +00:00
const _Math = Math;
if (Math.random() > num) {
const event_id = event.event_id;
2026-08-24 06:08:38 +00:00
let tmp7 = typeof event_id === "string";
2026-08-04 21:03:28 +00:00
if (typeof event_id === "string") {
2026-07-29 08:29:29 +00:00
tmp7 = 0 !== event_id.length;
}
if (tmp7) {
2026-08-24 06:08:38 +00:00
obj1 = _modDef1208;
2026-07-29 08:29:29 +00:00
obj1.markCrashHandled(event_id);
}
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
let tmp13 = null;
2026-07-20 16:05:17 +00:00
if (flag) {
2026-07-29 08:29:29 +00:00
let event_id1 = event.event_id;
if (event_id1 == null) {
event_id1 = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp13 = event_id1;
2026-07-20 16:05:17 +00:00
}
const timestamp = event.timestamp;
let result;
if (null != timestamp) {
2026-08-04 21:03:28 +00:00
if (typeof timestamp === "number") {
2026-07-20 16:05:17 +00:00
const _isNaN = isNaN;
if (!isNaN(timestamp)) {
result = 1000 * timestamp;
}
}
const _Date = Date;
if (timestamp instanceof Date) {
result = timestamp.getTime();
2026-08-04 21:03:28 +00:00
} else if (typeof timestamp === "string") {
2026-07-29 08:29:29 +00:00
const _Date3 = Date;
2026-07-20 16:05:17 +00:00
const parsed = Date.parse(timestamp);
const _Number = Number;
if (!Number.isNaN(parsed)) {
result = parsed;
}
}
}
2026-07-29 08:29:29 +00:00
if (result == null) {
const _Date2 = Date;
2026-07-20 16:05:17 +00:00
result = Date.now();
}
2026-08-24 06:08:38 +00:00
const obj3 = transitionTo;
const track = expandEventPropertiesDefault.track;
2026-07-20 16:05:17 +00:00
if (tmp4) {
extra = event.extra;
2026-07-29 08:29:29 +00:00
if (extra == null) {
2026-07-20 16:05:17 +00:00
extra = {};
}
2026-07-29 08:29:29 +00:00
obj = { did_crash: true, sentry_issue_id: null, client_track_timestamp: null, exit_reason: null, exit_description: null, tombstone_hash: null, tombstone_cause: null, tombstone: null, call_stack_tree: null, binary_name: null, exception_message: null, exception_stacktrace: null, js_error_message: null, js_error_stacktrace: null };
obj[1] = tmp13;
obj[2] = result;
const native_exit_reason = extra.native_exit_reason;
let tmp27 = null;
2026-08-04 21:03:28 +00:00
if (typeof native_exit_reason === "string") {
2026-07-29 08:29:29 +00:00
tmp27 = null;
if (native_exit_reason.length > 0) {
tmp27 = native_exit_reason;
}
}
obj[3] = tmp27;
const prop1 = extra.native_exit_description;
let tmp28 = null;
2026-08-04 21:03:28 +00:00
if (typeof prop1 === "string") {
2026-07-29 08:29:29 +00:00
tmp28 = null;
if (prop1.length > 0) {
tmp28 = prop1;
}
}
obj[4] = tmp28;
const prop2 = extra.native_tombstone_hash;
let tmp29 = null;
2026-08-04 21:03:28 +00:00
if (typeof prop2 === "string") {
2026-07-29 08:29:29 +00:00
tmp29 = null;
if (prop2.length > 0) {
tmp29 = prop2;
}
}
obj[5] = tmp29;
const prop3 = extra.native_tombstone_cause;
let tmp30 = null;
2026-08-04 21:03:28 +00:00
if (typeof prop3 === "string") {
2026-07-29 08:29:29 +00:00
tmp30 = null;
if (prop3.length > 0) {
tmp30 = prop3;
}
}
obj[6] = tmp30;
const native_tombstone = extra.native_tombstone;
let tmp31 = null;
2026-08-04 21:03:28 +00:00
if (typeof native_tombstone === "string") {
2026-07-29 08:29:29 +00:00
tmp31 = null;
if (native_tombstone.length > 0) {
tmp31 = native_tombstone;
}
}
obj[7] = tmp31;
const prop4 = extra.native_tombstone_group_by;
let tmp32 = null;
2026-08-04 21:03:28 +00:00
if (typeof prop4 === "string") {
2026-07-29 08:29:29 +00:00
tmp32 = null;
if (prop4.length > 0) {
tmp32 = prop4;
}
}
obj[8] = tmp32;
const prop5 = extra.native_tombstone_origin;
let tmp33 = null;
2026-08-04 21:03:28 +00:00
if (typeof prop5 === "string") {
2026-07-29 08:29:29 +00:00
tmp33 = null;
if (prop5.length > 0) {
tmp33 = prop5;
}
}
obj[9] = tmp33;
obj[10] = getCrashErrorMessage(event);
obj[11] = getErrorStackTrace(event);
const prop6 = extra.persisted_error_message;
let tmp36 = null;
2026-08-04 21:03:28 +00:00
if (typeof prop6 === "string") {
2026-07-29 08:29:29 +00:00
tmp36 = null;
if (prop6.length > 0) {
tmp36 = prop6;
}
}
obj[12] = tmp36;
const prop7 = extra.persisted_error_stack;
let tmp37 = null;
2026-08-04 21:03:28 +00:00
if (typeof prop7 === "string") {
2026-07-29 08:29:29 +00:00
tmp37 = null;
if (prop7.length > 0) {
tmp37 = prop7;
}
}
obj[13] = tmp37;
track(tmp20.APP_NATIVE_CRASH, obj);
let tmp25 = tmp18;
let tmp26 = tmp18;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj = { path: null, client_track_timestamp: null, sentry_issue_id: null, extra: null, error_message: null, error_level: null, error_stack: null };
obj[0] = obj3.getHistory().location.pathname;
obj[1] = result;
obj[2] = tmp13;
obj[3] = hint;
obj[4] = getCrashErrorMessage(event);
obj[5] = level;
obj[6] = getErrorStackTrace(event);
track(tmp20.APP_CRASHED, obj);
tmp25 = tmp18;
tmp26 = tmp18;
const tmp22 = level;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const event_id2 = event.event_id;
2026-08-04 21:03:28 +00:00
let tmp39 = typeof event_id2 === "string";
if (typeof event_id2 === "string") {
2026-07-29 08:29:29 +00:00
tmp39 = 0 !== event_id2.length;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp39) {
tmp25(1208).markCrashHandled(event_id2);
const tmp25Result = tmp25(1208);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const AppCrashedReasons = tmp11(13625).AppCrashedReasons;
const tmp19 = expandEventPropertiesDefault;
2026-07-29 08:29:29 +00:00
const tmp41 = tmp4 ? AppCrashedReasons.UNHANDLED_NATIVE_ERROR : AppCrashedReasons.UNHANDLED_JS_ERROR;
2026-08-24 06:08:38 +00:00
obj1 = { name: tmp11(5016).MetricEvents.APP_CRASHED, tags: null };
items = ["reason:" + tmp41, ];
2026-07-29 08:29:29 +00:00
if (level == null) {
level = "unknown";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
items[1] = "level:" + level;
obj1[1] = items;
2026-08-24 06:08:38 +00:00
tmp26(5011).increment(obj1, true);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
({ AnalyticEvents: closure_6, Endpoints } = ME);
addBreadcrumb = addBreadcrumb.reactNavigationIntegration();
2026-07-20 16:05:17 +00:00
const regExp = new RegExp("/v" + window.GLOBAL_ENV.API_VERSION + Endpoints.METRICS, "g");
2026-07-23 10:11:24 +00:00
let items = [regExp, , ];
2026-07-20 16:05:17 +00:00
const regExp1 = new RegExp("/v" + window.GLOBAL_ENV.API_VERSION + Endpoints.METRICS_V2, "g");
items[1] = regExp1;
const regExp2 = new RegExp("/v" + window.GLOBAL_ENV.API_VERSION + Endpoints.TRACK, "g");
items[2] = regExp2;
2026-08-24 06:08:38 +00:00
let closure_10 = new timestampDefault("Sentry");
2026-07-23 10:11:24 +00:00
let closure_11 = ["The operation couldn\u2019t be completed. (com.apple.CallKit.error.requesttransaction", "Request has been terminated", "couldn't execute statement: database is disabled", "couldn't delete database: database is currently open", "database is no longer open"];
let c12 = 0.05;
let c13 = 0.005;
let c14 = false;
2026-07-29 08:29:29 +00:00
let closure_20 = IGNORE_ANALYTICS_BREADCRUMB_EVENTS.filterThrottle({ maxBudgetMinute: 1, maxBudgetHour: 15 });
2026-08-24 06:08:38 +00:00
let tmp7 = new timestampDefault("Sentry");
const result1 = require("set").fileFinishedImporting("modules/errors/native/SentryInitUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
export const routingInstrumentation = addBreadcrumb;
2026-07-20 16:05:17 +00:00
export const initSentry = function initSentry() {
const CrashReportingManager = NativeModules.CrashReportingManager;
2026-07-29 08:29:29 +00:00
if (CrashReportingManager != null) {
2026-07-20 16:05:17 +00:00
const isUserStaffForCrashReporting = CrashReportingManager.getIsUserStaffForCrashReporting((arg0) => {
2026-08-24 06:08:38 +00:00
closure_14 = arg0;
2026-07-29 08:29:29 +00:00
let obj = callback3(table[14]);
2026-07-20 16:05:17 +00:00
const constants = obj.getConstants();
const ReleaseChannel = constants.ReleaseChannel;
if (-1 === ReleaseChannel.indexOf("debug")) {
if (-1 === ReleaseChannel.indexOf("developer")) {
2026-07-29 08:29:29 +00:00
const isStable = callback(tmp[15]).isStable;
obj = { releaseChannel: null, isProductionChannel: null };
obj[0] = ReleaseChannel;
obj[1] = isStable;
closure_10.verbose("Initialize", obj);
2026-08-13 07:00:46 +00:00
if (obj15.isAndroid()) {
2026-07-20 16:05:17 +00:00
if (isStable) {
2026-08-13 07:00:46 +00:00
let tmp14Result = tmp14(tmp[17]);
const device = tmp14Result.getDevice();
2026-07-20 16:05:17 +00:00
}
}
2026-08-24 06:08:38 +00:00
c12 = 0.05;
2026-07-20 16:05:17 +00:00
const SentryDsn = constants.SentryDsn;
if (isStable) {
2026-08-13 07:00:46 +00:00
tmp14Result = tmp14(tmp[18]);
2026-07-20 16:05:17 +00:00
let SentryStaffDsn = SentryDsn;
2026-08-13 07:00:46 +00:00
if (tmp14Result.isMetaQuest()) {
2026-07-29 08:29:29 +00:00
c12 = 1;
2026-08-24 06:08:38 +00:00
c13 = 1;
2026-07-20 16:05:17 +00:00
SentryStaffDsn = SentryDsn;
}
} else {
2026-07-29 08:29:29 +00:00
c12 = 1;
2026-07-20 16:05:17 +00:00
SentryStaffDsn = constants.SentryAlphaBetaDsn;
}
if (arg0) {
SentryStaffDsn = constants.SentryStaffDsn;
2026-07-29 08:29:29 +00:00
c12 = 1;
2026-07-20 16:05:17 +00:00
}
2026-08-13 07:00:46 +00:00
obj15 = callback(tmp[16]);
2026-07-29 08:29:29 +00:00
const lastCrashReport = callback2(tmp[13]).getLastCrashReport();
const obj4 = callback2(tmp[13]);
lastCrashReport.then((arg0) => {
if (null != arg0) {
callback2(arg0, { crash_event_source: "startup_reconcile" });
}
}).catch((arg0) => {
logger.warn("Failed to replay pending crash report", arg0);
});
const nextPromise = lastCrashReport.then((arg0) => {
if (null != arg0) {
callback2(arg0, { crash_event_source: "startup_reconcile" });
}
});
2026-08-13 07:00:46 +00:00
const tmp14Result1 = callback(tmp[4]);
2026-07-20 16:05:17 +00:00
let str2 = "ios";
2026-08-13 07:00:46 +00:00
if (tmp14Result2.isAndroid()) {
2026-07-20 16:05:17 +00:00
str2 = "android";
}
2026-08-24 06:08:38 +00:00
obj = { tunnel: null, autoInitializeNativeSdk: false, beforeSend: null, dist: "6266", dsn: null, environment: null, tracesSampleRate: 0, sampleRate: 1, ignoreErrors: null, release: "discord_android@344.0.0-2+344200", tracePropagationTargets: null, integrations: null, beforeBreadcrumb: null };
2026-07-29 08:29:29 +00:00
obj[0] = `/error-reporting-proxy/${str2}`;
obj[2] = closure_16;
obj[4] = SentryStaffDsn;
obj[5] = ReleaseChannel;
obj[8] = closure_11;
2026-08-24 06:08:38 +00:00
items = [closure_7];
2026-07-29 08:29:29 +00:00
obj[10] = items;
const items1 = [closure_8, , ];
2026-08-13 07:00:46 +00:00
tmp14Result2 = callback(tmp[16]);
2026-07-29 08:29:29 +00:00
items1[1] = callback(tmp[4]).featureFlagsIntegration();
2026-08-13 07:00:46 +00:00
const tmp14Result3 = callback(tmp[4]);
2026-08-24 06:08:38 +00:00
obj1 = { shouldCreateSpanForRequest: null };
2026-07-29 08:29:29 +00:00
obj1[0] = function shouldCreateSpanForRequest(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-29 08:29:29 +00:00
return !closure_9.some((arg0) => null != closure_0.match(arg0));
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
items1[2] = callback(tmp[4]).reactNativeTracingIntegration(obj1);
obj[11] = items1;
obj[12] = function beforeBreadcrumb(data) {
2026-07-20 16:05:17 +00:00
if (null == data.data) {
data.data = {};
}
2026-07-29 08:29:29 +00:00
const currentMemoryUsageKB = callback(table[19]).getCurrentMemoryUsageKB();
2026-07-20 16:05:17 +00:00
if (null != currentMemoryUsageKB) {
data.data.client_performance_memory = currentMemoryUsageKB;
}
2026-07-29 08:29:29 +00:00
const obj = callback(table[19]);
const tmp = callback;
const tmp2 = table;
const currentCPUUsagePercent = callback(table[19]).getCurrentCPUUsagePercent();
2026-07-20 16:05:17 +00:00
if (null != currentCPUUsagePercent) {
data.data.client_performance_cpu = currentCPUUsagePercent;
}
return data;
};
2026-08-13 07:00:46 +00:00
tmp14Result1.init(obj);
const tmp14Result4 = callback(tmp[4]);
2026-08-24 06:08:38 +00:00
callback(tmp[4]).setTag("buildNumber", "6266");
2026-08-13 07:00:46 +00:00
const tmp14Result5 = callback(tmp[4]);
2026-07-29 08:29:29 +00:00
callback(tmp[4]).setTag("appVersion", constants.Version);
2026-08-13 07:00:46 +00:00
const tmp14Result6 = callback(tmp[4]);
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
2026-07-29 08:29:29 +00:00
callback(tmp[4]).setTag("design_id", "" + callback(tmp[20]).DesignIds.DESIGN_TABS_IA);
2026-08-13 07:00:46 +00:00
const tmp14Result7 = callback(tmp[4]);
2026-07-20 16:05:17 +00:00
}
}
});
}
};