mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
make event update callback nullable
This commit is contained in:
@@ -253,8 +253,7 @@ class CalDAVHandler(val context: Context) {
|
|||||||
existingEvent.id = 0
|
existingEvent.id = 0
|
||||||
if (existingEvent.hashCode() != event.hashCode() && title.isNotEmpty()) {
|
if (existingEvent.hashCode() != event.hashCode() && title.isNotEmpty()) {
|
||||||
event.id = originalEventId
|
event.id = originalEventId
|
||||||
context.dbHelper.update(event, false) {
|
context.dbHelper.update(event, false)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if the event is an exception from another events repeat rule, find the original parent event
|
// 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)
|
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 selectionArgs = arrayOf(event.id.toString())
|
||||||
val values = fillEventValues(event)
|
val values = fillEventValues(event)
|
||||||
val selection = "$COL_ID = ?"
|
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) {
|
if (updateAtCalDAV && event.source != SOURCE_SIMPLE_CALENDAR && context.config.caldavSync) {
|
||||||
CalDAVHandler(context).updateCalDAVEvent(event)
|
CalDAVHandler(context).updateCalDAVEvent(event)
|
||||||
}
|
}
|
||||||
callback()
|
callback?.invoke()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fillEventValues(event: Event): ContentValues {
|
private fun fillEventValues(event: Event): ContentValues {
|
||||||
|
@@ -140,7 +140,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.id = eventToUpdate.id
|
event.id = eventToUpdate.id
|
||||||
activity.dbHelper.update(event, true) {}
|
activity.dbHelper.update(event, true)
|
||||||
}
|
}
|
||||||
eventsImported++
|
eventsImported++
|
||||||
resetValues()
|
resetValues()
|
||||||
|
Reference in New Issue
Block a user