refactor(notifications): extract routing predicates and fix pre-overlay

- Extract shouldShowOsd/Overlay/Desktop into notification-routing.ts (was duplicated in 3 files)
- Add resolveOverlayReadinessNotificationType: preserves system channel when overlay not ready (both→osd-system, system→system, overlay→osd)
- Route overlay loading status through showConfiguredStatusNotification instead of raw OSD
This commit is contained in:
2026-06-04 22:24:56 -07:00
parent 144373db52
commit 88fa9ba8b5
7 changed files with 94 additions and 48 deletions
+9 -5
View File
@@ -611,6 +611,7 @@ import {
notifyConfiguredStatus,
type ConfiguredStatusNotificationOptions,
} from './main/runtime/configured-status-notification';
import { resolveOverlayReadinessNotificationType } from './main/runtime/notification-routing';
import { createUpdateDialogPresenter } from './main/runtime/update/update-dialogs';
import {
runUpdateCliCommand,
@@ -3340,10 +3341,7 @@ function isVisibleOverlayContentReady(): boolean {
function getConfiguredStatusNotificationType(): NotificationType {
const configuredType = getResolvedConfig().ankiConnect.behavior.notificationType;
if (configuredType === 'none' || isVisibleOverlayContentReady()) {
return configuredType;
}
return 'osd';
return resolveOverlayReadinessNotificationType(configuredType, isVisibleOverlayContentReady());
}
function sendOverlayNotificationEvent(payload: OverlayNotificationEventPayload): void {
@@ -3417,7 +3415,13 @@ function showYoutubeFlowStatusNotification(message: string): void {
}
function showOverlayLoadingStatusNotification(message: string): void {
showMpvOsd(message);
showConfiguredStatusNotification(message, {
id: 'overlay-loading-status',
title: 'SubMiner',
variant: 'progress',
persistent: true,
desktop: false,
});
}
const buildBroadcastRuntimeOptionsChangedMainDepsHandler =