mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-06-09 15:13:32 -07:00
9247248d48
- Add Catppuccin Macchiato overlay notification stack with 3s transient timeout - Add `notifications.overlayPosition` config (top-left | top | top-right) - Route startup tokenization and subtitle annotation status through configured surfaces - Deduplicate rapid subtitle mode toggle notifications - Change `both` to mean overlay + system; add `osd-system` as legacy alias for old behavior - Keep `osd`/`osd-system` as config-file-only legacy values; Settings UI offers overlay/system/both/none
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import type { UpdateNotificationType } from '../../../types/config';
|
|
import type { OverlayNotificationPayload } from '../../../types/notification';
|
|
|
|
export interface UpdateNotificationDeps {
|
|
showSystemNotification: (title: string, body: string) => void;
|
|
showOverlayNotification: (payload: OverlayNotificationPayload) => void;
|
|
showOsdNotification: (message: string) => void | Promise<void>;
|
|
log: (message: string) => void;
|
|
}
|
|
|
|
export async function notifyUpdateAvailable(
|
|
options: { notificationType: UpdateNotificationType; version: string },
|
|
deps: UpdateNotificationDeps,
|
|
): Promise<void> {
|
|
if (options.notificationType === 'none') return;
|
|
|
|
const message = `SubMiner v${options.version} is available`;
|
|
if (options.notificationType === 'overlay' || options.notificationType === 'both') {
|
|
deps.showOverlayNotification({
|
|
title: 'SubMiner update available',
|
|
body: message,
|
|
variant: 'info',
|
|
});
|
|
}
|
|
if (options.notificationType === 'osd' || options.notificationType === 'osd-system') {
|
|
try {
|
|
await deps.showOsdNotification(message);
|
|
} catch (error) {
|
|
const reason = error instanceof Error ? error.message : String(error);
|
|
deps.log(`Update OSD notification failed: ${reason}`);
|
|
}
|
|
}
|
|
if (
|
|
options.notificationType === 'system' ||
|
|
options.notificationType === 'both' ||
|
|
options.notificationType === 'osd-system'
|
|
) {
|
|
deps.showSystemNotification('SubMiner update available', message);
|
|
}
|
|
}
|