diff --git a/Queueify.Core/Services/Strings.En.cs b/Queueify.Core/Services/Strings.En.cs
index 69e2c30..ea31147 100644
--- a/Queueify.Core/Services/Strings.En.cs
+++ b/Queueify.Core/Services/Strings.En.cs
@@ -308,6 +308,10 @@ public static partial class Loc
["update.available"] = "A new version is out: Queueify {0}.",
["update.retry"] = "Try again",
["update.cancel"] = "Cancel",
+ ["update.skip"] = "Skip this version",
+ ["update.start_failed"] = "Queueify {0} is in place but didn't start, so your Queueify exe won't open until it's replaced. Keep this window open and download a version that works from the releases page (an earlier one, if this one is broken). Try again only helps if something on this PC got in the way, like a full disk or an antivirus.",
+ ["update.releases"] = "Releases page",
+ ["update.ok"] = "OK",
["update.restarting"] = "Starting Queueify {0}…",
["update.install"] = "Update and restart",
["update.whats_new"] = "What's new",
diff --git a/Queueify.Core/Services/Strings.Es.cs b/Queueify.Core/Services/Strings.Es.cs
index 8868b5b..88bcd02 100644
--- a/Queueify.Core/Services/Strings.Es.cs
+++ b/Queueify.Core/Services/Strings.Es.cs
@@ -309,6 +309,10 @@ public static partial class Loc
["update.available"] = "Hay una versión nueva: Queueify {0}.",
["update.retry"] = "Probar de nuevo",
["update.cancel"] = "Cancelar",
+ ["update.skip"] = "Saltear esta versión",
+ ["update.start_failed"] = "Queueify {0} quedó en su lugar pero no arrancó, así que tu exe de Queueify no va a abrir hasta que lo reemplaces. Dejá esta ventana abierta y descargá una versión que funcione desde la página de versiones (una anterior, si esta viene fallada). Probar de nuevo solo sirve si algo de esta PC se interpuso, como un disco lleno o un antivirus.",
+ ["update.releases"] = "Página de versiones",
+ ["update.ok"] = "Entendido",
["update.restarting"] = "Abriendo Queueify {0}…",
["update.install"] = "Actualizar y reiniciar",
["update.whats_new"] = "Novedades",
diff --git a/Queueify.Core/Services/UiState.cs b/Queueify.Core/Services/UiState.cs
index 0079642..f3fb40c 100644
--- a/Queueify.Core/Services/UiState.cs
+++ b/Queueify.Core/Services/UiState.cs
@@ -37,6 +37,9 @@ public sealed class UiState
/// Ask GitHub for a newer version at each start (Settings → Updates).
public bool CheckForUpdates { get; set; } = true;
+ /// "Skip this version" on the offer: not offered at start again, only by Check for updates.
+ public string? SkippedVersion { get; set; }
+
/// Back to the original layout (panel, list view, order, window size); the tour isn't repeated.
public void ResetLayout()
{
diff --git a/Queueify.Core/Services/Updater.cs b/Queueify.Core/Services/Updater.cs
index e951f76..fbf092e 100644
--- a/Queueify.Core/Services/Updater.cs
+++ b/Queueify.Core/Services/Updater.cs
@@ -21,6 +21,9 @@ public sealed record UpdateSource(Uri Latest, string DownloadPrefix)
/// The releases page, for when the app can't update itself.
public static Uri Releases { get; } = new("https://github.com/PAumedes/Queueify/releases/latest");
+ /// Every version, for when the latest one doesn't work here.
+ public static Uri AllReleases { get; } = new("https://github.com/PAumedes/Queueify/releases");
+
///
/// GitHub, unless QUEUEIFY_UPDATE_SERVER names a server on this PC: the UI tests serve a release from
/// one. Anything else is ignored, so the variable can't point updates elsewhere.
@@ -95,6 +98,9 @@ public sealed class Updater(HttpClient http, UpdateSource source, TimeSpan? stal
public static bool IsNewer(string candidate, string current) =>
System.Version.TryParse(candidate, out var c) && System.Version.TryParse(current, out var v) && c > v;
+ /// Whether to offer a release: one the user skipped only when they asked (Check for updates).
+ public static bool IsWanted(AppRelease release, string? skipped, bool asked) => asked || release.Version != skipped;
+
/// The latest release when it's newer than this version; null when this is the latest.
public async Task CheckAsync(string currentVersion, CancellationToken ct)
{
diff --git a/Queueify.Tests/AppDataTests.cs b/Queueify.Tests/AppDataTests.cs
index 85a5766..298ea38 100644
--- a/Queueify.Tests/AppDataTests.cs
+++ b/Queueify.Tests/AppDataTests.cs
@@ -177,15 +177,15 @@ public void Layout_survives_a_save_and_load()
{
PaneWidth = 512, PaneVisible = false, CoverView = true, Sort = "artist",
WindowBounds = [10, 20, 1300, 900], Maximized = true, TourSeen = true,
- Theme = "dark", Language = "es", OcrLanguage = "en-US", OcrHintDismissed = true, CheckForUpdates = false,
+ Theme = "dark", Language = "es", OcrLanguage = "en-US", OcrHintDismissed = true, CheckForUpdates = false, SkippedVersion = "1.4.0",
};
saved.Save(path);
var loaded = UiState.Load(path);
Assert.Equal(
- (saved.PaneWidth, saved.PaneVisible, saved.CoverView, saved.Sort, saved.Maximized, saved.TourSeen, saved.Theme, saved.Language, saved.OcrLanguage, saved.OcrHintDismissed, saved.CheckForUpdates),
- (loaded.PaneWidth, loaded.PaneVisible, loaded.CoverView, loaded.Sort, loaded.Maximized, loaded.TourSeen, loaded.Theme, loaded.Language, loaded.OcrLanguage, loaded.OcrHintDismissed, loaded.CheckForUpdates));
+ (saved.PaneWidth, saved.PaneVisible, saved.CoverView, saved.Sort, saved.Maximized, saved.TourSeen, saved.Theme, saved.Language, saved.OcrLanguage, saved.OcrHintDismissed, saved.CheckForUpdates, saved.SkippedVersion),
+ (loaded.PaneWidth, loaded.PaneVisible, loaded.CoverView, loaded.Sort, loaded.Maximized, loaded.TourSeen, loaded.Theme, loaded.Language, loaded.OcrLanguage, loaded.OcrHintDismissed, loaded.CheckForUpdates, loaded.SkippedVersion));
Assert.Equal(saved.WindowBounds, loaded.WindowBounds);
}
diff --git a/Queueify.Tests/UpdaterTests.cs b/Queueify.Tests/UpdaterTests.cs
index e865a69..e92c81c 100644
--- a/Queueify.Tests/UpdaterTests.cs
+++ b/Queueify.Tests/UpdaterTests.cs
@@ -134,6 +134,15 @@ public void Only_a_newer_version_is_an_update(string candidate, string current,
Assert.Equal(newer, Updater.IsNewer(candidate, current));
}
+ [Theory]
+ [InlineData(null, false, true)] // nothing skipped
+ [InlineData("1.4.0", false, false)] // skipped: not offered at start
+ [InlineData("1.4.0", true, true)] // but Check for updates still finds it
+ [InlineData("1.3.5", false, true)] // a newer one than the skipped one is offered again
+ public void A_skipped_version_is_only_offered_when_asked_for(string? skipped, bool asked, bool offered)
+ {
+ Assert.Equal(offered, Updater.IsWanted(Release(), skipped, asked));
+ }
// ── Asking GitHub ──
[Fact]
diff --git a/Queueify/MainWindow.xaml.cs b/Queueify/MainWindow.xaml.cs
index a086e01..7dd83d8 100644
--- a/Queueify/MainWindow.xaml.cs
+++ b/Queueify/MainWindow.xaml.cs
@@ -105,6 +105,9 @@ public MainWindow()
RefreshQueue();
ShowResults([]);
FillHelp();
+ // The bar keeps its height from state to state while open; a new window size starts it over.
+ UpdateBar.Closed += (_, _) => UpdateBar.MinHeight = 0;
+ SizeChanged += (_, _) => UpdateBar.MinHeight = 0;
// Pick up other PCs' changes when coming back to the window (at most every 20 s).
Activated += (_, args) =>
@@ -1087,15 +1090,17 @@ private Button RestartButton()
return restart;
}
+ private enum Restart { Closed, NotStarted, StarterFailed }
+
///
- /// Starts a fresh copy and closes this one (which saves the window and layout as usual); false when it
- /// couldn't. Through the download's starter, this window stays until the starter has unpacked the new
- /// copy and started it, so there's never a moment without Queueify on screen.
+ /// Starts a fresh copy and closes this one (which saves the window and layout as usual). Through the
+ /// download's starter, this window stays until the starter has unpacked the new copy and its window is
+ /// open, so there's never a moment without Queueify on screen, nor two of them.
///
- private async Task RestartAppAsync()
+ private async Task RestartAppAsync()
{
// A second click while the new copy starts would start another one.
- if (_restarting) return true;
+ if (_restarting) return Restart.Closed;
_restarting = true;
// Saved first, so the new copy opens where this one was.
SaveWindow();
@@ -1110,38 +1115,29 @@ private async Task RestartAppAsync()
{
ShowToast(Loc.F("app.restart_failed", ex.Message), severity: InfoBarSeverity.Warning);
_restarting = false;
- return false;
+ return Restart.NotStarted;
}
using (started)
{
if (started != null && AppData.StarterExe != null)
{
- try
+ // However long the first unpack takes, or the starter's message waits to be read: until
+ // it's done, nothing else is running.
+ await started.WaitForExitAsync();
+ if (started.ExitCode != 0)
{
- using var limit = new CancellationTokenSource(TimeSpan.FromMinutes(2));
- await started.WaitForExitAsync(limit.Token);
// The starter showed its own message about what went wrong.
- if (started.ExitCode != 0)
- {
- _restarting = false;
- return false;
- }
- // The starter is done once the new copy runs; its window takes a moment more.
- while (!NewQueueifyWindow(running))
- await Task.Delay(200, limit.Token);
- }
- catch (OperationCanceledException)
- {
- // Two minutes without a new window (the starter may be showing an error): this one stays.
_restarting = false;
- return false;
+ return Restart.StarterFailed;
}
+ // The new copy runs; its window takes a moment more. A minute at most, then this one goes anyway.
+ for (int i = 0; i < 300 && !NewQueueifyWindow(running); i++)
+ await Task.Delay(200);
}
}
Close();
- return true;
+ return Restart.Closed;
}
-
private bool _restarting;
// ───────────────────────── Sync between PCs ─────────────────────────
@@ -1532,7 +1528,7 @@ private async Task CheckForUpdatesAsync(bool quiet)
try
{
var release = await _updater.CheckAsync(AppInfo.Version, CancellationToken.None);
- if (release != null && !_updating) OfferUpdate(release);
+ if (release != null && !_updating && Updater.IsWanted(release, _ui.SkippedVersion, asked: _reportCheck)) OfferUpdate(release);
if (_reportCheck) ShowUpdateStatus(release != null ? Loc.F("update.available", release.Version) : Loc.T("update.latest"));
}
catch (Exception ex)
@@ -1557,9 +1553,19 @@ private void ShowUpdateStatus(string text)
private void OfferUpdate(AppRelease release)
{
- var whatsNew = new HyperlinkButton { Content = Loc.T("update.whats_new"), Padding = new Thickness(0, 2, 0, 2), Margin = new Thickness(0, 0, 0, 8) };
+ var whatsNew = new HyperlinkButton { Content = Loc.T("update.whats_new"), Padding = new Thickness(0, 2, 0, 2) };
whatsNew.Click += (_, _) => OpenInBrowser(release.Page);
- ShowUpdateBar(InfoBarSeverity.Informational, Loc.F("update.available", release.Version), InstallButton(release, "update.install"), whatsNew, closable: true);
+ // Not now, and not at the next starts either; Check for updates in About still finds it.
+ var skip = new HyperlinkButton { Content = Loc.T("update.skip"), Padding = new Thickness(0, 2, 0, 2) };
+ AutomationProperties.SetAutomationId(skip, "SkipUpdateButton");
+ skip.Click += (_, _) =>
+ {
+ _ui.SkippedVersion = release.Version;
+ _ui.Save();
+ UpdateBar.IsOpen = false;
+ };
+ var links = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 20, Margin = new Thickness(0, 0, 0, 8), Children = { whatsNew, skip } };
+ ShowUpdateBar(InfoBarSeverity.Informational, Loc.F("update.available", release.Version), InstallButton(release, "update.install"), links, closable: true);
}
private Button InstallButton(AppRelease release, string text)
@@ -1612,13 +1618,39 @@ private async Task InstallUpdateAsync(AppRelease release)
_download.Dispose();
_download = null;
}
- // The new version unpacks before its window opens: this one says so and stays until then.
- ShowUpdateBar(InfoBarSeverity.Informational, Loc.F("update.restarting", release.Version), null,
- new ProgressBar { IsIndeterminate = true, Margin = new Thickness(0, 0, 0, 12) }, closable: false);
- // The new exe is in place either way; if it can't be started now, the next start uses it. _updating
- // stays set, so it isn't downloaded again.
- if (!await RestartAppAsync())
- ShowUpdateBar(InfoBarSeverity.Warning, Loc.F("update.restart_failed", release.Version), null, null, closable: true);
+ // The new version unpacks before its window opens: this one says so and stays until then. The
+ // keyboard waits on the progress indicator (named, so it's read out) instead of falling into the page.
+ var starting = Loc.F("update.restarting", release.Version);
+ var wait = new ProgressBar { IsIndeterminate = true, IsTabStop = true, Margin = new Thickness(0, 0, 0, 12) };
+ AutomationProperties.SetName(wait, starting);
+ ShowUpdateBar(InfoBarSeverity.Informational, starting, null, wait, closable: false);
+ switch (await RestartAppAsync())
+ {
+ case Restart.StarterFailed:
+ {
+ // The new exe itself didn't start (its starter said why), and it's the user's only Queueify
+ // exe now. What helps first is a version that works, maybe an older one if this release is
+ // broken: all of them are on the releases page. The same download again only helps when the
+ // cause was on this PC (disk space, an antivirus).
+ _updating = false;
+ var releases = new Button { Content = Loc.T("update.releases"), Style = (Style)Application.Current.Resources["AccentButtonStyle"] };
+ releases.Click += (_, _) => OpenInBrowser(UpdateSource.AllReleases);
+ var retry = new HyperlinkButton { Content = Loc.T("update.retry"), Padding = new Thickness(0, 2, 0, 2), Margin = new Thickness(0, 0, 0, 8) };
+ AutomationProperties.SetAutomationId(retry, "InstallUpdateButton");
+ retry.Click += (_, _) => _ = InstallUpdateAsync(release);
+ ShowUpdateBar(InfoBarSeverity.Error, Loc.F("update.start_failed", release.Version), releases, retry, closable: false);
+ break;
+ }
+ case Restart.NotStarted:
+ {
+ // The new exe is in place; the next start uses it. _updating stays set, so it isn't
+ // downloaded again. OK closes the bar, and gives the keyboard somewhere to be meanwhile.
+ var ok = new Button { Content = Loc.T("update.ok") };
+ ok.Click += (_, _) => UpdateBar.IsOpen = false;
+ ShowUpdateBar(InfoBarSeverity.Warning, Loc.F("update.restart_failed", release.Version), ok, null, closable: true);
+ break;
+ }
+ }
}
private static HashSet QueueifyProcesses()
@@ -1661,7 +1693,10 @@ private void ShowUpdateBar(InfoBarSeverity severity, string message, Microsoft.U
UpdateBar.IsOpen = true;
// Opening, the bar announces itself; later states are said here.
if (wasOpen) Announce(UpdateBar, message);
- if (focusInBar && action != null) action.Loaded += (_, _) => action.Focus(FocusState.Keyboard);
+ // Only grows while open, so the page below doesn't jump up and down from one state to the next.
+ if (wasOpen) UpdateBar.MinHeight = Math.Max(UpdateBar.MinHeight, UpdateBar.ActualHeight);
+ if (focusInBar && ((Control?)action ?? content as Control) is { IsTabStop: true } target)
+ target.Loaded += (_, _) => target.Focus(FocusState.Keyboard);
}
private static bool IsInside(DependencyObject? element, DependencyObject container)
diff --git a/README.md b/README.md
index c604e88..e5354b9 100644
--- a/README.md
+++ b/README.md
@@ -29,9 +29,9 @@ warn the first time because the app isn't signed: *More info → Run anyway*. Th
version takes a moment longer: the exe unpacks the app into `%LOCALAPPDATA%\Queueify\app` (about 70 MB)
and runs it from there. The copy of the previous version is removed by itself.
-**Updates**: when a new version is out, a bar at the top of the window offers it. *Update and restart*
+**Updates**: when a new version is out, a bar under the page title offers it. *Update and restart*
downloads it, checks it against the release and puts it in place of your exe, under the same name. Help →
-About → *Check for updates* asks right away; Settings → Updates turns off the check at start. (From 1.3.0 or
+About → *Check for updates* asks right away; *Skip this version* stops one version from being offered at start; Settings → Updates turns off the check at start. (From 1.3.0 or
earlier, download 1.4.0 by hand once.)
Your queue, keys and layout live in `%LOCALAPPDATA%\Queueify` (Help → *Open data folder*). To move to a new
diff --git a/docs/adr/0009-update-from-github-releases.md b/docs/adr/0009-update-from-github-releases.md
index ea4debf..3059d76 100644
--- a/docs/adr/0009-update-from-github-releases.md
+++ b/docs/adr/0009-update-from-github-releases.md
@@ -26,7 +26,9 @@ and while the app runs nothing has that exe open: the starter unpacks the app, s
exe is as it was. There's no backup copy: the old version is always on the releases page. A read-only exe
is updated too.
- The app then restarts through the new exe, and its window stays (saying so) until the new version's
- window is open: the first start of a version unpacks for a few seconds.
+ window is open: the first start of a version unpacks for a few seconds. It waits for the starter however
+ long that takes, so there are never two windows; if the new exe doesn't start (its starter says why),
+ the bar says so and offers to download it again.
- A failed update says why in plain words and offers **Try again** and the release page.
- When the folder can't be written to, or the app wasn't started from a download (a build folder), the bar
offers the release page instead.
@@ -38,7 +40,8 @@ and while the app runs nothing has that exe open: the starter unpacks the app, s
- One request to GitHub per start: GitHub sees the address and that Queueify is starting, nothing else;
the setting turns it off. GitHub allows 60 unauthenticated requests an hour per address, plenty for a few
starts a day.
-- A closed offer comes back at the next start; there's no "skip this version", only the setting.
+- A closed offer comes back at the next start; **Skip this version** keeps that version from being offered at
+ start (Check for updates still finds it, and a newer one is offered again).
- The release's asset name and its digest are now a contract: renaming the asset, or publishing it somewhere
else, breaks updating for everyone on older versions ([RELEASING.md](../RELEASING.md)).
- The trust is GitHub's: the digest comes from the same API as the download link, over HTTPS. It catches a
diff --git a/tests/ui/Queueify.UpdateUiTests.ps1 b/tests/ui/Queueify.UpdateUiTests.ps1
index db314ca..7501a25 100644
--- a/tests/ui/Queueify.UpdateUiTests.ps1
+++ b/tests/ui/Queueify.UpdateUiTests.ps1
@@ -186,7 +186,47 @@ Check ($null -eq (Find '*new version is out*')) 'with checks turned off, nothing
Select-Item (Find 'Help*' 'ListItem')
Invoke (FindId 'CheckUpdatesButton')
Check ($null -ne (Wait-Find '*new version is out: Queueify 99.0.0*')) 'checking by hand still finds it'
+Stop-App
+# Back on for the rest.
+'{ "Language": "en", "TourSeen": true }' | Set-Content -Encoding UTF8 (Join-Path $env:LOCALAPPDATA 'Queueify\ui.json')
+
+# ── Skip this version: not offered at the next start, still found by Check for updates ──
+Offer '99.0.0' $sha256
+Start-App
+Invoke (FindId 'SkipUpdateButton')
+Check ($null -eq (Find '*new version is out*')) 'Skip this version closes the offer'
+Stop-App
+Start-App
+Start-Sleep 3
+Check ($null -eq (Find '*new version is out*')) 'a skipped version is not offered at the next start'
+Select-Item (Find 'Help*' 'ListItem')
+Invoke (FindId 'CheckUpdatesButton')
+Check ($null -ne (Wait-Find '*new version is out: Queueify 99.0.0*')) 'Check for updates still offers a skipped version'
+Stop-App
+
+# ── A new exe that matches its release but doesn't start: this window stays and says so ──
+# (One byte changed in the marker at its very end: the starter finds no app appended and says it's damaged,
+# whatever is already unpacked.)
+'{ "Language": "en", "TourSeen": true }' | Set-Content -Encoding UTF8 (Join-Path $env:LOCALAPPDATA 'Queueify\ui.json')
+$broken = [byte[]]$newExe.Clone()
+$broken[$broken.Length - 1] = $broken[$broken.Length - 1] -bxor 0x40
+$newExe = $broken
+Offer '99.0.0' ([System.BitConverter]::ToString([System.Security.Cryptography.SHA256]::Create().ComputeHash($broken)).Replace('-', '').ToLowerInvariant())
+Start-App
+$before = @(Get-AppProcess | ForEach-Object Id)
+Invoke (FindId 'InstallUpdateButton')
+# The starter's own message box: read it and press OK.
+$box = $null
+for ($i = 0; $i -lt 60 -and -not $box; $i++) {
+ Start-Sleep -Milliseconds 500
+ $box = $A::RootElement.FindAll($Tree::Children, $Cond::TrueCondition) | Where-Object { $_.Current.ClassName -eq '#32770' -and $_.Current.Name -eq 'Queueify' } | Select-Object -First 1
}
+Check ($null -ne $box) 'the new exe says it is damaged'
+if ($box) { Invoke ($box.FindAll($Tree::Descendants, $Cond::TrueCondition) | Where-Object { $_.Current.ControlType.ProgrammaticName -eq 'ControlType.Button' } | Select-Object -First 1) }
+Check ($null -ne (Wait-Find "*is in place but didn't start, so your Queueify exe won't open*")) 'this window stays and says the new version did not start'
+Check ($null -ne (Find 'Releases page' 'Button')) 'the releases page comes first'
+Check ($null -ne (FindId 'InstallUpdateButton') -and (FindId 'InstallUpdateButton').Current.Name -eq 'Try again') 'and offers to download it again'
+Check (@(Get-AppProcess | Where-Object { $_.Id -notin $before }).Count -eq 0) 'no second Queueify started'}
finally {
Stop-App
$listener.Stop()