Skip to content

Instantly share code, notes, and snippets.

@Lavanyagaur22
Created April 6, 2019 08:30
Show Gist options
  • Save Lavanyagaur22/ab697253f6a6cef7823ed17bd84701ea to your computer and use it in GitHub Desktop.
Save Lavanyagaur22/ab697253f6a6cef7823ed17bd84701ea to your computer and use it in GitHub Desktop.
fun updateTask(id: String, title: String, version: Int) {
Log.e(TAG, "inside update task")
val client = Utils.getApolloClient(this)?.mutate(
UpdateCurrentTask.builder().id(id).title(title).version(version).build()
)
client?.enqueue(object : ApolloCall.Callback<UpdateCurrentTask.Data>() {
override fun onFailure(e: ApolloException) {
Log.e("onFailure" + "updateTask", e.toString())
}
override fun onResponse(response: Response<UpdateCurrentTask.Data>) {
val result = response.data()?.updateTask()
Log.e(TAG, "${result?.id()}")
Log.e(TAG, "${result?.title()}")
Log.e(TAG, "${result?.description()}")
Log.e(TAG, "${result?.version()}")
runOnUiThread {
noteslist.clear()
getTasks()
}
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment