fix(tasks): play pop sound directly and not from store
This solves two problems: 1. Previously, changing anything on a done task would play the pop sound all the time, because the store only knew the new done status was "done" and not if it was done previously already. 2. Safari will prevent playing a sound without user interaction. This means the user has to interact directly with the method playing the sound which was not the case when the sound was played from the store. Resolves https://kolaente.dev/vikunja/frontend/issues/3292
This commit is contained in:
@ -499,6 +499,8 @@ import {success} from '@/message'
|
||||
import type {Action as MessageAction} from '@/message'
|
||||
import {useProjectStore} from '@/stores/projects'
|
||||
import {TASK_REPEAT_MODES} from '@/types/IRepeatMode'
|
||||
import {useAuthStore} from '@/stores/auth'
|
||||
import {playPopSound} from '@/helpers/playPop'
|
||||
|
||||
const {
|
||||
taskId,
|
||||
@ -735,6 +737,10 @@ function toggleTaskDone() {
|
||||
done: !task.value.done,
|
||||
}
|
||||
|
||||
if (newTask.done && useAuthStore().settings.frontendSettings.playSoundWhenDone) {
|
||||
playPopSound()
|
||||
}
|
||||
|
||||
saveTask(
|
||||
newTask,
|
||||
toggleTaskDone,
|
||||
|
Reference in New Issue
Block a user