mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-06-10 03:13:32 -07:00
feat(notifications): add overlay notifications with position config
- 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
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { notifyUpdateAvailable } from './update-notifications';
|
||||
import type { OverlayNotificationPayload } from '../../../types/notification';
|
||||
|
||||
test('notifyUpdateAvailable routes system and osd notifications from config', async () => {
|
||||
test('notifyUpdateAvailable routes notification surfaces from config', async () => {
|
||||
const calls: string[] = [];
|
||||
const deps = {
|
||||
showSystemNotification: (title: string, body: string) => {
|
||||
@@ -11,19 +12,27 @@ test('notifyUpdateAvailable routes system and osd notifications from config', as
|
||||
showOsdNotification: async (message: string) => {
|
||||
calls.push(`osd:${message}`);
|
||||
},
|
||||
showOverlayNotification: (payload: OverlayNotificationPayload) => {
|
||||
calls.push(`overlay:${payload.title}:${payload.body ?? ''}`);
|
||||
},
|
||||
log: (message: string) => {
|
||||
calls.push(`log:${message}`);
|
||||
},
|
||||
};
|
||||
|
||||
await notifyUpdateAvailable({ notificationType: 'overlay', version: '0.15.0' }, deps);
|
||||
await notifyUpdateAvailable({ notificationType: 'system', version: '0.15.0' }, deps);
|
||||
await notifyUpdateAvailable({ notificationType: 'both', version: '0.15.0' }, deps);
|
||||
await notifyUpdateAvailable({ notificationType: 'osd-system', version: '0.15.0' }, deps);
|
||||
await notifyUpdateAvailable({ notificationType: 'none', version: '0.15.0' }, deps);
|
||||
|
||||
assert.deepEqual(calls, [
|
||||
'overlay:SubMiner update available:SubMiner v0.15.0 is available',
|
||||
'system:SubMiner update available:SubMiner v0.15.0 is available',
|
||||
'overlay:SubMiner update available:SubMiner v0.15.0 is available',
|
||||
'system:SubMiner update available:SubMiner v0.15.0 is available',
|
||||
'osd:SubMiner v0.15.0 is available',
|
||||
'system:SubMiner update available:SubMiner v0.15.0 is available',
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -39,6 +48,9 @@ test('notifyUpdateAvailable logs osd fallback when overlay notification fails',
|
||||
showOsdNotification: async () => {
|
||||
throw new Error('mpv disconnected');
|
||||
},
|
||||
showOverlayNotification: () => {
|
||||
calls.push('overlay');
|
||||
},
|
||||
log: (message) => {
|
||||
calls.push(message);
|
||||
},
|
||||
@@ -60,6 +72,9 @@ test('notifyUpdateAvailable logs non-error osd failures with thrown value', asyn
|
||||
showOsdNotification: async () => {
|
||||
throw 'mpv disconnected';
|
||||
},
|
||||
showOverlayNotification: () => {
|
||||
calls.push('overlay');
|
||||
},
|
||||
log: (message) => {
|
||||
calls.push(message);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user