fix #735, handle a new way of adding repetition exceptions at CalDAV

This commit is contained in:
tibbi 2019-01-07 20:38:56 +01:00
parent 79f8b3dade
commit f19636e034

View file

@ -179,6 +179,7 @@ class CalDAVHelper(val context: Context) {
CalendarContract.Events.DTSTART,
CalendarContract.Events.DTEND,
CalendarContract.Events.DURATION,
CalendarContract.Events.EXDATE,
CalendarContract.Events.ALL_DAY,
CalendarContract.Events.RRULE,
CalendarContract.Events.ORIGINAL_ID,
@ -241,6 +242,12 @@ class CalDAVHelper(val context: Context) {
}
}
// some calendars add repeatable event exceptions with using the "exdate" field, not by creating a child event that is an exception
val exdate = cursor.getStringValue(CalendarContract.Events.EXDATE)
if (exdate != null) {
event.repetitionExceptions.add(exdate.substring(0, 8))
}
if (importIdsMap.containsKey(event.importId)) {
val existingEvent = importIdsMap[importId]
val originalEventId = existingEvent!!.id
@ -415,6 +422,7 @@ class CalDAVHelper(val context: Context) {
put(CalendarContract.Events.ORIGINAL_ID, event.getCalDAVEventId())
put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().id.toString())
put(CalendarContract.Events.ORIGINAL_INSTANCE_TIME, occurrenceTS * 1000L)
put(CalendarContract.Events.EXDATE, Formatter.getDayCodeFromTS(occurrenceTS))
}
}