Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
C# audioaudio-unitavaloniacpp20cross-platformdawdigital-audio-workstationdspjucelinux-audiomcp-servermidimusicmusic-productionpiano-rollplugin-hostsequencersynthesizervstvst3
(feat) Check for updates outside the start screen (#214)
Chris Laupama79e42a549b11
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 3f59cf6a..558849e7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -48,6 +48,15 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.is kept for the next launch. Text stays sharp at every size. The timeline, piano roll andaudio editor zoom as before, on top of the scale. Pick 125 % or more when the text is toosmall to read on a laptop screen, or 75 % to fit more tracks on a small one.+- **Nota tells you about updates wherever you are** (nota-daw/nota#58). It used to look for a+ new version only on the start screen, so it was easy to miss. Now:+ - It checks on every launch and once a day while it runs, and shows a new version in the+ status bar beside the version number: click it to **Update** or read the release notes.+ The download's progress and **Restart to update** show there too.+ - **Help → Check for updates…** (on macOS also in the **Nota** menu) checks right away and+ says so when you're up to date or GitHub can't be reached.+ - **Settings → Updates** can turn the automatic checks off, and shows the last check with a+ **Check now** button. Nothing downloads until you click Update.### Fixed- **⌘D in the piano roll no longer piles copies at the clip's end** when the selection isdiff --git a/FEATURES.md b/FEATURES.mdindex 32ba14f0..cadfcf2a 100644--- a/FEATURES.md+++ b/FEATURES.md@@ -1076,11 +1076,14 @@ audio effects after it keep running and keep their settings; saved with the projrelease text; the CHANGELOG section for versions without them) newer than `LastSeenVersion`, onceafter the first launch on a new version; any time from Help ▸ What's New or the versionnumber in the status bar.-- **Self-update** — the start screen's banner announces a newer GitHub release. **Update**- downloads the build for this platform (with progress, checked against the release's- sha256). **Restart now** installs it and relaunches, and **Later** installs it on quit.- This covers the macOS .app, the Windows installer (run silently) and the Linux AppImage.- Other copies fall back to a link to the release page.+- **Self-update** — Nota looks for a newer GitHub release on every launch and once a day while+ it runs (Settings ▸ Updates turns that off), and on demand from Help ▸ Check for updates…+ (also in the macOS app menu), which also says when you're up to date or couldn't check. A+ newer release shows in the start screen's banner and in the status bar beside the version.+ **Update** downloads the build for this platform (with progress, checked against the+ release's sha256). **Restart now** installs it and relaunches, and **Later** installs it on+ quit. This covers the macOS .app, the Windows installer (run silently) and the Linux+ AppImage. Other copies fall back to a link to the release page.- **About** — the app and engine versions, the copyright notice, and a pointer to thethird-party attribution notices (`LICENSES/THIRD-PARTY-NOTICES.md`).- **Settings** — a larger window with a sidebar grouped into Devices, Plug-ins and Generaldiff --git a/specs/033-update-checks/spec.md b/specs/033-update-checks/spec.mdnew file mode 100644index 00000000..864be338--- /dev/null+++ b/specs/033-update-checks/spec.md@@ -0,0 +1,45 @@+# Feature Specification: Update checks outside the start screen++**Feature Branch**: `033-update-checks`++**Created**: 2026-10-20++**Status**: Implemented++**Input**: User description: "Self-update is easy to miss: check outside the start screen and+add 'Check for updates…'" (nota-daw/nota#58). Users ask for a built-in updater because they+never see the one Nota has.++## Nota Context++**Feature area**: UI (Avalonia) — an app-wide update state, the status bar, the Help and macOS+app menus, Settings, the start screen banner. No engine change. Self-update itself+(`AppUpdater`: find the release, download, verify, swap in on quit) is unchanged; until now+it was only asked from the start screen, and its banner only showed if the launcher was still+open when the check came back, so turning the launcher off, opening a project directly or+keeping Nota open for days meant never hearing about a new version.++## Clarifications++### Session 2026-10-20++- Q: When does Nota check on its own? → A: On every launch (when the main window opens) and then once a day while it runs: a 30-minute poll asks whether 24 hours have passed since the last answered check, so a computer that slept through it checks soon after waking. A failed check doesn't count, so the next poll tries again.+- Q: Where does a new version show outside the launcher? → A: In the status bar, beside the version number: an accent dot and "Nota X is available". A click opens a menu: Update to Nota X (Download Nota X… for a copy that can't replace itself), Release notes, Not now. While downloading it shows a bar, the percentage and a cross to cancel; then "Restart to update to Nota X" (click restarts; it also installs on quit).+- Q: One download for the launcher and the status bar? → A: Yes. One app-wide state (`AppUpdates`) drives the start screen banner, the status bar, Settings → Updates and Check for updates…; "Not now" / Dismiss / Later in any of them hides the notice everywhere until a newer release turns up or the user checks again.+- Q: Check for updates… where? → A: Help menu (all platforms, the in-window menu bar on Windows / Linux) and the macOS Nota menu under About Nota; also in the command palette. It always answers: up to date, couldn't reach GitHub, or the update offer (Update / Later), or Restart now when one is already downloaded.+- Q: Settings? → A: A new Settings → Updates page: "Check for updates automatically" (on by default) and the state of this version with Check now / Update. A copy that can't replace itself says so. Background download (the issue's optional idea) is left out: nothing downloads until the user clicks Update.+- Q: Telling "up to date" from "couldn't check"? → A: `IAppUpdater.LastCheckFailed`, set when the feed couldn't be reached or read.++## Requirements++- **FR-001**: With automatic checks on, Nota MUST check on launch whether the start screen is shown or not, and again when 24 hours have passed since the last answered check.+- **FR-002**: With automatic checks off, Nota MUST NOT contact GitHub unless the user asks (Check for updates…, Check now).+- **FR-003**: A newer release MUST show in the main window's status bar until the user dismisses it, and in the start screen banner while it is open.+- **FR-004**: Check for updates… MUST say when the running version is the latest, and MUST say so differently when the check failed.+- **FR-005**: Nothing MUST download without a click on Update (or Try again).+- **FR-006**: A check MUST NOT run while an update downloads or waits to install (it would clear the updates folder).++## Out of scope++- Downloading in the background before the user asks.+- Release channels (pre-releases), and Linux packages other than the AppImage, which keep the release-page link.diff --git a/specs/033-update-checks/tasks.md b/specs/033-update-checks/tasks.mdnew file mode 100644index 00000000..61341fc4--- /dev/null+++ b/specs/033-update-checks/tasks.md@@ -0,0 +1,12 @@+# Tasks: Update checks outside the start screen++**Input**: [spec.md](spec.md)++- [x] T001 `IAppUpdater.LastCheckFailed`; `UpdateSchedule` (launch + daily, `IsDue`); `Settings.CheckForUpdates`+- [x] T002 `AppUpdates`: the app-wide state (check, download, dismiss, restart) started when the main window opens; cancelled on exit+- [x] T003 Start screen banner follows `AppUpdates` instead of running its own check+- [x] T004 Status bar notice (`MainWindow.Updates.cs`): available menu, download bar + cancel, Restart to update+- [x] T005 `help.checkUpdates` (Help menu, macOS app menu, palette) with up-to-date / failed / offer answers; `prefs.updates`+- [x] T006 Settings → Updates page (automatic checks switch, status, Check now / Update)+- [x] T007 Smoke tests (`--updater`): schedule, up to date vs failed check; CHANGELOG, FEATURES.md, nota-docs EN + RU+- [x] T008 Verified in the app against a local release feed (`NOTA_UPDATE_API`), `scripts/build-linux.sh` green; macOS check on the Macdiff --git a/src/managed/Nota.App/App.axaml b/src/managed/Nota.App/App.axamlindex 732367ec..1d0e46b1 100644--- a/src/managed/Nota.App/App.axaml+++ b/src/managed/Nota.App/App.axaml@@ -9,11 +9,12 @@<!-- macOS application menu (the bold "Nota" menu). Avalonia puts every item of theApplication's NativeMenu straight into the app menu, above Services / Hide / Quit,- so About and Settings are listed directly — wrapping them in a "Nota" item would+ so About, Check for updates and Settings are listed directly — wrapping them in a "Nota" item wouldnest them in a submenu (#160). Windows/Linux don't show this menu. --><NativeMenu.Menu><NativeMenu><NativeMenuItem Header="About Nota" Click="OnAppAbout"/>+ <NativeMenuItem Header="Check for updates…" Click="OnAppCheckUpdates"/><NativeMenuItemSeparator/><NativeMenuItem Header="Settings…" Click="OnAppPreferences" Gesture="Cmd+,"/></NativeMenu>diff --git a/src/managed/Nota.App/App.axaml.cs b/src/managed/Nota.App/App.axaml.csindex 4a0575c2..f0ca7d8c 100644--- a/src/managed/Nota.App/App.axaml.cs+++ b/src/managed/Nota.App/App.axaml.cs@@ -137,6 +137,7 @@ public partial class App : Avalonia.Application{// A downloaded update installs once the app is gone (see AppUpdater).desktop.Exit += (_, _) => Services.GetRequiredService<IAppUpdater>().RunPendingInstall();+ desktop.Exit += (_, _) => AppUpdates.Shared.CancelAll();// A Settings → Downloads install still running when the app quits is abandoned.desktop.Exit += (_, _) => DownloadJobs.Shared.CancelAll();@@ -179,9 +180,10 @@ public partial class App : Avalonia.Applicationbase.OnFrameworkInitializationCompleted();}- // macOS application-menu items (About / Settings) forward to the main window.+ // macOS application-menu items (About / Check for updates / Settings) forward to the main window.private MainWindow? MainWin =>(ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.MainWindow as MainWindow;private void OnAppAbout(object? sender, EventArgs e) => MainWin?.ShowAbout();private void OnAppPreferences(object? sender, EventArgs e) => MainWin?.ShowPreferences();+ private void OnAppCheckUpdates(object? sender, EventArgs e) => _ = MainWin?.CheckForUpdatesAsync();}diff --git a/src/managed/Nota.App/AppUpdates.cs b/src/managed/Nota.App/AppUpdates.csnew file mode 100644index 00000000..0414b59d--- /dev/null+++ b/src/managed/Nota.App/AppUpdates.cs@@ -0,0 +1,230 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// The app's one view of self-update (#58): whether a newer release is out, its download and+// whether it's ready to install. It lives for the app, so the start screen's banner, the main+// window's status bar notice (MainWindow.Updates.cs), Help → Check for updates… and Settings →+// Updates all show the same state and share one download. Nota checks on launch and once a day+// while it runs (UpdateSchedule) unless Settings → Updates turned that off; a check the user+// asks for runs either way. Nothing downloads until the user clicks Update. All members are+// used on the UI thread.++using System;+using System.Threading;+using System.Threading.Tasks;+using Avalonia.Controls;+using Avalonia.Threading;+using Microsoft.Extensions.DependencyInjection;+using Nota.Application;++namespace Nota.App;++internal sealed class AppUpdates+{+ public static AppUpdates Shared { get; } = new();++ public enum Stage+ {+ /// <summary>Up to date, or not checked yet.</summary>+ None,+ /// <summary>A newer release is out; nothing downloaded.</summary>+ Available,+ Downloading,+ /// <summary>Downloaded and verified: installs on quit, or now with Restart.</summary>+ Ready,+ /// <summary>The download failed; <see cref="Error"/> says why.</summary>+ Failed,+ }++ public Stage State { get; private set; }++ /// <summary>The newer release, or null while <see cref="State"/> is None.</summary>+ public AppRelease? Release { get; private set; }++ public StoreProgress Progress { get; private set; }++ public string? Error { get; private set; }++ /// <summary>The user said "Not now" to <see cref="Release"/>: the start screen and the status+ /// bar stop offering it until a newer one turns up or they ask again.</summary>+ public bool Dismissed { get; private set; }++ /// <summary>A check is running.</summary>+ public bool Checking => _check is not null;++ /// <summary>When the last check got an answer (local time), or null.</summary>+ public DateTime? LastChecked { get; private set; }++ /// <summary>The last check couldn't reach or read the release feed.</summary>+ public bool LastCheckFailed { get; private set; }++ /// <summary>This copy can replace itself (a packaged app in a writable place, not a dev+ /// build or one run from the disk image).</summary>+ public bool CanInstallInPlace => Updater.CanInstallInPlace;++ /// <summary>The release has a build for this computer and this copy can replace itself;+ /// otherwise its page is where to get it.</summary>+ public bool CanInstall => Release?.Asset is not null && Updater.CanInstallInPlace;++ /// <summary>State, release or dismissal changed.</summary>+ public event Action? Changed;++ /// <summary>The download reported progress.</summary>+ public event Action? ProgressChanged;++ private static IAppUpdater Updater => App.Services.GetRequiredService<IAppUpdater>();+ private static ISettingsService Settings => App.Services.GetRequiredService<ISettingsService>();++ private readonly CancellationTokenSource _app = new(); // app lifetime+ private CancellationTokenSource? _download;+ private Task<bool?>? _check;+ private DispatcherTimer? _timer;++ /// <summary>Launch: the first automatic check, then the daily one. Called once, when the+ /// main window opens.</summary>+ public void Start()+ {+ if (_timer is not null) return;+ if (Settings.Current.CheckForUpdates) _ = CheckAsync();+ _timer = new DispatcherTimer { Interval = UpdateSchedule.Poll };+ _timer.Tick += (_, _) =>+ {+ if (UpdateSchedule.IsDue(Settings.Current.CheckForUpdates, LastChecked, DateTime.Now)) _ = CheckAsync();+ };+ _timer.Start();+ }++ /// <summary>Ask GitHub for the latest release. True when a newer one is out, false when this+ /// is the latest, null when the check failed. A check already running is shared; with an+ /// update downloading or downloaded there's nothing to ask.</summary>+ public Task<bool?> CheckAsync()+ {+ if (State is Stage.Downloading or Stage.Ready) return Task.FromResult<bool?>(true);+ return _check ??= RunCheck();+ }++ private async Task<bool?> RunCheck()+ {+ Changed?.Invoke(); // Checking+ try+ {+ var release = await Updater.CheckAsync(_app.Token);+ LastCheckFailed = Updater.LastCheckFailed;+ if (LastCheckFailed) return null;+ LastChecked = DateTime.Now;+ if (State is Stage.Downloading or Stage.Ready) return true; // started while we asked+ if (release is null)+ {+ Release = null;+ State = Stage.None;+ Error = null;+ return false;+ }+ if (Release?.Version != release.Version) Dismissed = false; // a newer one than they waved off+ Release = release;+ if (State == Stage.None) State = Stage.Available;+ return true;+ }+ catch (Exception e)+ {+ App.Services.GetRequiredService<ILogSink>().Error("Update check failed", e);+ LastCheckFailed = true;+ return null;+ }+ finally+ {+ _check = null;+ Changed?.Invoke();+ }+ }++ /// <summary>Update: download and verify the new build, which then installs on quit. A copy+ /// that can't replace itself opens the release page instead.</summary>+ public async void Download(TopLevel? from)+ {+ if (Release is not { } release || State is Stage.Downloading or Stage.Ready) return;+ if (!CanInstall)+ {+ OpenReleasePage(from);+ return;+ }+ var job = _download = CancellationTokenSource.CreateLinkedTokenSource(_app.Token);+ State = Stage.Downloading;+ Dismissed = false;+ Error = null;+ Progress = new StoreProgress(0, $"Downloading Nota {release.Version}…");+ Changed?.Invoke();+ var progress = new Progress<StoreProgress>(p =>+ {+ if (job.IsCancellationRequested || State != Stage.Downloading) return;+ Progress = p;+ ProgressChanged?.Invoke();+ });+ try+ {+ await Updater.DownloadAsync(release, progress, job.Token);+ State = Stage.Ready;+ }+ catch (OperationCanceledException) { State = Stage.Available; }+ catch (StoreException e) { Fail(e.Message); }+ catch (Exception e)+ {+ App.Services.GetRequiredService<ILogSink>().Error("Update download failed", e);+ Fail($"Couldn't download the update: {e.Message}");+ }+ finally+ {+ _download = null;+ job.Dispose();+ }+ if (!_app.IsCancellationRequested) Changed?.Invoke();++ void Fail(string message)+ {+ State = Stage.Failed;+ Error = message;+ }+ }++ public void CancelDownload() => _download?.Cancel();++ /// <summary>"Not now": stop offering this release (a download in progress is cancelled).+ /// A downloaded update still installs on quit.</summary>+ public void Dismiss()+ {+ CancelDownload();+ if (State == Stage.None || Dismissed) return;+ Dismissed = true;+ Changed?.Invoke();+ }++ /// <summary>Offer the release again after a "Not now" (the user asked: Check for updates…).</summary>+ public void Undismiss()+ {+ if (!Dismissed) return;+ Dismissed = false;+ Changed?.Invoke();+ }++ /// <summary>Restart now: quit through <paramref name="close"/> (the normal close path, which+ /// asks about unsaved changes) and start the new version once it's installed.</summary>+ public void Restart(Action close)+ {+ if (State != Stage.Ready) return;+ Updater.RelaunchAfterInstall = true;+ close();+ }++ public void OpenReleasePage(TopLevel? from)+ {+ var url = Release?.PageUrl ?? Nota.Infrastructure.AppUpdater.ReleasesPage;+ _ = from?.Launcher.LaunchUriAsync(new Uri(url));+ }++ /// <summary>App exit: stop a running check or download.</summary>+ public void CancelAll()+ {+ _timer?.Stop();+ _app.Cancel();+ }+}diff --git a/src/managed/Nota.App/ConfirmWindow.cs b/src/managed/Nota.App/ConfirmWindow.csindex 175bd171..97012802 100644--- a/src/managed/Nota.App/ConfirmWindow.cs+++ b/src/managed/Nota.App/ConfirmWindow.cs@@ -13,7 +13,8 @@ namespace Nota.App;public sealed class ConfirmWindow : NotaWindow{- public ConfirmWindow(string title, string message, string affirmative, string negative)+ /// <param name="negative">The other button; null for a notice with just one.</param>+ public ConfirmWindow(string title, string message, string affirmative, string? negative){Title = title;Width = 400;@@ -24,7 +25,7 @@ public sealed class ConfirmWindow : NotaWindowvar yes = new Button { Content = affirmative, Classes = { "primary" } };yes.Click += (_, _) => Close(true);- var no = new Button { Content = negative, Classes = { "ghost" } };+ var no = new Button { Content = negative, Classes = { "ghost" }, IsVisible = negative is not null };no.Click += (_, _) => Close(false);SetBody(new StackPaneldiff --git a/src/managed/Nota.App/Controls/Glyph.cs b/src/managed/Nota.App/Controls/Glyph.csindex c1eb2900..e82f9f5e 100644--- a/src/managed/Nota.App/Controls/Glyph.cs+++ b/src/managed/Nota.App/Controls/Glyph.cs@@ -35,7 +35,7 @@ internal enum GlyphKindCopy, Cut, Paste, Trash, Duplicate, Split, Consolidate, Stems, Reverse, Folder, Ungroup,Palette, Note, Input, Arrow, Grid, Select, Save, List, Compare, Flatten,// Path kinds (16-unit grid, see Paths)- Arrangement, Session, Modular, Keyboard, Sliders, Downloads, Star, StarFilled, Bookmark, Doc, Midi, Map, History, Sidebar, Options, Search, CaretRight, CaretDown, Levels, Gamepad, Phone, Plug, Library, Appearance, Shortcuts, MidiPort, Action, Track, Device, Preset, Patch, Loop, Speaker, SpeakerMute, SpeakerLow, SpeakerHigh, Metronome, Follow, Snap, Automation, Apple, Windows, Linux, ChainLink,+ Arrangement, Session, Modular, Keyboard, Sliders, Downloads, Star, StarFilled, Bookmark, Doc, Midi, Map, History, Sidebar, Options, Search, CaretRight, CaretDown, Levels, Gamepad, Phone, Plug, Library, Appearance, Shortcuts, MidiPort, Action, Track, Device, Preset, Patch, Loop, Speaker, SpeakerMute, SpeakerLow, SpeakerHigh, Metronome, Follow, Snap, Automation, Apple, Windows, Linux, ChainLink, Update,Lock, LockOpen, // a reference (read-only) clip in the multi-clip editor, and the unlocked toggle}@@ -472,6 +472,8 @@ internal sealed class Glyph : Control[GlyphKind.Appearance] = ("M8 2.667 A5.333 5.333 0 1 0 8 13.333 ZM8 2.667 A5.333 5.333 0 0 1 8 13.333", null),// A keycap row on a keyboard (shortcuts).[GlyphKind.Shortcuts] = ("M2 4.667 H14 V11.333 H2 ZM4.667 7.333 H4.673 M7.333 7.333 H7.34 M10 7.333 H10.007 M5.333 9.333 H10.667", null),+ // A circular arrow (a new version: Settings → Updates).+ [GlyphKind.Update] = ("M13 8 A5 5 0 1 1 11.536 4.464 M11.6 1.6 V4.5 H8.7", null),// A controller with keys (MIDI devices).[GlyphKind.MidiPort] = ("M2.667 3.333 H13.333 V12.667 H2.667 ZM5.333 3.333 V8.667 M8 3.333 V8.667 M10.667 3.333 V8.667", null),// A prompt: chevron and cursor (a command).diff --git a/src/managed/Nota.App/MainWindow.Commands.cs b/src/managed/Nota.App/MainWindow.Commands.csindex d727edf2..4d984fed 100644--- a/src/managed/Nota.App/MainWindow.Commands.cs+++ b/src/managed/Nota.App/MainWindow.Commands.cs@@ -139,13 +139,14 @@ public partial class MainWindow{("prefs.audio", "Audio"), ("prefs.midi", "MIDI"), ("prefs.gamepads", "Gamepads"), ("prefs.remote", "Remote"),("prefs.plugins", "Plug-ins"), ("prefs.downloads", "Downloads"), ("prefs.library", "Library"),- ("prefs.appearance", "Appearance"), ("prefs.shortcuts", "Shortcuts"),+ ("prefs.appearance", "Appearance"), ("prefs.shortcuts", "Shortcuts"), ("prefs.updates", "Updates"),})B(id, () => ShowPreferencesPage(page));// ---- HelpB("help.docs", () => OnDocumentation(this, e));B("help.whatsNew", ShowWhatsNew);+ B("help.checkUpdates", () => _ = CheckForUpdatesAsync());B("help.about", ShowAbout);// Every catalog command must have a handler — a missing one is a bug, not a quiet no-op.diff --git a/src/managed/Nota.App/MainWindow.Recovery.cs b/src/managed/Nota.App/MainWindow.Recovery.csindex c652ac28..277d9d6e 100644--- a/src/managed/Nota.App/MainWindow.Recovery.cs+++ b/src/managed/Nota.App/MainWindow.Recovery.cs@@ -92,6 +92,10 @@ public partial class MainWindowRefreshAfterLoad();MarkProjectClean(); // the fresh startup project counts as unmodified+ // Look for a newer release now and once a day (unless Settings → Updates says not to);+ // the start screen and the status bar show what it finds.+ AppUpdates.Shared.Start();+// What's New shows once per new app version, ahead of the launcher.await ShowWhatsNewIfNeeded();diff --git a/src/managed/Nota.App/MainWindow.Updates.cs b/src/managed/Nota.App/MainWindow.Updates.csnew file mode 100644index 00000000..2604cc14--- /dev/null+++ b/src/managed/Nota.App/MainWindow.Updates.cs@@ -0,0 +1,175 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// A newer Nota in the main window (#58), so it isn't only offered on the start screen: the+// status bar notice (an accent dot and one line beside the version — available, downloading+// with its bar, ready to install, or failed) and Help → Check for updates…, which answers+// even when there's nothing new. Both follow AppUpdates, as the start screen banner does.++using System;+using System.Threading.Tasks;+using Avalonia;+using Avalonia.Controls;+using Avalonia.Controls.Shapes;+using Avalonia.Input;+using Avalonia.Layout;+using Avalonia.Media;++namespace Nota.App;++public partial class MainWindow+{+ private TextBlock _upText = null!, _upDetail = null!;+ private Ellipse _upDot = null!;+ private ProgressBar _upBar = null!;+ private Button _upClose = null!;+ private Border _upOpen = null!;++ private void BuildUpdateIndicator()+ {+ var updates = AppUpdates.Shared;+ _upDot = new Ellipse { Width = 6, Height = 6, VerticalAlignment = VerticalAlignment.Center };+ _upDot.BindResource(Shape.FillProperty, "Brush.Accent");+ _upText = new TextBlock { Classes = { "Caption" }, VerticalAlignment = VerticalAlignment.Center };+ var open = _upOpen = new Border+ {+ Background = Brushes.Transparent, Cursor = new Cursor(StandardCursorType.Hand),+ Child = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6, Children = { _upDot, _upText } },+ };+ open.PointerEntered += (_, _) => { if (updates.State != AppUpdates.Stage.Downloading) _upText.TextDecorations = TextDecorations.Underline; };+ open.PointerExited += (_, _) => _upText.TextDecorations = null;+ open.PointerPressed += (_, e) =>+ {+ if (!e.GetCurrentPoint(open).Properties.IsLeftButtonPressed) return;+ e.Handled = true;+ switch (updates.State)+ {+ case AppUpdates.Stage.Ready: updates.Restart(Close); break;+ case AppUpdates.Stage.Available or AppUpdates.Stage.Failed: UpdateMenu().Open(open); break;+ }+ };++ _upBar = new ProgressBar { Width = 90, Height = 4, MinWidth = 0, Minimum = 0, Maximum = 1, VerticalAlignment = VerticalAlignment.Center };+ _upBar.BindResource(ProgressBar.ForegroundProperty, "Brush.Accent");+ _upBar.BindResource(ProgressBar.BackgroundProperty, "Brush.BorderDefault");+ _upDetail = new TextBlock { Classes = { "Caption", "Mono" }, VerticalAlignment = VerticalAlignment.Center };++ // One cross: Cancel while it downloads, "Not now" otherwise.+ _upClose = new Button+ {+ Classes = { "ghost" }, Width = 18, Height = 18, Padding = new Thickness(0), MinHeight = 0, MinWidth = 0,+ VerticalAlignment = VerticalAlignment.Center, Content = new Glyph(GlyphKind.Close, 8),+ };+ _upClose.BindResource(Button.ForegroundProperty, "Brush.TextTertiary");+ _upClose.Click += (_, _) =>+ {+ if (updates.State == AppUpdates.Stage.Downloading) updates.CancelDownload();+ else updates.Dismiss();+ };++ UpdateHost.Children.Add(new StackPanel+ {+ Orientation = Orientation.Horizontal, Spacing = 8, Margin = new Thickness(0, 0, 14, 0),+ Children = { open, _upBar, _upDetail, _upClose },+ });++ updates.Changed += UpdateUpdateIndicator;+ updates.ProgressChanged += UpdateUpdateIndicator;+ Closed += (_, _) =>+ {+ updates.Changed -= UpdateUpdateIndicator;+ updates.ProgressChanged -= UpdateUpdateIndicator;+ };+ UpdateUpdateIndicator();+ }++ private void UpdateUpdateIndicator()+ {+ var u = AppUpdates.Shared;+ UpdateHost.IsVisible = u.Release is { } && u.State != AppUpdates.Stage.None && !u.Dismissed;+ if (!UpdateHost.IsVisible) return;+ var version = u.Release!.Version;+ bool busy = u.State == AppUpdates.Stage.Downloading;+ var p = u.Progress;+ _upText.Text = u.State switch+ {+ AppUpdates.Stage.Downloading => $"Downloading Nota {version}…",+ AppUpdates.Stage.Ready => $"Restart to update to Nota {version}",+ AppUpdates.Stage.Failed => "The update didn't download",+ _ => $"Nota {version} is available",+ };+ ToolTip.SetTip(_upOpen, u.State switch+ {+ AppUpdates.Stage.Downloading => null,+ AppUpdates.Stage.Ready => $"Nota {version} is downloaded. Click to restart now — or it installs the next time you quit.",+ AppUpdates.Stage.Failed => u.Error,+ _ => $"You have {AppInfo.Version}. Click to update or read the release notes.",+ });+ _upDot.IsVisible = !busy;+ _upBar.IsVisible = busy;+ _upBar.IsIndeterminate = busy && p.Fraction < 0;+ if (busy && p.Fraction >= 0) _upBar.Value = p.Fraction;+ _upDetail.Text = busy && p.Fraction >= 0 ? NotaNum.Unit(p.Fraction * 100, "0", "%") : "";+ _upDetail.IsVisible = _upDetail.Text.Length > 0;+ ToolTip.SetTip(_upClose, busy ? "Cancel the download"+ : u.State == AppUpdates.Stage.Ready ? "Hide — it still installs when you quit" : "Not now");+ }++ // Available / failed: what to do about it.+ private ContextMenu UpdateMenu()+ {+ var u = AppUpdates.Shared;+ var version = u.Release?.Version ?? "";+ var menu = new ContextMenu();+ menu.Items.Add(MenuKit.Item(+ u.State == AppUpdates.Stage.Failed ? "Try again"+ : u.CanInstall ? $"Update to Nota {version}" : $"Download Nota {version}…",+ GlyphKind.Update, () => u.Download(this)));+ menu.Items.Add(MenuKit.Item("Release notes", GlyphKind.Doc, () => u.OpenReleasePage(this)));+ menu.Items.Add(new Separator());+ menu.Items.Add(MenuKit.Item("Not now", click: u.Dismiss));+ return menu;+ }++ /// <summary>Help → Check for updates… (and the macOS app menu): ask GitHub now and say what+ /// came back, including "you're up to date" and "couldn't check".</summary>+ public async Task CheckForUpdatesAsync()+ {+ var u = AppUpdates.Shared;+ const string checking = "Checking for updates…";+ if (_vm is not null) _vm.StatusText = checking;+ bool? found = await u.CheckAsync();+ if (_vm is not null && _vm.StatusText == checking) _vm.StatusText = "";+ var title = "Check for updates";++ if (found is null)+ {+ await new ConfirmWindow(title, "Couldn't reach GitHub to check for a newer version of Nota. Check your internet connection and try again.",+ "OK", null).ShowDialog<bool>(this);+ return;+ }+ if (found == false || u.Release is not { } release)+ {+ await new ConfirmWindow(title, $"You're up to date: Nota {AppInfo.Version} is the latest version.", "OK", null).ShowDialog<bool>(this);+ return;+ }++ u.Undismiss();+ switch (u.State)+ {+ case AppUpdates.Stage.Downloading:+ return; // its progress is in the status bar already+ case AppUpdates.Stage.Ready:+ if (await new ConfirmWindow(title, $"Nota {release.Version} is ready to install. Restart Nota to finish updating — or it installs the next time you quit.",+ "Restart now", "Later").ShowDialog<bool>(this))+ u.Restart(Close);+ return;+ default:+ var message = $"Nota {release.Version} is out — you have {AppInfo.Version}."+ + (u.CanInstall ? " Nota downloads it here and installs it when you restart or quit." : " Download it from the release page.");+ if (await new ConfirmWindow("Update available", message, u.CanInstall ? "Update" : "Download", "Later").ShowDialog<bool>(this))+ u.Download(this);+ return;+ }+ }+}diff --git a/src/managed/Nota.App/MainWindow.Welcome.cs b/src/managed/Nota.App/MainWindow.Welcome.csindex 80c94ace..2c8f78d4 100644--- a/src/managed/Nota.App/MainWindow.Welcome.cs+++ b/src/managed/Nota.App/MainWindow.Welcome.cs@@ -51,18 +51,11 @@ public partial class MainWindowif (PendingRecovery is not null)win.Closed += (_, _) => { try { _recovery.ClearRecovery(); } catch { } };- // Look for a newer release in the background; the banner appears if one turns up- // while the launcher is still open. "Restart now" quits through the normal close path- // (the installer runs on exit — see App's Exit hook) and relaunches the new version.- var updater = App.Services.GetRequiredService<IAppUpdater>();- _ = updater.CheckAsync().ContinueWith(t =>- {- if (t.Result is { } release)- Avalonia.Threading.Dispatcher.UIThread.Post(() =>- {- if (win.IsVisible) win.ShowUpdateAvailable(release, updater, restart: () => { win.Close(); Close(); });- });- }, TaskScheduler.Default);+ // A newer release (AppUpdates: checked on launch, and by Help → Check for updates…)+ // shows as a banner, now or when the check comes back while the launcher is open.+ // "Restart now" quits through the normal close path (the installer runs on exit — see+ // App's Exit hook) and relaunches the new version.+ win.ShowUpdates(AppUpdates.Shared, restart: () => { win.Close(); Close(); });// Shown owned rather than modal, so a click on the main window behind it can close it// like the close button does (#67) — not while the launcher has its own dialog opendiff --git a/src/managed/Nota.App/MainWindow.axaml b/src/managed/Nota.App/MainWindow.axamlindex 84c7d4c5..e71d75b8 100644--- a/src/managed/Nota.App/MainWindow.axaml+++ b/src/managed/Nota.App/MainWindow.axaml@@ -110,6 +110,7 @@<NativeMenu><NativeMenuItem Header="Documentation" app:Commands.Id="help.docs"/><NativeMenuItem Header="What's new" app:Commands.Id="help.whatsNew"/>+ <NativeMenuItem Header="Check for updates…" app:Commands.Id="help.checkUpdates"/><NativeMenuItemSeparator/><NativeMenuItem Header="About Nota" app:Commands.Id="help.about"/></NativeMenu>@@ -398,10 +399,10 @@</Border><!-- Status line (22): caption text on the ground, a seam above it. -->- <Border DockPanel.Dock="Bottom" Background="{DynamicResource Brush.BgApp}"+ <Border x:Name="StatusBar" DockPanel.Dock="Bottom" Background="{DynamicResource Brush.BgApp}"BorderBrush="{DynamicResource Brush.Seam}" BorderThickness="0,1,0,0"Height="22" Padding="16,0">- <Grid ColumnDefinitions="*,Auto,Auto,Auto,Auto">+ <Grid ColumnDefinitions="*,Auto,Auto,Auto,Auto,Auto"><TextBlock Classes="Caption" VerticalAlignment="Center" Text="{Binding StatusText}"/><!-- Settings → Downloads job (MainWindow.Downloads.cs): it keeps running after Settings closes. --><Panel x:Name="DownloadHost" Grid.Column="1" VerticalAlignment="Center"/>@@ -417,10 +418,12 @@Foreground="{DynamicResource Brush.Accent}"Background="{DynamicResource Brush.BgSunken}"/></StackPanel>- <TextBlock Grid.Column="3" Classes="Caption Mono"+ <!-- A newer Nota release: available / downloading / ready to install (MainWindow.Updates.cs). -->+ <Panel x:Name="UpdateHost" Grid.Column="3" VerticalAlignment="Center"/>+ <TextBlock Grid.Column="4" Classes="Caption Mono"VerticalAlignment="Center" Text="{Binding EngineInfo}"/><!-- The installed version: opens its release notes (What's New), never an update (#127). -->- <Button x:Name="VersionButton" Grid.Column="4" Classes="ghost"+ <Button x:Name="VersionButton" Grid.Column="5" Classes="ghost"VerticalAlignment="Center" Margin="6,0,-6,0" Padding="6,1" MinHeight="0"Cursor="Hand" ToolTip.Tip="View release notes"><TextBlock x:Name="VersionText" Classes="Caption Mono"/>diff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.csindex 6c62b21f..6b9e85bc 100644--- a/src/managed/Nota.App/MainWindow.axaml.cs+++ b/src/managed/Nota.App/MainWindow.axaml.cs@@ -116,6 +116,7 @@ public partial class MainWindow : Window});DataContextChanged += OnDataContextChanged;BuildDownloadIndicator();+ BuildUpdateIndicator();InitTransportFit();// Platform-specific window icon: Windows/Linux get the .ico bundle from// assets/icons/windows so the taskbar / alt-tab shows the brand mark. macOSdiff --git a/src/managed/Nota.App/PreferencesWindow.Updates.cs b/src/managed/Nota.App/PreferencesWindow.Updates.csnew file mode 100644index 00000000..4b31664b--- /dev/null+++ b/src/managed/Nota.App/PreferencesWindow.Updates.cs@@ -0,0 +1,99 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// Settings → Updates (#58): whether Nota looks for new versions on its own (on launch and once+// a day), the state of the last check with Check now, and the update itself when one is out —+// the same shared state (AppUpdates) as the start screen banner and the status bar notice.++using System;+using Avalonia.Controls;+using Avalonia.Layout;+using Avalonia.Media;+using Microsoft.Extensions.DependencyInjection;+using Nota.Application;++namespace Nota.App;++public sealed partial class PreferencesWindow+{+ private const int UpdatesIndex = 9;++ private Control UpdatesPane()+ {+ var settings = App.Services.GetRequiredService<ISettingsService>();+ var updates = AppUpdates.Shared;++ var auto = SwitchRow("Check for updates automatically", settings.Current.CheckForUpdates, on =>+ {+ settings.Current.CheckForUpdates = on;+ settings.Save();+ if (on && UpdateSchedule.IsDue(true, updates.LastChecked, DateTime.Now)) _ = updates.CheckAsync();+ });++ var status = new TextBlock { FontSize = 12, Foreground = TextPrimary, TextWrapping = TextWrapping.Wrap, VerticalAlignment = VerticalAlignment.Center };+ var detail = Caption("");+ var check = Btn("Check now");+ var act = Btn("Update");+ act.Classes.Add("primary");+ check.Click += async (_, _) => await updates.CheckAsync();+ act.Click += (_, _) =>+ {+ if (updates.State == AppUpdates.Stage.Downloading) updates.CancelDownload();+ else updates.Download(GetTopLevel(this));+ };++ void Refresh()+ {+ var r = updates.Release;+ check.IsEnabled = !updates.Checking && updates.State is not (AppUpdates.Stage.Downloading or AppUpdates.Stage.Ready);+ check.Content = updates.Checking ? "Checking…" : "Check now";+ act.IsVisible = r is not null && updates.State != AppUpdates.Stage.Ready;+ (status.Text, detail.Text) = updates.State switch+ {+ AppUpdates.Stage.Available => ($"Nota {r!.Version} is available — you have {AppInfo.Version}.",+ updates.CanInstall ? "Update downloads it here; it installs when you restart or quit Nota." : "Download opens the release page."),+ AppUpdates.Stage.Downloading => ($"Downloading Nota {r!.Version}…", Percent()),+ AppUpdates.Stage.Ready => ($"Nota {r!.Version} is ready to install.", "It installs the next time you quit Nota, or click Restart to update in the status bar."),+ AppUpdates.Stage.Failed => ("The update didn't download.", updates.Error ?? ""),+ _ when updates.LastCheckFailed => ($"You have Nota {AppInfo.Version}.", "Couldn't reach GitHub to check for a newer version. Check your internet connection and try again."),+ _ when updates.LastChecked is { } at => ($"Nota {AppInfo.Version} is the latest version.", $"Last checked {When(at)}."),+ _ => ($"You have Nota {AppInfo.Version}.", "Not checked yet."),+ };+ act.Content = updates.State switch+ {+ AppUpdates.Stage.Downloading => "Cancel",+ AppUpdates.Stage.Failed => "Try again",+ _ => updates.CanInstall ? "Update" : "Download",+ };+ act.Classes.Set("primary", updates.State != AppUpdates.Stage.Downloading);+ detail.IsVisible = detail.Text!.Length > 0;+ }+ string Percent() => updates.Progress.Fraction >= 0 ? NotaNum.Unit(updates.Progress.Fraction * 100, "0", "%") : updates.Progress.Message;+ void Progress() => detail.Text = Percent();++ updates.Changed += Refresh;+ updates.ProgressChanged += Progress;+ status.DetachedFromVisualTree += (_, _) => { updates.Changed -= Refresh; updates.ProgressChanged -= Progress; };+ Refresh();++ var rows = new System.Collections.Generic.List<Control>+ {+ new StackPanel { Spacing = 3, Children = { status, detail } },+ new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Children = { check, act } },+ };+ if (!updates.CanInstallInPlace)+ rows.Add(Caption("This copy of Nota can't replace itself (a development build, or one run straight from the disk image), so a new version opens its release page to download.", muted: true));++ return Sections(+ Section("Automatic updates", 10, auto,+ Caption("On launch and once a day, Nota asks GitHub whether a newer version is out and tells you in the status bar. Nothing is downloaded until you click Update.")),+ Section("This version", 10, rows.ToArray()));+ }++ // "today at 14:02", "yesterday at 09:15", or the date.+ private static string When(DateTime at)+ {+ var day = at.Date == DateTime.Today ? "today" : at.Date == DateTime.Today.AddDays(-1) ? "yesterday" : at.ToString("d MMM");+ return $"{day} at {at:HH:mm}";+ }+}diff --git a/src/managed/Nota.App/PreferencesWindow.cs b/src/managed/Nota.App/PreferencesWindow.csindex 68ce2fdf..8d646351 100644--- a/src/managed/Nota.App/PreferencesWindow.cs+++ b/src/managed/Nota.App/PreferencesWindow.cs@@ -77,6 +77,7 @@ public sealed partial class PreferencesWindow : NotaWindownew Page("Library", "Content folders and version history", GlyphKind.Library),new Page("Appearance", "Theme, scale, waveforms and AI control", GlyphKind.Appearance),new Page("Shortcuts", "Keyboard reference", GlyphKind.Shortcuts),+ new Page("Updates", "New versions of Nota", GlyphKind.Update),}),};@@ -270,6 +271,7 @@ public sealed partial class PreferencesWindow : NotaWindow4 => PluginsPane(),6 => LibraryPane(),7 => AppearancePane(),+ UpdatesIndex => UpdatesPane(),_ => ShortcutsPane(),};diff --git a/src/managed/Nota.App/WelcomeWindow.cs b/src/managed/Nota.App/WelcomeWindow.csindex f71c7bde..b690650d 100644--- a/src/managed/Nota.App/WelcomeWindow.cs+++ b/src/managed/Nota.App/WelcomeWindow.cs@@ -5,7 +5,7 @@// drawn in nota-design/Nota Start.html. Brand header, New / Open actions, a list of// recent projects (click selects, double-click / Return opens, ↑ ↓ move), and shortcuts to// Settings and What's New, plus banners for crash recovery and a newer release on-// GitHub (which downloads and installs it in place — see IAppUpdater). New / Open / a recent project close the launcher and hand+// GitHub (which downloads and installs it in place — see AppUpdates). New / Open / a recent project close the launcher and hand// off to the main window; Settings and What's New open as child dialogs so the user// stays on the launcher.@@ -315,121 +315,118 @@ public sealed class WelcomeWindow : NotaWindowprivate readonly StackPanel _banners;- /// <summary>Show the "new version available" banner. When this install can update itself- /// it downloads in place (progress in the banner), then offers Restart now / Later — Later- /// installs on quit. Otherwise Download opens the release page. Called once the background- /// update check resolves.</summary>- public void ShowUpdateAvailable(AppRelease release, IAppUpdater updater, Action restart)+ /// <summary>Show the "new version available" banner whenever the app's update state+ /// (AppUpdates) has a release the user hasn't waved off — now, or when the launch check+ /// finds one while the launcher is still open. When this install can update itself it+ /// downloads in place (progress in the banner), then offers Restart now / Later — Later+ /// installs on quit. Otherwise Download opens the release page.</summary>+ internal void ShowUpdates(AppUpdates updates, Action restart){- new UpdateBanner(release, updater, restart, _banners).Attach();+ var banner = new UpdateBanner(updates, restart, _banners);+ Closed += (_, _) => banner.Detach();}- // The update banner's states: offer → downloading → ready (or failed → try again).+ // The update banner follows the shared state: offer → downloading → ready (or failed →+ // try again). Dismiss / Later wave the release off everywhere (the status bar too).private sealed class UpdateBanner{- private readonly AppRelease _release;- private readonly IAppUpdater _updater;+ private readonly AppUpdates _updates;private readonly Action _restart;private readonly StackPanel _host;private readonly Border _card;- private CancellationTokenSource? _cts;+ private AppUpdates.Stage _shown = (AppUpdates.Stage)(-1);+ private ProgressBar? _bar;+ private TextBlock? _message;- public UpdateBanner(AppRelease release, IAppUpdater updater, Action restart, StackPanel host)+ public UpdateBanner(AppUpdates updates, Action restart, StackPanel host){- _release = release;- _updater = updater;+ _updates = updates;_restart = restart;_host = host;_card = BannerCard();+ updates.Changed += Render;+ updates.ProgressChanged += ShowProgress;+ Render();}- public void Attach()+ public void Detach(){- if (_updater.PendingVersion == _release.Version) ShowReady();- else ShowOffer();- _host.Children.Add(_card);+ _updates.Changed -= Render;+ _updates.ProgressChanged -= ShowProgress;}- private bool CanUpdate => _release.Asset is not null && _updater.CanInstallInPlace;-- private void ShowOffer()+ private void Render(){- var openPage = () => { _ = Launcher(_card)?.LaunchUriAsync(new Uri(_release.PageUrl)); };- _card.Child = CanUpdate- ? BannerContent("A new version of Nota is available",- $"Nota {_release.Version} is out — you have {AppInfo.Version}.",+ var u = _updates;+ bool show = u.Release is not null && u.State != AppUpdates.Stage.None && !u.Dismissed;+ if (!show)+ {+ _host.Children.Remove(_card);+ _shown = (AppUpdates.Stage)(-1);+ return;+ }+ if (!_host.Children.Contains(_card)) _host.Children.Add(_card);+ if (u.State == _shown) return;+ _shown = u.State;+ var release = u.Release!;+ var top = TopLevel.GetTopLevel(_host);+ _bar = null;+ _message = null;+ _card.Child = u.State switch+ {+ AppUpdates.Stage.Downloading => Downloading(release),+ AppUpdates.Stage.Ready => BannerContent($"Nota {release.Version} is ready to install",+ "Restart Nota to finish updating — or it installs the next time you quit.",+ progress: null,+ ("Restart now", true, () => u.Restart(_restart)),+ ("Later", false, u.Dismiss)),+ AppUpdates.Stage.Failed => BannerContent("The update didn't download", u.Error ?? "",progress: null,- ("Update", true, () => _ = DownloadAsync()),- ("Release notes", false, openPage),- ("Dismiss", false, Remove))- : BannerContent("A new version of Nota is available",- $"Nota {_release.Version} is out — you have {AppInfo.Version}.",+ ("Try again", true, () => u.Download(top)),+ ("Dismiss", false, u.Dismiss)),+ _ when u.CanInstall => BannerContent("A new version of Nota is available",+ $"Nota {release.Version} is out — you have {AppInfo.Version}.",progress: null,- ("Download", true, openPage),- ("Dismiss", false, Remove));+ ("Update", true, () => u.Download(top)),+ ("Release notes", false, () => u.OpenReleasePage(top)),+ ("Dismiss", false, u.Dismiss)),+ _ => BannerContent("A new version of Nota is available",+ $"Nota {release.Version} is out — you have {AppInfo.Version}.",+ progress: null,+ ("Download", true, () => u.Download(top)),+ ("Dismiss", false, u.Dismiss)),+ };}- private async Task DownloadAsync()+ private Grid Downloading(AppRelease release){- _cts = new CancellationTokenSource();- var bar = new ProgressBar+ _bar = new ProgressBar{Minimum = 0, Maximum = 1, Height = 4, Margin = new Thickness(0, 6, 0, 0),Foreground = NotaPalette.Accent, Background = NotaPalette.BorderDefault,};- var size = _release.Asset!.Size / 1048576.0;- var content = BannerContent($"Downloading Nota {_release.Version}…",- $"0.0 / {NotaNum.Unit(size, "0.0", "MB")}", bar,- ("Cancel", false, () => _cts?.Cancel()));- _card.Child = content;- var message = (TextBlock)((StackPanel)content.Children[0]).Children[1]; // BannerContent's message line-- var progress = new Progress<StoreProgress>(p =>- {- if (p.Fraction < 0)- {- bar.IsIndeterminate = true;- message.Text = p.Message;- return;- }- bar.Value = p.Fraction;- message.Text = $"{(p.Fraction * size).ToString("0.0", NotaNum.Culture)} / {NotaNum.Unit(size, "0.0", "MB")}"- + $" · {NotaNum.Unit(p.Fraction * 100, "0", "%")}";- });- try- {- await _updater.DownloadAsync(_release, progress, _cts.Token);- ShowReady();- }- catch (OperationCanceledException) { ShowOffer(); }- catch (Exception e) { ShowFailed(e is StoreException ? e.Message : $"Couldn't download the update: {e.Message}"); }- finally { _cts.Dispose(); _cts = null; }- }-- private void ShowReady()- {- _card.Child = BannerContent($"Nota {_release.Version} is ready to install",- "Restart Nota to finish updating — or it installs the next time you quit.",- progress: null,- ("Restart now", true, () => { _updater.RelaunchAfterInstall = true; _restart(); }),- ("Later", false, Remove));- }-- private void ShowFailed(string error)- {- _card.Child = BannerContent("The update didn't download", error,- progress: null,- ("Try again", true, () => _ = DownloadAsync()),- ("Dismiss", false, Remove));+ var content = BannerContent($"Downloading Nota {release.Version}…", "", _bar,+ ("Cancel", false, _updates.CancelDownload));+ _message = (TextBlock)((StackPanel)content.Children[0]).Children[1]; // BannerContent's message line+ ShowProgress();+ return content;}- private void Remove()+ private void ShowProgress(){- _cts?.Cancel();- _host.Children.Remove(_card);+ if (_bar is null || _message is null || _updates.Release?.Asset is not { } asset) return;+ var p = _updates.Progress;+ if (p.Fraction < 0)+ {+ _bar.IsIndeterminate = true;+ _message.Text = p.Message;+ return;+ }+ var size = asset.Size / 1048576.0;+ _bar.Value = p.Fraction;+ _message.Text = $"{(p.Fraction * size).ToString("0.0", NotaNum.Culture)} / {NotaNum.Unit(size, "0.0", "MB")}"+ + $" · {NotaNum.Unit(p.Fraction * 100, "0", "%")}";}-- private static Avalonia.Platform.Storage.ILauncher? Launcher(Visual v) => TopLevel.GetTopLevel(v)?.Launcher;}// Offer to restore a crashed session.diff --git a/src/managed/Nota.Application/Palette/CommandCatalog.cs b/src/managed/Nota.Application/Palette/CommandCatalog.csindex ce502e17..1374e3b1 100644--- a/src/managed/Nota.Application/Palette/CommandCatalog.cs+++ b/src/managed/Nota.Application/Palette/CommandCatalog.cs@@ -117,10 +117,12 @@ public static class CommandCatalogC("prefs.library", "Settings: Library", "Settings", "", "preferences folders"),C("prefs.appearance", "Settings: Appearance", "Settings", "", "preferences theme dark light"),C("prefs.shortcuts", "Settings: Shortcuts", "Settings", "", "preferences hotkeys keys keyboard"),+ C("prefs.updates", "Settings: Updates", "Settings", "", "preferences update automatic check version"),// ---- Help -------------------------------------------------------------------------C("help.docs", "Documentation", "Help", "", "manual guide"),C("help.whatsNew", "What's new", "Help", "", "changelog release notes"),+ C("help.checkUpdates", "Check for updates…", "Help", "", "update upgrade new version download install"),C("help.about", "About Nota", "Help", "", "version"),};diff --git a/src/managed/Nota.Application/Ports/IAppUpdater.cs b/src/managed/Nota.Application/Ports/IAppUpdater.csindex 9baa0ff7..e41414ad 100644--- a/src/managed/Nota.Application/Ports/IAppUpdater.cs+++ b/src/managed/Nota.Application/Ports/IAppUpdater.cs@@ -18,9 +18,13 @@ public sealed record AppReleaseAsset(string Name, string Url, long Size, string?public interface IAppUpdater{/// <summary>The latest published release if it's newer than the running version, else null.- /// Best-effort: network / parse failures return null.</summary>+ /// Best-effort: network / parse failures return null and set <see cref="LastCheckFailed"/>.</summary>Task<AppRelease?> CheckAsync(CancellationToken ct = default);+ /// <summary>True when the last <see cref="CheckAsync"/> couldn't reach or read the release+ /// feed, so its null means "don't know" rather than "up to date".</summary>+ bool LastCheckFailed { get; }+/// <summary>True when this install can be replaced in place (a packaged app in a writable/// location). Otherwise the user downloads the release by hand.</summary>bool CanInstallInPlace { get; }diff --git a/src/managed/Nota.Application/Settings.cs b/src/managed/Nota.Application/Settings.csindex 25e7f908..16b94659 100644--- a/src/managed/Nota.Application/Settings.cs+++ b/src/managed/Nota.Application/Settings.cs@@ -47,6 +47,10 @@ public sealed class Settings/// <summary>Show the welcome screen (recent projects launcher) on startup. On by default;/// toggled from the welcome screen's "Show on startup" checkbox.</summary>public bool ShowWelcomeOnStartup { get; set; } = true;+ /// <summary>Look for a newer Nota release on launch and once a day while running (#58).+ /// On by default; Settings → Updates. Help → Check for updates… works either way, and+ /// nothing downloads until the user clicks Update.</summary>+ public bool CheckForUpdates { get; set; } = true;/// <summary>The Mixer window's view: "strips" or "map" (the Stereo Map, specs/008)./// A per-user preference, remembered between openings.</summary>public string MixerView { get; set; } = "strips";diff --git a/src/managed/Nota.Application/UpdateSchedule.cs b/src/managed/Nota.Application/UpdateSchedule.csnew file mode 100644index 00000000..43115d91--- /dev/null+++ b/src/managed/Nota.Application/UpdateSchedule.cs@@ -0,0 +1,22 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.++namespace Nota.Application;++/// <summary>When Nota looks for a newer release on its own (#58): on every launch and then+/// once a day while it runs, unless Settings → Updates turned that off. A check the user asks+/// for (Help → Check for updates…) runs regardless.</summary>+public static class UpdateSchedule+{+ /// <summary>How long a running Nota waits between automatic checks.</summary>+ public static readonly TimeSpan Interval = TimeSpan.FromHours(24);++ /// <summary>How often a running Nota asks <see cref="IsDue"/>. Short against the interval,+ /// so a computer that slept through the due time checks soon after it wakes.</summary>+ public static readonly TimeSpan Poll = TimeSpan.FromMinutes(30);++ /// <summary>True when an automatic check should run now: checking is on and the last+ /// successful check is <see cref="Interval"/> old (or there hasn't been one yet).</summary>+ public static bool IsDue(bool enabled, DateTime? lastChecked, DateTime now)+ => enabled && (lastChecked is not { } last || now - last >= Interval || now < last);+}diff --git a/src/managed/Nota.Infrastructure/Update/AppUpdater.cs b/src/managed/Nota.Infrastructure/Update/AppUpdater.csindex 264add21..f1d08ea9 100644--- a/src/managed/Nota.Infrastructure/Update/AppUpdater.cs+++ b/src/managed/Nota.Infrastructure/Update/AppUpdater.cs@@ -74,11 +74,14 @@ public sealed partial class AppUpdater : IAppUpdaterpublic bool RelaunchAfterInstall { get; set; }+ public bool LastCheckFailed { get; private set; }+// ---- check ------------------------------------------------------------------------------public async Task<AppRelease?> CheckAsync(CancellationToken ct = default){if (_pending is null) CleanUpdatesDir();+ LastCheckFailed = true;try{string json;@@ -94,7 +97,9 @@ public sealed partial class AppUpdater : IAppUpdaterif (!resp.IsSuccessStatusCode) return null;json = await resp.Content.ReadAsStringAsync(cts.Token).ConfigureAwait(false);}- return ParseRelease(json, _running, _os, _arch);+ var release = ParseRelease(json, _running, _os, _arch);+ LastCheckFailed = false;+ return release;}catch{diff --git a/tests/Nota.SmokeTest/AppUpdaterTests.cs b/tests/Nota.SmokeTest/AppUpdaterTests.csindex 66234014..64303b14 100644--- a/tests/Nota.SmokeTest/AppUpdaterTests.cs+++ b/tests/Nota.SmokeTest/AppUpdaterTests.cs@@ -58,9 +58,19 @@ internal static class AppUpdaterTestsyield return (AppUpdater.ParseRelease(json, "1.2.0", OSPlatform.Linux, Architecture.X64) is { Asset: null },"a release without this platform's build still reports the version (manual download)");+ // ---- when to check (#58) ------------------------------------------------------------+ var now = new DateTime(2026, 10, 20, 12, 0, 0);+ yield return (UpdateSchedule.IsDue(true, null, now) && UpdateSchedule.IsDue(true, now.AddHours(-24), now),+ "an automatic check is due on launch and a day after the last one");+ yield return (!UpdateSchedule.IsDue(true, now.AddHours(-23), now) && !UpdateSchedule.IsDue(false, null, now),+ "…not sooner, and never with automatic checks off");+ yield return (UpdateSchedule.IsDue(true, now.AddHours(2), now),+ "a last check in the future (the clock was moved back) doesn't block checking");+var tmp = Directory.CreateTempSubdirectory("nota-updater-test-").FullName;try{+ foreach (var r in CheckOutcomes(tmp)) yield return r;foreach (var r in Targets(tmp)) yield return r;foreach (var r in LinuxFlow(tmp)) yield return r;if (!OperatingSystem.IsWindows())@@ -74,6 +84,24 @@ internal static class AppUpdaterTests}}+ // ---- up to date vs couldn't check ------------------------------------------------------+ private static IEnumerable<(bool, string)> CheckOutcomes(string tmp)+ {+ var api = Path.Combine(tmp, "outcome.json");+ File.WriteAllText(api, ReleaseJson("v1.2.0", []));+ var updater = new AppUpdater("1.2.0", api, Path.Combine(tmp, "outcome-updates"), OSPlatform.Linux, Architecture.X64, null, null);+ var none = updater.CheckAsync().GetAwaiter().GetResult();+ yield return (none is null && !updater.LastCheckFailed, "the latest release is the running one: up to date, not a failed check");++ var missing = new AppUpdater("1.2.0", Path.Combine(tmp, "no-such-feed.json"), Path.Combine(tmp, "outcome-updates"), OSPlatform.Linux, Architecture.X64, null, null);+ var failed = missing.CheckAsync().GetAwaiter().GetResult();+ yield return (failed is null && missing.LastCheckFailed, "an unreachable release feed reports a failed check, not \"up to date\"");++ File.WriteAllText(api, "{ not json");+ updater.CheckAsync().GetAwaiter().GetResult();+ yield return (updater.LastCheckFailed, "an unreadable release feed is a failed check too");+ }+// ---- what is updatable ---------------------------------------------------------------private static IEnumerable<(bool, string)> Targets(string tmp){