feat: add automatic update checking with confirmation and progress dialogs

This commit is contained in:
Stone_Red
2026-02-21 17:11:47 +01:00
committed by Hue
parent 1fa4348700
commit cf9c647c03
5 changed files with 219 additions and 47 deletions
+5 -12
View File
@@ -23,6 +23,7 @@ public sealed class AppOrchestrator : IDisposable
private readonly CommandHandler _commandHandler;
private readonly NotificationSoundService _notificationSound;
private readonly AudioPlaybackService _audioPlayback = new();
private readonly UpdateChecker _updateService;
private EchoHubConnection? _connection;
private ApiClient? _apiClient;
@@ -45,10 +46,13 @@ public sealed class AppOrchestrator : IDisposable
_mainWindow = new MainWindow(app);
_commandHandler = new CommandHandler();
_notificationSound = new NotificationSoundService(config.Notifications);
_updateService = new UpdateChecker(app);
WireMainWindowEvents();
WireCommandHandlerEvents();
_updateService.Start();
_mainWindow.UpdateStatusBar("Disconnected");
}
@@ -56,6 +60,7 @@ public sealed class AppOrchestrator : IDisposable
{
_connection?.DisposeAsync().AsTask().GetAwaiter().GetResult();
_apiClient?.Dispose();
_updateService.Dispose();
}
// ── Convenience Helpers ────────────────────────────────────────────────
@@ -456,18 +461,6 @@ public sealed class AppOrchestrator : IDisposable
FetchAndUpdateOnlineUsers();
SaveServerToConfig(result);
// Check for newer version in the background
_ = Task.Run(async () =>
{
var newVersion = await UpdateChecker.CheckForUpdateAsync();
if (newVersion is not null)
{
InvokeUI(() => _mainWindow.AddSystemMessage(
HubConstants.DefaultChannel,
$"A new version of EchoHub is available: v{newVersion} (current: v{MainWindow.AppVersion}). Visit https://github.com/HueByte/EchoHub/releases"));
}
});
}, "Connection failed", "Connect");
}