Fix due date changes not saved on mobile
This commit is contained in:
parent
ff06f808ab
commit
2c6ec6ec35
2 changed files with 44 additions and 26 deletions
|
@ -142,6 +142,11 @@ export default class TaskModel extends AbstractModel {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof navigator.serviceWorker === 'undefined') {
|
||||||
|
console.debug('Service Worker not available')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const registration = await navigator.serviceWorker.getRegistration()
|
const registration = await navigator.serviceWorker.getRegistration()
|
||||||
if (typeof registration === 'undefined') {
|
if (typeof registration === 'undefined') {
|
||||||
return
|
return
|
||||||
|
@ -157,6 +162,10 @@ export default class TaskModel extends AbstractModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
async scheduleNotification(date) {
|
async scheduleNotification(date) {
|
||||||
|
if (typeof navigator.serviceWorker === 'undefined') {
|
||||||
|
console.debug('Service Worker not available')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (date < new Date()) {
|
if (date < new Date()) {
|
||||||
console.debug('Date is in the past, not scheduling a notification. Date is ', date)
|
console.debug('Date is in the past, not scheduling a notification. Date is ', date)
|
||||||
|
|
|
@ -9,8 +9,14 @@
|
||||||
{{ task.identifier }}
|
{{ task.identifier }}
|
||||||
</h1>
|
</h1>
|
||||||
<div class="is-done" v-if="task.done">Done</div>
|
<div class="is-done" v-if="task.done">Done</div>
|
||||||
<h1 @focusout="saveTaskOnChange()" @keyup.ctrl.enter="saveTaskOnChange()" class="title input" contenteditable="true"
|
<h1
|
||||||
ref="taskTitle">{{ task.title }}</h1>
|
@focusout="saveTaskOnChange()"
|
||||||
|
@keyup.ctrl.enter="saveTaskOnChange()"
|
||||||
|
class="title input"
|
||||||
|
contenteditable="true"
|
||||||
|
ref="taskTitle">
|
||||||
|
{{ task.title }}
|
||||||
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<h6 class="subtitle" v-if="parent && parent.namespace && parent.list">
|
<h6 class="subtitle" v-if="parent && parent.namespace && parent.list">
|
||||||
{{ parent.namespace.title }} >
|
{{ parent.namespace.title }} >
|
||||||
|
@ -552,6 +558,9 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We're doing the whole update in a nextTick because sometimes race conditions can occur when
|
||||||
|
// setting the due date on mobile which leads to no due date change being saved.
|
||||||
|
this.$nextTick(() => {
|
||||||
this.task.dueDate = this.dueDate
|
this.task.dueDate = this.dueDate
|
||||||
this.task.hexColor = this.taskColor
|
this.task.hexColor = this.taskColor
|
||||||
|
|
||||||
|
@ -572,12 +581,12 @@ export default {
|
||||||
}]
|
}]
|
||||||
this.success({message: 'The task was saved successfully.'}, this, actions)
|
this.success({message: 'The task was saved successfully.'}, this, actions)
|
||||||
}
|
}
|
||||||
this.dueDate = this.task.dueDate
|
|
||||||
this.setActiveFields()
|
this.setActiveFields()
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
this.error(e, this)
|
this.error(e, this)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
setFieldActive(fieldName) {
|
setFieldActive(fieldName) {
|
||||||
this.activeFields[fieldName] = true
|
this.activeFields[fieldName] = true
|
||||||
|
|
Loading…
Reference in a new issue