From c9ec5c96069e0f397b49c1f9e48b11eb6b6f1674 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 23 Jul 2017 21:57:54 +0200 Subject: [PATCH] move the fetching of local google events in a separate function --- .../com/simplemobiletools/calendar/helpers/DBHelper.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt index a6701926e..e37138362 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt @@ -381,10 +381,14 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont deleteEvents(childIds.toTypedArray()) } - fun deleteGoogleSyncEvents() { + fun getGoogleSyncEvents(): List { val selection = "$COL_SOURCE = $SOURCE_GOOGLE_SYNC" val cursor = getEventsCursor(selection) - val events = fillEvents(cursor) + return fillEvents(cursor) + } + + fun deleteGoogleSyncEvents() { + val events = getGoogleSyncEvents() val eventIDs = Array(events.size, { i -> (events[i].id.toString()) }) deleteEvents(eventIDs, false) }