From f60ccb766f30e7518bc348013b72f071f86ecbc6 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 31 Aug 2022 22:08:05 +0200 Subject: Add Plugin.start, make Settings actually start/stop plugins --- src/components/Settings.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/components/Settings.tsx') diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 19f6dd2..ee293bb 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -5,6 +5,8 @@ import IpcEvents from "../utils/IpcEvents"; import { Button, ButtonProps, Flex, Switch, Forms } from "../webpack/common"; import ErrorBoundary from "./ErrorBoundary"; +import { startPlugin } from "../plugins"; +import { stopPlugin } from '../plugins/index'; export default ErrorBoundary.wrap(function Settings(props) { const [settingsDir, , settingsDirPending] = useAwaiter(() => VencordNative.ipc.invoke(IpcEvents.GET_SETTINGS_DIR), "Loading..."); @@ -52,8 +54,19 @@ export default ErrorBoundary.wrap(function Settings(props) { settings.plugins[p.name].enabled = v; if (v) { p.dependencies?.forEach(d => { + // TODO: start every dependency settings.plugins[d].enabled = true; }); + if (!p.started && !startPlugin(p)) { + // TODO show notification + } + } else { + if (p.started && !stopPlugin(p)) { + // TODO show notification + } + } + if (p.patches) { + // TODO show notification } }} note={p.description} -- cgit