From f19636e034d893d93fef2b4d530a82d43c1d729b Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 7 Jan 2019 20:38:56 +0100 Subject: [PATCH] fix #735, handle a new way of adding repetition exceptions at CalDAV --- .../calendar/pro/helpers/CalDAVHelper.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt index 0b2f2a50f..e349b4530 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt @@ -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)) } }