From ca89d5fc279795ecce8d70f2b7b23394a9e08d31 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 13 Jun 2019 11:15:59 +0200 Subject: [PATCH] avoid readding deleted CalDAV synced events --- .../calendar/pro/helpers/CalDAVHelper.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 13ff0e810..5311ca232 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 @@ -186,7 +186,8 @@ class CalDAVHelper(val context: Context) { CalendarContract.Events.RRULE, CalendarContract.Events.ORIGINAL_ID, CalendarContract.Events.ORIGINAL_INSTANCE_TIME, - CalendarContract.Events.EVENT_LOCATION) + CalendarContract.Events.EVENT_LOCATION, + CalendarContract.Events.DELETED) val selection = "${CalendarContract.Events.CALENDAR_ID} = $calendarId" var cursor: Cursor? = null @@ -194,6 +195,11 @@ class CalDAVHelper(val context: Context) { cursor = context.contentResolver.query(uri, projection, selection, null, null) if (cursor?.moveToFirst() == true) { do { + val deleted = cursor.getIntValue(CalendarContract.Events.DELETED) + if (deleted == 1) { + continue + } + val id = cursor.getLongValue(CalendarContract.Events._ID) val title = cursor.getStringValue(CalendarContract.Events.TITLE) ?: "" val description = cursor.getStringValue(CalendarContract.Events.DESCRIPTION) ?: ""