Commit e4c50b34 authored by Ricki Hirner's avatar Ricki Hirner 🐑
Browse files

BatchOperation: explicitly allow null values

parent 2dd5100e
Pipeline #204810273 passed with stages
in 5 minutes and 4 seconds
......@@ -819,7 +819,7 @@ abstract class AndroidEvent(
}
protected open fun insertReminder(batch: BatchOperation, idxEvent: Int, alarm: VAlarm) {
val builder =BatchOperation.CpoBuilder.newInsert(calendar.syncAdapterURI(Reminders.CONTENT_URI))
val builder = BatchOperation.CpoBuilder.newInsert(calendar.syncAdapterURI(Reminders.CONTENT_URI))
val method = when (alarm.action?.value?.toUpperCase(Locale.US)) {
Action.DISPLAY.value,
......@@ -841,7 +841,7 @@ abstract class AndroidEvent(
}
protected open fun insertAttendee(batch: BatchOperation, idxEvent: Int, attendee: Attendee) {
val builder =BatchOperation.CpoBuilder.newInsert(calendar.syncAdapterURI(Attendees.CONTENT_URI))
val builder = BatchOperation.CpoBuilder.newInsert(calendar.syncAdapterURI(Attendees.CONTENT_URI))
val member = attendee.calAddress
if (member.scheme.equals("mailto", true))
......@@ -883,7 +883,7 @@ abstract class AndroidEvent(
// drop occurrences of EXT_CATEGORIES_SEPARATOR in category names
category.filter { it != EXT_CATEGORIES_SEPARATOR }
}
val builder =BatchOperation.CpoBuilder.newInsert(calendar.syncAdapterURI(ExtendedProperties.CONTENT_URI))
val builder = BatchOperation.CpoBuilder.newInsert(calendar.syncAdapterURI(ExtendedProperties.CONTENT_URI))
.withValue(ExtendedProperties.NAME, EXT_CATEGORIES)
.withValue(ExtendedProperties.VALUE, rawCategories)
......@@ -897,7 +897,7 @@ abstract class AndroidEvent(
return
}
val builder =BatchOperation.CpoBuilder.newInsert(calendar.syncAdapterURI(ExtendedProperties.CONTENT_URI))
val builder = BatchOperation.CpoBuilder.newInsert(calendar.syncAdapterURI(ExtendedProperties.CONTENT_URI))
.withValue(ExtendedProperties.NAME, UnknownProperty.CONTENT_ITEM_TYPE)
.withValue(ExtendedProperties.VALUE, UnknownProperty.toJsonString(property))
......
......@@ -134,7 +134,7 @@ class BatchOperation(
var selection: String? = null
var selectionArguments: Array<String>? = null
val values = mutableMapOf<String, Any>()
val values = mutableMapOf<String, Any?>()
val valueBackrefs = mutableMapOf<String, Int>()
......@@ -156,10 +156,7 @@ class BatchOperation(
}
fun withValue(key: String, value: Any?): CpoBuilder {
if (value != null)
values[key] = value
else
values -= key
values[key] = value
return this
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment