Browse Source

Don't include prerelease in package updates & update to nightly avalonia for better mica effect

pull/55/head
JT 1 year ago
parent
commit
f58e2a1afd
  1. 7
      NuGet.Config
  2. 8
      StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj
  3. 9
      StabilityMatrix.Avalonia/Views/MainWindow.axaml.cs
  4. 4
      StabilityMatrix.Core/Models/Packages/BaseGitPackage.cs
  5. 4
      StabilityMatrix.Core/Models/Packages/BasePackage.cs
  6. 9
      StabilityMatrix.Core/Models/Packages/VladAutomatic.cs

7
NuGet.Config

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Avalonia Nightly" value="https://nuget-feed-nightly.avaloniaui.net/v3/index.json" />
</packageSources>
</configuration>

8
StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj

@ -14,12 +14,12 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AsyncImageLoader.Avalonia" Version="3.0.0" /> <PackageReference Include="AsyncImageLoader.Avalonia" Version="3.0.0" />
<PackageReference Include="Avalonia" Version="11.0.0" /> <PackageReference Include="Avalonia" Version="11.0.999-cibuild0038094-beta" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.0.0" /> <PackageReference Include="Avalonia.AvaloniaEdit" Version="11.0.0" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0" /> <PackageReference Include="Avalonia.Desktop" Version="11.0.999-cibuild0038094-beta" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.0" /> <PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.999-cibuild0038094-beta" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0" /> <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.999-cibuild0038094-beta" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.0.1" /> <PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.0.1" />
<PackageReference Include="AvaloniaEdit.TextMate" Version="11.0.0" /> <PackageReference Include="AvaloniaEdit.TextMate" Version="11.0.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />

9
StabilityMatrix.Avalonia/Views/MainWindow.axaml.cs

@ -110,7 +110,12 @@ public partial class MainWindow : AppWindowBase
private void TryEnableMicaEffect() private void TryEnableMicaEffect()
{ {
TransparencyBackgroundFallback = Brushes.Transparent; TransparencyBackgroundFallback = Brushes.Transparent;
TransparencyLevelHint = new[] { WindowTransparencyLevel.Mica, WindowTransparencyLevel.Blur }; TransparencyLevelHint = new[]
{
WindowTransparencyLevel.Mica,
WindowTransparencyLevel.AcrylicBlur,
WindowTransparencyLevel.Blur
};
if (ActualThemeVariant == ThemeVariant.Dark) if (ActualThemeVariant == ThemeVariant.Dark)
{ {
@ -119,7 +124,7 @@ public partial class MainWindow : AppWindowBase
color = color.LightenPercent(-0.8f); color = color.LightenPercent(-0.8f);
Background = new ImmutableSolidColorBrush(color, 0.9); Background = new ImmutableSolidColorBrush(color, 0.8);
} }
else if (ActualThemeVariant == ThemeVariant.Light) else if (ActualThemeVariant == ThemeVariant.Light)
{ {

4
StabilityMatrix.Core/Models/Packages/BaseGitPackage.cs

@ -196,12 +196,12 @@ public abstract class BaseGitPackage : BasePackage
} }
public override async Task<string> Update(InstalledPackage installedPackage, public override async Task<string> Update(InstalledPackage installedPackage,
IProgress<ProgressReport>? progress = null) IProgress<ProgressReport>? progress = null, bool includePrerelease = false)
{ {
if (string.IsNullOrWhiteSpace(installedPackage.InstalledBranch)) if (string.IsNullOrWhiteSpace(installedPackage.InstalledBranch))
{ {
var releases = await GetAllReleases(); var releases = await GetAllReleases();
var latestRelease = releases.First(); var latestRelease = releases.First(x => includePrerelease || !x.Prerelease);
await DownloadPackage(latestRelease.TagName, false, progress); await DownloadPackage(latestRelease.TagName, false, progress);
await InstallPackage(progress); await InstallPackage(progress);
return latestRelease.TagName; return latestRelease.TagName;

4
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 RunPackage(string installedPackagePath, string arguments);
public abstract Task Shutdown(); public abstract Task Shutdown();
public abstract Task<bool> CheckForUpdates(InstalledPackage package); public abstract Task<bool> CheckForUpdates(InstalledPackage package);
public abstract Task<string> Update(InstalledPackage installedPackage, IProgress<ProgressReport>? progress = null);
public abstract Task<string> Update(InstalledPackage installedPackage,
IProgress<ProgressReport>? progress = null, bool includePrerelease = false);
public abstract Task<IEnumerable<Release>> GetReleaseTags(); public abstract Task<IEnumerable<Release>> GetReleaseTags();
public abstract List<LaunchOptionDefinition> LaunchOptions { get; } public abstract List<LaunchOptionDefinition> LaunchOptions { get; }

9
StabilityMatrix.Core/Models/Packages/VladAutomatic.cs

@ -225,9 +225,11 @@ public class VladAutomatic : BaseGitPackage
VenvRunner?.RunDetached(args.TrimEnd(), HandleConsoleOutput, HandleExit, workingDirectory: installedPackagePath); VenvRunner?.RunDetached(args.TrimEnd(), HandleConsoleOutput, HandleExit, workingDirectory: installedPackagePath);
} }
public override async Task<string> Update(InstalledPackage installedPackage, IProgress<ProgressReport>? progress = null) public override async Task<string> Update(InstalledPackage installedPackage,
IProgress<ProgressReport>? 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 version = await GithubApi.GetAllCommits(Author, Name, installedPackage.InstalledBranch);
var latest = version?.FirstOrDefault(); var latest = version?.FirstOrDefault();
@ -265,7 +267,8 @@ public class VladAutomatic : BaseGitPackage
return string.Empty; 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; return latest.Sha;
} }

Loading…
Cancel
Save