[UI > Settings] Fix removing billing settings and potential memory leak
This commit is contained in:
parent
65d57a0f69
commit
a462b8e81e
2 changed files with 10 additions and 10 deletions
|
@ -4,8 +4,6 @@ import { showToast } from "@ui/toasts";
|
|||
import logger from "@lib/logger";
|
||||
export let socket: WebSocket;
|
||||
|
||||
let iLoveBundlers = eval;
|
||||
|
||||
export function connectToDebugger(url: string) {
|
||||
if (socket !== undefined && socket.readyState !== WebSocket.CLOSED) {
|
||||
socket.close();
|
||||
|
@ -22,7 +20,7 @@ export function connectToDebugger(url: string) {
|
|||
|
||||
socket.addEventListener("message", (message: any) => {
|
||||
try {
|
||||
iLoveBundlers(message.data);
|
||||
(0, eval)(message.data);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import AssetBrowser from "@ui/settings/pages/AssetBrowser";
|
|||
|
||||
const screensModule = findByDisplayName("getScreens", false);
|
||||
const settingsModule = findByDisplayName("UserSettingsOverviewWrapper", false);
|
||||
let settingsInjected = false;
|
||||
let prevPatches: Function[] = [];
|
||||
|
||||
export default function initSettings() {
|
||||
after("default", screensModule, (args, existingScreens) => {
|
||||
|
@ -31,19 +31,21 @@ export default function initSettings() {
|
|||
});
|
||||
|
||||
after("default", settingsModule, (args, ret) => {
|
||||
for (let p of prevPatches) p();
|
||||
prevPatches = [];
|
||||
|
||||
const Overview = findInReactTree(ret.props.children, i => i.type && i.type.name === "UserSettingsOverview");
|
||||
|
||||
// Upload logs button gone
|
||||
after("renderSupportAndAcknowledgements", Overview.type.prototype, (args, { props: { children } }) => {
|
||||
prevPatches.push(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", Overview.type.prototype, (args, { props: { children } }) => {
|
||||
prevPatches.push(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, settingsInjected ? 1 : 0, <SettingsSection navigation={Overview.props.navigation} />);
|
||||
if (!settingsInjected) settingsInjected = true;
|
||||
});
|
||||
children.splice(index === -1 ? 4 : index, 0, <SettingsSection navigation={Overview.props.navigation} />);
|
||||
}));
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue