Commit a39a4997 authored by Ricki Hirner's avatar Ricki Hirner

Update OpenTasks

parent d99abf4c
......@@ -10,7 +10,7 @@ cache:
test:
script:
- (cd /sdk/emulator; ./emulator @test -no-audio -no-window & wait-for-emulator.sh)
- adb install src/androidTest/resources/org.dmfs.tasks_6760.apk
- adb install src/androidTest/resources/org.dmfs.tasks_6880.apk
- ./gradlew check connectedCheck
artifacts:
paths:
......
......@@ -61,6 +61,15 @@ class AndroidTaskListTest {
val taskList = AndroidTaskList.findByID(testAccount, provider!!, TestTaskList.Factory, ContentUris.parseId(uri))
assertNotNull(taskList)
// sync URIs
assertEquals("true", taskList.taskListSyncUri().getQueryParameter(TaskContract.CALLER_IS_SYNCADAPTER))
assertEquals(testAccount.type, taskList.taskListSyncUri().getQueryParameter(TaskContract.ACCOUNT_TYPE))
assertEquals(testAccount.name, taskList.taskListSyncUri().getQueryParameter(TaskContract.ACCOUNT_NAME))
assertEquals("true", taskList.tasksSyncUri().getQueryParameter(TaskContract.CALLER_IS_SYNCADAPTER))
assertEquals(testAccount.type, taskList.tasksSyncUri().getQueryParameter(TaskContract.ACCOUNT_TYPE))
assertEquals(testAccount.name, taskList.tasksSyncUri().getQueryParameter(TaskContract.ACCOUNT_NAME))
// delete task list
assertEquals(1, taskList.delete())
}
......
......@@ -162,7 +162,7 @@ abstract class AndroidTask(
}
fun add(): Uri? {
fun add(): Uri {
val batch = BatchOperation(taskList.provider.client)
val builder = ContentProviderOperation.newInsert(taskList.tasksSyncUri())
buildTask(builder, false)
......@@ -174,14 +174,16 @@ abstract class AndroidTask(
return result.uri
}
fun update(task: Task) {
fun update(task: Task): Uri {
this.task = task
val batch = BatchOperation(taskList.provider.client)
val builder = ContentProviderOperation.newUpdate(taskSyncURI())
val uri = taskSyncURI()
val builder = ContentProviderOperation.newUpdate(uri)
buildTask(builder, true)
batch.enqueue(BatchOperation.Operation(builder))
batch.commit()
return uri
}
fun delete(): Int {
......
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