Handle event/task sequence == null (meaning it was created locally and not...

Handle event/task sequence == null (meaning it was created locally and not sequence has yet been assigned)
parent 93464ccf
......@@ -129,7 +129,10 @@ public class LocalCalendar extends AndroidCalendar implements LocalCollection {
// get dirty events which are required to have an increased SEQUENCE value
for (LocalEvent event : (LocalEvent[])queryEvents(Events.DIRTY + "=" + DIRTY_INCREASE_SEQUENCE + " AND " + Events.ORIGINAL_ID + " IS NULL", null)) {
event.getEvent().sequence++;
if (event.getEvent().sequence == null) // sequence has not been assigned yet (i.e. this event was just locally created)
event.getEvent().sequence = 0;
else
event.getEvent().sequence++;
dirty.add(event);
}
......
......@@ -18,6 +18,8 @@ import android.provider.CalendarContract.Events;
import net.fortuna.ical4j.model.property.ProdId;
import org.apache.commons.lang3.math.NumberUtils;
import at.bitfire.davdroid.BuildConfig;
import at.bitfire.ical4android.AndroidCalendar;
import at.bitfire.ical4android.AndroidEvent;
......@@ -65,8 +67,7 @@ public class LocalEvent extends AndroidEvent implements LocalResource {
eTag = values.getAsString(COLUMN_ETAG);
event.uid = values.getAsString(COLUMN_UID);
if (values.containsKey(COLUMN_SEQUENCE))
event.sequence = values.getAsInteger(COLUMN_SEQUENCE);
event.sequence = values.getAsInteger(COLUMN_SEQUENCE);
}
@Override
......
......@@ -15,6 +15,7 @@ import android.provider.CalendarContract.Events;
import net.fortuna.ical4j.model.property.ProdId;
import org.apache.commons.lang3.math.NumberUtils;
import org.dmfs.provider.tasks.TaskContract.Tasks;
import java.io.FileNotFoundException;
......@@ -67,8 +68,7 @@ public class LocalTask extends AndroidTask implements LocalResource {
eTag = values.getAsString(COLUMN_ETAG);
task.uid = values.getAsString(COLUMN_UID);
if (values.containsKey(COLUMN_SEQUENCE))
task.sequence = values.getAsInteger(COLUMN_SEQUENCE);
task.sequence = values.getAsInteger(COLUMN_SEQUENCE);
}
@Override
......
......@@ -89,8 +89,12 @@ public class LocalTaskList extends AndroidTaskList implements LocalCollection {
public LocalResource[] getDirty() throws CalendarStorageException, FileNotFoundException {
LocalTask[] tasks = (LocalTask[])queryTasks(Tasks._DIRTY + "!=0", null);
if (tasks != null)
for (LocalTask task : tasks)
task.getTask().sequence++;
for (LocalTask task : tasks) {
if (task.getTask().sequence == null) // sequence has not been assigned yet (i.e. this task was just locally created)
task.getTask().sequence = 0;
else
task.getTask().sequence++;
}
return tasks;
}
......
......@@ -71,6 +71,7 @@
<SwitchPreference
android:key="log_verbose"
android:persistent="false"
android:dependency="log_external_file"
android:title="@string/settings_log_verbose"
android:summaryOn="@string/settings_log_verbose_on"
android:summaryOff="@string/settings_log_verbose_off" />
......
Subproject commit 585489eaa55f8840e439ee21aae6c7c04066c48d
Subproject commit 3142ae4a02348640cd5b184d1fb931d204f6bc5d
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