feat: vibrate on marked as done
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Dominik Pschenitschni 2022-11-09 23:14:32 +01:00
parent 94508173dc
commit e5b257aa43
Signed by: dpschen
GPG Key ID: B257AC0149F43A77
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