[SafeMode] Initial implementation (#61)
* [UI > Components] Add Discord's button * [SafeMode] Initial work, basic ErrorBoundary patch * [SafeMode] Custom error boundary (#57) * [SafeMode] Add mostly complete custom error boundary * [SafeMode] Use Button from @ui/components in error boundary * [SafeMode] Wrap the error boundary in our own error boundary * [SafeMode > ErrorBoundary] Code-style changes --------- Co-authored-by: Beef <beefers@riseup.net> * [TS] Add basic type for Discord's button * [UI] Move Codeblock to components, and use it * [UI > Settings] Allow disabling the ErrorBoundary in CustomPage * [UI > Settings] Move the ErrorBoundary triggers to Developer * [TS] Add Codeblock to types * [TS] Use ButtonColors in Button type * [SafeMode > ErrorBoundary] Rework * [UI] Add HelpMessage to components * [SafeMode] Proper implementation * [Global] SafeMode is optional (#59) * [UI > Developer] Restore the balance * [SafeMode > ErrorBoundary] Optimise for tablet UI * [SafeMode] Last-minute fixes --------- Co-authored-by: Jack <30497388+FieryFlames@users.noreply.github.com> Co-authored-by: Jack Matthews <jm5112356@gmail.com>
This commit is contained in:
parent
f85fc4b00c
commit
5344f0017a
16 changed files with 293 additions and 47 deletions
|
@ -1,4 +1,5 @@
|
|||
import { ReactNative as RN, NavigationNative } from "@metro/common";
|
||||
import { findByProps } from "@metro/filters";
|
||||
import { Forms } from "@ui/components";
|
||||
import { getAssetIDByName } from "@ui/assets";
|
||||
import { connectToDebugger } from "@lib/debug";
|
||||
|
@ -7,6 +8,8 @@ import settings, { loaderConfig } from "@lib/settings";
|
|||
import ErrorBoundary from "@ui/components/ErrorBoundary";
|
||||
|
||||
const { FormSection, FormRow, FormSwitchRow, FormInput, FormDivider } = Forms;
|
||||
const { hideActionSheet } = findByProps("openLazy", "hideActionSheet");
|
||||
const { showSimpleActionSheet } = findByProps("showSimpleActionSheet");
|
||||
|
||||
export default function Developer() {
|
||||
const navigation = NavigationNative.useNavigation();
|
||||
|
@ -79,6 +82,26 @@ export default function Developer() {
|
|||
trailing={FormRow.Arrow}
|
||||
onPress={() => navigation.push("VendettaAssetBrowser")}
|
||||
/>
|
||||
<FormDivider />
|
||||
<FormRow
|
||||
label="ErrorBoundary Tools"
|
||||
leading={<FormRow.Icon source={getAssetIDByName("ic_warning_24px")} />}
|
||||
trailing={FormRow.Arrow}
|
||||
onPress={() => showSimpleActionSheet({
|
||||
key: "ErrorBoundaryTools",
|
||||
header: {
|
||||
title: "Which ErrorBoundary do you want to trip?",
|
||||
icon: <FormRow.Icon style={{ marginRight: 8 }} source={getAssetIDByName("ic_warning_24px")} />,
|
||||
onClose: () => hideActionSheet(),
|
||||
},
|
||||
options: [
|
||||
// @ts-expect-error
|
||||
// Of course, to trigger an error, we need to do something incorrectly. The below will do!
|
||||
{ label: "Vendetta", onPress: () => navigation.push("VendettaCustomPage", { render: () => <undefined /> }) },
|
||||
{ label: "Discord", isDestructive: true, onPress: () => navigation.push("VendettaCustomPage", { noErrorBoundary: true }) },
|
||||
],
|
||||
})}
|
||||
/>
|
||||
</FormSection>
|
||||
</RN.ScrollView>
|
||||
</ErrorBoundary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue