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,
|
createCliCommandDepsRuntimeService,
|
||||||
createOverlayManagerService,
|
createOverlayManagerService,
|
||||||
createFieldGroupingOverlayRuntimeService,
|
createFieldGroupingOverlayRuntimeService,
|
||||||
createIpcDepsRuntimeService,
|
|
||||||
createNumericShortcutRuntimeService,
|
createNumericShortcutRuntimeService,
|
||||||
createOverlayContentMeasurementStoreService,
|
createOverlayContentMeasurementStoreService,
|
||||||
createOverlayShortcutRuntimeHandlers,
|
createOverlayShortcutRuntimeHandlers,
|
||||||
@@ -124,9 +123,7 @@ import {
|
|||||||
openYomitanSettingsWindow,
|
openYomitanSettingsWindow,
|
||||||
playNextSubtitleRuntimeService,
|
playNextSubtitleRuntimeService,
|
||||||
refreshOverlayShortcutsRuntimeService,
|
refreshOverlayShortcutsRuntimeService,
|
||||||
registerAnkiJimakuIpcRuntimeService,
|
|
||||||
registerGlobalShortcutsService,
|
registerGlobalShortcutsService,
|
||||||
registerIpcHandlersService,
|
|
||||||
registerOverlayShortcutsService,
|
registerOverlayShortcutsService,
|
||||||
replayCurrentSubtitleRuntimeService,
|
replayCurrentSubtitleRuntimeService,
|
||||||
resolveJimakuApiKeyService,
|
resolveJimakuApiKeyService,
|
||||||
@@ -163,9 +160,7 @@ import type { SubsyncRuntimeDeps } from "./core/services/subsync-runner-service"
|
|||||||
import { applyRuntimeOptionResultRuntimeService } from "./core/services/runtime-options-ipc-service";
|
import { applyRuntimeOptionResultRuntimeService } from "./core/services/runtime-options-ipc-service";
|
||||||
import {
|
import {
|
||||||
createRuntimeOptionsIpcDeps,
|
createRuntimeOptionsIpcDeps,
|
||||||
createAnkiJimakuIpcRuntimeServiceDeps,
|
|
||||||
createCliCommandRuntimeServiceDeps,
|
createCliCommandRuntimeServiceDeps,
|
||||||
createMainIpcRuntimeServiceDeps,
|
|
||||||
createSubsyncRuntimeDeps,
|
createSubsyncRuntimeDeps,
|
||||||
} from "./main/dependencies";
|
} from "./main/dependencies";
|
||||||
import {
|
import {
|
||||||
@@ -173,6 +168,10 @@ import {
|
|||||||
createAppReadyRuntimeDeps as createAppReadyRuntimeDepsBuilder,
|
createAppReadyRuntimeDeps as createAppReadyRuntimeDepsBuilder,
|
||||||
} from "./main/app-lifecycle";
|
} from "./main/app-lifecycle";
|
||||||
import { handleMpvCommandFromIpcRuntime } from "./main/ipc-mpv-command";
|
import { handleMpvCommandFromIpcRuntime } from "./main/ipc-mpv-command";
|
||||||
|
import {
|
||||||
|
registerAnkiJimakuIpcRuntimeServices,
|
||||||
|
registerMainIpcRuntimeServices,
|
||||||
|
} from "./main/ipc-runtime";
|
||||||
import { createStartupBootstrapRuntimeDeps } from "./main/startup";
|
import { createStartupBootstrapRuntimeDeps } from "./main/startup";
|
||||||
import {
|
import {
|
||||||
ConfigService,
|
ConfigService,
|
||||||
@@ -1532,9 +1531,7 @@ const runtimeOptionsIpcDeps = createRuntimeOptionsIpcDeps({
|
|||||||
showMpvOsd,
|
showMpvOsd,
|
||||||
});
|
});
|
||||||
|
|
||||||
registerIpcHandlersService(
|
registerMainIpcRuntimeServices({
|
||||||
createIpcDepsRuntimeService(
|
|
||||||
createMainIpcRuntimeServiceDeps({
|
|
||||||
getInvisibleWindow: () => overlayManager.getInvisibleWindow(),
|
getInvisibleWindow: () => overlayManager.getInvisibleWindow(),
|
||||||
getMainWindow: () => overlayManager.getMainWindow(),
|
getMainWindow: () => overlayManager.getMainWindow(),
|
||||||
getVisibleOverlayVisibility: () => overlayManager.getVisibleOverlayVisible(),
|
getVisibleOverlayVisibility: () => overlayManager.getVisibleOverlayVisible(),
|
||||||
@@ -1567,12 +1564,9 @@ registerIpcHandlersService(
|
|||||||
reportOverlayContentBounds: (payload: unknown) => {
|
reportOverlayContentBounds: (payload: unknown) => {
|
||||||
overlayContentMeasurementStore.report(payload);
|
overlayContentMeasurementStore.report(payload);
|
||||||
},
|
},
|
||||||
}),
|
});
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
registerAnkiJimakuIpcRuntimeService(
|
registerAnkiJimakuIpcRuntimeServices({
|
||||||
createAnkiJimakuIpcRuntimeServiceDeps({
|
|
||||||
patchAnkiConnectEnabled: (enabled: boolean) => {
|
patchAnkiConnectEnabled: (enabled: boolean) => {
|
||||||
configService.patchRawConfig({ ankiConnect: { enabled } });
|
configService.patchRawConfig({ ankiConnect: { enabled } });
|
||||||
},
|
},
|
||||||
@@ -1608,5 +1602,4 @@ registerAnkiJimakuIpcRuntimeService(
|
|||||||
destPath: string,
|
destPath: string,
|
||||||
headers: Record<string, string>,
|
headers: Record<string, string>,
|
||||||
) => downloadToFile(url, destPath, headers),
|
) => 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