decord/alpha/source/utils/SentryUtils.native.tsx

350 lines
12 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 1255
// Function ID: 1256
// Name: SentryUtils
2026-10-12 06:59:38 +00:00
// Dependencies: [17, 3, 1256, 686, 14392, 685, 1381, 2]
2026-07-20 16:05:17 +00:00
2026-10-09 10:00:15 +00:00
// Module 1255 (SentryUtils)
import LoggerDefault from "Logger" /* 3 */;
2026-10-03 08:58:59 +00:00
import react_native from "react-native" /* 17 */;
import addSentryBreadcrumbDefault from "addSentryBreadcrumb" /* 685 */;
import _modAll686 from "module_686" /* 686 */;
2026-10-09 10:00:15 +00:00
import react_nativeAll from "react-native" /* 1381 */;
import SentryInitUtils_mod from "SentryInitUtils" /* 1256 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
2026-10-03 08:58:59 +00:00
let _require, dependencyMap, exception, importAll;
2026-10-03 08:58:59 +00:00
const NativeModules = react_native.NativeModules;
let tmp2 = new LoggerDefault("Sentry");
let closure_5 = tmp2;
let SentryInitUtils = SentryInitUtils_mod;
SentryInitUtils = SentryInitUtils.initSentry();
2026-10-03 08:58:59 +00:00
let obj = {
2026-07-20 16:05:17 +00:00
setUser(id, username, email, staff) {
const user = { id, username, email, staff };
2026-10-03 08:58:59 +00:00
const obj2 = _modAll686;
const currentScope = obj2.getCurrentScope();
currentScope.setUser(user);
2026-07-29 08:29:29 +00:00
const CrashReportingManager = NativeModules.CrashReportingManager;
CrashReportingManager.setUser(user);
2026-07-20 16:05:17 +00:00
},
clearUser() {
2026-10-03 08:58:59 +00:00
const obj = _modAll686;
const currentScope = obj.getCurrentScope();
2026-07-20 16:05:17 +00:00
currentScope.setUser(null);
2026-07-29 08:29:29 +00:00
const CrashReportingManager = NativeModules.CrashReportingManager;
CrashReportingManager.setUser({ staff: false });
2026-07-20 16:05:17 +00:00
},
setTags(arg0) {
2026-10-03 08:58:59 +00:00
const obj = _modAll686;
const currentScope = obj.getCurrentScope();
2026-07-20 16:05:17 +00:00
currentScope.setTags(arg0);
},
setExtra(arg0) {
2026-10-03 08:58:59 +00:00
const obj = _modAll686;
const currentScope = obj.getCurrentScope();
2026-07-20 16:05:17 +00:00
currentScope.setExtras(arg0);
},
captureException(arg0, extra) {
2026-10-03 08:58:59 +00:00
let closure_0;
let closure_2;
_require = arg0;
2026-10-03 08:58:59 +00:00
let obj = require("ErrorCommonUtils");
importAll = obj.getUpdatedOptions(extra);
const obj2 = _modAll686;
obj2.withScope((setTags) => {
if (null != closure_2) {
2026-10-03 08:58:59 +00:00
if (null != closure_2.tags) {
setTags.setTags(closure_2.tags);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
if (null != closure_2.extra) {
setTags.setExtras(closure_2.extra);
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
const obj = _modAll686;
closure_1 = obj.captureException(closure_0);
2026-07-20 16:05:17 +00:00
});
return closure_1;
2026-07-20 16:05:17 +00:00
},
captureCrash(error, extra) {
2026-10-03 08:58:59 +00:00
let closure_3;
_require = error;
2026-10-03 08:58:59 +00:00
const tmp = dependencyMap;
let obj = require("ErrorCommonUtils");
const updatedOptions = obj.getUpdatedOptions(extra);
2026-07-20 16:05:17 +00:00
let tags;
2026-07-29 08:29:29 +00:00
if (updatedOptions != null) {
2026-07-20 16:05:17 +00:00
tags = updatedOptions.tags;
}
if (null != tags) {
let tags1;
2026-07-29 08:29:29 +00:00
if (updatedOptions != null) {
2026-07-20 16:05:17 +00:00
tags1 = updatedOptions.tags;
}
}
2026-08-24 06:08:38 +00:00
dependencyMap = Object.assign({ crash: "true" }, {});
2026-10-03 08:58:59 +00:00
const obj2 = updatedOptions(686);
obj2.withScope((setExtras) => {
const tmp2 = null != updatedOptions && null != tmp.extra;
2026-07-29 08:29:29 +00:00
if (tmp2) {
2026-10-03 08:58:59 +00:00
setExtras.setExtras(updatedOptions.extra);
2026-07-20 16:05:17 +00:00
}
setExtras.setTags(closure_3);
2026-07-20 16:05:17 +00:00
setExtras.setLevel("fatal");
setExtras.addEventProcessor((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) {
2026-10-03 08:58:59 +00:00
const obj = { handled: false };
2026-07-20 16:05:17 +00:00
const merged = Object.assign(first.mechanism);
first.mechanism = obj;
}
return exception;
});
2026-10-03 08:58:59 +00:00
let obj = _modAll686;
closure_1 = obj.captureException(error);
2026-07-20 16:05:17 +00:00
});
return closure_1;
2026-07-20 16:05:17 +00:00
},
captureMessage(arg0, extra, arg2) {
2026-10-03 08:58:59 +00:00
let closure_0;
let closure_2;
_require = arg0;
2026-10-03 08:58:59 +00:00
let closure_1 = arg2;
let obj = require("ErrorCommonUtils");
importAll = obj.getUpdatedOptions(extra);
const obj2 = _modAll686;
obj2.withScope((setExtras) => {
const tmp2 = null != closure_2 && null != closure_2.extra;
2026-07-29 08:29:29 +00:00
if (tmp2) {
2026-10-03 08:58:59 +00:00
setExtras.setExtras(closure_2.extra);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const tmp4 = null != closure_2 && null != closure_2.tags;
2026-07-29 08:29:29 +00:00
if (tmp4) {
2026-10-03 08:58:59 +00:00
setExtras.setTags(closure_2.tags);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const tmp6 = null != closure_2 && null != closure_2.fingerprint;
2026-08-24 06:08:38 +00:00
if (tmp6) {
2026-10-03 08:58:59 +00:00
setExtras.setFingerprint(closure_2.fingerprint);
2026-08-24 06:08:38 +00:00
setExtras.addEventProcessor((arg0) => {
arg0.exception = undefined;
return arg0;
});
}
2026-10-03 08:58:59 +00:00
const obj = _modAll686;
obj.captureMessage(closure_0, closure_1);
2026-07-20 16:05:17 +00:00
});
},
addFeatureFlag(arg0, arg1) {
2026-10-03 08:58:59 +00:00
const getClient = _modAll686.getClient;
2026-07-20 16:05:17 +00:00
let client;
2026-10-03 08:58:59 +00:00
_modAll686;
2026-07-29 08:29:29 +00:00
if (getClient != null) {
client = getClient();
2026-07-20 16:05:17 +00:00
}
let integrationByName;
2026-07-29 08:29:29 +00:00
if (client != null) {
const getIntegrationByName = client.getIntegrationByName;
if (getIntegrationByName != null) {
integrationByName = getIntegrationByName("FeatureFlags");
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (integrationByName != null) {
const addFeatureFlag = integrationByName.addFeatureFlag;
if (addFeatureFlag != null) {
addFeatureFlag(arg0, arg1);
}
2026-07-20 16:05:17 +00:00
}
},
2026-07-29 08:29:29 +00:00
addBreadcrumb(url) {
2026-08-24 06:08:38 +00:00
closure_5.verbose("Breadcrumb", url);
addSentryBreadcrumbDefault(url);
2026-07-20 16:05:17 +00:00
},
profiledRootComponent(displayName) {
let withProfilerResult = displayName;
2026-10-03 08:58:59 +00:00
const obj = react_nativeAll;
2026-07-20 16:05:17 +00:00
if ("canaryRelease" === obj.getConstants().ReleaseChannel) {
2026-10-03 08:58:59 +00:00
const tmpResult = _modAll686;
withProfilerResult = tmpResult.withProfiler(displayName, { includeRender: true, includeUpdates: true });
2026-07-20 16:05:17 +00:00
}
return withProfilerResult;
},
crash() {
const CrashReportingManager = NativeModules.CrashReportingManager;
CrashReportingManager.crash();
},
2026-07-29 08:29:29 +00:00
triggerMemoryWarning() {
const CrashReportingManager = NativeModules.CrashReportingManager;
CrashReportingManager.triggerMemoryWarning();
},
markCrashHandled(event_id) {
if (0 !== event_id.length) {
try {
2026-07-20 16:05:17 +00:00
const CrashReportingManager = NativeModules.CrashReportingManager;
2026-07-29 08:29:29 +00:00
const markCrashHandled = CrashReportingManager.markCrashHandled;
if (markCrashHandled != null) {
markCrashHandled(event_id);
}
} catch (tmp4) {
2026-08-24 06:08:38 +00:00
closure_5.warn("Failed to mark crash as handled", tmp4);
2026-07-20 16:05:17 +00:00
}
}
},
getLastCrashReport() {
2026-10-03 08:58:59 +00:00
const promise = new Promise((fn, arg1) => {
let closure_0 = fn;
let closure_1 = arg1;
const CrashReportingManager = NativeModules.CrashReportingManager;
2026-07-20 16:05:17 +00:00
let getLastCrashReport;
2026-07-29 08:29:29 +00:00
if (CrashReportingManager != null) {
2026-07-20 16:05:17 +00:00
getLastCrashReport = CrashReportingManager.getLastCrashReport;
}
if (null != getLastCrashReport) {
2026-10-12 06:59:38 +00:00
const lastCrashReport = CrashReportingManager.getLastCrashReport((event_id) => {
2026-10-03 08:58:59 +00:00
let tmp5;
2026-10-12 06:59:38 +00:00
function parseNativeCrashReport(event_id) {
2026-10-03 08:58:59 +00:00
let obj;
let obj5;
let str3;
let tmp4;
let result;
2026-10-12 06:59:38 +00:00
if (typeof event_id.timestamp === "number") {
2026-10-03 08:58:59 +00:00
const _Number = Number;
2026-10-12 06:59:38 +00:00
if (!Number.isNaN(event_id.timestamp)) {
result = event_id.timestamp / 1000;
2026-10-03 08:58:59 +00:00
}
}
2026-10-12 06:59:38 +00:00
let str = event_id.level;
2026-10-03 08:58:59 +00:00
if (str == null) {
let str2 = "error";
2026-10-12 06:59:38 +00:00
if (event_id.is_native) {
2026-10-03 08:58:59 +00:00
str2 = "fatal";
}
str = str2;
}
let formatted;
if (str != null) {
formatted = str.toLowerCase();
}
2026-10-12 06:59:38 +00:00
obj = { type: "y", event_id: event_id.event_id, timestamp: result, level: formatted, tags: tmp4, extra: Object.assign({}, obj.extra, obj5) };
const origin = event_id.origin;
2026-10-03 08:58:59 +00:00
let tmp3 = typeof origin === "string";
if (typeof origin === "string") {
tmp3 = origin.length > 0;
}
tmp4 = undefined;
if (tmp3) {
2026-10-12 06:59:38 +00:00
tmp4 = { "event.origin": event_id.origin };
const obj2 = { "event.origin": event_id.origin };
2026-10-03 08:58:59 +00:00
}
2026-10-12 06:59:38 +00:00
const error_message = event_id.error_message;
2026-10-03 08:58:59 +00:00
let tmp5 = typeof error_message === "string";
if (typeof error_message === "string") {
tmp5 = error_message.length > 0;
}
obj5 = { native_is_native: str3 };
if (tmp5) {
2026-10-12 06:59:38 +00:00
({ error_message: obj.message, error_message: obj3.persisted_error_message } = event_id);
2026-10-03 08:58:59 +00:00
}
2026-10-12 06:59:38 +00:00
const error_stack = event_id.error_stack;
2026-10-03 08:58:59 +00:00
let tmp6 = typeof error_stack === "string";
if (typeof error_stack === "string") {
tmp6 = error_stack.length > 0;
}
if (tmp6) {
2026-10-12 06:59:38 +00:00
obj5.persisted_error_stack = event_id.error_stack;
2026-10-03 08:58:59 +00:00
}
2026-10-12 06:59:38 +00:00
if (event_id.is_native) {
const exit_reason = event_id.exit_reason;
2026-10-03 08:58:59 +00:00
let tmp7 = typeof exit_reason === "string";
if (typeof exit_reason === "string") {
tmp7 = exit_reason.length > 0;
}
if (tmp7) {
2026-10-12 06:59:38 +00:00
obj5.native_exit_reason = event_id.exit_reason;
2026-10-03 08:58:59 +00:00
}
2026-10-12 06:59:38 +00:00
const exit_description = event_id.exit_description;
2026-10-03 08:58:59 +00:00
let tmp8 = typeof exit_description === "string";
if (typeof exit_description === "string") {
tmp8 = exit_description.length > 0;
}
if (tmp8) {
2026-10-12 06:59:38 +00:00
obj5.native_exit_description = event_id.exit_description;
2026-10-03 08:58:59 +00:00
}
2026-10-12 06:59:38 +00:00
const tombstone = event_id.tombstone;
2026-10-03 08:58:59 +00:00
let tmp9 = typeof tombstone === "string";
if (typeof tombstone === "string") {
tmp9 = tombstone.length > 0;
}
if (tmp9) {
2026-10-12 06:59:38 +00:00
obj5.native_tombstone = event_id.tombstone;
2026-10-03 08:58:59 +00:00
}
2026-10-12 06:59:38 +00:00
const tombstone_cause = event_id.tombstone_cause;
2026-10-03 08:58:59 +00:00
let tmp10 = typeof tombstone_cause === "string";
if (typeof tombstone_cause === "string") {
tmp10 = tombstone_cause.length > 0;
}
if (tmp10) {
2026-10-12 06:59:38 +00:00
obj5.native_tombstone_cause = event_id.tombstone_cause;
2026-10-03 08:58:59 +00:00
}
2026-10-12 06:59:38 +00:00
const tombstone_hash = event_id.tombstone_hash;
2026-10-03 08:58:59 +00:00
let tmp11 = typeof tombstone_hash === "string";
if (typeof tombstone_hash === "string") {
tmp11 = tombstone_hash.length > 0;
}
if (tmp11) {
2026-10-12 06:59:38 +00:00
obj5.native_tombstone_hash = event_id.tombstone_hash;
2026-10-03 08:58:59 +00:00
}
2026-10-12 06:59:38 +00:00
const tombstone_group_by = event_id.tombstone_group_by;
2026-10-03 08:58:59 +00:00
let tmp12 = typeof tombstone_group_by === "string";
if (typeof tombstone_group_by === "string") {
tmp12 = tombstone_group_by.length > 0;
}
if (tmp12) {
2026-10-12 06:59:38 +00:00
obj5.native_tombstone_group_by = event_id.tombstone_group_by;
2026-10-03 08:58:59 +00:00
}
2026-10-12 06:59:38 +00:00
const tombstone_origin = event_id.tombstone_origin;
2026-10-03 08:58:59 +00:00
let tmp13 = typeof tombstone_origin === "string";
if (typeof tombstone_origin === "string") {
tmp13 = tombstone_origin.length > 0;
}
if (tmp13) {
2026-10-12 06:59:38 +00:00
obj5.native_tombstone_origin = event_id.tombstone_origin;
2026-10-03 08:58:59 +00:00
}
}
str3 = "false";
2026-10-12 06:59:38 +00:00
if (event_id.is_native) {
2026-10-03 08:58:59 +00:00
str3 = "true";
}
return obj;
}
2026-07-29 08:29:29 +00:00
try {
let tmp3 = null;
2026-10-03 08:58:59 +00:00
const tmp2 = closure_0;
2026-10-12 06:59:38 +00:00
if (null != event_id) {
tmp3 = parseNativeCrashReport(event_id);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp2(tmp3);
2026-07-29 08:29:29 +00:00
} catch (tmp5) {
2026-10-03 08:58:59 +00:00
let tmp6 = closure_1;
let tmp7 = closure_1(tmp5);
2026-07-20 16:05:17 +00:00
}
});
} else {
2026-10-03 08:58:59 +00:00
let tmp2 = fn(null);
2026-07-20 16:05:17 +00:00
}
});
2026-10-03 08:58:59 +00:00
return promise;
2026-07-20 16:05:17 +00:00
}
};
2026-10-03 08:58:59 +00:00
let result = size.fileFinishedImporting("utils/SentryUtils.native.tsx");
export default obj;