WIP: feat: vibrate on marked as done #2665

Closed
dpschen wants to merge 1 commits from dpschen/frontend:feature/vibrate-on-marked-as-done into main
1 changed files with 7 additions and 0 deletions

View File

@ -152,6 +152,8 @@ import {useNamespaceStore} from '@/stores/namespaces'
import {useBaseStore} from '@/stores/base'
import {useTaskStore} from '@/stores/tasks'
const VIBRATION_PATTERN_SUCCESS = [100]
const props = defineProps({
theTask: {
type: Object as PropType<ITask>,
@ -244,6 +246,11 @@ async function markAsDone(checked: boolean) {
}
if (checked) {
// TODO: move to store, make configurable in user settings
if (window.navigator?.vibrate) {
// vibrate shortly to indicate success
window.navigator.vibrate(VIBRATION_PATTERN_SUCCESS)
}
setTimeout(updateFunc, 300) // Delay it to show the animation when marking a task as done
} else {
await updateFunc() // Don't delay it when un-marking it as it doesn't have an animation the other way around