From bfe68b96840af390969ef0e01b7b18ef0b94ae30 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 1 May 2019 14:34:04 +0100 Subject: [PATCH] LocalTask: add a function to save tasks as dirty. --- .../java/com/etesync/syncadapter/resource/LocalTask.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/com/etesync/syncadapter/resource/LocalTask.kt b/app/src/main/java/com/etesync/syncadapter/resource/LocalTask.kt index 418bc013..614fc54a 100644 --- a/app/src/main/java/com/etesync/syncadapter/resource/LocalTask.kt +++ b/app/src/main/java/com/etesync/syncadapter/resource/LocalTask.kt @@ -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 { 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 { 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 */