-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to modify conversationData, userStorage values in Kotlin #26
Comments
This is the same as #17, where you can clone the object to a mutable implementation. |
As said in #17 But The conversationData is overrided in ResponseSerializer.kt actions-on-google-java/src/main/kotlin/com/google/actions/api/impl/io/ResponseSerializer.kt Line 94 in 5e2c7c9
You should put it before line 86 As workaround you can try to access and modify
Edit: actions-on-google-java/src/main/kotlin/com/google/actions/api/impl/DialogflowRequest.kt Line 63 in 5e2c7c9
|
The same thing seems to work for conversation data in Kotlin val sessionData = mutableMapOf<String, Any>()
sessionData.putAll(aogRequest.conversationData)
val headquarters = sessionData["headquarters"] as MutableList<String>
assertEquals("google1", headquarters[0])
headquarters[0] = "google2"
sessionData["headquarters"] = headquarters
val responseBuilder =
ResponseBuilder(usesDialogflow = false, conversationData = sessionData)
val aogResponse = responseBuilder.build()
val jsonOutput = aogResponse.toJson() |
Have you noticed that conversationData is overided by the context: |
When using Dialogflow? |
Yes |
Closing as a duplicate of #17 For separate/unrelated bugs, please open a new issue. |
conversationData
anduserStorage
are immutable values and cannot be changed using kotlin.For now there is no option to modify this! One of possible solution is to override
getResponseBuilder
inDialogflowApp
and construct ownResponseBuilder
with custom data BUTResponseBuilder
is internal class.Someone already noticed that in other task few months ago and you didn't fixed it yet.
Please fix this!
The text was updated successfully, but these errors were encountered: