move the fetching of local google events in a separate function

This commit is contained in:
tibbi 2017-07-23 21:57:54 +02:00
parent 038d00ed0a
commit c9ec5c9606
1 changed files with 6 additions and 2 deletions

View File

@ -381,10 +381,14 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
deleteEvents(childIds.toTypedArray())
}
fun deleteGoogleSyncEvents() {
fun getGoogleSyncEvents(): List<Event> {
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)
}