feat(04-01): refactor all notify() call sites to use structured NotificationOptions
- Change ipc-support.ts notify() from (title, body) to (options: NotificationOptions) - Wire createNotificationService in bootstrap-application.ts with lazy service graph refs - Update all 12 call sites with entity context, urgency, navigation, and batch keys - Update dependency interfaces in service-graph, worker, orchestration, automation, updater, desktop-shell - No string-based notify() calls remain in src/main/ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9ebb489644
commit
667ac48aa5
8 files changed
+113
-34
No files matched your search
@@ -3,6 +3,7 @@ import { ipcMain, Notification } from "electron";
|
||||
import { ZodError } from "zod";
|
||||
import type { DesktopEvent } from "@shared/types";
|
||||
import type { DesktopResult } from "@shared/contracts";
|
||||
import type { NotificationOptions } from "./notification-service";
|
||||
|
||||
interface IpcSupportDependencies {
|
||||
isDev: boolean;
|
||||
@@ -15,6 +16,7 @@ interface IpcSupportDependencies {
|
||||
hasCompany: (companyId: string) => boolean;
|
||||
belongsToCompany: (table: string, id: string, companyId: string) => boolean;
|
||||
};
|
||||
notificationService?: { notify: (options: NotificationOptions) => void };
|
||||
}
|
||||
|
||||
function isTrustedRendererUrl(url: string, isDev: boolean, devServerOrigin: string | null) {
|
||||
@@ -39,6 +41,7 @@ export function createIpcSupport({
|
||||
logger,
|
||||
getMainWindow,
|
||||
getDb,
|
||||
notificationService,
|
||||
}: IpcSupportDependencies) {
|
||||
function sanitizeHandlerError(error: unknown) {
|
||||
if (error instanceof ZodError) {
|
||||
@@ -102,9 +105,12 @@ export function createIpcSupport({
|
||||
emitEvent({ type: "domain-changed" });
|
||||
}
|
||||
|
||||
function notify(title: string, body: string) {
|
||||
if (Notification.isSupported()) {
|
||||
new Notification({ title, body }).show();
|
||||
function notify(options: NotificationOptions) {
|
||||
if (notificationService) {
|
||||
notificationService.notify(options);
|
||||
} else if (Notification.isSupported()) {
|
||||
// Fallback for early bootstrap before notification service is wired
|
||||
new Notification({ title: options.title, body: options.body }).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user