1
0
mirror of https://github.com/etesync/android synced 2024-11-25 17:38:13 +00:00

LocalTask: add a function to save tasks as dirty.

This commit is contained in:
Tom Hacohen 2019-05-01 14:34:04 +01:00
parent f4ce548310
commit bfe68b9684

View File

@ -10,6 +10,7 @@ package com.etesync.syncadapter.resource
import android.content.ContentProviderOperation
import android.content.ContentValues
import android.net.Uri
import android.text.TextUtils
import at.bitfire.ical4android.AndroidTask
import at.bitfire.ical4android.AndroidTaskFactory
@ -28,6 +29,8 @@ class LocalTask : AndroidTask, LocalResource<Task> {
internal const val COLUMN_SEQUENCE = TaskContract.Tasks.SYNC3
}
private var saveAsDirty = false // When true, the resource will be saved as dirty
private var fileName: String? = null
var eTag: String? = null
@ -77,9 +80,14 @@ class LocalTask : AndroidTask, LocalResource<Task> {
builder.withValue(TaskContract.Tasks._SYNC_ID, fileName)
.withValue(COLUMN_UID, task?.uid)
.withValue(COLUMN_SEQUENCE, task?.sequence)
.withValue(TaskContract.Tasks._DIRTY, if (saveAsDirty) 1 else 0)
.withValue(COLUMN_ETAG, eTag)
}
fun addAsDirty(): Uri {
saveAsDirty = true
return this.add()
}
/* custom queries */