From e5b257aa43a63c96823b8d1764015011d580fef1 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Wed, 9 Nov 2022 23:14:32 +0100 Subject: [PATCH] feat: vibrate on marked as done --- src/components/tasks/partials/singleTaskInList.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/tasks/partials/singleTaskInList.vue b/src/components/tasks/partials/singleTaskInList.vue index 7d2a4d581..51629dfda 100644 --- a/src/components/tasks/partials/singleTaskInList.vue +++ b/src/components/tasks/partials/singleTaskInList.vue @@ -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, @@ -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 -- 2.40.1