diff --git a/src/Ryujinx/Systems/Updater/Updater.GitHub.cs b/src/Ryujinx/Systems/Updater/Updater.GitHub.cs index f7627ed01..49c09ba5a 100644 --- a/src/Ryujinx/Systems/Updater/Updater.GitHub.cs +++ b/src/Ryujinx/Systems/Updater/Updater.GitHub.cs @@ -18,7 +18,7 @@ namespace Ryujinx.Ava.Systems { private static GitHubReleaseChannels.Channel? _currentGitHubReleaseChannel; - public static async Task> CheckGitHubVersionAsync(bool showVersionUpToDate = false) + private static async Task> CheckGitHubVersionAsync(bool showVersionUpToDate = false) { if (!Version.TryParse(Program.Version, out Version currentVersion)) { diff --git a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs index 093628d1d..1f492474f 100644 --- a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs +++ b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs @@ -19,7 +19,7 @@ namespace Ryujinx.Ava.Systems { private static GitLabReleaseChannels.ChannelType _currentGitLabReleaseChannel; - public static async Task> CheckGitLabVersionAsync(bool showVersionUpToDate = false) + private static async Task> CheckGitLabVersionAsync(bool showVersionUpToDate = false) { if (!Version.TryParse(Program.Version, out Version currentVersion)) { diff --git a/src/Ryujinx/Systems/Updater/Updater.cs b/src/Ryujinx/Systems/Updater/Updater.cs index 0c9a77023..302c2ad15 100644 --- a/src/Ryujinx/Systems/Updater/Updater.cs +++ b/src/Ryujinx/Systems/Updater/Updater.cs @@ -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> 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; diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index d438342a4..23a3f26f9 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -419,7 +419,7 @@ namespace Ryujinx.Ava.UI.Windows .Catch(task => Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}")); break; 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); }