feat(app): register UpdateCheckService and InstallerLocator in DI

This commit is contained in:
mika kuns
2026-04-23 15:03:28 +02:00
parent ee09706811
commit 0934b294c2
2 changed files with 22 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
using Avalonia;
using ClaudeDo.Data;
using ClaudeDo.Data.Git;
using ClaudeDo.Releases;
using ClaudeDo.Ui;
using ClaudeDo.Ui.Services;
using ClaudeDo.Ui.ViewModels;
@@ -9,6 +10,8 @@ using ClaudeDo.Ui.ViewModels.Modals;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Net.Http;
using System.Reflection;
using System.Runtime.InteropServices;
namespace ClaudeDo.App;
@@ -75,6 +78,17 @@ sealed class Program
sc.AddSingleton<GitService>();
sc.AddSingleton(sp => new WorkerClient(sp.GetRequiredService<AppSettings>().SignalRUrl));
// Release check + installer update
sc.AddSingleton<HttpClient>(_ => new HttpClient { Timeout = TimeSpan.FromSeconds(10) });
sc.AddSingleton<IReleaseClient>(sp => new ReleaseClient(sp.GetRequiredService<HttpClient>()));
sc.AddSingleton<InstallerLocator>();
sc.AddSingleton(sp =>
{
var releases = sp.GetRequiredService<IReleaseClient>();
var version = Assembly.GetEntryAssembly()?.GetName().Version?.ToString() ?? "0.0.0.0";
return new UpdateCheckService(releases, version);
});
// ViewModels
sc.AddTransient<WorktreeModalViewModel>();
sc.AddTransient<SettingsModalViewModel>();