mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 13:23:28 -05:00
feat(Updater): Fixes
This commit is contained in:
parent
d925fe4922
commit
bb34833b3c
3 changed files with 17 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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: {},
|
||||
|
||||
|
|
|
@ -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<void>(r => {
|
||||
if (settings.updateRelaunch) return relaunch();
|
||||
return await new Promise<void>(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() {
|
|||
</Switch>
|
||||
<Switch
|
||||
value={settings.autoUpdateNotification}
|
||||
onChange={(v: boolean) => 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
|
||||
</Switch>
|
||||
<Switch
|
||||
value={settings.autoUpdateRelaunch}
|
||||
onChange={(v: boolean) => 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
|
||||
|
|
Loading…
Reference in a new issue