[Settings] Fix navigation being invalidated
This commit is contained in:
parent
70a60a5b33
commit
f02b1d842e
1 changed files with 10 additions and 8 deletions
|
@ -9,11 +9,12 @@ import AssetBrowser from "@ui/settings/pages/AssetBrowser";
|
||||||
|
|
||||||
const screensModule = findByDisplayName("getScreens", false);
|
const screensModule = findByDisplayName("getScreens", false);
|
||||||
const settingsModule = findByDisplayName("UserSettingsOverviewWrapper", false);
|
const settingsModule = findByDisplayName("UserSettingsOverviewWrapper", false);
|
||||||
|
let settingsInjected = false;
|
||||||
|
|
||||||
export default function initSettings() {
|
export default function initSettings() {
|
||||||
after("default", screensModule, (args, ret) => {
|
after("default", screensModule, (args, existingScreens) => {
|
||||||
return {
|
return {
|
||||||
...ret,
|
...existingScreens,
|
||||||
VendettaSettings: {
|
VendettaSettings: {
|
||||||
title: "Vendetta",
|
title: "Vendetta",
|
||||||
render: General,
|
render: General,
|
||||||
|
@ -29,19 +30,20 @@ export default function initSettings() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
after("default", settingsModule, (args, _ret) => {
|
after("default", settingsModule, (args, ret) => {
|
||||||
const toPatch = findInReactTree(_ret.props.children, i => i.type && i.type.name === "UserSettingsOverview");
|
const Overview = findInReactTree(ret.props.children, i => i.type && i.type.name === "UserSettingsOverview");
|
||||||
|
|
||||||
// Upload logs button gone
|
// 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");
|
const index = children.findIndex((c: any) => c?.type?.name === "UploadLogsButton");
|
||||||
if (index !== -1) children.splice(index, 1);
|
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 titles = [i18n.Messages["BILLING_SETTINGS"], i18n.Messages["PREMIUM_SETTINGS"]];
|
||||||
const index = children.findIndex((c: any) => titles.includes(c.props.title));
|
const index = children.findIndex((c: any) => titles.includes(c.props.title));
|
||||||
children.splice(index === -1 ? 4 : index, 0, <SettingsSection navigation={toPatch.props.navigation} />);
|
children.splice(index === -1 ? 4 : index, settingsInjected ? 1 : 0, <SettingsSection navigation={Overview.props.navigation} />);
|
||||||
|
if (!settingsInjected) settingsInjected = true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}, true);
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue