mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
refactor(main): extract IPC runtime deps factories
This commit is contained in:
22
src/main.ts
22
src/main.ts
@@ -1524,7 +1524,15 @@ const runtimeOptionsIpcDeps = {
|
||||
};
|
||||
|
||||
registerIpcHandlersService(
|
||||
createIpcDepsRuntimeService({
|
||||
createIpcDepsRuntimeService(createMainIpcRuntimeServiceDeps()),
|
||||
);
|
||||
|
||||
registerAnkiJimakuIpcRuntimeService(
|
||||
createAnkiJimakuIpcRuntimeServiceDeps(),
|
||||
);
|
||||
|
||||
function createMainIpcRuntimeServiceDeps() {
|
||||
return {
|
||||
getInvisibleWindow: () => overlayManager.getInvisibleWindow(),
|
||||
getMainWindow: () => overlayManager.getMainWindow(),
|
||||
getVisibleOverlayVisibility: () => overlayManager.getVisibleOverlayVisible(),
|
||||
@@ -1556,11 +1564,11 @@ registerIpcHandlersService(
|
||||
reportOverlayContentBounds: (payload) => {
|
||||
overlayContentMeasurementStore.report(payload);
|
||||
},
|
||||
}),
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
registerAnkiJimakuIpcRuntimeService(
|
||||
{
|
||||
function createAnkiJimakuIpcRuntimeServiceDeps() {
|
||||
return {
|
||||
patchAnkiConnectEnabled: (enabled) => {
|
||||
configService.patchRawConfig({ ankiConnect: { enabled } });
|
||||
},
|
||||
@@ -1586,5 +1594,5 @@ registerAnkiJimakuIpcRuntimeService(
|
||||
isRemoteMediaPath: (mediaPath) => isRemoteMediaPath(mediaPath),
|
||||
downloadToFile: (url, destPath, headers) =>
|
||||
downloadToFile(url, destPath, headers),
|
||||
},
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user