From 908e3853d37363d1e90fd114170772eb64348b53 Mon Sep 17 00:00:00 2001 From: Naveen Date: Thu, 5 Oct 2023 21:53:57 +0530 Subject: [PATCH] Don't schedule reminder for completed tasks --- .../simplemobiletools/calendar/pro/extensions/Context.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt index 7c4d7041d..bbb3d0b86 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt @@ -117,9 +117,15 @@ fun Context.scheduleNextEventReminder(event: Event, showToasts: Boolean) { val now = getNowSeconds() val reminderSeconds = validReminders.reversed().map { it.minutes * 60 } + val isTask = event.isTask() eventsHelper.getEvents(now, now + YEAR, event.id!!, false) { events -> if (events.isNotEmpty()) { for (curEvent in events) { + if (isTask && curEvent.isTaskCompleted()) { + // skip scheduling reminders for completed tasks + continue + } + for (curReminder in reminderSeconds) { if (curEvent.getEventStartTS() - curReminder > now) { scheduleEventIn((curEvent.getEventStartTS() - curReminder) * 1000L, curEvent, showToasts)