mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-11 23:53:03 -04:00
feat(Updater): Fixes
This commit is contained in:
parent
d925fe4922
commit
bb34833b3c
3 changed files with 17 additions and 9 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue