Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using UniGetUI.Avalonia.ViewModels;
using UniGetUI.Core.Data;
using UniGetUI.Core.Logging;
using UniGetUI.Core.SettingsEngine;
using UniGetUI.Core.Tools;

namespace UniGetUI.Avalonia.ViewModels.Pages.SettingsPages;
Expand All @@ -13,6 +14,12 @@ public partial class Interface_PViewModel : ViewModelBase
{
public bool IsWindows { get; } = OperatingSystem.IsWindows();

/// <summary>
/// True when the user is enrolled in the beta program. In that case the modern UI is forced
/// and the classic-mode toggle should be disabled.
/// </summary>
public bool IsBetaTester { get; } = Settings.Get(Settings.K.EnableUniGetUIBeta);

[ObservableProperty] private string _iconCacheSizeText = "";

public event EventHandler? RestartRequired;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
Text="{t:Translate Use classic mode}"
WarningText="{t:Translate Restart UniGetUI to apply this change}"
StateChangedCommand="{Binding ShowRestartRequiredCommand}"
IsEnabled="{Binding !IsBetaTester}"
ToolTip.Tip="{t:Translate The classic UI is disabled for beta testers}"
CornerRadius="8"/>

<StackPanel x:Name="SystemTraySection" Orientation="Vertical">
Expand Down
10 changes: 10 additions & 0 deletions src/UniGetUI.Tests/ModernAppLauncherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ public void ClassicModeDefaultsToEnabled()
Assert.False(ModernAppLauncher.IsClassicModeEnabled());
}

[Fact]
public void BetaTestersDefaultToModernUI()
{
Assert.True(ModernAppLauncher.IsClassicModeEnabled());

Settings.Set(Settings.K.EnableUniGetUIBeta, true);

Assert.False(ModernAppLauncher.IsClassicModeEnabled());
}

[Fact]
public void ResolveModernExecutablePath_PrefersRootExecutable()
{
Expand Down
3 changes: 2 additions & 1 deletion src/UniGetUI/ModernAppLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ internal static class ModernAppLauncher
internal const string ModernAppDirectoryName = "Avalonia";
internal const string ModernAppExecutableName = "UniGetUI.Avalonia.exe";

public static bool IsClassicModeEnabled() => !Settings.Get(Settings.K.DisableClassicMode);
public static bool IsClassicModeEnabled() =>
!Settings.Get(Settings.K.DisableClassicMode) && !Settings.Get(Settings.K.EnableUniGetUIBeta);

public static void Launch(string[] args)
{
Expand Down
Loading