feat: owner review 2 phase 1: :latest, Unraid array space, Settings with About, whole-folder import (#9)
CI / Build and test (push) Successful in 5m11s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 8m57s
CI / PostgreSQL 16 integration (push) Successful in 3m10s
CI / PostgreSQL 17 integration (push) Successful in 3m30s
CI / Docker image (push) Successful in 49s
Release / Server image (push) Successful in 1m4s
CI / Build and test (push) Successful in 5m11s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 8m57s
CI / PostgreSQL 16 integration (push) Successful in 3m10s
CI / PostgreSQL 17 integration (push) Successful in 3m30s
CI / Docker image (push) Successful in 49s
Release / Server image (push) Successful in 1m4s
- :latest follows the highest stable release, or the highest pre-release while none is stable (Chronos.Tools release-channels); bad tags are refused before anything is built. - Unraid: CHRONOS_SPACE_PATH and the template's Array view show the array's free space; the write volume (cache) is shown apart; completions check the archive volume (507). - Settings is a gear, docked at the foot of the admin sidebar; About is the last part of Settings on the desktop and the panel. - Import > Folder > Whole folder: one sequence per format (desktop only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #9.
This commit is contained in:
1 parent
5acdf146c7
commit
1f089888e8
320 files changed
+3030
-927
No files matched your search
@@ -0,0 +1,130 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Input;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Ui.Controls;
|
||||
using Chronos.Ui.Mvvm;
|
||||
|
||||
namespace Chronos.App.About;
|
||||
|
||||
/// <summary>
|
||||
/// What Settings › About (BRIEF §12.9: version and build, licence link, third-party notice, translation notice) and
|
||||
/// Settings › Updates (the releases page and the update notice of <see cref="UpdateFlow"/>, BRIEF §18) show. The shell
|
||||
/// owns it, so the update check on start runs whatever screen is open; it is no section of the rail (owner review 2, R5).
|
||||
/// </summary>
|
||||
public sealed class AboutViewModel : LocalizedViewModel
|
||||
{
|
||||
private readonly UpdateFlow _update;
|
||||
|
||||
public AboutViewModel(ShellViewModel shell)
|
||||
{
|
||||
Shell = shell;
|
||||
var environment = shell.Services.Environment;
|
||||
_update = new UpdateFlow(new UpdateHost(UpdateCheck.RunningVersion(Version), environment.IsCapture, environment.IsPortable,
|
||||
ct => Shell.Services.CheckForUpdateAsync(ct), (release, progress, ct) => Shell.Services.DownloadUpdateAsync(release, progress, ct),
|
||||
ShellActions.OpenUrl, ShellActions.Reveal)
|
||||
{ RunningIsPrerelease = UpdateCheck.IsPrerelease(Version) });
|
||||
_update.Changed += RaiseUpdate;
|
||||
ShowPackageCommand = new RelayCommand(() =>
|
||||
{
|
||||
if (_update.PackagePath is { } path) ShellActions.Reveal(path);
|
||||
}, () => _update.PackagePath is not null);
|
||||
CancelDownloadCommand = new RelayCommand(_update.CancelDownload, () => IsDownloading);
|
||||
OpenReleasesCommand = new RelayCommand(() => ShellActions.OpenUrl(ProductLinks.Releases));
|
||||
OpenLicenceCommand = new RelayCommand(() => ShellActions.OpenUrl(ProductLinks.Licence));
|
||||
ReviewTranslationCommand = new RelayCommand(() => ShellActions.OpenUrl(ProductLinks.Issues));
|
||||
}
|
||||
|
||||
public ShellViewModel Shell { get; }
|
||||
|
||||
public string Version => AppServices.VersionText;
|
||||
|
||||
/// <summary>File version and processor architecture.</summary>
|
||||
public string Build =>
|
||||
(typeof(App).Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version ?? Version) + Loc.Separator + RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant();
|
||||
|
||||
public string Runtime => RuntimeInformation.FrameworkDescription;
|
||||
|
||||
public string OperatingSystem => RuntimeInformation.OSDescription;
|
||||
|
||||
/// <summary>Every language but English is machine-translated and open to review (BRIEF §16).</summary>
|
||||
public bool IsTranslated => !Loc.Culture.TwoLetterISOLanguageName.Equals("en", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
public ICommand CheckCommand => _update.Check;
|
||||
public ICommand DownloadCommand => _update.Download;
|
||||
public ICommand ShowPackageCommand { get; }
|
||||
public ICommand CancelDownloadCommand { get; }
|
||||
public ICommand OpenReleasesCommand { get; }
|
||||
public ICommand OpenLicenceCommand { get; }
|
||||
public ICommand ReviewTranslationCommand { get; }
|
||||
|
||||
/// <summary>"Up to date", "Chronos 0.2.0 available", …; null before the first check.</summary>
|
||||
public string? UpdateText => _update.State switch
|
||||
{
|
||||
UpdateState.Checking => Loc.L("About.Update.Checking"),
|
||||
UpdateState.UpToDate => Loc.L("About.Update.Current"),
|
||||
UpdateState.Available when _update.Release is { } r => Loc.L("About.Update.Available", UpdateCheck.Display(r.Version)),
|
||||
UpdateState.Failed => Loc.L("About.Update.Failed"),
|
||||
UpdateState.Downloading => Loc.L("About.Update.Downloading", _update.Downloaded),
|
||||
UpdateState.Downloaded when _update.Release is { } r => Loc.L("About.Update.Ready", UpdateCheck.Display(r.Version)),
|
||||
UpdateState.DownloadFailed => Loc.L("About.Update.DownloadFailed"),
|
||||
UpdateState.NotVerified => Loc.L("About.Update.NotVerified"),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary>What screen readers announce: each new state, not each percent of a download.</summary>
|
||||
public string? UpdateAnnouncement => _update.State == UpdateState.Downloading ? Loc.L("About.Update.InProgress") : UpdateText;
|
||||
|
||||
public StatusKind UpdateKind => _update.State switch
|
||||
{
|
||||
UpdateState.Checking or UpdateState.Downloading => StatusKind.Running,
|
||||
UpdateState.UpToDate or UpdateState.Downloaded => StatusKind.Done,
|
||||
UpdateState.Available => StatusKind.Warning,
|
||||
_ => StatusKind.Error,
|
||||
};
|
||||
|
||||
public bool HasUpdateText => UpdateText is not null;
|
||||
|
||||
/// <summary>Download is offered: a newer release exists and no verified package is waiting (a failed download can be retried).</summary>
|
||||
public bool IsUpdateAvailable => _update.IsDownloadOffered;
|
||||
|
||||
/// <summary>The verified setup or portable zip is in the temporary folder.</summary>
|
||||
public bool IsPackageReady => _update.State == UpdateState.Downloaded;
|
||||
|
||||
public bool IsDownloading => _update.State == UpdateState.Downloading;
|
||||
|
||||
/// <summary>What Download does here: fetch and verify the setup or the portable zip (with its size), or open the release page.</summary>
|
||||
public string DownloadToolTip => _update.Package is { } package
|
||||
? Loc.L(_update.IsPortable ? "Tooltips.About.DownloadPortable" : "Tooltips.About.Download", Formatting.Bytes(package.Size))
|
||||
: Loc.L("Tooltips.About.DownloadPage");
|
||||
|
||||
public string ShowPackageToolTip => Loc.L(_update.IsPortable ? "Tooltips.About.ShowPortable" : "Tooltips.About.ShowSetup");
|
||||
|
||||
/// <summary>Starts the update check on start when allowed (opt-out, BRIEF §18); never in a capture run.</summary>
|
||||
public void Attach() => _ = NotifyAsync();
|
||||
|
||||
/// <summary>Sets a result without the network (capture, tests).</summary>
|
||||
internal void SetResult(ReleaseInfo? release, bool failed = false) => _update.SetResult(release, failed);
|
||||
|
||||
private async Task NotifyAsync()
|
||||
{
|
||||
if (await _update.CheckOnStartAsync(Shell.Services.Settings.CheckForUpdates) is not { } newer) return;
|
||||
Shell.Notify(Loc.L("About.Update.Available", UpdateCheck.Display(newer.Version)), actionText: Loc.L("About.Update.Download"),
|
||||
actionToolTip: DownloadToolTip, action: () => DownloadCommand.Execute(null));
|
||||
}
|
||||
|
||||
private void RaiseUpdate()
|
||||
{
|
||||
OnPropertyChanged(nameof(UpdateText));
|
||||
OnPropertyChanged(nameof(UpdateAnnouncement));
|
||||
OnPropertyChanged(nameof(UpdateKind));
|
||||
OnPropertyChanged(nameof(HasUpdateText));
|
||||
OnPropertyChanged(nameof(IsUpdateAvailable));
|
||||
OnPropertyChanged(nameof(IsPackageReady));
|
||||
OnPropertyChanged(nameof(IsDownloading));
|
||||
OnPropertyChanged(nameof(DownloadToolTip));
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public sealed record UpdateHost(
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The update notice of About and Settings › Updates (BRIEF §18): checks the latest release, downloads and verifies the
|
||||
/// The update notice of Settings › Updates (BRIEF §18): checks the latest release, downloads and verifies the
|
||||
/// package that upgrades this copy (<see cref="UpdateDownload"/>: the setup, or the portable zip for a portable copy)
|
||||
/// and shows it in Explorer. Running it is left to the user because BRIEF §8.6 lets Chronos only open links and show
|
||||
/// files. A release without that package or without <c>SHA256SUMS</c> only opens its page; a capture run never touches
|
||||
|
||||
Reference in new issue
Block a user