move version checking into a single method to unify updater logic across the app

This commit is contained in:
GreemDev
2025-06-03 03:09:50 -05:00
parent d0c055ccb8
commit 787a14ed2b
4 changed files with 19 additions and 11 deletions

View File

@ -56,15 +56,8 @@ namespace Ryujinx.Ava.Systems
private static string _stableUrlFormat = 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;
try
@ -78,6 +71,21 @@ namespace Ryujinx.Ava.Systems
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)
return;