diff --git a/src/lib/ui/settings/patches/panel.tsx b/src/lib/ui/settings/patches/panel.tsx index e54a2e4..b480c49 100644 --- a/src/lib/ui/settings/patches/panel.tsx +++ b/src/lib/ui/settings/patches/panel.tsx @@ -31,41 +31,47 @@ function SettingsSection() { } export function patchPanelUI(unpatches: (() => void | boolean)[]) { - unpatches.push(after("default", findByNameLazy("getScreens", false), (_a, screens) => ({ - ...screens, - VendettaCustomPage: { - title: "Bunny", - render: () => - }, - BUNNY_CUSTOM_PAGE: { - title: "Bunny", - render: () => - } - }))); + try { + unpatches.push( + after("default", findByNameLazy("getScreens", false), (_a, screens) => ({ + ...screens, + VendettaCustomPage: { + title: "Bunny", + render: () => + }, + BUNNY_CUSTOM_PAGE: { + title: "Bunny", + render: () => + } + })) + ); - const unpatch = after("default", findByNameLazy("UserSettingsOverviewWrapper", false), (_a, ret) => { - const UserSettingsOverview = findInReactTree(ret.props.children, n => n.type?.name === "UserSettingsOverview"); + const unpatch = after("default", findByNameLazy("UserSettingsOverviewWrapper", false), (_a, ret) => { + const UserSettingsOverview = findInReactTree(ret.props.children, n => n.type?.name === "UserSettingsOverview"); - unpatches.push(after("renderSupportAndAcknowledgements", UserSettingsOverview.type.prototype, (_args, { props: { children } }) => { - const index = children.findIndex((c: any) => c?.type?.name === "UploadLogsButton"); - if (index !== -1) children.splice(index, 1); - })); + unpatches.push(after("renderSupportAndAcknowledgements", UserSettingsOverview.type.prototype, (_args, { props: { children } }) => { + const index = children.findIndex((c: any) => c?.type?.name === "UploadLogsButton"); + if (index !== -1) children.splice(index, 1); + })); - unpatches.push(after("render", UserSettingsOverview.type.prototype, (_args, res) => { - const titles = [i18n.Messages.BILLING_SETTINGS, i18n.Messages.PREMIUM_SETTINGS]; + unpatches.push(after("render", UserSettingsOverview.type.prototype, (_args, res) => { + const titles = [i18n.Messages.BILLING_SETTINGS, i18n.Messages.PREMIUM_SETTINGS]; - const sections = findInReactTree( - res.props.children, - n => n?.children?.[1]?.type === LegacyFormSection - )?.children || res.props.children; + const sections = findInReactTree( + res.props.children, + n => n?.children?.[1]?.type === LegacyFormSection + )?.children || res.props.children; - if (sections) { - const index = sections.findIndex((c: any) => titles.includes(c?.props.label)); - sections.splice(-~index || 4, 0, ); - } - })); - }, true); + if (sections) { + const index = sections.findIndex((c: any) => titles.includes(c?.props.label)); + sections.splice(-~index || 4, 0, ); + } + })); + }, true); - unpatches.push(unpatch); + unpatches.push(unpatch); + } catch { + + } }