diff --git a/src/ui/settings/index.tsx b/src/ui/settings/index.tsx
index 87b12ff..17974d0 100644
--- a/src/ui/settings/index.tsx
+++ b/src/ui/settings/index.tsx
@@ -9,11 +9,12 @@ import AssetBrowser from "@ui/settings/pages/AssetBrowser";
const screensModule = findByDisplayName("getScreens", false);
const settingsModule = findByDisplayName("UserSettingsOverviewWrapper", false);
+let settingsInjected = false;
export default function initSettings() {
- after("default", screensModule, (args, ret) => {
+ after("default", screensModule, (args, existingScreens) => {
return {
- ...ret,
+ ...existingScreens,
VendettaSettings: {
title: "Vendetta",
render: General,
@@ -29,19 +30,20 @@ export default function initSettings() {
}
});
- after("default", settingsModule, (args, _ret) => {
- const toPatch = findInReactTree(_ret.props.children, i => i.type && i.type.name === "UserSettingsOverview");
+ after("default", settingsModule, (args, ret) => {
+ const Overview = findInReactTree(ret.props.children, i => i.type && i.type.name === "UserSettingsOverview");
// Upload logs button gone
- after("renderSupportAndAcknowledgements", toPatch.type.prototype, (args, { props: { children } }) => {
+ after("renderSupportAndAcknowledgements", Overview.type.prototype, (args, { props: { children } }) => {
const index = children.findIndex((c: any) => c?.type?.name === "UploadLogsButton");
if (index !== -1) children.splice(index, 1);
});
- after("render", toPatch.type.prototype, (args, { props: { children } }) => {
+ after("render", Overview.type.prototype, (args, { props: { children } }) => {
const titles = [i18n.Messages["BILLING_SETTINGS"], i18n.Messages["PREMIUM_SETTINGS"]];
const index = children.findIndex((c: any) => titles.includes(c.props.title));
- children.splice(index === -1 ? 4 : index, 0, );
+ children.splice(index === -1 ? 4 : index, settingsInjected ? 1 : 0, );
+ if (!settingsInjected) settingsInjected = true;
});
- }, true);
+ });
}
\ No newline at end of file