[UI > Settings] Fix for latest Discord releases
This commit is contained in:
parent
ba20db27d9
commit
b7a3580ccf
1 changed files with 5 additions and 2 deletions
|
@ -12,6 +12,7 @@ import Plugins from "@ui/settings/pages/Plugins";
|
||||||
import Themes from "@ui/settings/pages/Themes";
|
import Themes from "@ui/settings/pages/Themes";
|
||||||
import Developer from "@ui/settings/pages/Developer";
|
import Developer from "@ui/settings/pages/Developer";
|
||||||
import AssetBrowser from "@ui/settings/pages/AssetBrowser";
|
import AssetBrowser from "@ui/settings/pages/AssetBrowser";
|
||||||
|
import { Forms } from "@ui/components";
|
||||||
|
|
||||||
const screensModule = findByName("getScreens", false);
|
const screensModule = findByName("getScreens", false);
|
||||||
const settingsModule = findByName("UserSettingsOverviewWrapper", false);
|
const settingsModule = findByName("UserSettingsOverviewWrapper", false);
|
||||||
|
@ -67,10 +68,12 @@ export default function initSettings() {
|
||||||
|
|
||||||
patches.push(after("render", Overview.type.prototype, (_, { props: { children } }) => {
|
patches.push(after("render", Overview.type.prototype, (_, { props: { children } }) => {
|
||||||
const titles = [i18n.Messages["BILLING_SETTINGS"], i18n.Messages["PREMIUM_SETTINGS"]];
|
const titles = [i18n.Messages["BILLING_SETTINGS"], i18n.Messages["PREMIUM_SETTINGS"]];
|
||||||
const index = children.findIndex((c: any) => titles.includes(c.props.title));
|
//! Fix for Android 174201 and iOS 42188
|
||||||
|
children = findInReactTree(children, (tree) => tree.children[1].type === Forms.FormSection).children;
|
||||||
|
const index = children.findIndex((c: any) => titles.includes(c?.props.label));
|
||||||
children.splice(index === -1 ? 4 : index, 0, <SettingsSection />);
|
children.splice(index === -1 ? 4 : index, 0, <SettingsSection />);
|
||||||
}));
|
}));
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
return () => patches.forEach(p => p());
|
return () => patches.forEach(p => p());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue