From 812c0be413e8b12b509ca1e3db079a4e7db7b5ed Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Tue, 12 Nov 2024 00:37:18 -0600 Subject: [PATCH] Delete snoozed reminders when completing tasks --- app/src/main/java/com/todoroo/astrid/service/TaskCompleter.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/todoroo/astrid/service/TaskCompleter.kt b/app/src/main/java/com/todoroo/astrid/service/TaskCompleter.kt index 4ba34a590..c9e624e01 100644 --- a/app/src/main/java/com/todoroo/astrid/service/TaskCompleter.kt +++ b/app/src/main/java/com/todoroo/astrid/service/TaskCompleter.kt @@ -10,6 +10,7 @@ import com.todoroo.astrid.gcal.GCalHelper import com.todoroo.astrid.repeats.RepeatTaskHelper import dagger.hilt.android.qualifiers.ApplicationContext import org.tasks.LocalBroadcastManager +import org.tasks.data.dao.AlarmDao import org.tasks.data.dao.CaldavDao import org.tasks.data.db.Database import org.tasks.data.entity.Task @@ -32,6 +33,7 @@ class TaskCompleter @Inject internal constructor( private val caldavDao: CaldavDao, private val gCalHelper: GCalHelper, private val workManager: WorkManager, + private val alarmDao: AlarmDao, ) { suspend fun setComplete(taskId: Long, completed: Boolean = true) = taskDao @@ -70,6 +72,7 @@ class TaskCompleter @Inject internal constructor( val completed = completionDate > 0 val modified = currentTimeMillis() database.withTransaction { + alarmDao.deleteSnoozed(tasks.map { it.id }) tasks .map { it.copy(