mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 22:26:41 +09:00
Show a notification if checking for updates via button and there are none available
This commit is contained in:
@ -57,25 +57,28 @@ namespace osu.Game.Updater
|
||||
|
||||
private readonly object updateTaskLock = new object();
|
||||
|
||||
private Task updateCheckTask;
|
||||
private Task<bool> updateCheckTask;
|
||||
|
||||
public async Task CheckForUpdateAsync()
|
||||
public async Task<bool> CheckForUpdateAsync()
|
||||
{
|
||||
if (!CanCheckForUpdate)
|
||||
return;
|
||||
|
||||
Task waitTask;
|
||||
Task<bool> waitTask;
|
||||
|
||||
lock (updateTaskLock)
|
||||
waitTask = (updateCheckTask ??= PerformUpdateCheck());
|
||||
|
||||
await waitTask;
|
||||
bool hasUpdates = await waitTask;
|
||||
|
||||
lock (updateTaskLock)
|
||||
updateCheckTask = null;
|
||||
|
||||
return hasUpdates;
|
||||
}
|
||||
|
||||
protected virtual Task PerformUpdateCheck() => Task.CompletedTask;
|
||||
/// <summary>
|
||||
/// Performs an asynchronous check for application updates.
|
||||
/// </summary>
|
||||
/// <returns>Whether any update is waiting. May return true if an error occured (there is potentially an update available).</returns>
|
||||
protected virtual Task<bool> PerformUpdateCheck() => Task.FromResult(false);
|
||||
|
||||
private class UpdateCompleteNotification : SimpleNotification
|
||||
{
|
||||
|
Reference in New Issue
Block a user