Initial commit

This commit is contained in:
Craftplacer 2020-05-07 08:07:22 +02:00
parent c8134162b5
commit 836efe3f7c
4 changed files with 24 additions and 3 deletions

View File

@ -37,10 +37,12 @@ namespace osu.Desktop.Updater
if (game.IsDeployedBuild)
{
Splat.Locator.CurrentMutable.Register(() => new SquirrelLogger(), typeof(Splat.ILogger));
Schedule(() => Task.Run(() => checkForUpdateAsync()));
CheckForUpdate();
}
}
public override void CheckForUpdate() => Schedule(() => Task.Run(() => checkForUpdateAsync()));
private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
{
// should we schedule a retry on completion of this check?

View File

@ -5,15 +5,19 @@ using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Updater;
namespace osu.Game.Overlays.Settings.Sections.General
{
public class UpdateSettings : SettingsSubsection
{
[Resolved(CanBeNull = true)]
private UpdateManager updateManager { get; set; }
protected override string Header => "Updates";
[BackgroundDependencyLoader]
private void load(Storage storage, OsuConfigManager config)
private void load(Storage storage, OsuConfigManager config, OsuGameBase game)
{
Add(new SettingsEnumDropdown<ReleaseStream>
{
@ -21,6 +25,13 @@ namespace osu.Game.Overlays.Settings.Sections.General
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
});
Add(new SettingsButton
{
Text = "Check for updates",
Action = () => updateManager?.CheckForUpdate(),
Enabled = { Value = game.IsDeployedBuild }
});
if (RuntimeInfo.IsDesktop)
{
Add(new SettingsButton

View File

@ -30,9 +30,11 @@ namespace osu.Game.Updater
version = game.Version;
if (game.IsDeployedBuild)
Schedule(() => Task.Run(checkForUpdateAsync));
CheckForUpdate();
}
public override void CheckForUpdate() => Schedule(() => Task.Run(checkForUpdateAsync));
private async void checkForUpdateAsync()
{
try

View File

@ -4,6 +4,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Logging;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Overlays;
@ -44,6 +45,11 @@ namespace osu.Game.Updater
config.Set(OsuSetting.Version, version);
}
public virtual void CheckForUpdate()
{
Logger.Log("CheckForUpdate was called on the base class (UpdateManager)", LoggingTarget.Information);
}
private class UpdateCompleteNotification : SimpleNotification
{
private readonly string version;