Skip to content

Commit 23191da

Browse files
committed
fix support list
1 parent 5c24a77 commit 23191da

24 files changed

Lines changed: 87 additions & 44 deletions

File tree

src/Languages/lang_en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"Do you really want to uninstall the following {0} packages?": "Do you really want to uninstall the following {0} packages?",
8181
"No": "No",
8282
"Yes": "Yes",
83+
"Partial": "Partial",
8384
"View on UniGetUI": "View on UniGetUI",
8485
"Update": "Update",
8586
"Open UniGetUI": "Open UniGetUI",
@@ -524,6 +525,7 @@
524525
"e.g. 10": "e.g. 10",
525526
"Custom minimum age (days)": "Custom minimum age (days)",
526527
"{pm} does not provide release dates for its packages, so this setting will have no effect": "{pm} does not provide release dates for its packages, so this setting will have no effect",
528+
"{pm} only provides release dates for some of its packages, so this setting will only apply to those packages": "{pm} only provides release dates for some of its packages, so this setting will only apply to those packages",
527529
"Override the global minimum update age for this package manager": "Override the global minimum update age for this package manager",
528530
"View {0} logs": "View {0} logs",
529531
"If Python cannot be found or is not listing packages but is installed on the system, ": "If Python cannot be found or is not listing packages but is installed on the system, ",

src/UniGetUI.Avalonia/ViewModels/Pages/SettingsPages/UpdatesViewModel.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using UniGetUI.Avalonia.Views.Pages.SettingsPages;
77
using UniGetUI.Core.Tools;
88
using UniGetUI.PackageEngine;
9+
using UniGetUI.PackageEngine.ManagerClasses.Manager;
910
using CoreSettings = UniGetUI.Core.SettingsEngine.Settings;
1011
using CornerRadius = Avalonia.CornerRadius;
1112
using Thickness = Avalonia.Thickness;
@@ -20,10 +21,6 @@ public partial class UpdatesViewModel : ViewModelBase
2021
[ObservableProperty] private bool _isAutoCheckEnabled;
2122
[ObservableProperty] private bool _isCustomAgeSelected;
2223

23-
private static readonly HashSet<string> _managersWithoutUpdateDate =
24-
new(StringComparer.OrdinalIgnoreCase)
25-
{ "Homebrew", "Scoop", "vcpkg" };
26-
2724
/// <summary>Items for the minimum update age ComboboxCard, in display/value pairs.</summary>
2825
public IReadOnlyList<(string Name, string Value)> MinimumAgeItems { get; } =
2926
[
@@ -60,9 +57,6 @@ public UpdatesViewModel()
6057

6158
public Control BuildReleaseDateCompatTable()
6259
{
63-
string yesStr = CoreTools.Translate("Yes");
64-
string noStr = CoreTools.Translate("No");
65-
6660
var managers = PEInterface.Managers.ToList();
6761

6862
var table = new Grid
@@ -89,8 +83,13 @@ public Control BuildReleaseDateCompatTable()
8983
var name = new TextBlock { Text = manager.DisplayName, VerticalAlignment = VerticalAlignment.Center };
9084
Grid.SetRow(name, row); Grid.SetColumn(name, 0);
9185

92-
bool supported = !_managersWithoutUpdateDate.Contains(manager.Name);
93-
var badge = _statusBadge(supported ? yesStr : noStr, supported ? Colors.Green : Colors.Red);
86+
(string label, Color color) = manager.Capabilities.KnowsPackageReleaseDate switch
87+
{
88+
PackageReleaseDateSupport.Yes => (CoreTools.Translate("Yes"), Colors.Green),
89+
PackageReleaseDateSupport.Partial => (CoreTools.Translate("Partial"), Color.FromRgb(224, 168, 0)),
90+
_ => (CoreTools.Translate("No"), Colors.Red),
91+
};
92+
var badge = _statusBadge(label, color);
9493
Grid.SetRow(badge, row); Grid.SetColumn(badge, 1);
9594

9695
table.Children.Add(name);

src/UniGetUI.Avalonia/Views/Pages/SettingsPages/PackageManagerPage.axaml.cs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using UniGetUI.Core.Tools;
1313
using UniGetUI.Interface.Enums;
1414
using UniGetUI.PackageEngine.Interfaces;
15+
using UniGetUI.PackageEngine.ManagerClasses.Manager;
1516
using UniGetUI.PackageEngine.Managers.VcpkgManager;
1617
using CoreSettings = UniGetUI.Core.SettingsEngine.Settings;
1718
using CornerRadius = global::Avalonia.CornerRadius;
@@ -21,9 +22,6 @@ namespace UniGetUI.Avalonia.Views.Pages.SettingsPages;
2122

2223
public sealed partial class PackageManagerPage : UserControl, ISettingsPage
2324
{
24-
private static readonly HashSet<string> _managersWithoutUpdateDate =
25-
new(StringComparer.OrdinalIgnoreCase)
26-
{ "Homebrew", "Scoop", "vcpkg" };
2725
private PackageManagerViewModel ViewModel => (PackageManagerViewModel)DataContext!;
2826

2927
public bool CanGoBack => true;
@@ -260,17 +258,28 @@ private void BuildPage()
260258
};
261259

262260
bool initiallyCustom = savedAge == "custom";
263-
bool ageSupported = !_managersWithoutUpdateDate.Contains(manager.Name);
264-
object ageDescription = !ageSupported
265-
? new TextBlock
261+
var releaseDateSupport = manager.Capabilities.KnowsPackageReleaseDate;
262+
bool ageSupported = releaseDateSupport != PackageReleaseDateSupport.No;
263+
object ageDescription = releaseDateSupport switch
264+
{
265+
PackageReleaseDateSupport.No => new TextBlock
266266
{
267267
Text = CoreTools.Translate("{pm} does not provide release dates for its packages, so this setting will have no effect")
268268
.Replace("{pm}", manager.DisplayName),
269269
Foreground = new SolidColorBrush(Color.Parse("#e05252")),
270270
TextWrapping = TextWrapping.Wrap,
271271
FontSize = 12,
272-
}
273-
: CoreTools.Translate("Override the global minimum update age for this package manager");
272+
},
273+
PackageReleaseDateSupport.Partial => new TextBlock
274+
{
275+
Text = CoreTools.Translate("{pm} only provides release dates for some of its packages, so this setting will only apply to those packages")
276+
.Replace("{pm}", manager.DisplayName),
277+
Foreground = new SolidColorBrush(Color.FromRgb(224, 168, 0)),
278+
TextWrapping = TextWrapping.Wrap,
279+
FontSize = 12,
280+
},
281+
_ => CoreTools.Translate("Override the global minimum update age for this package manager"),
282+
};
274283

275284
ageCombo.IsEnabled = ageSupported;
276285
customAgeInput.IsEnabled = ageSupported;

src/UniGetUI.PackageEngine.Enums/ManagerCapabilities.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ public enum ProxySupport
77
Yes,
88
}
99

10+
public enum PackageReleaseDateSupport
11+
{
12+
No,
13+
Partial,
14+
Yes,
15+
}
16+
1017
public struct SourceCapabilities
1118
{
1219
public bool KnowsUpdateDate { get; set; } = false;
@@ -37,6 +44,7 @@ public struct ManagerCapabilities
3744
public bool SupportsCustomPackageScreenshots = false;
3845
public ProxySupport SupportsProxy = ProxySupport.No;
3946
public bool SupportsProxyAuth = false;
47+
public PackageReleaseDateSupport KnowsPackageReleaseDate = PackageReleaseDateSupport.No;
4048
public SourceCapabilities Sources { get; set; }
4149

4250
public ManagerCapabilities()

src/UniGetUI.PackageEngine.Managers.Apt/Apt.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public Apt()
2626
SupportsCustomSources = false,
2727
SupportsProxy = ProxySupport.No,
2828
SupportsProxyAuth = false,
29+
KnowsPackageReleaseDate = PackageReleaseDateSupport.Yes,
2930
};
3031

3132
Properties = new ManagerProperties

src/UniGetUI.PackageEngine.Managers.Bun/Bun.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public Bun()
2929
CanListDependencies = true,
3030
SupportsPreRelease = true,
3131
SupportsProxy = ProxySupport.No,
32-
SupportsProxyAuth = false
32+
SupportsProxyAuth = false,
33+
KnowsPackageReleaseDate = PackageReleaseDateSupport.Yes,
3334
};
3435

3536
Properties = new ManagerProperties

src/UniGetUI.PackageEngine.Managers.Cargo/Cargo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public Cargo()
6767
CanDownloadInstaller = true,
6868
SupportsProxy = ProxySupport.Partially,
6969
SupportsProxyAuth = true,
70+
KnowsPackageReleaseDate = PackageReleaseDateSupport.Yes,
7071
};
7172

7273
var cratesIo = new ManagerSource(this, "crates.io", new Uri("https://index.crates.io/"));

src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public Chocolatey()
9393
},
9494
SupportsProxy = ProxySupport.Yes,
9595
SupportsProxyAuth = true,
96+
KnowsPackageReleaseDate = PackageReleaseDateSupport.Yes,
9697
};
9798

9899
Properties = new ManagerProperties

src/UniGetUI.PackageEngine.Managers.Dnf/Dnf.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public Dnf()
2929
SupportsCustomSources = false,
3030
SupportsProxy = ProxySupport.No,
3131
SupportsProxyAuth = false,
32+
KnowsPackageReleaseDate = PackageReleaseDateSupport.Yes,
3233
};
3334

3435
Properties = new ManagerProperties

src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public DotNet()
4343
SupportsCustomVersions = true,
4444
SupportsProxy = ProxySupport.Partially,
4545
SupportsProxyAuth = true,
46+
KnowsPackageReleaseDate = PackageReleaseDateSupport.Yes,
4647
};
4748

4849
Properties = new ManagerProperties

0 commit comments

Comments
 (0)