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