decord/alpha/source/components_native/ErrorBoundary.tsx
github-actions c6aa9eb120 chore: update source for alpha 349.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5030.js (118.4 MB)
2026-10-01 06:55:13 +00:00

168 lines
5.9 KiB
TypeScript

// Module ID: 14342
// Function ID: 14343
// Name: ErrorBoundary
// Dependencies: [5, 32, 19, 17, 11178, 21, 4845, 504, 11480, 5465, 1115, 4569, 1231, 573, 1177, 9499, 4841, 2]
// Module 14342 (ErrorBoundary)
import DispatcherDefault from "Dispatcher" /* 573 */;
import util from "util" /* 1115 */;
import native from "native" /* 1177 */;
import SentryUtilsDefault from "SentryUtils" /* 1231 */;
import Text_Text from "Text/Text" /* 4841 */;
import components_Button_Button from "components/Button/Button" /* 5465 */;
import AppCrash from "AppCrash" /* 9499 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
import BuildOverrideStore from "BuildOverrideStore" /* 11178 */;
require = fn;
function MaybeClearBuildOverride() {
closure_1 = async function _clearOverride() {
_require(true);
await tmp3(tmp16[8]).clearBuildOverride();
if (1 === tmp7) {
c3 = 0;
closure_128_0(false);
c4 = 3;
} else if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 !== 2) {
c3 = 0;
}
return arg1;
};
const tmp = _slicedToArray(noop.useState(false), 2);
_require = tmp[1];
const items = [BuildOverrideStore];
if (null == obj.useStateFromStores(items, () => {
const overrides = currentBuildOverride.getCurrentBuildOverride().overrides;
let id;
if (overrides != null) {
const tmp4 = overrides[closure_0(undefined, dependencyMap[8]).DEVICE_FIELD];
if (tmp4 != null) {
id = tmp4.id;
}
}
return id;
})) {
return null;
} else {
const obj2 = { variant: "secondary", loading: tmp[0], text: null, onPress: null };
const intl = tmp2(1115).intl;
obj2.text = intl.string(tmp2(1115).t["/Nz9rY"]);
obj2.onPress = function clearOverride() {
const self = this;
const apply = closure_1.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
};
return closure_9(tmp2(5465).Button, obj2);
}
obj = require("initialize");
}
get_ActivityIndicator = fn(17);
({ NativeModules: metroRequire, View: closure_7 } = get_ActivityIndicator);
const jsxProd = fn(21);
({ jsx: closure_9, jsxs: c10 } = jsxProd);
const createStyles = fn(4845);
let closure_11 = createStyles.createLegacyClassComponentStyles({ buttons: { position: "absolute", right: 32, bottom: 32, left: 32, gap: 12 }, debugLogsContainer: { position: "absolute", right: 32, top: 64, display: "flex", flexDirection: "row", alignItems: "center", gap: 12 }, error: { marginTop: 24, textAlign: "center" }, text: { textAlign: "center" } });
const PureComponent = noop.PureComponent;
class ErrorBoundary extends PureComponent {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
applyArgumentsResult.state = { error: null, info: null };
applyArgumentsResult.discordErrorsSet = false;
return applyArgumentsResult;
}
}
const prototype = ErrorBoundary.prototype;
prototype["componentDidCatch"] = function componentDidCatch(error, info) {
this.triggerSoftCrash(error, info);
};
prototype["triggerSoftCrash"] = function triggerSoftCrash(error, info) {
this.setState({ error, info });
SentryUtilsDefault.captureCrash(error, { extra: info });
const obj = { error, info };
const obj3 = { extra: info };
DispatcherDefault.dispatch({ type: "CLEAR_CACHES", reason: "App Crashed", resetSocket: true });
};
prototype["handleReload"] = function handleReload() {
BundleUpdaterManager = BundleUpdaterManager.BundleUpdaterManager;
BundleUpdaterManager.reload();
};
prototype["componentDidMount"] = function componentDidMount() {
const self = this;
if (null == window.DiscordErrors) {
const _window = window;
const obj = {
softCrash(error) {
self.triggerSoftCrash(error);
}
};
window.DiscordErrors = obj;
tmp.discordErrorsSet = true;
}
};
prototype["componentWillUnmount"] = function componentWillUnmount() {
if (this.discordErrorsSet) {
const _window = window;
window.DiscordErrors = null;
tmp.discordErrorsSet = false;
}
};
prototype["render"] = function render() {
const self = this;
const tmp = closure_11(this.context);
const error = this.state.error;
if (null !== error) {
const obj = { Illustration: AppCrash.AppCrash, title: null, body: null, titleStyle: null, bodyStyle: null, children: null };
const intl = util.intl;
obj.title = intl.string(util.t.tx8CkI);
const intl2 = util.intl;
obj.body = intl2.string(util.t.CvQlAH);
({ text: obj.titleStyle, text: obj.bodyStyle } = tmp);
const obj2 = { style: tmp.error, variant: "text-sm/medium", color: "text-muted", children: null };
let str;
if (error != null) {
str = error.message;
}
if (str == null) {
let name;
if (error != null) {
name = error.name;
}
str = name;
}
if (str == null) {
str = "Unknown Error";
}
obj2.children = str;
const items = [React7(Text_Text.Text, obj2), , ];
const obj3 = { style: tmp.buttons, children: null };
const items1 = [React7(MaybeClearBuildOverride, {}), ];
const obj4 = { text: null, onPress: null };
const intl3 = tmp3(1115).intl;
obj4.text = intl3.string(util.t["4n8OJn"]);
obj4.onPress = self.handleReload;
items1[1] = React7(components_Button_Button.Button, obj4);
obj3.children = items1;
items[1] = closure_1_10(React5, obj3);
items[2] = null;
obj.children = items;
let children = tmp2(native.EmptyState, obj);
} else {
children = self.props.children;
}
return children;
};
ErrorBoundary.contextType = fn(4569).ThemeContext;
const size = fn(2);
const result = size.fileFinishedImporting("components_native/ErrorBoundary.tsx");
export default ErrorBoundary;