mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-17 04:10:45 +01:00
make event update callback nullable
This commit is contained in:
parent
7fb3a95455
commit
30ee706176
@ -253,8 +253,7 @@ class CalDAVHandler(val context: Context) {
|
||||
existingEvent.id = 0
|
||||
if (existingEvent.hashCode() != event.hashCode() && title.isNotEmpty()) {
|
||||
event.id = originalEventId
|
||||
context.dbHelper.update(event, false) {
|
||||
}
|
||||
context.dbHelper.update(event, false)
|
||||
}
|
||||
} else {
|
||||
// if the event is an exception from another events repeat rule, find the original parent event
|
||||
|
@ -226,7 +226,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
||||
callback(event.id)
|
||||
}
|
||||
|
||||
fun update(event: Event, updateAtCalDAV: Boolean, callback: () -> Unit) {
|
||||
fun update(event: Event, updateAtCalDAV: Boolean, callback: (() -> Unit)? = null) {
|
||||
val selectionArgs = arrayOf(event.id.toString())
|
||||
val values = fillEventValues(event)
|
||||
val selection = "$COL_ID = ?"
|
||||
@ -245,7 +245,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
||||
if (updateAtCalDAV && event.source != SOURCE_SIMPLE_CALENDAR && context.config.caldavSync) {
|
||||
CalDAVHandler(context).updateCalDAVEvent(event)
|
||||
}
|
||||
callback()
|
||||
callback?.invoke()
|
||||
}
|
||||
|
||||
private fun fillEventValues(event: Event): ContentValues {
|
||||
|
@ -140,7 +140,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
||||
}
|
||||
} else {
|
||||
event.id = eventToUpdate.id
|
||||
activity.dbHelper.update(event, true) {}
|
||||
activity.dbHelper.update(event, true)
|
||||
}
|
||||
eventsImported++
|
||||
resetValues()
|
||||
|
Loading…
x
Reference in New Issue
Block a user