import type { UpdateNotificationType } from '../../../types/config'; export interface UpdateNotificationDeps { showSystemNotification: (title: string, body: string) => void; showOsdNotification: (message: string) => void | Promise; log: (message: string) => void; } export async function notifyUpdateAvailable( options: { notificationType: UpdateNotificationType; version: string }, deps: UpdateNotificationDeps, ): Promise { if (options.notificationType === 'none') return; const message = `SubMiner v${options.version} is available`; if (options.notificationType === 'system' || options.notificationType === 'both') { deps.showSystemNotification('SubMiner update available', message); } if (options.notificationType === 'osd' || options.notificationType === 'both') { try { await deps.showOsdNotification(message); } catch (error) { const reason = error instanceof Error ? error.message : String(error); deps.log(`Update OSD notification failed: ${reason}`); } } }