generated from nhcarrigan/template
feat: add notification sounds
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { derived } from "svelte/store";
|
||||
import { configStore } from "./config";
|
||||
import { soundPlayer } from "$lib/notifications";
|
||||
|
||||
// Sync notification settings with config
|
||||
export const notificationSettings = derived(configStore.config, ($config) => {
|
||||
soundPlayer.setEnabled($config.notifications_enabled);
|
||||
soundPlayer.setGlobalVolume($config.notification_volume);
|
||||
|
||||
return {
|
||||
enabled: $config.notifications_enabled,
|
||||
volume: $config.notification_volume,
|
||||
};
|
||||
});
|
||||
|
||||
// Helper to update notification settings
|
||||
export async function updateNotificationSettings(enabled: boolean, volume: number) {
|
||||
await configStore.updateConfig({
|
||||
notifications_enabled: enabled,
|
||||
notification_volume: volume,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user