mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 09:42:54 +08:00
Merge efcdb268d2
into ce4aac4184
This commit is contained in:
commit
da74dc9963
@ -2,10 +2,13 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Game;
|
using osu.Game;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
@ -16,7 +19,7 @@ namespace osu.Desktop.Updater
|
|||||||
{
|
{
|
||||||
public partial class VelopackUpdateManager : Game.Updater.UpdateManager
|
public partial class VelopackUpdateManager : Game.Updater.UpdateManager
|
||||||
{
|
{
|
||||||
private readonly UpdateManager updateManager;
|
private UpdateManager updateManager = null!;
|
||||||
private INotificationOverlay notificationOverlay = null!;
|
private INotificationOverlay notificationOverlay = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
@ -25,22 +28,45 @@ namespace osu.Desktop.Updater
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private ILocalUserPlayInfo? localUserInfo { get; set; }
|
private ILocalUserPlayInfo? localUserInfo { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuConfigManager osuConfigManager { get; set; } = null!;
|
||||||
|
|
||||||
private bool isInGameplay => localUserInfo?.PlayingState.Value != LocalUserPlayingState.NotPlaying;
|
private bool isInGameplay => localUserInfo?.PlayingState.Value != LocalUserPlayingState.NotPlaying;
|
||||||
|
|
||||||
private UpdateInfo? pendingUpdate;
|
private UpdateInfo? pendingUpdate;
|
||||||
|
|
||||||
public VelopackUpdateManager()
|
private Bindable<ReleaseStream> releaseStream => osuConfigManager.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream);
|
||||||
{
|
|
||||||
updateManager = new UpdateManager(new GithubSource(@"https://github.com/ppy/osu", null, false), new UpdateOptions
|
|
||||||
{
|
|
||||||
AllowVersionDowngrade = true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(INotificationOverlay notifications)
|
private void load(INotificationOverlay notifications)
|
||||||
{
|
{
|
||||||
notificationOverlay = notifications;
|
notificationOverlay = notifications;
|
||||||
|
|
||||||
|
UpdateOptions options = new UpdateOptions
|
||||||
|
{
|
||||||
|
AllowVersionDowngrade = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
string arch = RuntimeInformation.OSArchitecture.ToString().ToLowerInvariant();
|
||||||
|
|
||||||
|
string platform = Environment.OSVersion.Platform switch
|
||||||
|
{
|
||||||
|
PlatformID.Win32NT => "win",
|
||||||
|
PlatformID.Unix => "linux-" + arch,
|
||||||
|
PlatformID.MacOSX => "osx-" + arch,
|
||||||
|
_ => throw new PlatformNotSupportedException(),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (releaseStream.Value == ReleaseStream.Photon)
|
||||||
|
{
|
||||||
|
options.ExplicitChannel = $"{platform}-photon";
|
||||||
|
// TODO: The logging here is not correct. It should be reading from `VelopackLocator.GetDefault(null).Channel` instead. Should also probably be moved to a more appropriate location.
|
||||||
|
Logger.Log("Using photon channel");
|
||||||
|
}
|
||||||
|
else if (releaseStream.Value == ReleaseStream.Lazer)
|
||||||
|
options.ExplicitChannel = platform;
|
||||||
|
|
||||||
|
updateManager = new UpdateManager(new GithubSource(@"https://github.com/ppy/osu", null, false), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task<bool> PerformUpdateCheck() => await checkForUpdateAsync().ConfigureAwait(false);
|
protected override async Task<bool> PerformUpdateCheck() => await checkForUpdateAsync().ConfigureAwait(false);
|
||||||
|
@ -6,6 +6,7 @@ namespace osu.Game.Configuration
|
|||||||
public enum ReleaseStream
|
public enum ReleaseStream
|
||||||
{
|
{
|
||||||
Lazer,
|
Lazer,
|
||||||
|
Photon,
|
||||||
//Stable40,
|
//Stable40,
|
||||||
//Beta40,
|
//Beta40,
|
||||||
//Stable
|
//Stable
|
||||||
|
@ -13,6 +13,7 @@ using osu.Framework.Screens;
|
|||||||
using osu.Framework.Statistics;
|
using osu.Framework.Statistics;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
|
using osu.Game.Overlays.Dialog;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Overlays.Settings.Sections.Maintenance;
|
using osu.Game.Overlays.Settings.Sections.Maintenance;
|
||||||
using osu.Game.Updater;
|
using osu.Game.Updater;
|
||||||
@ -36,13 +37,40 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private Storage storage { get; set; } = null!;
|
private Storage storage { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IDialogOverlay dialogOverlay { get; set; } = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config, OsuGame? game)
|
private void load(OsuConfigManager config, OsuGame? game)
|
||||||
{
|
{
|
||||||
|
var releaseStream = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream);
|
||||||
Add(new SettingsEnumDropdown<ReleaseStream>
|
Add(new SettingsEnumDropdown<ReleaseStream>
|
||||||
{
|
{
|
||||||
LabelText = GeneralSettingsStrings.ReleaseStream,
|
LabelText = GeneralSettingsStrings.ReleaseStream,
|
||||||
Current = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
|
Current = releaseStream,
|
||||||
|
});
|
||||||
|
|
||||||
|
bool debounce = false;
|
||||||
|
releaseStream.BindValueChanged(r =>
|
||||||
|
{
|
||||||
|
if (debounce)
|
||||||
|
{
|
||||||
|
debounce = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (game?.RestartAppWhenExited() == true)
|
||||||
|
{
|
||||||
|
game.AttemptExit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dialogOverlay.Push(new ConfirmDialog("You must restart after changing release streams. Are you sure about this?", () => game?.AttemptExit(), () =>
|
||||||
|
{
|
||||||
|
debounce = true;
|
||||||
|
releaseStream.Value = r.OldValue;
|
||||||
|
}));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (updateManager?.CanCheckForUpdate == true)
|
if (updateManager?.CanCheckForUpdate == true)
|
||||||
|
Loading…
Reference in New Issue
Block a user