From 2e143686afade28444768790164fdd12c7eb50cd Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Wed, 27 May 2026 18:44:46 +0200 Subject: [PATCH] feat(host-factory): register ChunkRenderer + PayloadHandler + Lender (F) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit F adds the 3 new DI registrations needed for the v1.7.1 R-Block: - ChunkRenderer (4-param ctor: themes, fonts, logger, gameFunctions) - PayloadHandler singleton (7-param ctor: themes, ipc, functions, inputBar, mainWindow, chunkRenderer, logger) - Lender factory (closure over sp, constructs a fresh PayloadHandler per Borrow() — used by InputPreview in Sub-Task I) All three use Factory-Lambdas because Lender has an internal ctor and ChunkRenderer/PayloadHandler are internal sealed (ActivatorUtilities can't reflect into internal ctors per [[reference_hellion_chat_di_container_v150]]). MainWindow DI-reg update is deferred to Sub-Task A2 (split per Flo 2026-05-27 to avoid the DI-cycle that would otherwise emerge from the PayloadHandler → MainWindow → MessageList → PayloadHandler graph — cycle resolved via setter-injection on MessageList in G/H). G is next: wires PayloadHandlerInitHostedService.StartAsync to register the AddonLifecycle listener for MoveTooltip and call MessageList. AttachPayloadHandler. H adds the MessageList ChunkRenderer ctor-param + AttachPayloadHandler setter. --- HellionChat/PluginHostFactory.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/HellionChat/PluginHostFactory.cs b/HellionChat/PluginHostFactory.cs index 36a723d..cdf47e5 100644 --- a/HellionChat/PluginHostFactory.cs +++ b/HellionChat/PluginHostFactory.cs @@ -225,6 +225,36 @@ internal static class PluginHostFactory ); }); + // Factory-lambdas for ChunkRenderer, PayloadHandler, and Lender + // because all three are internal-sealed (ActivatorUtilities can't reflect into + // internal ctors) and Lender has an internal ctor by design. + services.AddSingleton(sp => new Ui.Components.ChunkRenderer( + sp.GetRequiredService(), + sp.GetRequiredService(), + sp.GetRequiredService>(), + sp.GetRequiredService() + )); + services.AddSingleton(sp => new PayloadHandler( + sp.GetRequiredService(), + sp.GetRequiredService(), + sp.GetRequiredService(), + sp.GetRequiredService(), + sp.GetRequiredService(), + sp.GetRequiredService(), + sp.GetRequiredService>() + )); + services.AddSingleton(sp => new Lender(() => + new PayloadHandler( + sp.GetRequiredService(), + sp.GetRequiredService(), + sp.GetRequiredService(), + sp.GetRequiredService(), + sp.GetRequiredService(), + sp.GetRequiredService(), + sp.GetRequiredService>() + ) + )); + // Block C — Windows. WindowSystem.AddWindow is called from // PluginLifecycle.LoadAsync on the framework thread. services.AddSingleton(sp => new Ui.Windows.SettingsWindow(