Play a sound when marking a task as done
This commit is contained in:
parent
91a4a39527
commit
7f5140bbb4
8 changed files with 42 additions and 2 deletions
|
@ -34,7 +34,7 @@ http {
|
||||||
gzip_buffers 16 8k;
|
gzip_buffers 16 8k;
|
||||||
gzip_http_version 1.1;
|
gzip_http_version 1.1;
|
||||||
gzip_min_length 256;
|
gzip_min_length 256;
|
||||||
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml font/woff2 image/x-icon;
|
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml font/woff2 image/x-icon audio/wav;
|
||||||
|
|
||||||
# Expires map
|
# Expires map
|
||||||
map $sent_http_content_type $expires {
|
map $sent_http_content_type $expires {
|
||||||
|
@ -49,6 +49,7 @@ http {
|
||||||
font/woff2 max;
|
font/woff2 max;
|
||||||
image/svg+xml max;
|
image/svg+xml max;
|
||||||
image/x-icon max;
|
image/x-icon max;
|
||||||
|
audio/wav max;
|
||||||
~image/ max;
|
~image/ max;
|
||||||
~font/ max;
|
~font/ max;
|
||||||
}
|
}
|
||||||
|
|
BIN
public/audio/pop.wav
Normal file
BIN
public/audio/pop.wav
Normal file
Binary file not shown.
|
@ -4,7 +4,7 @@
|
||||||
// Cache assets
|
// Cache assets
|
||||||
workbox.routing.registerRoute(
|
workbox.routing.registerRoute(
|
||||||
// This regexp matches all files in precache-manifest
|
// This regexp matches all files in precache-manifest
|
||||||
new RegExp('.+\\.(css|json|js|svg|woff2|png|html|txt)$'),
|
new RegExp('.+\\.(css|json|js|svg|woff2|png|html|txt|wav)$'),
|
||||||
new workbox.strategies.StaleWhileRevalidate(),
|
new workbox.strategies.StaleWhileRevalidate(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,7 @@ import User from '../../misc/user'
|
||||||
import Fancycheckbox from '../../input/fancycheckbox'
|
import Fancycheckbox from '../../input/fancycheckbox'
|
||||||
import DeferTask from './defer-task'
|
import DeferTask from './defer-task'
|
||||||
import {closeWhenClickedOutside} from '@/helpers/closeWhenClickedOutside'
|
import {closeWhenClickedOutside} from '@/helpers/closeWhenClickedOutside'
|
||||||
|
import {playPop} from '@/helpers/playPop'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'singleTaskInList',
|
name: 'singleTaskInList',
|
||||||
|
@ -164,6 +165,9 @@ export default {
|
||||||
const updateFunc = () => {
|
const updateFunc = () => {
|
||||||
this.taskService.update(this.task)
|
this.taskService.update(this.task)
|
||||||
.then(t => {
|
.then(t => {
|
||||||
|
if(this.task.done) {
|
||||||
|
playPop()
|
||||||
|
}
|
||||||
this.task = t
|
this.task = t
|
||||||
this.$emit('task-updated', t)
|
this.$emit('task-updated', t)
|
||||||
this.success(
|
this.success(
|
||||||
|
|
11
src/helpers/playPop.js
Normal file
11
src/helpers/playPop.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
export const playSoundWhenDoneKey = 'playSoundWhenTaskDone'
|
||||||
|
|
||||||
|
export const playPop = () => {
|
||||||
|
const enabled = localStorage.getItem(playSoundWhenDoneKey) === 'true' || localStorage.getItem(playSoundWhenDoneKey) === null
|
||||||
|
if(!enabled) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const popSound = new Audio('/audio/pop.wav')
|
||||||
|
popSound.play()
|
||||||
|
}
|
|
@ -265,6 +265,7 @@ import Rights from '../../../models/rights.json'
|
||||||
import {LOADING, LOADING_MODULE} from '@/store/mutation-types'
|
import {LOADING, LOADING_MODULE} from '@/store/mutation-types'
|
||||||
import FilterPopup from '@/components/list/partials/filter-popup'
|
import FilterPopup from '@/components/list/partials/filter-popup'
|
||||||
import Dropdown from '@/components/misc/dropdown'
|
import Dropdown from '@/components/misc/dropdown'
|
||||||
|
import {playPop} from '@/helpers/playPop'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Kanban',
|
name: 'Kanban',
|
||||||
|
@ -421,6 +422,11 @@ export default {
|
||||||
this.$set(this.taskUpdating, task.id, true)
|
this.$set(this.taskUpdating, task.id, true)
|
||||||
task.done = !task.done
|
task.done = !task.done
|
||||||
this.$store.dispatch('tasks/update', task)
|
this.$store.dispatch('tasks/update', task)
|
||||||
|
.then(() => {
|
||||||
|
if(task.done) {
|
||||||
|
playPop()
|
||||||
|
}
|
||||||
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
this.error(e, this)
|
this.error(e, this)
|
||||||
})
|
})
|
||||||
|
|
|
@ -421,6 +421,7 @@ import ColorPicker from '../../components/input/colorPicker'
|
||||||
import attachmentUpload from '../../components/tasks/mixins/attachmentUpload'
|
import attachmentUpload from '../../components/tasks/mixins/attachmentUpload'
|
||||||
import heading from '@/components/tasks/partials/heading'
|
import heading from '@/components/tasks/partials/heading'
|
||||||
import Datepicker from '@/components/input/datepicker'
|
import Datepicker from '@/components/input/datepicker'
|
||||||
|
import {playPop} from '@/helpers/playPop'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TaskDetailView',
|
name: 'TaskDetailView',
|
||||||
|
@ -644,6 +645,11 @@ export default {
|
||||||
},
|
},
|
||||||
toggleTaskDone() {
|
toggleTaskDone() {
|
||||||
this.task.done = !this.task.done
|
this.task.done = !this.task.done
|
||||||
|
|
||||||
|
if(this.task.done) {
|
||||||
|
playPop()
|
||||||
|
}
|
||||||
|
|
||||||
this.saveTask(true, () => this.toggleTaskDone())
|
this.saveTask(true, () => this.toggleTaskDone())
|
||||||
},
|
},
|
||||||
setDescriptionChanged(e) {
|
setDescriptionChanged(e) {
|
||||||
|
|
|
@ -108,6 +108,12 @@
|
||||||
Send me Reminders for tasks via Email
|
Send me Reminders for tasks via Email
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="checkbox">
|
||||||
|
<input type="checkbox" v-model="playSoundWhenDone"/>
|
||||||
|
Play a sound when marking tasks as done
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<x-button
|
<x-button
|
||||||
:loading="userSettingsService.loading"
|
:loading="userSettingsService.loading"
|
||||||
|
@ -225,6 +231,7 @@ import TotpModel from '../../models/totp'
|
||||||
import TotpService from '../../services/totp'
|
import TotpService from '../../services/totp'
|
||||||
import UserSettingsService from '../../services/userSettings'
|
import UserSettingsService from '../../services/userSettings'
|
||||||
import UserSettingsModel from '../../models/userSettings'
|
import UserSettingsModel from '../../models/userSettings'
|
||||||
|
import {playSoundWhenDoneKey} from '@/helpers/playPop'
|
||||||
|
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
|
|
||||||
|
@ -249,6 +256,7 @@ export default {
|
||||||
totpConfirmPasscode: '',
|
totpConfirmPasscode: '',
|
||||||
totpDisableForm: false,
|
totpDisableForm: false,
|
||||||
totpDisablePassword: '',
|
totpDisablePassword: '',
|
||||||
|
playSoundWhenDone: false,
|
||||||
|
|
||||||
settings: UserSettingsModel,
|
settings: UserSettingsModel,
|
||||||
userSettingsService: UserSettingsService,
|
userSettingsService: UserSettingsService,
|
||||||
|
@ -273,6 +281,8 @@ export default {
|
||||||
emailRemindersEnabled: this.$store.state.auth.info.emailRemindersEnabled ?? false,
|
emailRemindersEnabled: this.$store.state.auth.info.emailRemindersEnabled ?? false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.playSoundWhenDone = localStorage.getItem(playSoundWhenDoneKey) === 'true' || localStorage.getItem(playSoundWhenDoneKey) === null
|
||||||
|
|
||||||
this.totpStatus()
|
this.totpStatus()
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -370,6 +380,8 @@ export default {
|
||||||
.catch(e => this.error(e, this))
|
.catch(e => this.error(e, this))
|
||||||
},
|
},
|
||||||
updateSettings() {
|
updateSettings() {
|
||||||
|
localStorage.setItem(playSoundWhenDoneKey, this.playSoundWhenDone)
|
||||||
|
|
||||||
this.userSettingsService.update(this.settings)
|
this.userSettingsService.update(this.settings)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$store.commit('auth/setUserSettings', this.settings)
|
this.$store.commit('auth/setUserSettings', this.settings)
|
||||||
|
|
Loading…
Reference in a new issue