mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 06:46:24 +02:00
UI: Added option to check for updates in the background
This commit is contained in:
parent
6ab899f621
commit
fe9fe2a10f
11 changed files with 204 additions and 60 deletions
|
@ -19,6 +19,7 @@ using Ryujinx.Ava.UI.ViewModels;
|
|||
using Ryujinx.Ava.Utilities;
|
||||
using Ryujinx.Ava.Utilities.AppLibrary;
|
||||
using Ryujinx.Ava.Utilities.Configuration;
|
||||
using Ryujinx.Ava.Utilities.Configuration.UI;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Helper;
|
||||
using Ryujinx.Common.Logging;
|
||||
|
@ -400,10 +401,29 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
await Dispatcher.UIThread.InvokeAsync(async () => await UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys));
|
||||
}
|
||||
|
||||
if (ConfigurationState.Instance.CheckUpdatesOnStart && !CommandLineState.HideAvailableUpdates && Updater.CanUpdate())
|
||||
if (!Updater.CanUpdate() || CommandLineState.HideAvailableUpdates)
|
||||
return;
|
||||
|
||||
switch (ConfigurationState.Instance.UpdateCheckerType.Value)
|
||||
{
|
||||
await Updater.BeginUpdateAsync()
|
||||
.Catch(task => Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}"));
|
||||
case UpdaterType.PromptAtStartup:
|
||||
await Updater.BeginUpdateAsync()
|
||||
.Catch(task => Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}"));
|
||||
break;
|
||||
case UpdaterType.CheckInBackground:
|
||||
if ((await Updater.CheckVersionAsync()).TryGet(out (Version Current, Version Incoming) versions))
|
||||
{
|
||||
string newVersionString = ReleaseInformation.IsCanaryBuild
|
||||
? $"Canary {versions.Current} -> Canary {versions.Incoming}"
|
||||
: $"{versions.Current} -> {versions.Incoming}";
|
||||
|
||||
if (versions.Current < versions.Incoming)
|
||||
NotificationHelper.ShowInformation(
|
||||
title: "Update Available",
|
||||
text: newVersionString,
|
||||
onClick: () => _ = Updater.BeginUpdateAsync());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue