1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 07:43:00 +08:00

Check whether the build is deployed within the public check updates method

This commit is contained in:
Craftplacer 2020-05-08 02:48:27 +02:00
parent e6ad28a1cb
commit 3c24ca08d0
2 changed files with 18 additions and 9 deletions

View File

@ -26,6 +26,7 @@ namespace osu.Desktop.Updater
private UpdateManager updateManager;
private NotificationOverlay notificationOverlay;
private OsuGameBase gameBase;
public Task PrepareUpdateAsync() => UpdateManager.RestartAppWhenExited();
@ -34,16 +35,18 @@ namespace osu.Desktop.Updater
[BackgroundDependencyLoader]
private void load(NotificationOverlay notification, OsuGameBase game)
{
gameBase = game;
notificationOverlay = notification;
if (game.IsDeployedBuild)
{
Splat.Locator.CurrentMutable.Register(() => new SquirrelLogger(), typeof(Splat.ILogger));
CheckForUpdate();
}
Splat.Locator.CurrentMutable.Register(() => new SquirrelLogger(), typeof(Splat.ILogger));
CheckForUpdate();
}
public override void CheckForUpdate() => Schedule(() => Task.Run(() => checkForUpdateAsync()));
public override void CheckForUpdate()
{
if (gameBase.IsDeployedBuild)
Schedule(() => Task.Run(() => checkForUpdateAsync()));
}
private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
{

View File

@ -26,16 +26,22 @@ namespace osu.Game.Updater
[Resolved]
private GameHost host { get; set; }
private OsuGameBase gameBase;
[BackgroundDependencyLoader]
private void load(OsuGameBase game)
{
gameBase = game;
version = game.Version;
if (game.IsDeployedBuild)
CheckForUpdate();
CheckForUpdate();
}
public override void CheckForUpdate() => Schedule(() => Task.Run(checkForUpdateAsync));
public override void CheckForUpdate()
{
if (gameBase.IsDeployedBuild)
Schedule(() => Task.Run(checkForUpdateAsync));
}
private async void checkForUpdateAsync()
{