[Settings] Move to proper one-time patch
This commit is contained in:
parent
88e4f357a4
commit
e32d331c5e
1 changed files with 9 additions and 10 deletions
|
@ -2,30 +2,29 @@ import { React, i18n } from "@metro/common";
|
|||
import { findByDisplayName } from "@metro/filters";
|
||||
import { after } from "@lib/patcher";
|
||||
import findInReactTree from "@utils/findInReactTree";
|
||||
import SettingsSection from "./components/SettingsSection";
|
||||
import General from "./components/General";
|
||||
import AssetBrowser from "./components/AssetBrowser";
|
||||
import SettingsSection from "@ui/settings/components/SettingsSection";
|
||||
import General from "@ui/settings/pages/General";
|
||||
import AssetBrowser from "@ui/settings/pages/AssetBrowser";
|
||||
|
||||
const screensModule = findByDisplayName("getScreens", false);
|
||||
const settingsModule = findByDisplayName("UserSettingsOverviewWrapper", false);
|
||||
|
||||
export default function initSettings() {
|
||||
const screensPatch = after("default", screensModule, (args, ret) => {
|
||||
after("default", screensModule, (args, ret) => {
|
||||
return {
|
||||
...ret,
|
||||
VendettaSettings: {
|
||||
title: "Vendetta",
|
||||
render: General
|
||||
render: General,
|
||||
},
|
||||
VendettaAssetBrowser: {
|
||||
title: "Asset Browser",
|
||||
render: AssetBrowser
|
||||
}
|
||||
render: AssetBrowser,
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
const settingsPatch = after("default", settingsModule, (args, _ret) => {
|
||||
settingsPatch();
|
||||
after("default", settingsModule, (args, _ret) => {
|
||||
const toPatch = findInReactTree(_ret.props.children, i => i.type && i.type.name === "UserSettingsOverview");
|
||||
|
||||
// Upload logs button gone
|
||||
|
@ -39,5 +38,5 @@ export default function initSettings() {
|
|||
const index = children.findIndex((c: any) => titles.includes(c.props.title));
|
||||
children.splice(index === -1 ? 4 : index, 0, <SettingsSection navigation={toPatch.props.navigation} />);
|
||||
});
|
||||
});
|
||||
}, true);
|
||||
}
|
Loading…
Reference in a new issue