Files
discord-decomp/sources/utils/SentryUtils.native.tsx
T
2026-07-28 01:06:53 +03:00

424 lines
21 KiB
TypeScript

/* Metro module 1216; source: utils/SentryUtils.native.tsx; dependencies: [27, 3, 1217, 819, 12844, 818, 1582, 2] */
import Logger from '../modules/debug/Logger.tsx'; /* Metro dependency 3 */
import AddSentryBreadcrumbNative from '../modules/sentry/addSentryBreadcrumb.native.tsx'; /* Metro dependency 818 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as Module00819Module from '../by-id/module-00819.js'; /* Metro dependency 819 */
import * as SentryInitUtilsModule from '../modules/errors/native/SentryInitUtils.tsx'; /* Metro dependency 1217 */
import * as ErrorCommonUtilsModule from './ErrorCommonUtils.tsx'; /* Metro dependency 12844 */
function _fun13517(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#13517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:6, offset: 0x00ded430, size: 336 bytes, params: 8, frame: 19
const env0_0 = require;
const isNonEmptyString = function(a0) {
return typeof a0 === 'string' && a0.length > 0;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = Logger;
value = new value('Sentry');
(SentryInitUtilsModule).initSentry();
object = {setUser: function(a0, a1, a2, a3) {
var object = {id: a0, username: a1, email: a2, staff: a3};
importAll(dependencyMap[3]).getCurrentScope().setUser(object);
updateNativeReporter(object);
}, clearUser: function() {
importAll(dependencyMap[3]).getCurrentScope().setUser(null);
updateNativeReporter();
}, setTags: setTags_13522, setExtra: setExtra_13523, captureException: captureException_13524,
captureCrash: captureCrash, captureMessage: captureMessage_13529, addFeatureFlag: addFeatureFlag_13531,
addBreadcrumb: addBreadcrumb_13532, profiledRootComponent: function(a0) {
var r0;
var value = a0;
var ReleaseChannel = importAll(dependencyMap[6]).getConstants().ReleaseChannel;
if (ReleaseChannel !== 'canaryRelease') {
r0 = value;
} else {
value = importAll(dependencyMap[3]).withProfiler(value, {'includeRender': true, 'includeUpdates': true});
r0 = value;
}
return r0;
}, crash: function() {
var CrashReportingManager = NativeModules.CrashReportingManager;
CrashReportingManager.crash();
}, markCrashHandled: markCrashHandled, getLastCrashReport: function() {
var Promise = global.Promise;
var value = Object.create(Promise.prototype, {constructor: {value: Promise}});
var value2 = new Promise(_fun13537);
return value2 instanceof Object ? value2 : value;
}};
(FileImportTrackerModule).fileFinishedImporting('utils/SentryUtils.native.tsx');
exports.default = object;
function updateNativeReporter() { // fn#13519, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:211, offset: 0x00ded59e, size: 47 bytes, params: 1, frame: 12
const value = a0;
const r3 = value !== undefined ? value : {staff: false};
const CrashReportingManager = NativeModules.CrashReportingManager;
CrashReportingManager.setUser(r3);
}
function setTags_13522(a0) { // fn#13522, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:513, offset: 0x00ded661, size: 51 bytes, params: 2, frame: 12
let value = Module00819Module;
value = value.getCurrentScope();
value.setTags(a0);
}
function setExtra_13523(a0) { // fn#13523, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:562, offset: 0x00ded694, size: 51 bytes, params: 2, frame: 12
let value = Module00819Module;
value = value.getCurrentScope();
value.setExtras(a0);
}
function captureException_13524(a0, a1) { // fn#13524, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:614, offset: 0x00ded6c7, size: 86 bytes, params: 3, frame: 15
const env0_0 = a0;
const env0_1 = (ErrorCommonUtilsModule).getUpdatedOptions(a1);
(Module00819Module).withScope(_fun13525);
function _fun13525(a0) { // fn#13525, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:690, offset: 0x00ded71d, size: 128 bytes, params: 2, frame: 13
if (env0_1 != null) {
if (env0_1.tags != null) {
a0.setTags(env0_1.tags);
}
if (env0_1.extra != null) {
a0.setExtras(env0_1.extra);
}
}
(Module00819Module).captureException(env0_0);
}
}
function captureCrash(a0, a1) { // fn#13526, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:805, offset: 0x00ded79d, size: 169 bytes, params: 3, frame: 17
const env0_0 = a0;
const value2 = undefined;
const updatedOptions = (ErrorCommonUtilsModule).getUpdatedOptions(a1);
const r6 = (updatedOptions == null ? value2 : updatedOptions.tags) ?? ({});
const Object = global.Object;
const env0_3 = Object.assign({crash: 'true'}, r6);
(Module00819Module).withScope(_fun13527);
return env0_1;
function _fun13527(a0) { // fn#13527, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:986, offset: 0x00ded846, size: 153 bytes, params: 2, frame: 13
if (env0_2 != null && env0_2.extra != null) {
a0.setExtras(env0_2.extra);
}
a0.setTags(env0_3);
a0.setLevel('fatal');
a0.addEventProcessor(function(a0) {
var r5;
var r2;
var object;
var property = a0.exception;
r2 = property == null || property.values == null ? undefined : property.values[0];
if (r2 != null) {
object = {};
copyDataProperties(object, r2.mechanism, r5);
object['handled'] = false;
r2.mechanism = object;
}
return a0;
});
env0_1 = (importAll(819) /* metro dependency 819 */).captureException(env0_0);
}
}
function captureMessage_13529(a0, a1) { // fn#13529, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:1254, offset: 0x00ded92d, size: 86 bytes, params: 3, frame: 15
const env0_0 = a0;
const env0_1 = (ErrorCommonUtilsModule).getUpdatedOptions(a1);
(Module00819Module).withScope(_fun13530);
function _fun13530(a0) { // fn#13530, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:1328, offset: 0x00ded983, size: 148 bytes, params: 2, frame: 13
if (env0_1 != null && env0_1.extra != null) {
a0.setExtras(env0_1.extra);
}
if (env0_1 != null && env0_1.tags != null) {
a0.setTags(env0_1.tags);
}
(Module00819Module).captureMessage(env0_0);
}
}
function addFeatureFlag_13531(a0, a1) { // fn#13531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:1448, offset: 0x00deda17, size: 150 bytes, params: 3, frame: 15
var r5;
var value;
const value2 = undefined;
const getClient = (importAll(819) /* metro dependency 819 */).getClient;
if (getClient == null) {
r5 = value2;
} else {
value = importAll(819) /* metro dependency 819 */;
value = value.getClient();
r5 = value;
}
const r4 = r5 == null || r5.getIntegrationByName == null ? value2 : r5.getIntegrationByName('FeatureFlags');
if (!(r4 == null || r4.addFeatureFlag == null)) {
r4.addFeatureFlag(a0, a1);
}
return value2;
}
function addBreadcrumb_13532(a0) { // fn#13532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:1667, offset: 0x00dedaad, size: 57 bytes, params: 2, frame: 14
env0_5.verbose('Breadcrumb', a0);
(AddSentryBreadcrumbNative)(a0);
}
function markCrashHandled(a0) { // fn#13535, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:1907, offset: 0x00dedb66, size: 95 bytes, params: 2, frame: 13
var value;
var CrashReportingManager;
var markCrashHandled;
var value2;
var error;
var binding;
if (a0.length !== 0) {
try {
value = environment;
CrashReportingManager = NativeModules.CrashReportingManager;
markCrashHandled = CrashReportingManager.markCrashHandled;
value2 = markCrashHandled == null;
if (!value2) {
CrashReportingManager = NativeModules.CrashReportingManager;
CrashReportingManager.markCrashHandled(a0);
}
} catch (error) {
binding = env0_5;
binding.warn('Failed to mark crash as handled', error);
}
}
}
function getLastCrashReport() { // fn#13536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:2113, offset: 0x00dedbc5, size: 37 bytes, params: 1, frame: 11
const Promise = global.Promise;
const value = Object.create(Promise.prototype, {constructor: {value: Promise}});
const promise = new Promise(_fun13537);
return promise instanceof Object ? promise : value;
function _fun13537(a0, a1) { // fn#13537, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:2130, offset: 0x00dedbea, size: 77 bytes, params: 3, frame: 15
var environment;
const env0_0 = a0;
const env0_1 = a1;
let value = environment.__proto__;
const CrashReportingManager = NativeModules.CrashReportingManager;
value = undefined;
const getLastCrashReport = CrashReportingManager == null ? value : CrashReportingManager.getLastCrashReport;
if (getLastCrashReport != null) {
CrashReportingManager.getLastCrashReport(_fun13538);
} else {
a0(null);
}
return value;
function _fun13538(a0) { // fn#13538, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1343:2234, offset: 0x00dedc37, size: 599 bytes, params: 2, frame: 19
var r5;
var r4;
var r7;
var r3;
var r1;
var value;
var binding;
var value2;
var value3;
var timestamp;
var value4;
var value5;
var Number;
var isNaN;
var isNaN2;
var value6;
var level;
var value7;
var is_native;
var value8;
var value9;
var value10;
var value11;
var object;
var event_id;
var value12;
var isNonEmptyStringBinding;
var origin;
var isNonEmptyString2;
var object3;
var error_message;
var isNonEmptyString3;
var error_stack;
var isNonEmptyString4;
var exit_reason;
var isNonEmptyString5;
var exit_description;
var isNonEmptyString6;
var tombstone;
var isNonEmptyString7;
var tombstone_cause;
var isNonEmptyString8;
var tombstone_hash;
var isNonEmptyString9;
var tombstone_group_by;
var isNonEmptyString10;
var tombstone_origin;
var isNonEmptyString11;
var value13;
var value14;
var Object;
var assign;
var extra;
var value15;
var error;
try {
value = environment;
binding = env0_0;
value2 = null;
value3 = value2 == a0;
if (value3) {
r1 = value2;
} else {
timestamp = a0.timestamp;
value4 = undefined;
value5 = typeof timestamp !== 'number';
if (value5) {
r5 = value4;
} else {
Number = global.Number;
isNaN = Number.isNaN;
timestamp = a0.timestamp;
isNaN2 = Reflect.apply(isNaN, Number, [timestamp]);
if (isNaN2) {
r5 = value4;
} else {
timestamp = a0.timestamp;
value6 = timestamp / 1000;
r5 = value6;
}
}
level = a0.level;
value7 = value2 != level;
if (value7) {
r7 = level;
} else {
is_native = a0.is_native;
value8 = 'error';
if (is_native) {
value9 = 'fatal';
r4 = value9;
} else {
r4 = value8;
}
r7 = r4;
}
value10 = value2 == r7;
if (value10) {
r4 = value4;
} else {
value11 = r7.toLowerCase();
r4 = value11;
}
object = {type: value4};
event_id = a0.event_id;
object.event_id = event_id;
object.timestamp = r5;
object.level = r4;
value12 = environment.__proto__.__proto__;
isNonEmptyStringBinding = isNonEmptyString;
origin = a0.origin;
isNonEmptyString2 = isNonEmptyStringBinding(origin);
if (isNonEmptyString2) {
origin = a0.origin;
r5 = {['event.origin']: origin};
} else {
r5 = value4;
}
object.tags = r5;
object3 = {};
isNonEmptyStringBinding = isNonEmptyString;
error_message = a0.error_message;
isNonEmptyString3 = isNonEmptyStringBinding(error_message);
if (isNonEmptyString3) {
error_message = a0.error_message;
object.message = error_message;
error_message = a0.error_message;
object3.persisted_error_message = error_message;
}
isNonEmptyStringBinding = isNonEmptyString;
error_stack = a0.error_stack;
isNonEmptyString4 = isNonEmptyStringBinding(error_stack);
if (isNonEmptyString4) {
error_stack = a0.error_stack;
object3.persisted_error_stack = error_stack;
}
is_native = a0.is_native;
if (is_native) {
isNonEmptyStringBinding = isNonEmptyString;
exit_reason = a0.exit_reason;
isNonEmptyString5 = isNonEmptyStringBinding(exit_reason);
if (isNonEmptyString5) {
exit_reason = a0.exit_reason;
object3.native_exit_reason = exit_reason;
}
isNonEmptyStringBinding = isNonEmptyString;
exit_description = a0.exit_description;
isNonEmptyString6 = isNonEmptyStringBinding(exit_description);
if (isNonEmptyString6) {
exit_description = a0.exit_description;
object3.native_exit_description = exit_description;
}
isNonEmptyStringBinding = isNonEmptyString;
tombstone = a0.tombstone;
isNonEmptyString7 = isNonEmptyStringBinding(tombstone);
if (isNonEmptyString7) {
tombstone = a0.tombstone;
object3.native_tombstone = tombstone;
}
isNonEmptyStringBinding = isNonEmptyString;
tombstone_cause = a0.tombstone_cause;
isNonEmptyString8 = isNonEmptyStringBinding(tombstone_cause);
if (isNonEmptyString8) {
tombstone_cause = a0.tombstone_cause;
object3.native_tombstone_cause = tombstone_cause;
}
isNonEmptyStringBinding = isNonEmptyString;
tombstone_hash = a0.tombstone_hash;
isNonEmptyString9 = isNonEmptyStringBinding(tombstone_hash);
if (isNonEmptyString9) {
tombstone_hash = a0.tombstone_hash;
object3.native_tombstone_hash = tombstone_hash;
}
isNonEmptyStringBinding = isNonEmptyString;
tombstone_group_by = a0.tombstone_group_by;
isNonEmptyString10 = isNonEmptyStringBinding(tombstone_group_by);
if (isNonEmptyString10) {
tombstone_group_by = a0.tombstone_group_by;
object3.native_tombstone_group_by = tombstone_group_by;
}
isNonEmptyStringBinding = isNonEmptyString;
tombstone_origin = a0.tombstone_origin;
isNonEmptyString11 = isNonEmptyStringBinding(tombstone_origin);
if (isNonEmptyString11) {
tombstone_origin = a0.tombstone_origin;
object3.native_tombstone_origin = tombstone_origin;
}
}
is_native = a0.is_native;
value13 = 'false';
if (is_native) {
value14 = 'true';
r3 = value14;
} else {
r3 = value13;
}
object3.native_is_native = r3;
Object = global.Object;
assign = Object.assign;
extra = object.extra;
value15 = Reflect.apply(assign, Object, [{}, extra, object3]);
object.extra = value15;
r1 = object;
}
binding(r1);
} catch (error) {
require(error);
}
}
}
}
}
global.__d(_fun13517, 1216, [27, 3, 1217, 819, 12844, 818, 1582,
2]) /* metro module 1216, dependencies: [27, 3, 1217, 819, 12844, 818, 1582, 2] */;