properly reschedule repeating event if an exception has been added
This commit is contained in:
parent
41ab749abb
commit
8229735f63
|
@ -66,9 +66,10 @@ fun Context.scheduleAllEvents() {
|
|||
}
|
||||
}
|
||||
|
||||
fun Context.scheduleNextEventReminder(event: Event, dbHelper: DBHelper) {
|
||||
if (event.getReminders().isEmpty())
|
||||
fun Context.scheduleNextEventReminder(event: Event?, dbHelper: DBHelper) {
|
||||
if (event == null || event.getReminders().isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
val now = (System.currentTimeMillis() / 1000).toInt()
|
||||
val reminderSeconds = event.getReminders().reversed().map { it * 60 }
|
||||
|
|
|
@ -495,6 +495,9 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
fun addEventRepeatException(parentEventId: Int, occurrenceTS: Int) {
|
||||
fillExceptionValues(parentEventId, occurrenceTS) {
|
||||
mDb.insert(EXCEPTIONS_TABLE_NAME, null, it)
|
||||
|
||||
val parentEvent = getEventWithId(parentEventId)
|
||||
context.scheduleNextEventReminder(parentEvent, this)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue