Commit ea01dcd5 authored by Ricki Hirner's avatar Ricki Hirner 🐑

Ignore empty strings when processing locally stored events

parent 5b6ab803
Pipeline #96408237 passed with stages
in 4 minutes and 48 seconds
...@@ -110,14 +110,16 @@ abstract class AndroidEvent( ...@@ -110,14 +110,16 @@ abstract class AndroidEvent(
field = event field = event
val e = iterEvents.next() val e = iterEvents.next()
populateEvent(e.entityValues) populateEvent(MiscUtils.removeEmptyStrings(e.entityValues))
for (subValue in e.subValues) for (subValue in e.subValues) {
val subValues = MiscUtils.removeEmptyStrings(subValue.values)
when (subValue.uri) { when (subValue.uri) {
Attendees.CONTENT_URI -> populateAttendee(subValue.values) Attendees.CONTENT_URI -> populateAttendee(subValues)
Reminders.CONTENT_URI -> populateReminder(subValue.values) Reminders.CONTENT_URI -> populateReminder(subValues)
ExtendedProperties.CONTENT_URI -> populateExtended(subValue.values) ExtendedProperties.CONTENT_URI -> populateExtended(subValues)
} }
}
populateExceptions() populateExceptions()
useRetainedClassification() useRetainedClassification()
......
...@@ -85,15 +85,17 @@ object MiscUtils { ...@@ -85,15 +85,17 @@ object MiscUtils {
/** /**
* Removes empty [String] values from [values]. * Removes empty [String] values from [values].
* *
* @param values set of values to be processed * @param values set of values to be modified
* @return the modified object (which is the same object as passed in; for chaining)
*/ */
fun removeEmptyStrings(values: ContentValues) { fun removeEmptyStrings(values: ContentValues): ContentValues {
val it = values.keySet().iterator() val it = values.keySet().iterator()
while (it.hasNext()) { while (it.hasNext()) {
val obj = values[it.next()] val obj = values[it.next()]
if (obj is String && obj.isEmpty()) if (obj is String && obj.isEmpty())
it.remove() it.remove()
} }
return values
} }
......
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