mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-08 17:37:14 +00:00
move version checking into a single method to unify updater logic across the app
This commit is contained in:
parent
d0c055ccb8
commit
787a14ed2b
@ -18,7 +18,7 @@ namespace Ryujinx.Ava.Systems
|
|||||||
{
|
{
|
||||||
private static GitHubReleaseChannels.Channel? _currentGitHubReleaseChannel;
|
private static GitHubReleaseChannels.Channel? _currentGitHubReleaseChannel;
|
||||||
|
|
||||||
public static async Task<Optional<(Version Current, Version Incoming)>> CheckGitHubVersionAsync(bool showVersionUpToDate = false)
|
private static async Task<Optional<(Version Current, Version Incoming)>> CheckGitHubVersionAsync(bool showVersionUpToDate = false)
|
||||||
{
|
{
|
||||||
if (!Version.TryParse(Program.Version, out Version currentVersion))
|
if (!Version.TryParse(Program.Version, out Version currentVersion))
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ namespace Ryujinx.Ava.Systems
|
|||||||
{
|
{
|
||||||
private static GitLabReleaseChannels.ChannelType _currentGitLabReleaseChannel;
|
private static GitLabReleaseChannels.ChannelType _currentGitLabReleaseChannel;
|
||||||
|
|
||||||
public static async Task<Optional<(Version Current, Version Incoming)>> CheckGitLabVersionAsync(bool showVersionUpToDate = false)
|
private static async Task<Optional<(Version Current, Version Incoming)>> CheckGitLabVersionAsync(bool showVersionUpToDate = false)
|
||||||
{
|
{
|
||||||
if (!Version.TryParse(Program.Version, out Version currentVersion))
|
if (!Version.TryParse(Program.Version, out Version currentVersion))
|
||||||
{
|
{
|
||||||
|
@ -56,15 +56,8 @@ namespace Ryujinx.Ava.Systems
|
|||||||
private static string _stableUrlFormat = null;
|
private static string _stableUrlFormat = null;
|
||||||
private static string _changelogUrlFormat = null;
|
private static string _changelogUrlFormat = null;
|
||||||
|
|
||||||
public static async Task BeginUpdateAsync(bool showVersionUpToDate = false)
|
public static async Task<Optional<(Version, Version)>> CheckForUpdateAsync(bool showVersionUpToDate = false)
|
||||||
{
|
{
|
||||||
if (_running)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_running = true;
|
|
||||||
|
|
||||||
Optional<(Version, Version)> versionTuple;
|
Optional<(Version, Version)> versionTuple;
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -78,6 +71,21 @@ namespace Ryujinx.Ava.Systems
|
|||||||
versionTuple = await CheckGitHubVersionAsync(showVersionUpToDate);
|
versionTuple = await CheckGitHubVersionAsync(showVersionUpToDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return versionTuple;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static async Task BeginUpdateAsync(bool showVersionUpToDate = false)
|
||||||
|
{
|
||||||
|
if (_running)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_running = true;
|
||||||
|
|
||||||
|
Optional<(Version, Version)> versionTuple = await CheckForUpdateAsync(showVersionUpToDate);
|
||||||
|
|
||||||
if (_running is false || !versionTuple.HasValue)
|
if (_running is false || !versionTuple.HasValue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
.Catch(task => Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}"));
|
.Catch(task => Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}"));
|
||||||
break;
|
break;
|
||||||
case UpdaterType.CheckInBackground:
|
case UpdaterType.CheckInBackground:
|
||||||
if ((await Updater.CheckGitHubVersionAsync()).TryGet(out (Version Current, Version Incoming) versions))
|
if ((await Updater.CheckForUpdateAsync()).TryGet(out (Version Current, Version Incoming) versions))
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(() => RyujinxApp.MainWindow.ViewModel.UpdateAvailable = versions.Current < versions.Incoming);
|
Dispatcher.UIThread.Post(() => RyujinxApp.MainWindow.ViewModel.UpdateAvailable = versions.Current < versions.Incoming);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user