feat(settings): separate toasts and system notifications toggles
- Split "Notifications" setting into "In-app Toasts" and "System Notifications" - In-app toasts control the toast messages within the app - System notifications control desktop notifications on track change - Both settings persist to localStorage and load on app startup - Migrates old 'qbz-notifications-enabled' key to new 'qbz-toasts-enabled' feat(library): add stop scanning button - Add library_stop_scan command in Rust backend - Add cancel flag (AtomicBool) to LibraryState - Check cancel flag during scan loop for both CUE and audio files - Add "Cancelled" status to ScanStatus enum - Add stop button in LocalLibraryView scan progress UI - Button appears red on hover for clear visibility cc
This commit is contained in:
1 parent
7c42395598
commit
b8e3bca6f8
9 files changed
+149
-27
No files matched your search
@@ -206,6 +206,33 @@ function normalizeCoverUrlForMetadata(coverUrl?: string | null): string | null {
|
||||
|
||||
// ============ System Notifications ============
|
||||
|
||||
let systemNotificationsEnabled = true;
|
||||
|
||||
/**
|
||||
* Load system notifications preference from localStorage
|
||||
*/
|
||||
export function loadSystemNotificationsPreference(): void {
|
||||
const saved = localStorage.getItem('qbz-system-notifications-enabled');
|
||||
if (saved !== null) {
|
||||
systemNotificationsEnabled = saved === 'true';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set system notifications enabled/disabled
|
||||
*/
|
||||
export function setSystemNotificationsEnabled(enabled: boolean): void {
|
||||
systemNotificationsEnabled = enabled;
|
||||
localStorage.setItem('qbz-system-notifications-enabled', String(enabled));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get system notifications enabled state
|
||||
*/
|
||||
export function getSystemNotificationsEnabled(): boolean {
|
||||
return systemNotificationsEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show system notification for track change
|
||||
*/
|
||||
@@ -217,6 +244,11 @@ export async function showTrackNotification(
|
||||
bitDepth?: number,
|
||||
sampleRate?: number
|
||||
): Promise<void> {
|
||||
// Skip if system notifications are disabled
|
||||
if (!systemNotificationsEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await invoke('show_track_notification', {
|
||||
title,
|
||||
|
||||
Reference in new issue
Block a user