diff --git a/src/Vencord.ts b/src/Vencord.ts index af57ca3b..3c5315be 100644 --- a/src/Vencord.ts +++ b/src/Vencord.ts @@ -100,6 +100,7 @@ async function init() { if (Settings.autoUpdate) { await update(); + if (Settings.updateRelaunch) return relaunch; if (Settings.autoUpdateNotification) setTimeout(() => showNotification({ title: "Equicord has been updated!", @@ -108,7 +109,6 @@ async function init() { noPersist: true, onClick: relaunch }), 10_000); - if (Settings.autoUpdateRelaunch) return relaunch; return; } diff --git a/src/api/Settings.ts b/src/api/Settings.ts index 36cef22f..edb2646b 100644 --- a/src/api/Settings.ts +++ b/src/api/Settings.ts @@ -30,7 +30,6 @@ import plugins from "~plugins"; const logger = new Logger("Settings"); export interface Settings { autoUpdate: boolean; - autoUpdateRelaunch: boolean; autoUpdateNotification: boolean; useQuickCss: boolean; enableReactDevtools: boolean; @@ -39,6 +38,7 @@ export interface Settings { enabledThemeLinks: string[]; frameless: boolean; transparent: boolean; + updateRelaunch: boolean; winCtrlQ: boolean; macosVibrancyStyle: | "content" @@ -88,7 +88,6 @@ export interface Settings { const DefaultSettings: Settings = { autoUpdate: true, - autoUpdateRelaunch: false, autoUpdateNotification: true, useQuickCss: true, themeLinks: [], @@ -100,6 +99,7 @@ const DefaultSettings: Settings = { winCtrlQ: false, macosVibrancyStyle: undefined, disableMinSize: false, + updateRelaunch: false, winNativeTitleBar: false, plugins: {}, diff --git a/src/components/VencordSettings/UpdaterTab.tsx b/src/components/VencordSettings/UpdaterTab.tsx index 1760a690..546110d3 100644 --- a/src/components/VencordSettings/UpdaterTab.tsx +++ b/src/components/VencordSettings/UpdaterTab.tsx @@ -107,6 +107,7 @@ function Updatable(props: CommonProps) { const [isChecking, setIsChecking] = React.useState(false); const [isUpdating, setIsUpdating] = React.useState(false); + const settings = useSettings(["updateRelaunch"]); const isOutdated = (updates?.length ?? 0) > 0; return ( @@ -118,7 +119,8 @@ function Updatable(props: CommonProps) { onClick={withDispatcher(setIsUpdating, async () => { if (await update()) { setUpdates([]); - await new Promise(r => { + if (settings.updateRelaunch) return relaunch(); + return await new Promise(r => { Alerts.show({ title: "Update Success!", body: "Successfully updated. Restart now to apply the changes?", @@ -189,7 +191,7 @@ function Newer(props: CommonProps) { } function Updater() { - const settings = useSettings(["autoUpdate", "autoUpdateRelaunch", "autoUpdateNotification"]); + const settings = useSettings(["autoUpdate", "updateRelaunch", "autoUpdateNotification"]); const [repo, err, repoPending] = useAwaiter(getRepo, { fallbackValue: "Loading..." }); @@ -215,16 +217,22 @@ function Updater() { settings.autoUpdateNotification = v} + onChange={(v: boolean) => { + settings.autoUpdateNotification = v; + settings.updateRelaunch = !v; + }} note="Shows a notification when Equicord automatically updates" disabled={!settings.autoUpdate} > Get notified when an automatic update completes settings.autoUpdateRelaunch = v} - note="Relaunches the app after automatically updating with no prompt" + value={settings.updateRelaunch} + onChange={(v: boolean) => { + settings.updateRelaunch = v; + settings.autoUpdateNotification = !v; + }} + note="Relaunches the app after updating with no prompt" disabled={!settings.autoUpdate} > Automatically relaunch after updating