浏览代码

refac: notification sound behaviour

Timothy Jaeryang Baek 4 月之前
父节点
当前提交
996ade9090
共有 1 个文件被更改,包括 4 次插入0 次删除
  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();