feat: simplify playPopSound setting check
This commit is contained in:
parent
5cf57a520c
commit
42c458a736
@ -111,7 +111,6 @@ import {formatDateLong, formatISO, formatDateSince} from '@/helpers/time/formatD
|
||||
import {colorIsDark} from '@/helpers/color/colorIsDark'
|
||||
import {useTaskStore} from '@/stores/tasks'
|
||||
import AssigneeList from '@/components/tasks/partials/AssigneeList.vue'
|
||||
import {useAuthStore} from '@/stores/auth'
|
||||
import {playPopSound} from '@/helpers/playPop'
|
||||
import {isEditorContentEmpty} from '@/helpers/editorContentEmpty'
|
||||
|
||||
@ -137,7 +136,7 @@ async function toggleTaskDone(task: ITask) {
|
||||
done: !task.done,
|
||||
})
|
||||
|
||||
if (updatedTask.done && useAuthStore().settings.frontendSettings.playSoundWhenDone) {
|
||||
if (updatedTask.done) {
|
||||
playPopSound()
|
||||
}
|
||||
} finally {
|
||||
|
@ -204,7 +204,6 @@ import FancyCheckbox from '@/components/input/FancyCheckbox.vue'
|
||||
import {error, success} from '@/message'
|
||||
import {useTaskStore} from '@/stores/tasks'
|
||||
import {useProjectStore} from '@/stores/projects'
|
||||
import {useAuthStore} from '@/stores/auth'
|
||||
import {playPopSound} from '@/helpers/playPop'
|
||||
|
||||
const props = defineProps({
|
||||
@ -380,7 +379,7 @@ async function createAndRelateTask(title: string) {
|
||||
async function toggleTaskDone(task: ITask) {
|
||||
await taskStore.update(task)
|
||||
|
||||
if (task.done && useAuthStore().settings.frontendSettings.playSoundWhenDone) {
|
||||
if (task.done) {
|
||||
playPopSound()
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,6 @@ import {useTaskStore} from '@/stores/tasks'
|
||||
import AssigneeList from '@/components/tasks/partials/AssigneeList.vue'
|
||||
import {useIntervalFn} from '@vueuse/core'
|
||||
import {playPopSound} from '@/helpers/playPop'
|
||||
import {useAuthStore} from '@/stores/auth'
|
||||
import {isEditorContentEmpty} from '@/helpers/editorContentEmpty'
|
||||
import {TASK_REPEAT_MODES} from '@/types/IRepeatMode'
|
||||
|
||||
@ -311,7 +310,7 @@ async function markAsDone(checked: boolean, wasReverted: boolean = false) {
|
||||
return
|
||||
}
|
||||
|
||||
if (checked && useAuthStore().settings.frontendSettings.playSoundWhenDone) {
|
||||
if (checked) {
|
||||
playPopSound()
|
||||
}
|
||||
emit('taskUpdated', newTask)
|
||||
|
@ -1,8 +1,13 @@
|
||||
import {useAuthStore} from '@/stores/auth'
|
||||
|
||||
import popSoundFile from '@/assets/audio/pop.mp3'
|
||||
|
||||
export const playSoundWhenDoneKey = 'playSoundWhenTaskDone'
|
||||
|
||||
export function playPopSound() {
|
||||
const playSoundWhenDone = useAuthStore().settings.frontendSettings.playSoundWhenDone
|
||||
|
||||
if (!playSoundWhenDone)
|
||||
return
|
||||
|
||||
try {
|
||||
const popSound = new Audio(popSoundFile)
|
||||
popSound.play()
|
||||
|
@ -879,7 +879,7 @@ function toggleTaskDone() {
|
||||
done: !task.value.done,
|
||||
}
|
||||
|
||||
if (newTask.done && authStore.settings.frontendSettings.playSoundWhenDone) {
|
||||
if (newTask.done) {
|
||||
playPopSound()
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user