refactor(main): extract IPC runtime deps factories

This commit is contained in:
2026-02-14 01:17:19 -08:00
parent 0bd1a18cd7
commit 94c1b131ef

View File

@@ -1524,7 +1524,15 @@ const runtimeOptionsIpcDeps = {
}; };
registerIpcHandlersService( registerIpcHandlersService(
createIpcDepsRuntimeService({ createIpcDepsRuntimeService(createMainIpcRuntimeServiceDeps()),
);
registerAnkiJimakuIpcRuntimeService(
createAnkiJimakuIpcRuntimeServiceDeps(),
);
function createMainIpcRuntimeServiceDeps() {
return {
getInvisibleWindow: () => overlayManager.getInvisibleWindow(), getInvisibleWindow: () => overlayManager.getInvisibleWindow(),
getMainWindow: () => overlayManager.getMainWindow(), getMainWindow: () => overlayManager.getMainWindow(),
getVisibleOverlayVisibility: () => overlayManager.getVisibleOverlayVisible(), getVisibleOverlayVisibility: () => overlayManager.getVisibleOverlayVisible(),
@@ -1556,11 +1564,11 @@ registerIpcHandlersService(
reportOverlayContentBounds: (payload) => { reportOverlayContentBounds: (payload) => {
overlayContentMeasurementStore.report(payload); overlayContentMeasurementStore.report(payload);
}, },
}), };
); }
registerAnkiJimakuIpcRuntimeService( function createAnkiJimakuIpcRuntimeServiceDeps() {
{ return {
patchAnkiConnectEnabled: (enabled) => { patchAnkiConnectEnabled: (enabled) => {
configService.patchRawConfig({ ankiConnect: { enabled } }); configService.patchRawConfig({ ankiConnect: { enabled } });
}, },
@@ -1586,5 +1594,5 @@ registerAnkiJimakuIpcRuntimeService(
isRemoteMediaPath: (mediaPath) => isRemoteMediaPath(mediaPath), isRemoteMediaPath: (mediaPath) => isRemoteMediaPath(mediaPath),
downloadToFile: (url, destPath, headers) => downloadToFile: (url, destPath, headers) =>
downloadToFile(url, destPath, headers), downloadToFile(url, destPath, headers),
}, };
); }