decord/source/utils/SentryUtils.native.tsx

319 lines
11 KiB
TypeScript
Raw Normal View History

// Module ID: 1232
// Function ID: 1233
// Name: SentryUtils
// Dependencies: [17, 3, 1233, 675, 14169, 674, 1364, 2]
2026-07-20 16:05:17 +00:00
// Module 1232 (SentryUtils)
import LoggerDefault from "Logger" /* 3 */;
import _mod17 from "module_17" /* 17 */;
import addSentryBreadcrumbDefault from "addSentryBreadcrumb" /* 674 */;
import _modAll675 from "module_675" /* 675 */;
import SentryInitUtils_mod from "SentryInitUtils" /* 1233 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
const NativeModules = _mod17.NativeModules;
let closure_5 = new LoggerDefault("Sentry");
let SentryInitUtils = SentryInitUtils_mod;
SentryInitUtils = SentryInitUtils.initSentry();
let result = size.fileFinishedImporting("utils/SentryUtils.native.tsx");
export default {
2026-07-20 16:05:17 +00:00
setUser(id, username, email, staff) {
const user = { id, username, email, staff };
const currentScope = _modAll675.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() {
const currentScope = _modAll675.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) {
const currentScope = _modAll675.getCurrentScope();
2026-07-20 16:05:17 +00:00
currentScope.setTags(arg0);
},
setExtra(arg0) {
const currentScope = _modAll675.getCurrentScope();
2026-07-20 16:05:17 +00:00
currentScope.setExtras(arg0);
},
captureException(arg0, extra) {
_require = arg0;
importAll = require("ErrorCommonUtils").getUpdatedOptions(extra);
const obj = require("ErrorCommonUtils");
_modAll675.withScope((setTags) => {
if (null != closure_2) {
2026-07-29 08:29:29 +00:00
if (null != tmp.tags) {
setTags.setTags(tmp.tags);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (null != tmp.extra) {
setTags.setExtras(tmp.extra);
2026-07-20 16:05:17 +00:00
}
}
closure_1 = _modAll675.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) {
_require = error;
const updatedOptions = require("ErrorCommonUtils").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" }, {});
let obj = require("ErrorCommonUtils");
updatedOptions(675).withScope((setExtras) => {
2026-07-29 08:29:29 +00:00
if (tmp2) {
setExtras.setExtras(tmp.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) {
const obj = {};
const merged = Object.assign(first.mechanism);
2026-07-29 08:29:29 +00:00
obj.handled = false;
2026-07-20 16:05:17 +00:00
first.mechanism = obj;
}
return exception;
});
closure_1 = _modAll675.captureException(closure_0);
2026-07-20 16:05:17 +00:00
});
return closure_1;
2026-07-20 16:05:17 +00:00
},
captureMessage(arg0, extra, arg2) {
_require = arg0;
2026-08-24 06:08:38 +00:00
closure_1 = arg2;
importAll = require("ErrorCommonUtils").getUpdatedOptions(extra);
const obj = require("ErrorCommonUtils");
_modAll675.withScope((setExtras) => {
2026-07-29 08:29:29 +00:00
if (tmp2) {
setExtras.setExtras(tmp.extra);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp4) {
setExtras.setTags(tmp.tags);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
if (tmp6) {
setExtras.setFingerprint(tmp.fingerprint);
setExtras.addEventProcessor((arg0) => {
arg0.exception = undefined;
return arg0;
});
}
_modAll675.captureMessage(closure_0, closure_1);
2026-07-20 16:05:17 +00:00
});
},
addFeatureFlag(arg0, arg1) {
const getClient = _modAll675.getClient;
2026-07-20 16:05:17 +00:00
let client;
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;
if ("canaryRelease" === obj.getConstants().ReleaseChannel) {
withProfilerResult = _modAll675.withProfiler(displayName, { includeRender: true, includeUpdates: true });
const tmpResult = _modAll675;
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() {
return new Promise((fn, arg1) => {
closure_0 = fn;
2026-08-24 06:08:38 +00:00
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) {
const lastCrashReport = CrashReportingManager.getLastCrashReport((timestamp) => {
2026-07-29 08:29:29 +00:00
try {
let tmp3 = null;
if (null != timestamp) {
tmp3 = (function parseNativeCrashReport(timestamp) {
let result;
2026-08-04 21:03:28 +00:00
if (typeof timestamp.timestamp === "number") {
2026-07-29 08:29:29 +00:00
const _Number = Number;
if (!Number.isNaN(timestamp.timestamp)) {
result = timestamp.timestamp / 1000;
}
}
let str = timestamp.level;
if (str == null) {
let str2 = "error";
if (timestamp.is_native) {
str2 = "fatal";
}
str = str2;
}
let formatted;
if (str != null) {
formatted = str.toLowerCase();
}
const obj = { type: "y", event_id: timestamp.event_id, timestamp: result, level: formatted, tags: null };
2026-07-29 08:29:29 +00:00
const origin = timestamp.origin;
2026-08-04 21:03:28 +00:00
let tmp3 = typeof origin === "string";
if (typeof origin === "string") {
2026-07-29 08:29:29 +00:00
tmp3 = origin.length > 0;
}
let tmp4;
if (tmp3) {
const obj2 = { "event.origin": timestamp.origin };
tmp4 = obj2;
2026-07-29 08:29:29 +00:00
}
obj.tags = tmp4;
2026-07-29 08:29:29 +00:00
const error_message = timestamp.error_message;
2026-08-04 21:03:28 +00:00
let tmp5 = typeof error_message === "string";
if (typeof error_message === "string") {
2026-07-29 08:29:29 +00:00
tmp5 = error_message.length > 0;
}
const obj5 = {};
2026-07-29 08:29:29 +00:00
if (tmp5) {
({ error_message: obj.message, error_message: obj3.persisted_error_message } = timestamp);
}
const error_stack = timestamp.error_stack;
2026-08-04 21:03:28 +00:00
let tmp6 = typeof error_stack === "string";
if (typeof error_stack === "string") {
2026-07-29 08:29:29 +00:00
tmp6 = error_stack.length > 0;
}
if (tmp6) {
obj5.persisted_error_stack = timestamp.error_stack;
2026-07-29 08:29:29 +00:00
}
if (timestamp.is_native) {
const exit_reason = timestamp.exit_reason;
2026-08-04 21:03:28 +00:00
let tmp7 = typeof exit_reason === "string";
if (typeof exit_reason === "string") {
2026-07-29 08:29:29 +00:00
tmp7 = exit_reason.length > 0;
}
if (tmp7) {
obj5.native_exit_reason = timestamp.exit_reason;
2026-07-29 08:29:29 +00:00
}
const exit_description = timestamp.exit_description;
2026-08-04 21:03:28 +00:00
let tmp8 = typeof exit_description === "string";
if (typeof exit_description === "string") {
2026-07-29 08:29:29 +00:00
tmp8 = exit_description.length > 0;
}
if (tmp8) {
obj5.native_exit_description = timestamp.exit_description;
2026-07-29 08:29:29 +00:00
}
const tombstone = timestamp.tombstone;
2026-08-04 21:03:28 +00:00
let tmp9 = typeof tombstone === "string";
if (typeof tombstone === "string") {
2026-07-29 08:29:29 +00:00
tmp9 = tombstone.length > 0;
}
if (tmp9) {
obj5.native_tombstone = timestamp.tombstone;
2026-07-29 08:29:29 +00:00
}
const tombstone_cause = timestamp.tombstone_cause;
2026-08-04 21:03:28 +00:00
let tmp10 = typeof tombstone_cause === "string";
if (typeof tombstone_cause === "string") {
2026-07-29 08:29:29 +00:00
tmp10 = tombstone_cause.length > 0;
}
if (tmp10) {
obj5.native_tombstone_cause = timestamp.tombstone_cause;
2026-07-29 08:29:29 +00:00
}
const tombstone_hash = timestamp.tombstone_hash;
2026-08-04 21:03:28 +00:00
let tmp11 = typeof tombstone_hash === "string";
if (typeof tombstone_hash === "string") {
2026-07-29 08:29:29 +00:00
tmp11 = tombstone_hash.length > 0;
}
if (tmp11) {
obj5.native_tombstone_hash = timestamp.tombstone_hash;
2026-07-29 08:29:29 +00:00
}
const tombstone_group_by = timestamp.tombstone_group_by;
2026-08-04 21:03:28 +00:00
let tmp12 = typeof tombstone_group_by === "string";
if (typeof tombstone_group_by === "string") {
2026-07-29 08:29:29 +00:00
tmp12 = tombstone_group_by.length > 0;
}
if (tmp12) {
obj5.native_tombstone_group_by = timestamp.tombstone_group_by;
2026-07-29 08:29:29 +00:00
}
const tombstone_origin = timestamp.tombstone_origin;
2026-08-04 21:03:28 +00:00
let tmp13 = typeof tombstone_origin === "string";
if (typeof tombstone_origin === "string") {
2026-07-29 08:29:29 +00:00
tmp13 = tombstone_origin.length > 0;
}
if (tmp13) {
obj5.native_tombstone_origin = timestamp.tombstone_origin;
2026-07-29 08:29:29 +00:00
}
}
let str3 = "false";
if (timestamp.is_native) {
str3 = "true";
}
obj5.native_is_native = str3;
obj.extra = Object.assign({}, obj.extra, obj5);
2026-07-29 08:29:29 +00:00
return obj;
})(timestamp);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
closure_0(tmp3);
} catch (tmp5) {
closure_1(tmp5);
2026-07-20 16:05:17 +00:00
}
});
} else {
fn(null);
2026-07-20 16:05:17 +00:00
}
});
}
};