mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
refactor(main): extract IPC registration wiring into main/ipc-runtime module
This commit is contained in:
23
src/main.ts
23
src/main.ts
@@ -97,7 +97,6 @@ import {
|
||||
createCliCommandDepsRuntimeService,
|
||||
createOverlayManagerService,
|
||||
createFieldGroupingOverlayRuntimeService,
|
||||
createIpcDepsRuntimeService,
|
||||
createNumericShortcutRuntimeService,
|
||||
createOverlayContentMeasurementStoreService,
|
||||
createOverlayShortcutRuntimeHandlers,
|
||||
@@ -124,9 +123,7 @@ import {
|
||||
openYomitanSettingsWindow,
|
||||
playNextSubtitleRuntimeService,
|
||||
refreshOverlayShortcutsRuntimeService,
|
||||
registerAnkiJimakuIpcRuntimeService,
|
||||
registerGlobalShortcutsService,
|
||||
registerIpcHandlersService,
|
||||
registerOverlayShortcutsService,
|
||||
replayCurrentSubtitleRuntimeService,
|
||||
resolveJimakuApiKeyService,
|
||||
@@ -163,9 +160,7 @@ import type { SubsyncRuntimeDeps } from "./core/services/subsync-runner-service"
|
||||
import { applyRuntimeOptionResultRuntimeService } from "./core/services/runtime-options-ipc-service";
|
||||
import {
|
||||
createRuntimeOptionsIpcDeps,
|
||||
createAnkiJimakuIpcRuntimeServiceDeps,
|
||||
createCliCommandRuntimeServiceDeps,
|
||||
createMainIpcRuntimeServiceDeps,
|
||||
createSubsyncRuntimeDeps,
|
||||
} from "./main/dependencies";
|
||||
import {
|
||||
@@ -173,6 +168,10 @@ import {
|
||||
createAppReadyRuntimeDeps as createAppReadyRuntimeDepsBuilder,
|
||||
} from "./main/app-lifecycle";
|
||||
import { handleMpvCommandFromIpcRuntime } from "./main/ipc-mpv-command";
|
||||
import {
|
||||
registerAnkiJimakuIpcRuntimeServices,
|
||||
registerMainIpcRuntimeServices,
|
||||
} from "./main/ipc-runtime";
|
||||
import { createStartupBootstrapRuntimeDeps } from "./main/startup";
|
||||
import {
|
||||
ConfigService,
|
||||
@@ -1532,9 +1531,7 @@ const runtimeOptionsIpcDeps = createRuntimeOptionsIpcDeps({
|
||||
showMpvOsd,
|
||||
});
|
||||
|
||||
registerIpcHandlersService(
|
||||
createIpcDepsRuntimeService(
|
||||
createMainIpcRuntimeServiceDeps({
|
||||
registerMainIpcRuntimeServices({
|
||||
getInvisibleWindow: () => overlayManager.getInvisibleWindow(),
|
||||
getMainWindow: () => overlayManager.getMainWindow(),
|
||||
getVisibleOverlayVisibility: () => overlayManager.getVisibleOverlayVisible(),
|
||||
@@ -1567,12 +1564,9 @@ registerIpcHandlersService(
|
||||
reportOverlayContentBounds: (payload: unknown) => {
|
||||
overlayContentMeasurementStore.report(payload);
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
registerAnkiJimakuIpcRuntimeService(
|
||||
createAnkiJimakuIpcRuntimeServiceDeps({
|
||||
registerAnkiJimakuIpcRuntimeServices({
|
||||
patchAnkiConnectEnabled: (enabled: boolean) => {
|
||||
configService.patchRawConfig({ ankiConnect: { enabled } });
|
||||
},
|
||||
@@ -1608,5 +1602,4 @@ registerAnkiJimakuIpcRuntimeService(
|
||||
destPath: string,
|
||||
headers: Record<string, string>,
|
||||
) => downloadToFile(url, destPath, headers),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
28
src/main/ipc-runtime.ts
Normal file
28
src/main/ipc-runtime.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import {
|
||||
createIpcDepsRuntimeService,
|
||||
registerAnkiJimakuIpcRuntimeService,
|
||||
registerIpcHandlersService,
|
||||
} from "../core/services";
|
||||
import {
|
||||
createAnkiJimakuIpcRuntimeServiceDeps,
|
||||
AnkiJimakuIpcRuntimeServiceDepsParams,
|
||||
createMainIpcRuntimeServiceDeps,
|
||||
MainIpcRuntimeServiceDepsParams,
|
||||
} from "./dependencies";
|
||||
|
||||
export function registerMainIpcRuntimeServices(
|
||||
params: MainIpcRuntimeServiceDepsParams,
|
||||
): void {
|
||||
registerIpcHandlersService(
|
||||
createIpcDepsRuntimeService(createMainIpcRuntimeServiceDeps(params)),
|
||||
);
|
||||
}
|
||||
|
||||
export function registerAnkiJimakuIpcRuntimeServices(
|
||||
params: AnkiJimakuIpcRuntimeServiceDepsParams,
|
||||
): void {
|
||||
registerAnkiJimakuIpcRuntimeService(
|
||||
createAnkiJimakuIpcRuntimeServiceDeps(params),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user