From f58e2a1afdbbe27fd9d07beed9c13bb2d3f85455 Mon Sep 17 00:00:00 2001 From: JT Date: Tue, 25 Jul 2023 19:16:49 -0700 Subject: [PATCH] Don't include prerelease in package updates & update to nightly avalonia for better mica effect --- NuGet.Config | 7 +++++++ .../StabilityMatrix.Avalonia.csproj | 8 ++++---- StabilityMatrix.Avalonia/Views/MainWindow.axaml.cs | 9 +++++++-- .../Models/Packages/BaseGitPackage.cs | 4 ++-- StabilityMatrix.Core/Models/Packages/BasePackage.cs | 4 +++- StabilityMatrix.Core/Models/Packages/VladAutomatic.cs | 11 +++++++---- 6 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 NuGet.Config diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 00000000..32e6bcce --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj b/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj index 5cf09c8c..0b45244a 100644 --- a/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj +++ b/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj @@ -14,12 +14,12 @@ - + - - + + - + diff --git a/StabilityMatrix.Avalonia/Views/MainWindow.axaml.cs b/StabilityMatrix.Avalonia/Views/MainWindow.axaml.cs index 0a344102..6d659c18 100644 --- a/StabilityMatrix.Avalonia/Views/MainWindow.axaml.cs +++ b/StabilityMatrix.Avalonia/Views/MainWindow.axaml.cs @@ -110,7 +110,12 @@ public partial class MainWindow : AppWindowBase private void TryEnableMicaEffect() { TransparencyBackgroundFallback = Brushes.Transparent; - TransparencyLevelHint = new[] { WindowTransparencyLevel.Mica, WindowTransparencyLevel.Blur }; + TransparencyLevelHint = new[] + { + WindowTransparencyLevel.Mica, + WindowTransparencyLevel.AcrylicBlur, + WindowTransparencyLevel.Blur + }; if (ActualThemeVariant == ThemeVariant.Dark) { @@ -119,7 +124,7 @@ public partial class MainWindow : AppWindowBase color = color.LightenPercent(-0.8f); - Background = new ImmutableSolidColorBrush(color, 0.9); + Background = new ImmutableSolidColorBrush(color, 0.8); } else if (ActualThemeVariant == ThemeVariant.Light) { diff --git a/StabilityMatrix.Core/Models/Packages/BaseGitPackage.cs b/StabilityMatrix.Core/Models/Packages/BaseGitPackage.cs index 1be11796..4776c248 100644 --- a/StabilityMatrix.Core/Models/Packages/BaseGitPackage.cs +++ b/StabilityMatrix.Core/Models/Packages/BaseGitPackage.cs @@ -196,12 +196,12 @@ public abstract class BaseGitPackage : BasePackage } public override async Task Update(InstalledPackage installedPackage, - IProgress? progress = null) + IProgress? progress = null, bool includePrerelease = false) { if (string.IsNullOrWhiteSpace(installedPackage.InstalledBranch)) { var releases = await GetAllReleases(); - var latestRelease = releases.First(); + var latestRelease = releases.First(x => includePrerelease || !x.Prerelease); await DownloadPackage(latestRelease.TagName, false, progress); await InstallPackage(progress); return latestRelease.TagName; diff --git a/StabilityMatrix.Core/Models/Packages/BasePackage.cs b/StabilityMatrix.Core/Models/Packages/BasePackage.cs index 4a280912..812f8fe1 100644 --- a/StabilityMatrix.Core/Models/Packages/BasePackage.cs +++ b/StabilityMatrix.Core/Models/Packages/BasePackage.cs @@ -25,7 +25,9 @@ public abstract class BasePackage public abstract Task RunPackage(string installedPackagePath, string arguments); public abstract Task Shutdown(); public abstract Task CheckForUpdates(InstalledPackage package); - public abstract Task Update(InstalledPackage installedPackage, IProgress? progress = null); + + public abstract Task Update(InstalledPackage installedPackage, + IProgress? progress = null, bool includePrerelease = false); public abstract Task> GetReleaseTags(); public abstract List LaunchOptions { get; } diff --git a/StabilityMatrix.Core/Models/Packages/VladAutomatic.cs b/StabilityMatrix.Core/Models/Packages/VladAutomatic.cs index 42b57f46..2c50a362 100644 --- a/StabilityMatrix.Core/Models/Packages/VladAutomatic.cs +++ b/StabilityMatrix.Core/Models/Packages/VladAutomatic.cs @@ -225,9 +225,11 @@ public class VladAutomatic : BaseGitPackage VenvRunner?.RunDetached(args.TrimEnd(), HandleConsoleOutput, HandleExit, workingDirectory: installedPackagePath); } - public override async Task Update(InstalledPackage installedPackage, IProgress? progress = null) + public override async Task Update(InstalledPackage installedPackage, + IProgress? progress = null, bool includePrerelease = false) { - progress?.Report(new ProgressReport(0.1f, message: "Downloading package update...", isIndeterminate: true, type: ProgressType.Download)); + progress?.Report(new ProgressReport(0.1f, message: "Downloading package update...", + isIndeterminate: true, type: ProgressType.Download)); var version = await GithubApi.GetAllCommits(Author, Name, installedPackage.InstalledBranch); var latest = version?.FirstOrDefault(); @@ -265,8 +267,9 @@ public class VladAutomatic : BaseGitPackage return string.Empty; } - progress?.Report(new ProgressReport(1f, message: "Update Complete", isIndeterminate: false, type: ProgressType.Generic)); - + progress?.Report(new ProgressReport(1f, message: "Update Complete", isIndeterminate: false, + type: ProgressType.Generic)); + return latest.Sha; } }