mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-13 16:46:08 -08:00
feat(controller): route status messages through notifications
- Send controller connected and disabled messages over a new IPC channel so they follow ankiConnect.behavior.notificationType - Remove the separate controller status toast from the overlay - Only announce connected controllers when controller.enabled is on - Announce a controller again after it reconnects, and update usage docs
This commit is contained in:
15 files changed
+84
-167
No files matched your search
@@ -92,6 +92,7 @@ export interface IpcServiceDeps {
|
||||
/** The overlay reports the controller it is reading (null when none). */
|
||||
reportActiveController: (gamepadId: string | null) => void;
|
||||
getActiveControllerId: () => string | null;
|
||||
notifyControllerStatus: (message: string) => void;
|
||||
getSecondarySubMode: () => unknown;
|
||||
getCurrentSecondarySub: () => string;
|
||||
focusMainWindow: () => void;
|
||||
@@ -362,6 +363,7 @@ export interface IpcDepsRuntimeOptions {
|
||||
/** The overlay reports the controller it is reading (null when none). */
|
||||
reportActiveController: (gamepadId: string | null) => void;
|
||||
getActiveControllerId: () => string | null;
|
||||
notifyControllerStatus: (message: string) => void;
|
||||
getSecondarySubMode: () => unknown;
|
||||
getMpvClient: () => MpvClientLike | null;
|
||||
focusMainWindow: () => void;
|
||||
@@ -440,6 +442,7 @@ export function createIpcDepsRuntime(options: IpcDepsRuntimeOptions): IpcService
|
||||
saveControllerConfig: options.saveControllerConfig,
|
||||
reportActiveController: options.reportActiveController,
|
||||
getActiveControllerId: options.getActiveControllerId,
|
||||
notifyControllerStatus: options.notifyControllerStatus,
|
||||
getSecondarySubMode: options.getSecondarySubMode,
|
||||
getCurrentSecondarySub: () => options.getMpvClient()?.currentSecondarySubText || '',
|
||||
focusMainWindow: () => {
|
||||
@@ -777,6 +780,11 @@ export function registerIpcHandlers(deps: IpcServiceDeps, ipc: IpcMainRegistrar
|
||||
return deps.getActiveControllerId();
|
||||
});
|
||||
|
||||
ipc.on(IPC_CHANNELS.command.notifyControllerStatus, (_event: unknown, message: unknown) => {
|
||||
if (typeof message !== 'string' || message.trim().length === 0) return;
|
||||
deps.notifyControllerStatus(message);
|
||||
});
|
||||
|
||||
ipc.handle(IPC_CHANNELS.request.getSecondarySubMode, () => {
|
||||
return deps.getSecondarySubMode();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user