diff --git a/app/src/main/java/com/todoroo/astrid/dao/TaskDao.kt b/app/src/main/java/com/todoroo/astrid/dao/TaskDao.kt index ac25e20d9..fe26b8201 100644 --- a/app/src/main/java/com/todoroo/astrid/dao/TaskDao.kt +++ b/app/src/main/java/com/todoroo/astrid/dao/TaskDao.kt @@ -13,6 +13,7 @@ import org.tasks.LocalBroadcastManager import org.tasks.data.SubtaskInfo import org.tasks.data.TaskContainer import org.tasks.data.TaskDao +import org.tasks.date.DateTimeUtils.newDateTime import org.tasks.db.SuspendDbUtils.eachChunk import org.tasks.jobs.WorkManager import org.tasks.location.GeofenceApi @@ -97,6 +98,9 @@ class TaskDao @Inject constructor( timerPlugin.stopTimer(task) } } + if (task.dueDate != original?.dueDate && newDateTime(task.dueDate).isAfterNow) { + notificationManager.cancel(task.id) + } if (completionDateModified || deletionDateModified) { geofenceApi.update(task.id) } diff --git a/app/src/main/java/org/tasks/dialogs/DateTimePicker.kt b/app/src/main/java/org/tasks/dialogs/DateTimePicker.kt index a7b71e770..3af5cf638 100644 --- a/app/src/main/java/org/tasks/dialogs/DateTimePicker.kt +++ b/app/src/main/java/org/tasks/dialogs/DateTimePicker.kt @@ -244,9 +244,6 @@ class DateTimePicker : BottomSheetDialogFragment() { if (taskId > 0) { lifecycleScope.launch(NonCancellable) { val task: Task = taskDao.fetch(taskId)!! - if (newDateTime(dueDate).isAfterNow) { - notificationManager.cancel(task.id) - } task.setDueDateAdjustingHideUntil(dueDate) taskDao.save(task) }