Browse Source

refac: notification sound behaviour

Timothy Jaeryang Baek 4 months ago
parent
commit
996ade9090
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/lib/components/NotificationToast.svelte

+ 4 - 0
src/lib/components/NotificationToast.svelte

@@ -12,6 +12,10 @@
 	export let content: string;
 	export let content: string;
 
 
 	onMount(() => {
 	onMount(() => {
+		if (!navigator.userActivation.hasBeenActive) {
+			return;
+		}
+
 		if ($settings?.notificationSound ?? true) {
 		if ($settings?.notificationSound ?? true) {
 			const audio = new Audio(`/audio/notification.mp3`);
 			const audio = new Audio(`/audio/notification.mp3`);
 			audio.play();
 			audio.play();