e76d88e0c7
Import the existing Electron + React + TypeScript app as the version-control baseline before the scanner rework (C# input/capture sidecar, resolution-anchored layout profiles, OCR preprocessing, eval harness, rescan-merge, GOOD interop). Housekeeping in this commit: - Remove orphaned temp_inputhelper_block.ts (duplicate of the input-helper script). - Ignore .claude/scheduled_tasks.lock local session state. - Add .gitattributes to normalize line endings (LF in repo). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { ipcMain } from "electron";
|
|
import type {
|
|
BooleanResult,
|
|
FocusGenshinResult,
|
|
RuntimeInfo,
|
|
SaveSnapshotResult,
|
|
ScannerStatusPayload,
|
|
} from "../../src/types/global.js";
|
|
import type { AppSnapshot } from "../../src/types/domain.js";
|
|
|
|
interface AppCommandDependencies {
|
|
focusMainWindow: () => BooleanResult;
|
|
moveMainWindowOffGenshin: () => Promise<void>;
|
|
focusGenshinForScanStart: () => Promise<FocusGenshinResult>;
|
|
publishScannerStatus: (status: ScannerStatusPayload) => Promise<BooleanResult>;
|
|
getRuntimeInfo: () => Promise<RuntimeInfo>;
|
|
loadSnapshot: () => Promise<AppSnapshot | null>;
|
|
saveSnapshot: (snapshot: AppSnapshot) => Promise<SaveSnapshotResult>;
|
|
runMockScan: () => Promise<AppSnapshot | null>;
|
|
showOverlay: () => Promise<BooleanResult>;
|
|
hideOverlay: () => Promise<BooleanResult>;
|
|
}
|
|
|
|
export function registerAppHandlers({
|
|
focusMainWindow,
|
|
moveMainWindowOffGenshin,
|
|
focusGenshinForScanStart,
|
|
publishScannerStatus,
|
|
getRuntimeInfo,
|
|
loadSnapshot,
|
|
saveSnapshot,
|
|
runMockScan,
|
|
showOverlay,
|
|
hideOverlay,
|
|
}: AppCommandDependencies) {
|
|
ipcMain.handle("app:focusMainWindow", async () => focusMainWindow());
|
|
ipcMain.handle("automation:focusGenshin", async () => {
|
|
await moveMainWindowOffGenshin();
|
|
return focusGenshinForScanStart();
|
|
});
|
|
ipcMain.handle("scanner:publishStatus", async (_event, status: ScannerStatusPayload) => {
|
|
await publishScannerStatus(status);
|
|
return { ok: true };
|
|
});
|
|
ipcMain.handle("app:getRuntimeInfo", async () => getRuntimeInfo());
|
|
ipcMain.handle("snapshot:load", async () => loadSnapshot());
|
|
ipcMain.handle("snapshot:save", async (_event, snapshot: AppSnapshot) => saveSnapshot(snapshot));
|
|
ipcMain.handle("scan:runMock", async () => runMockScan());
|
|
ipcMain.handle("overlay:show", () => showOverlay());
|
|
ipcMain.handle("overlay:hide", () => hideOverlay());
|
|
}
|