Pass through correct update to apply when calling `WaitExitThenApplyUpdates`

This commit is contained in:
Dean Herbert 2024-09-02 17:20:33 +09:00
parent 68e6fa286e
commit cd9b82253e
No known key found for this signature in database
1 changed files with 5 additions and 5 deletions

View File

@ -52,7 +52,7 @@ private async Task<bool> checkForUpdateAsync(UpdateProgressNotification? notific
if (localUserInfo?.IsPlaying.Value == true) if (localUserInfo?.IsPlaying.Value == true)
return false; return false;
var info = await updateManager.CheckForUpdatesAsync().ConfigureAwait(false); UpdateInfo? info = await updateManager.CheckForUpdatesAsync().ConfigureAwait(false);
// Handle no updates available. // Handle no updates available.
if (info == null) if (info == null)
@ -65,7 +65,7 @@ private async Task<bool> checkForUpdateAsync(UpdateProgressNotification? notific
{ {
Activated = () => Activated = () =>
{ {
restartToApplyUpdate(); restartToApplyUpdate(null);
return true; return true;
} }
}); });
@ -78,7 +78,7 @@ private async Task<bool> checkForUpdateAsync(UpdateProgressNotification? notific
{ {
notification = new UpdateProgressNotification notification = new UpdateProgressNotification
{ {
CompletionClickAction = restartToApplyUpdate, CompletionClickAction = () => restartToApplyUpdate(info),
}; };
Schedule(() => notificationOverlay.Post(notification)); Schedule(() => notificationOverlay.Post(notification));
@ -117,9 +117,9 @@ private async Task<bool> checkForUpdateAsync(UpdateProgressNotification? notific
return true; return true;
} }
private bool restartToApplyUpdate() private bool restartToApplyUpdate(UpdateInfo? info)
{ {
updateManager.WaitExitThenApplyUpdates(null); updateManager.WaitExitThenApplyUpdates(info?.TargetFullRelease);
Schedule(() => game.AttemptExit()); Schedule(() => game.AttemptExit());
return true; return true;
} }