Fix calendar entry updates

pull/1785/head
Alex Baker 3 years ago
parent 5de75d2036
commit 0fcab69e5b

@ -18,6 +18,7 @@ import org.tasks.data.TaskContainer
import org.tasks.data.TaskDao
import org.tasks.date.DateTimeUtils.isAfterNow
import org.tasks.db.SuspendDbUtils.eachChunk
import org.tasks.jobs.WorkManager
import org.tasks.location.GeofenceApi
import org.tasks.notifications.NotificationManager
import org.tasks.preferences.Preferences
@ -34,6 +35,7 @@ class TaskDao @Inject constructor(
private val timerPlugin: TimerPlugin,
private val syncAdapters: SyncAdapters,
private val alarmService: AlarmService,
private val workManager: WorkManager,
) {
suspend fun fetch(id: Long): Task? = taskDao.fetch(id)
@ -112,6 +114,9 @@ class TaskDao @Inject constructor(
val deletionDateModified = task.deletionDate != original?.deletionDate ?: 0
val justCompleted = completionDateModified && task.isCompleted
val justDeleted = deletionDateModified && task.isDeleted
if (task.calendarURI?.isNotBlank() == true) {
workManager.updateCalendar(task)
}
coroutineScope {
launch(Dispatchers.Default) {
if (justCompleted || justDeleted) {

@ -69,8 +69,6 @@ class TaskCompleter @Inject internal constructor(
tasks.forEach {
if (completed && it.isRecurring) {
workManager.scheduleRepeat(it)
} else if (!it.calendarURI.isNullOrBlank()) {
workManager.updateCalendar(it)
}
}
if (completed && notificationManager.currentInterruptionFilter == INTERRUPTION_FILTER_ALL) {

Loading…
Cancel
Save