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,32 +558,35 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.task.dueDate = this.dueDate
|
// We're doing the whole update in a nextTick because sometimes race conditions can occur when
|
||||||
this.task.hexColor = this.taskColor
|
// setting the due date on mobile which leads to no due date change being saved.
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.task.dueDate = this.dueDate
|
||||||
|
this.task.hexColor = this.taskColor
|
||||||
|
|
||||||
// If no end date is being set, but a start date and due date,
|
// If no end date is being set, but a start date and due date,
|
||||||
// use the due date as the end date
|
// use the due date as the end date
|
||||||
if (this.task.endDate === null && this.task.startDate !== null && this.task.dueDate !== null) {
|
if (this.task.endDate === null && this.task.startDate !== null && this.task.dueDate !== null) {
|
||||||
this.task.endDate = this.task.dueDate
|
this.task.endDate = this.task.dueDate
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$store.dispatch('tasks/update', this.task)
|
this.$store.dispatch('tasks/update', this.task)
|
||||||
.then(r => {
|
.then(r => {
|
||||||
this.$set(this, 'task', r)
|
this.$set(this, 'task', r)
|
||||||
let actions = []
|
let actions = []
|
||||||
if (undoCallback !== null) {
|
if (undoCallback !== null) {
|
||||||
actions = [{
|
actions = [{
|
||||||
title: 'Undo',
|
title: 'Undo',
|
||||||
callback: undoCallback,
|
callback: undoCallback,
|
||||||
}]
|
}]
|
||||||
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