diff --git a/StabilityMatrix.Avalonia/ViewModels/Settings/UpdateSettingsViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/Settings/UpdateSettingsViewModel.cs index c3a6f417..a9b36129 100644 --- a/StabilityMatrix.Avalonia/ViewModels/Settings/UpdateSettingsViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/Settings/UpdateSettingsViewModel.cs @@ -9,6 +9,7 @@ using CommunityToolkit.Mvvm.Input; using Exceptionless.DateTimeExtensions; using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Media.Animation; +using Semver; using StabilityMatrix.Avalonia.Languages; using StabilityMatrix.Avalonia.Models; using StabilityMatrix.Avalonia.Services; @@ -107,7 +108,7 @@ public partial class UpdateSettingsViewModel : PageViewModelBase accountsService.LykosAccountStatusUpdate += (_, args) => { - var isSelectable = args.IsPatreonConnected; + var isBetaChannelsEnabled = args.User?.IsActiveSupporter == true; foreach ( var card in AvailableUpdateChannelCards.Where( @@ -115,7 +116,7 @@ public partial class UpdateSettingsViewModel : PageViewModelBase ) ) { - card.IsSelectable = isSelectable; + card.IsSelectable = isBetaChannelsEnabled; } }; @@ -171,7 +172,11 @@ public partial class UpdateSettingsViewModel : PageViewModelBase Dispatcher.UIThread .InvokeAsync(async () => { - var dialog = DialogHelper.CreateTaskDialog("Become a Supporter", "uwu"); + var dialog = DialogHelper.CreateTaskDialog( + "Become a Supporter", + "" + + "Support the Stability Matrix Team and get access to early development builds and be the first to test new features. " + ); dialog.Buttons = new[] { @@ -205,27 +210,20 @@ public partial class UpdateSettingsViewModel : PageViewModelBase partial void OnUpdateStatusChanged(UpdateStatusChangedEventArgs? value) { // Update the update channel cards + + // Use maximum version from platforms equal or lower than current foreach (var card in AvailableUpdateChannelCards) { card.LatestVersion = value?.UpdateChannels - .GetValueOrDefault(card.UpdateChannel) + .Where(kv => kv.Key <= card.UpdateChannel) + .Select(kv => kv.Value) + .MaxBy(info => info.Version, SemVersion.PrecedenceComparer) ?.Version; - } - } - - partial void OnPreferredUpdateChannelChanged(UpdateChannel oldValue, UpdateChannel newValue) - { - if (newValue == UpdateChannel.Stable) - { - return; - } - if (accountsService.LykosStatus?.User?.IsActiveSupporter == true) - { - return; + /*card.LatestVersion = value?.UpdateChannels + .GetValueOrDefault(card.UpdateChannel) + ?.Version;*/ } - - PreferredUpdateChannel = UpdateChannel.Stable; } /// diff --git a/StabilityMatrix.Avalonia/Views/Settings/UpdateSettingsPage.axaml b/StabilityMatrix.Avalonia/Views/Settings/UpdateSettingsPage.axaml index 90a59e0a..9a8e4c06 100644 --- a/StabilityMatrix.Avalonia/Views/Settings/UpdateSettingsPage.axaml +++ b/StabilityMatrix.Avalonia/Views/Settings/UpdateSettingsPage.axaml @@ -15,11 +15,16 @@ xmlns:ui="using:FluentAvalonia.UI.Controls" xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels" xmlns:vmSettings="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Settings" + xmlns:converters="clr-namespace:StabilityMatrix.Avalonia.Converters" d:DataContext="{x:Static mocks:DesignData.UpdateSettingsViewModel}" d:DesignHeight="550" d:DesignWidth="800" x:DataType="vmSettings:UpdateSettingsViewModel" mc:Ignorable="d"> + + + + @@ -84,14 +89,20 @@ + Text="{Binding DisplayName}"> + + + + + + + +