feat: vibrate on marked as done
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
94508173dc
commit
e5b257aa43
|
@ -152,6 +152,8 @@ import {useNamespaceStore} from '@/stores/namespaces'
|
||||||
import {useBaseStore} from '@/stores/base'
|
import {useBaseStore} from '@/stores/base'
|
||||||
import {useTaskStore} from '@/stores/tasks'
|
import {useTaskStore} from '@/stores/tasks'
|
||||||
|
|
||||||
|
const VIBRATION_PATTERN_SUCCESS = [100]
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
theTask: {
|
theTask: {
|
||||||
type: Object as PropType<ITask>,
|
type: Object as PropType<ITask>,
|
||||||
|
@ -244,6 +246,11 @@ async function markAsDone(checked: boolean) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checked) {
|
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
|
setTimeout(updateFunc, 300) // Delay it to show the animation when marking a task as done
|
||||||
} else {
|
} else {
|
||||||
await updateFunc() // Don't delay it when un-marking it as it doesn't have an animation the other way around
|
await updateFunc() // Don't delay it when un-marking it as it doesn't have an animation the other way around
|
||||||
|
|
Reference in New Issue