Use SYNC1 as DAVx5 etag

pull/1074/head
Alex Baker 4 years ago
parent c06f5958b4
commit abf7a06282

@ -62,18 +62,18 @@ class OpenTaskDao @Inject constructor(
calendars calendars
} }
suspend fun getEtags(listId: Long): List<Triple<String, String, String>> = withContext(Dispatchers.IO) { suspend fun getEtags(listId: Long): List<Triple<String, String?, String>> = withContext(Dispatchers.IO) {
val items = ArrayList<Triple<String, String, String>>() val items = ArrayList<Triple<String, String?, String>>()
cr.query( cr.query(
tasks, tasks,
arrayOf(Tasks._SYNC_ID, Tasks.SYNC_VERSION, "version"), arrayOf(Tasks._SYNC_ID, Tasks.SYNC1, "version"),
"${Tasks.LIST_ID} = $listId", "${Tasks.LIST_ID} = $listId",
null, null,
null)?.use { null)?.use {
while (it.moveToNext()) { while (it.moveToNext()) {
items.add(Triple( items.add(Triple(
it.getString(Tasks._SYNC_ID)!!, it.getString(Tasks._SYNC_ID)!!,
it.getLong(Tasks.SYNC_VERSION).toString(), it.getString(Tasks.SYNC1),
it.getLong("version").toString())) it.getLong("version").toString()))
} }
} }

@ -159,9 +159,9 @@ class OpenTasksSynchronizer @Inject constructor(
} }
val etags = openTaskDao.getEtags(listId) val etags = openTaskDao.getEtags(listId)
etags.forEach { (syncId, syncVersion, version) -> etags.forEach { (syncId, sync1, version) ->
val caldavTask = caldavDao.getTask(calendar.uuid!!, syncId) val caldavTask = caldavDao.getTask(calendar.uuid!!, syncId)
val etag = if (isEteSync) version else syncVersion val etag = if (isEteSync) version else sync1
if (caldavTask?.etag == null || caldavTask.etag != etag) { if (caldavTask?.etag == null || caldavTask.etag != etag) {
applyChanges(calendar, listId, syncId, etag, caldavTask) applyChanges(calendar, listId, syncId, etag, caldavTask)
} }
@ -265,7 +265,7 @@ class OpenTasksSynchronizer @Inject constructor(
calendar: CaldavCalendar, calendar: CaldavCalendar,
listId: Long, listId: Long,
syncId: String, syncId: String,
etag: String, etag: String?,
existing: CaldavTask?) { existing: CaldavTask?) {
cr.query( cr.query(
Tasks.getContentUri(openTaskDao.authority), Tasks.getContentUri(openTaskDao.authority),

Loading…
Cancel
Save