add an empty helper function for updating caldav events
This commit is contained in:
parent
3e6b64c4b6
commit
ca8252fc13
4 changed files with 16 additions and 9 deletions
|
@ -532,7 +532,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||
if (mRepeatInterval > 0 && wasRepeatable) {
|
||||
EditRepeatingEventDialog(this) {
|
||||
if (it) {
|
||||
dbHelper.update(mEvent) {
|
||||
dbHelper.update(mEvent, true) {
|
||||
eventUpdated()
|
||||
}
|
||||
} else {
|
||||
|
@ -546,7 +546,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
dbHelper.update(mEvent) {
|
||||
dbHelper.update(mEvent, true) {
|
||||
eventUpdated()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,11 +142,11 @@ class SettingsActivity : SimpleActivity() {
|
|||
|
||||
Thread({
|
||||
if (newCalendarIds.isNotEmpty()) {
|
||||
val eventTypeNames = dbHelper.fetchEventTypes().map { it.title.toLowerCase() } as ArrayList<String>
|
||||
val existingEventTypeNames = dbHelper.fetchEventTypes().map { it.title.toLowerCase() } as ArrayList<String>
|
||||
getSyncedCalDAVCalendars().forEach {
|
||||
if (!eventTypeNames.contains(it.displayName.toLowerCase())) {
|
||||
if (!existingEventTypeNames.contains(it.displayName.toLowerCase())) {
|
||||
val eventType = EventType(0, it.displayName, it.color, it.id)
|
||||
eventTypeNames.add(it.displayName.toLowerCase())
|
||||
existingEventTypeNames.add(it.displayName.toLowerCase())
|
||||
dbHelper.insertEventType(eventType)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ class CalDAVEventsHandler(val context: Context) {
|
|||
existingEvent.id = 0
|
||||
if (existingEvent.hashCode() != event.hashCode()) {
|
||||
event.id = originalEventId
|
||||
context.dbHelper.update(event) {
|
||||
context.dbHelper.update(event, false) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -149,7 +149,7 @@ class CalDAVEventsHandler(val context: Context) {
|
|||
}
|
||||
}
|
||||
|
||||
fun addCalDAVEvent(event: Event) {
|
||||
fun insertCalDAVEvent(event: Event) {
|
||||
val calendarId = event.getCalDAVCalendarId()
|
||||
val uri = CalendarContract.Events.CONTENT_URI
|
||||
val calendarValues = ContentValues().apply {
|
||||
|
@ -187,6 +187,10 @@ class CalDAVEventsHandler(val context: Context) {
|
|||
context.dbHelper.updateEventImportIdAndSource(event.id, importId, "$CALDAV-$calendarId")
|
||||
}
|
||||
|
||||
fun updateCalDAVEvent(event: Event) {
|
||||
|
||||
}
|
||||
|
||||
private fun getDurationCode(event: Event): String {
|
||||
return if (event.getIsAllDay()) {
|
||||
val dur = Math.max(1, (event.endTS - event.startTS) / DAY)
|
||||
|
|
|
@ -200,13 +200,13 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
context.scheduleReminder(event, this)
|
||||
|
||||
if (addToCalDAV) {
|
||||
CalDAVEventsHandler(context).addCalDAVEvent(event)
|
||||
CalDAVEventsHandler(context).insertCalDAVEvent(event)
|
||||
}
|
||||
|
||||
callback(event.id)
|
||||
}
|
||||
|
||||
fun update(event: Event, callback: () -> Unit) {
|
||||
fun update(event: Event, updateAtCalDAV: Boolean, callback: () -> Unit) {
|
||||
val selectionArgs = arrayOf(event.id.toString())
|
||||
val values = fillEventValues(event)
|
||||
val selection = "$COL_ID = ?"
|
||||
|
@ -222,6 +222,9 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
|
||||
context.updateWidgets()
|
||||
context.scheduleReminder(event, this)
|
||||
if (updateAtCalDAV) {
|
||||
CalDAVEventsHandler(context).updateCalDAVEvent(event)
|
||||
}
|
||||
callback()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue