Commit a39a4997 authored by Ricki Hirner's avatar Ricki Hirner

Update OpenTasks

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