1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Restore notification code

This commit is contained in:
Dean Herbert 2020-06-12 19:20:45 +09:00
parent 4f809767a5
commit 35f577375c

View File

@ -39,6 +39,18 @@ namespace osu.Game.Updater
Schedule(() => Task.Run(CheckForUpdateAsync));
// Query last version only *once*, so the user can re-check for updates, in case they closed the notification or else.
lastVersion ??= config.Get<string>(OsuSetting.Version);
var version = game.Version;
if (game.IsDeployedBuild && version != lastVersion)
{
// only show a notification if we've previously saved a version to the config file (ie. not the first run).
if (!string.IsNullOrEmpty(lastVersion))
Notifications.Post(new UpdateCompleteNotification(version));
}
// debug / local compilations will reset to a non-release string.
// can be useful to check when an install has transitioned between release and otherwise (see OsuConfigManager's migrations).
config.Set(OsuSetting.Version, game.Version);
@ -62,23 +74,7 @@ namespace osu.Game.Updater
updateCheckTask = null;
}
protected virtual Task PerformUpdateCheck()
{
// Query last version only *once*, so the user can re-check for updates, in case they closed the notification or else.
lastVersion ??= config.Get<string>(OsuSetting.Version);
var version = game.Version;
if (version != lastVersion)
{
// only show a notification if we've previously saved a version to the config file (ie. not the first run).
if (!string.IsNullOrEmpty(lastVersion))
Notifications.Post(new UpdateCompleteNotification(version));
}
// we aren't doing any async in this method, so we return a completed task instead.
return Task.CompletedTask;
}
protected virtual Task PerformUpdateCheck() => Task.CompletedTask;
private class UpdateCompleteNotification : SimpleNotification
{