From b2ecb02335fa51a7c7eadab0acb3beb91c289802 Mon Sep 17 00:00:00 2001 From: Ven Date: Tue, 24 Jan 2023 01:42:57 +0100 Subject: Make Windows Ctrl+Q feature optional; add opt-in auto update (#451) --- src/components/VencordSettings/Updater.tsx | 22 +++++++++++++++++++++- src/components/VencordSettings/VencordTab.tsx | 21 +++++++++++++-------- 2 files changed, 34 insertions(+), 9 deletions(-) (limited to 'src/components') diff --git a/src/components/VencordSettings/Updater.tsx b/src/components/VencordSettings/Updater.tsx index dea8766..8a126a8 100644 --- a/src/components/VencordSettings/Updater.tsx +++ b/src/components/VencordSettings/Updater.tsx @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +import { useSettings } from "@api/settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { ErrorCard } from "@components/ErrorCard"; import { Flex } from "@components/Flex"; @@ -23,7 +24,7 @@ import { handleComponentFailed } from "@components/handleComponentFailed"; import { Link } from "@components/Link"; import { classes, useAwaiter } from "@utils/misc"; import { changes, checkForUpdates, getRepo, isNewer, rebuild, update, updateError, UpdateLogger } from "@utils/updater"; -import { Alerts, Button, Card, Forms, Margins, Parser, React, Toasts } from "@webpack/common"; +import { Alerts, Button, Card, Forms, Margins, Parser, React, Switch, Toasts } from "@webpack/common"; import gitHash from "~git-hash"; @@ -183,6 +184,8 @@ function Newer(props: CommonProps) { } function Updater() { + const settings = useSettings(["notifyAboutUpdates", "autoUpdate"]); + const [repo, err, repoPending] = useAwaiter(getRepo, { fallbackValue: "Loading..." }); React.useEffect(() => { @@ -197,6 +200,23 @@ function Updater() { return ( + Updater Settings + settings.notifyAboutUpdates = v} + note="Shows a toast on startup" + disabled={settings.autoUpdate} + > + Get notified about new updates + + settings.autoUpdate = v} + note="Automatically update Vencord without confirmation prompt" + > + Automatically update + + Repo {repoPending ? repo : err ? "Failed to retrieve - check console" : ( diff --git a/src/components/VencordSettings/VencordTab.tsx b/src/components/VencordSettings/VencordTab.tsx index 9429cdd..5da4442 100644 --- a/src/components/VencordSettings/VencordTab.tsx +++ b/src/components/VencordSettings/VencordTab.tsx @@ -97,21 +97,26 @@ function VencordSettings() { settings.enableReactDevtools = v} - note="Requires a full restart"> + note="Requires a full restart" + > Enable React Developer Tools - settings.notifyAboutUpdates = v} - note="Shows a toast on startup"> - Get notified about new updates - settings.frameless = v} - note="Requires a full restart"> + note="Requires a full restart" + > Disable the window frame + {navigator.platform.toLowerCase().startsWith("win") && ( + settings.winCtrlQ = v} + note="Requires a full restart" + > + Register Ctrl+Q as shortcut to close Discord (Alternative to Alt+F4) + + )} )} -- cgit