Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion osu.Game/OsuGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1301,10 +1301,17 @@ protected override void LoadComplete()

applyConfigMigrations();

string lastVersion = LocalConfig.Get<string>(OsuSetting.Version);
string version = Version;

// only show a notification if we've previously saved a version to the config file (ie. not the first run).
if (IsDeployedBuild && !string.IsNullOrEmpty(lastVersion) && version != lastVersion)
Notifications.Post(new UpdateCompleteNotification(version));

// finally, update the version stored to the configuration.
// this MUST happen after `applyConfigMigrations()` call, as it relies on comparing the previous version.
// debug / local compilations will reset to a non-release string.
LocalConfig.SetValue(OsuSetting.Version, Version);
LocalConfig.SetValue(OsuSetting.Version, version);
}

/// <summary>
Expand Down
57 changes: 25 additions & 32 deletions osu.Game/Updater/UpdateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,8 @@ protected override void LoadComplete()
{
base.LoadComplete();

string version = game.Version;
string lastVersion = config.Get<string>(OsuSetting.Version);

if (game.IsDeployedBuild)
{
// only show a notification if we've previously saved a version to the config file (ie. not the first run).
if (!string.IsNullOrEmpty(lastVersion) && version != lastVersion)
Notifications.Post(new UpdateCompleteNotification(version));

// make sure the release stream setting matches the build which was just run.
if (FixedReleaseStream != null)
config.SetValue(OsuSetting.ReleaseStream, FixedReleaseStream.Value);
Expand Down Expand Up @@ -137,31 +130,6 @@ protected override void Dispose(bool isDisposing)
updateCancellationSource.Dispose();
}

private partial class UpdateCompleteNotification : SimpleNotification
{
private readonly string version;

public UpdateCompleteNotification(string version)
{
this.version = version;
Text = NotificationsStrings.GameVersionAfterUpdate(version);
}

[BackgroundDependencyLoader]
private void load(OsuColour colours, ChangelogOverlay changelog, INotificationOverlay notificationOverlay)
{
Icon = FontAwesome.Solid.CheckSquare;
IconContent.Colour = colours.BlueDark;

Activated = delegate
{
notificationOverlay.Hide();
changelog.ShowBuild(version);
return true;
};
}
}

public partial class UpdateDownloadProgressNotification : ProgressNotification
{
private readonly CancellationToken cancellationToken;
Expand Down Expand Up @@ -259,4 +227,29 @@ protected override void Update()
}
}
}

public partial class UpdateCompleteNotification : SimpleNotification
{
private readonly string version;

public UpdateCompleteNotification(string version)
{
this.version = version;
Text = NotificationsStrings.GameVersionAfterUpdate(version);
}

[BackgroundDependencyLoader]
private void load(OsuColour colours, ChangelogOverlay changelog, INotificationOverlay notificationOverlay)
{
Icon = FontAwesome.Solid.CheckSquare;
IconContent.Colour = colours.BlueDark;

Activated = delegate
{
notificationOverlay.Hide();
changelog.ShowBuild(version);
return true;
};
}
}
}
Loading